Source_Code
stringlengths
69
484k
IR_Original
stringlengths
2.05k
17.9M
#include <stdio.h> int main () { int n; int k; int i; int ans = 0; scanf ("%d %d", &n, &k); int h[n]; for (i = 0; i < n; i++) { scanf ("%d", &h[i]); } for (i = 0; i < n; i++) { if (k <= h[i] ) ans++; } printf ("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294585/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294585/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %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 %cmp19 = icmp sgt i32 %3, 0 br i1 %cmp19, label %for.body, label %for.end11 for.cond2.preheader: ; preds = %for.body %cmp321 = icmp sgt i32 %15, 0 br i1 %cmp321, label %for.body4.lr.ph, label %for.end11 for.body4.lr.ph: ; preds = %for.cond2.preheader %4 = load i32, ptr %k, align 4, !tbaa !5 %wide.trip.count = zext i32 %15 to i64 %min.iters.check = icmp ult i32 %15, 8 br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph vector.ph: ; preds = %for.body4.lr.ph %n.vec = and i64 %wide.trip.count, 4294967288 %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %4, i64 0 %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %vec.phi32 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ] %5 = getelementptr inbounds i32, ptr %vla, i64 %index %wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5 %6 = getelementptr inbounds i32, ptr %5, i64 4 %wide.load33 = load <4 x i32>, ptr %6, align 16, !tbaa !5 %7 = icmp sle <4 x i32> %broadcast.splat, %wide.load %8 = icmp sle <4 x i32> %broadcast.splat, %wide.load33 %9 = zext <4 x i1> %7 to <4 x i32> %10 = zext <4 x i1> %8 to <4 x i32> %11 = add <4 x i32> %vec.phi, %9 %12 = add <4 x i32> %vec.phi32, %10 %index.next = add nuw i64 %index, 8 %13 = icmp eq i64 %index.next, %n.vec br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %12, %11 %14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end11, label %for.body4.preheader for.body4.preheader: ; preds = %for.body4.lr.ph, %middle.block %indvars.iv27.ph = phi i64 [ 0, %for.body4.lr.ph ], [ %n.vec, %middle.block ] %ans.022.ph = phi i32 [ 0, %for.body4.lr.ph ], [ %14, %middle.block ] 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.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %15 = load i32, ptr %n, align 4, !tbaa !5 %16 = sext i32 %15 to i64 %cmp = icmp slt i64 %indvars.iv.next, %16 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13 for.body4: ; preds = %for.body4.preheader, %for.body4 %indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body4 ], [ %indvars.iv27.ph, %for.body4.preheader ] %ans.022 = phi i32 [ %spec.select, %for.body4 ], [ %ans.022.ph, %for.body4.preheader ] %arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv27 %17 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %cmp7.not = icmp sle i32 %4, %17 %inc8 = zext i1 %cmp7.not to i32 %spec.select = add nuw nsw i32 %ans.022, %inc8 %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.end11, label %for.body4, !llvm.loop !14 for.end11: ; preds = %for.body4, %middle.block, %entry, %for.cond2.preheader %ans.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %14, %middle.block ], [ %spec.select, %for.body4 ] %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress 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, !11, !12} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!"llvm.loop.isvectorized", i32 1} !12 = !{!"llvm.loop.unroll.runtime.disable"} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10, !12, !11}
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int main(){ int n, k; scanf("%d%d", &n, &k); int hight[n]; int count=0; for(int i=0; i<n; i++){ scanf("%d", &hight[i]); if(hight[i]>=k) count++; } printf("%d", count); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294635/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294635/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %k = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %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 %cmp11 = icmp sgt i32 %3, 0 br i1 %cmp11, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %count.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.body ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %count.012 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %4 = load i32, ptr %arrayidx, align 4, !tbaa !5 %5 = load i32, ptr %k, align 4, !tbaa !5 %cmp4.not = icmp sge i32 %4, %5 %inc = zext i1 %cmp4.not to i32 %spec.select = add nuw nsw i32 %count.012, %inc %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %6 = load i32, ptr %n, align 4, !tbaa !5 %7 = sext i32 %6 to i64 %cmp = icmp slt i64 %indvars.iv.next, %7 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <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 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)) int main(void) { uint64_t N, K; size_t cnt = 0; scanf("%"PRIu64"%"PRIu64, &N, &K); for (uint64_t i = 0; i < N; i++) { uint64_t h; scanf("%"PRIu64, &h); if (K <= h) { cnt++; } } printf("%zu\n", cnt); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294679/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294679/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu%lu\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%lu\00", align 1 @.str.2 = private unnamed_addr constant [5 x i8] c"%zu\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 %K = alloca i64, align 8 %h = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K) %0 = load i64, ptr %N, align 8, !tbaa !5 %cmp7.not = icmp eq i64 %0, 0 br i1 %cmp7.not, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.body, %entry %cnt.0.lcssa = phi i64 [ 0, %entry ], [ %spec.select, %for.body ] %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %cnt.0.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #4 ret i32 0 for.body: ; preds = %entry, %for.body %i.09 = phi i64 [ %inc3, %for.body ], [ 0, %entry ] %cnt.08 = phi i64 [ %spec.select, %for.body ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h) %1 = load i64, ptr %K, align 8, !tbaa !5 %2 = load i64, ptr %h, align 8, !tbaa !5 %cmp2.not = icmp ule i64 %1, %2 %inc = zext i1 %cmp2.not to i64 %spec.select = add i64 %cnt.08, %inc call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #4 %inc3 = add nuw i64 %i.09, 1 %3 = load i64, ptr %N, align 8, !tbaa !5 %cmp = icmp ult i64 %inc3, %3 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(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 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{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"}
#include <stdio.h> int f(int a,int b){ int r; while(b>0){ r=a%b; a=b; b=r; } return a; } int main(){ int G,N,A; scanf("%d\n",&N); int D[1000001]; int PC[1000001]; for(int i=1;i<=1000000;i++){ D[i]=1; PC[i]=0; } int p=2,k=2; while(p<=1000000){ if(D[p]==1){ D[p]=2; k=1; while(p*k<=1000000){ D[p*k]=p; k++; } } p++; } for(int i=1;i<=N;i++){ scanf("%d",&A); if(i==1) G=A; else G=f(G,A); while(A>1){ p=D[A]; PC[p]++; while(A%p==0) A/=p; } } int c=1; for(int i=1;i<=1000000;i++){ if(PC[i]>1) c=0; } if(c==1) printf("pairwise coprime\n"); else if(G==1) printf("setwise coprime\n"); else printf("not coprime\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294721/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294721/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @str = private unnamed_addr constant [12 x i8] c"not coprime\00", align 1 @str.5 = private unnamed_addr constant [16 x i8] c"setwise coprime\00", align 1 @str.6 = private unnamed_addr constant [17 x i8] c"pairwise coprime\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @f(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cmp4 = icmp sgt i32 %b, 0 br i1 %cmp4, label %while.body, label %while.end 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 = icmp sgt i32 %rem, 0 br i1 %cmp, label %while.body, label %while.end, !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) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %N = alloca i32, align 4 %A = alloca i32, align 4 %D = alloca [1000001 x i32], align 16 %PC = alloca [1000001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) call void @llvm.lifetime.start.p0(i64 4000004, ptr nonnull %D) #6 call void @llvm.lifetime.start.p0(i64 4000004, ptr nonnull %PC) #6 %scevgep = getelementptr inbounds i8, ptr %PC, i64 4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(4000000) %scevgep, i8 0, i64 4000000, i1 false), !tbaa !7 br label %vector.body vector.body: ; preds = %vector.body, %entry %index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ] %offset.idx = or i64 %index, 1 %0 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %offset.idx store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 4, !tbaa !7 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 4, !tbaa !7 %offset.idx.1 = add nuw i64 %index, 9 %2 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %offset.idx.1 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 4, !tbaa !7 %3 = getelementptr inbounds i32, ptr %2, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 4, !tbaa !7 %offset.idx.2 = add nuw i64 %index, 17 %4 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %offset.idx.2 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 4, !tbaa !7 %5 = getelementptr inbounds i32, ptr %4, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 4, !tbaa !7 %offset.idx.3 = add nuw i64 %index, 25 %6 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %offset.idx.3 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 4, !tbaa !7 %7 = getelementptr inbounds i32, ptr %6, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 4, !tbaa !7 %offset.idx.4 = add nuw i64 %index, 33 %8 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %offset.idx.4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 4, !tbaa !7 %9 = getelementptr inbounds i32, ptr %8, i64 4 store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 4, !tbaa !7 %index.next.4 = add nuw nsw i64 %index, 40 %10 = icmp eq i64 %index.next.4, 1000000 br i1 %10, label %while.body, label %vector.body, !llvm.loop !11 for.cond19.preheader: ; preds = %if.end %11 = load i32, ptr %N, align 4, !tbaa !7 %cmp20.not104 = icmp slt i32 %11, 1 br i1 %cmp20.not104, label %vector.ph134, label %for.body22 while.body: ; preds = %vector.body, %if.end %indvars.iv111 = phi i64 [ %indvars.iv.next112, %if.end ], [ 2, %vector.body ] %arrayidx5 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %indvars.iv111 %12 = load i32, ptr %arrayidx5, align 4, !tbaa !7 %cmp6 = icmp eq i32 %12, 1 br i1 %cmp6, label %while.body11.preheader, label %if.end while.body11.preheader: ; preds = %while.body store i32 2, ptr %arrayidx5, align 4, !tbaa !7 %13 = trunc i64 %indvars.iv111 to i32 br label %while.body11 while.body11: ; preds = %while.body11.preheader, %while.body11 %indvars.iv115 = phi i64 [ 1, %while.body11.preheader ], [ %indvars.iv.next116, %while.body11 ] %indvars.iv113 = phi i64 [ %indvars.iv111, %while.body11.preheader ], [ %indvars.iv.next114, %while.body11 ] %arrayidx14 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %indvars.iv113 store i32 %13, ptr %arrayidx14, align 4, !tbaa !7 %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1 %14 = mul nuw nsw i64 %indvars.iv.next116, %indvars.iv111 %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, %indvars.iv111 %cmp10 = icmp ult i64 %14, 1000001 br i1 %cmp10, label %while.body11, label %if.end, !llvm.loop !14 if.end: ; preds = %while.body11, %while.body %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1 %exitcond122.not = icmp eq i64 %indvars.iv.next112, 1000001 br i1 %exitcond122.not, label %for.cond19.preheader, label %while.body, !llvm.loop !15 for.cond45.preheader.loopexit: ; preds = %for.inc41 %15 = icmp eq i32 %G.1131, 1 %16 = select i1 %15, ptr @str.5, ptr @str br label %vector.ph134 vector.ph134: ; preds = %for.cond19.preheader, %for.cond45.preheader.loopexit %G.0.lcssa = phi ptr [ @str, %for.cond19.preheader ], [ %16, %for.cond45.preheader.loopexit ] br label %vector.body136 vector.body136: ; preds = %vector.body136, %vector.ph134 %index137 = phi i64 [ 0, %vector.ph134 ], [ %index.next141.1, %vector.body136 ] %vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph134 ], [ %26, %vector.body136 ] %vec.phi138 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph134 ], [ %28, %vector.body136 ] %offset.idx139 = or i64 %index137, 1 %17 = getelementptr inbounds [1000001 x i32], ptr %PC, i64 0, i64 %offset.idx139 %wide.load = load <4 x i32>, ptr %17, align 4, !tbaa !7 %18 = getelementptr inbounds i32, ptr %17, i64 4 %wide.load140 = load <4 x i32>, ptr %18, align 4, !tbaa !7 %19 = icmp sgt <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1> %20 = icmp sgt <4 x i32> %wide.load140, <i32 1, i32 1, i32 1, i32 1> %offset.idx139.1 = or i64 %index137, 9 %21 = getelementptr inbounds [1000001 x i32], ptr %PC, i64 0, i64 %offset.idx139.1 %wide.load.1 = load <4 x i32>, ptr %21, align 4, !tbaa !7 %22 = getelementptr inbounds i32, ptr %21, i64 4 %wide.load140.1 = load <4 x i32>, ptr %22, align 4, !tbaa !7 %23 = icmp sgt <4 x i32> %wide.load.1, <i32 1, i32 1, i32 1, i32 1> %24 = icmp sgt <4 x i32> %wide.load140.1, <i32 1, i32 1, i32 1, i32 1> %25 = select <4 x i1> %23, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %19 %26 = select <4 x i1> %25, <4 x i32> zeroinitializer, <4 x i32> %vec.phi %27 = select <4 x i1> %24, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %20 %28 = select <4 x i1> %27, <4 x i32> zeroinitializer, <4 x i32> %vec.phi138 %index.next141.1 = add nuw nsw i64 %index137, 16 %29 = icmp eq i64 %index.next141.1, 1000000 br i1 %29, label %middle.block132, label %vector.body136, !llvm.loop !16 middle.block132: ; preds = %vector.body136 %rdx.select.cmp.not = icmp ne <4 x i32> %26, <i32 1, i32 1, i32 1, i32 1> %rdx.select.cmp142144 = icmp ne <4 x i32> %28, <i32 1, i32 1, i32 1, i32 1> %rdx.select.cmp142 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp142144 %30 = bitcast <4 x i1> %rdx.select.cmp142 to i4 %.not = icmp eq i4 %30, 0 %str.5.sink = select i1 %.not, ptr @str.6, ptr %G.0.lcssa %puts87 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink) call void @llvm.lifetime.end.p0(i64 4000004, ptr nonnull %PC) #6 call void @llvm.lifetime.end.p0(i64 4000004, ptr nonnull %D) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6 ret i32 0 for.body22: ; preds = %for.cond19.preheader, %for.inc41 %i18.0106 = phi i32 [ %inc42, %for.inc41 ], [ 1, %for.cond19.preheader ] %G.0105 = phi i32 [ %G.1131, %for.inc41 ], [ undef, %for.cond19.preheader ] %call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A) %cmp24 = icmp eq i32 %i18.0106, 1 %31 = load i32, ptr %A, align 4, !tbaa !7 br i1 %cmp24, label %if.end27, label %if.else if.else: ; preds = %for.body22 %cmp4.i = icmp sgt i32 %31, 0 br i1 %cmp4.i, label %while.body.i, label %for.inc41 while.body.i: ; preds = %if.else, %while.body.i %a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %G.0105, %if.else ] %b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %31, %if.else ] %rem.i = srem i32 %a.addr.06.i, %b.addr.05.i %cmp.i = icmp sgt i32 %rem.i, 0 br i1 %cmp.i, label %while.body.i, label %if.end27, !llvm.loop !5 if.end27: ; preds = %while.body.i, %for.body22 %G.1 = phi i32 [ %31, %for.body22 ], [ %b.addr.05.i, %while.body.i ] %cmp29102 = icmp sgt i32 %31, 1 br i1 %cmp29102, label %while.body30, label %for.inc41 while.cond36.while.cond28.loopexit_crit_edge: ; preds = %while.body38 store i32 %div, ptr %A, align 4, !tbaa !7 br label %while.cond28.loopexit while.cond28.loopexit: ; preds = %while.cond36.while.cond28.loopexit_crit_edge, %while.body30 %div.lcssa100 = phi i32 [ %div, %while.cond36.while.cond28.loopexit_crit_edge ], [ %div.lcssa101103, %while.body30 ] %cmp29 = icmp sgt i32 %div.lcssa100, 1 br i1 %cmp29, label %while.body30, label %for.inc41, !llvm.loop !17 while.body30: ; preds = %if.end27, %while.cond28.loopexit %div.lcssa101103 = phi i32 [ %div.lcssa100, %while.cond28.loopexit ], [ %31, %if.end27 ] %idxprom31 = zext i32 %div.lcssa101103 to i64 %arrayidx32 = getelementptr inbounds [1000001 x i32], ptr %D, i64 0, i64 %idxprom31 %32 = load i32, ptr %arrayidx32, align 4, !tbaa !7 %idxprom33 = sext i32 %32 to i64 %arrayidx34 = getelementptr inbounds [1000001 x i32], ptr %PC, i64 0, i64 %idxprom33 %33 = load i32, ptr %arrayidx34, align 4, !tbaa !7 %inc35 = add nsw i32 %33, 1 store i32 %inc35, ptr %arrayidx34, align 4, !tbaa !7 %rem96 = srem i32 %div.lcssa101103, %32 %cmp3797 = icmp eq i32 %rem96, 0 br i1 %cmp3797, label %while.body38, label %while.cond28.loopexit while.body38: ; preds = %while.body30, %while.body38 %div9598 = phi i32 [ %div, %while.body38 ], [ %div.lcssa101103, %while.body30 ] %div = sdiv i32 %div9598, %32 %rem = srem i32 %div, %32 %cmp37 = icmp eq i32 %rem, 0 br i1 %cmp37, label %while.body38, label %while.cond36.while.cond28.loopexit_crit_edge, !llvm.loop !18 for.inc41: ; preds = %while.cond28.loopexit, %if.else, %if.end27 %G.1131 = phi i32 [ %G.1, %if.end27 ], [ %G.0105, %if.else ], [ %G.1, %while.cond28.loopexit ] %inc42 = add nuw nsw i32 %i18.0106, 1 %34 = load i32, ptr %N, align 4, !tbaa !7 %cmp20.not.not = icmp slt i32 %i18.0106, %34 br i1 %cmp20.not.not, label %for.body22, label %for.cond45.preheader.loopexit, !llvm.loop !19 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 attributes #0 = { nofree 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 nounwind willreturn memory(argmem: write) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = 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} !16 = distinct !{!16, !6, !12, !13} !17 = distinct !{!17, !6} !18 = distinct !{!18, !6} !19 = distinct !{!19, !6}
#include <stdio.h> #include <stdlib.h> typedef long long ll; struct store { int a; int b; }; int struct_asc(const void *x, const void *y){ struct store *X = (struct store *)x; struct store *Y = (struct store *)y; return X->a - Y->a; } int main(int argc, char *argv[]) { int n, m; scanf("%d %d", &n, &m); struct store st[100000]; for(int i = 0; i < n; ++i){ scanf("%d %d", &st[i].a, &st[i].b); } qsort(st, n, sizeof(struct store), struct_asc); int c = 0; ll ans = 0; for(int i = 0; i < n; ++i){ c += st[i].b; ans += (ll)st[i].a * (ll)st[i].b; if(c > m){ ans -= (ll)st[i].a * ((ll)c - (ll)m); break; } } printf("%lld\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294772/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294772/source.c" target datalayout = "e-m:e-p270: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.store = type { i32, i32 } @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @struct_asc(ptr nocapture noundef readonly %x, ptr nocapture noundef readonly %y) #0 { entry: %0 = load i32, ptr %x, align 4, !tbaa !5 %1 = load i32, ptr %y, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; 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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %st = alloca [100000 x %struct.store], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %st) #5 %0 = load i32, ptr %n, align 4, !tbaa !10 %cmp56 = icmp sgt i32 %0, 0 br i1 %cmp56, label %for.body, label %entry.for.cond.cleanup_crit_edge entry.for.cond.cleanup_crit_edge: ; preds = %entry %.pre = sext i32 %0 to i64 br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge %conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %4, %for.body ] call void @qsort(ptr noundef nonnull %st, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @struct_asc) #5 %1 = load i32, ptr %n, align 4, !tbaa !10 %cmp658 = icmp sgt i32 %1, 0 br i1 %cmp658, label %for.body9.lr.ph, label %cleanup for.body9.lr.ph: ; preds = %for.cond.cleanup %2 = load i32, ptr %m, align 4, !tbaa !10 %wide.trip.count = zext i32 %1 to i64 br label %for.body9 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x %struct.store], ptr %st, i64 0, i64 %indvars.iv %b = getelementptr inbounds [100000 x %struct.store], ptr %st, i64 0, i64 %indvars.iv, i32 1 %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %b) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !10 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11 for.cond5: ; preds = %for.body9 %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1 %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count br i1 %exitcond.not, label %cleanup, label %for.body9, !llvm.loop !13 for.body9: ; preds = %for.body9.lr.ph, %for.cond5 %indvars.iv67 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next68, %for.cond5 ] %ans.060 = phi i64 [ 0, %for.body9.lr.ph ], [ %add21, %for.cond5 ] %c.059 = phi i32 [ 0, %for.body9.lr.ph ], [ %add, %for.cond5 ] %arrayidx11 = getelementptr inbounds [100000 x %struct.store], ptr %st, i64 0, i64 %indvars.iv67 %b12 = getelementptr inbounds [100000 x %struct.store], ptr %st, i64 0, i64 %indvars.iv67, i32 1 %5 = load i32, ptr %b12, align 4, !tbaa !14 %add = add nsw i32 %5, %c.059 %6 = load i32, ptr %arrayidx11, align 8, !tbaa !5 %conv16 = sext i32 %6 to i64 %conv20 = sext i32 %5 to i64 %mul = mul nsw i64 %conv16, %conv20 %add21 = add nsw i64 %mul, %ans.060 %cmp22 = icmp sgt i32 %add, %2 br i1 %cmp22, label %if.then, label %for.cond5 if.then: ; preds = %for.body9 %conv28 = sext i32 %add to i64 %conv29 = sext i32 %2 to i64 %sub.neg = sub nsw i64 %conv29, %conv28 %mul30.neg = mul nsw i64 %sub.neg, %conv16 %sub31 = add i64 %mul30.neg, %add21 br label %cleanup cleanup: ; preds = %for.cond5, %for.cond.cleanup, %if.then %ans.1 = phi i64 [ %sub31, %if.then ], [ 0, %for.cond.cleanup ], [ %add21, %for.cond5 ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.1) call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %st) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !7, i64 0} !6 = !{!"store", !7, i64 0, !7, i64 4} !7 = !{!"int", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!7, !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = !{!6, !7, i64 4}
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <ctype.h> #include <stdint.h> #include <string.h> #include <wchar.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)) typedef struct { uint64_t A; uint64_t B; } val; int compare_f(const void *a, const void *b) { return ((val *)a)->A < ((val *)b)->A ? -1 : 1; } 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 gcd(uint64_t m, uint64_t n) { uint64_t temp; while (m%n != 0) { temp = n; n = m % n; m = temp; } return n; } static val info[100000]; int main(void) { size_t N, M; scanf("%zu %zu\n", &N, &M); for (size_t i = 0; i < N; i++) { scanf("%"PRIu64" %"PRIu64, &(info[i].A), &(info[i].B)); if (i < N - 1) { scanf("\n"); } } qsort(info, N, sizeof(val), compare_f); uint64_t min = 0; for (size_t i = 0; i < N && 0 < M; i++) { const uint64_t count = MIN(info[i].B, M); min += count * info[i].A; M -= (size_t)count; } printf("%"PRIu64"\n", min); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294815/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294815/source.c" target datalayout = "e-m:e-p270: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.val = type { i64, i64 } @.str = private unnamed_addr constant [9 x i8] c"%zu %zu\0A\00", align 1 @.str.1 = private unnamed_addr constant [8 x i8] c"%lu %lu\00", align 1 @info = internal global [100000 x %struct.val] zeroinitializer, align 16 @.str.2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 @.str.3 = 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_f(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp ult i64 %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 %M = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %M) #6 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %M) %0 = load i64, ptr %N, align 8, !tbaa !10 %cmp35.not = icmp eq i64 %0, 0 br i1 %cmp35.not, label %for.cond.cleanup, label %for.body for.cond.cleanup: ; preds = %for.inc, %entry %.lcssa = phi i64 [ 0, %entry ], [ %4, %for.inc ] call void @qsort(ptr noundef nonnull @info, i64 noundef %.lcssa, i64 noundef 16, ptr noundef nonnull @compare_f) #6 %1 = load i64, ptr %N, align 8, !tbaa !10 %M.promoted = load i64, ptr %M, align 8 %cmp738 = icmp ne i64 %1, 0 %cmp839 = icmp ne i64 %M.promoted, 0 %2 = select i1 %cmp738, i1 %cmp839, i1 false br i1 %2, label %for.body10, label %for.cond.cleanup9 for.body: ; preds = %entry, %for.inc %i.036 = phi i64 [ %inc, %for.inc ], [ 0, %entry ] %arrayidx = getelementptr inbounds [100000 x %struct.val], ptr @info, i64 0, i64 %i.036 %B = getelementptr inbounds [100000 x %struct.val], ptr @info, i64 0, i64 %i.036, i32 1 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %B) %3 = load i64, ptr %N, align 8, !tbaa !10 %sub = add i64 %3, -1 %cmp3 = icmp ult i64 %i.036, %sub br i1 %cmp3, label %if.then, label %for.inc if.then: ; preds = %for.body %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2) %.pre = load i64, ptr %N, align 8, !tbaa !10 br label %for.inc for.inc: ; preds = %for.body, %if.then %4 = phi i64 [ %3, %for.body ], [ %.pre, %if.then ] %inc = add nuw i64 %i.036, 1 %cmp = icmp ult i64 %inc, %4 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11 for.cond6.for.cond.cleanup9_crit_edge: ; preds = %for.body10 store i64 %sub18, ptr %M, align 8, !tbaa !10 br label %for.cond.cleanup9 for.cond.cleanup9: ; preds = %for.cond6.for.cond.cleanup9_crit_edge, %for.cond.cleanup %min.0.lcssa = phi i64 [ %add, %for.cond6.for.cond.cleanup9_crit_edge ], [ 0, %for.cond.cleanup ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %min.0.lcssa) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %M) #6 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6 ret i32 0 for.body10: ; preds = %for.cond.cleanup, %for.body10 %i5.042 = phi i64 [ %inc20, %for.body10 ], [ 0, %for.cond.cleanup ] %min.041 = phi i64 [ %add, %for.body10 ], [ 0, %for.cond.cleanup ] %sub183740 = phi i64 [ %sub18, %for.body10 ], [ %M.promoted, %for.cond.cleanup ] %arrayidx11 = getelementptr inbounds [100000 x %struct.val], ptr @info, i64 0, i64 %i5.042 %B12 = getelementptr inbounds [100000 x %struct.val], ptr @info, i64 0, i64 %i5.042, i32 1 %5 = load i64, ptr %B12, align 8, !tbaa !13 %. = call i64 @llvm.umin.i64(i64 %5, i64 %sub183740) %6 = load i64, ptr %arrayidx11, align 16, !tbaa !5 %mul = mul i64 %., %6 %add = add i64 %mul, %min.041 %sub18 = sub i64 %sub183740, %. %inc20 = add nuw i64 %i5.042, 1 %cmp7 = icmp ult i64 %inc20, %1 %cmp8 = icmp ne i64 %sub18, 0 %7 = select i1 %cmp7, i1 %cmp8, i1 false br i1 %7, label %for.body10, label %for.cond6.for.cond.cleanup9_crit_edge, !llvm.loop !14 } ; 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 declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umin.i64(i64, i64) #5 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree "no-trapping-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, !7, i64 0} !6 = !{!"", !7, i64 0, !7, i64 8} !7 = !{!"long", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!7, !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = !{!6, !7, i64 8} !14 = distinct !{!14, !12}
#include<stdio.h> int MIN(int a,int b){return a<b?a:b;} int R=1,C=1,H[2000010],N[2000010]; //評価関数(いまはMIN) int hyouka(int a,int b){ if(C<b)return 1; if(C<a||b==0)return 0; return N[H[a]]<N[H[b]]?1:0; } //挿入関数 void hin(int a){ int i=C++; for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2]; H[i]=R++; } //取り出す関数 int hout(){ int rt=H[1],i,j=2,k=H[--C]; for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)]; H[j/2]=k; return rt; } int main(){ int n,m,i,j; long long s=0,a,b[100010]; scanf("%d %d",&n,&m); for(i=0;i<n;i++){ scanf("%lld %lld",&a,&b[R]); hin(a); } for(i=0;i<n;i++){ j=hout(); a=MIN(m,b[j]); m-=a; s+=a*N[j]; } printf("%lld\n",s); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294873/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294873/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @R = dso_local local_unnamed_addr global i32 1, align 4 @C = dso_local local_unnamed_addr global i32 1, align 4 @N = dso_local local_unnamed_addr global [2000010 x i32] zeroinitializer, align 16 @H = dso_local local_unnamed_addr global [2000010 x i32] zeroinitializer, align 16 @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1 @.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @MIN(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 { entry: %cond = tail call i32 @llvm.smin.i32(i32 %a, i32 %b) ret i32 %cond } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @hyouka(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 { entry: %0 = load i32, ptr @C, align 4, !tbaa !5 %cmp = icmp slt i32 %0, %b br i1 %cmp, label %return, label %if.end if.end: ; preds = %entry %cmp1 = icmp slt i32 %0, %a %cmp2 = icmp eq i32 %b, 0 %or.cond = or i1 %cmp2, %cmp1 br i1 %or.cond, label %return, label %if.end4 if.end4: ; preds = %if.end %idxprom = sext i32 %a to i64 %arrayidx = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %idxprom5 = sext i32 %1 to i64 %arrayidx6 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5 %2 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %idxprom7 = sext i32 %b to i64 %arrayidx8 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7 %3 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %idxprom9 = sext i32 %3 to i64 %arrayidx10 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9 %4 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp11 = icmp slt i32 %2, %4 %cond = zext i1 %cmp11 to i32 br label %return return: ; preds = %if.end, %entry, %if.end4 %retval.0 = phi i32 [ %cond, %if.end4 ], [ 1, %entry ], [ 0, %if.end ] ret i32 %retval.0 } ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @hin(i32 noundef %a) local_unnamed_addr #2 { entry: %0 = load i32, ptr @C, align 4, !tbaa !5 %.fr = freeze i32 %0 %inc = add nsw i32 %.fr, 1 store i32 %inc, ptr @C, align 4, !tbaa !5 %1 = load i32, ptr @R, align 4, !tbaa !5 store i32 %1, ptr @H, align 16, !tbaa !5 %idxprom = sext i32 %1 to i64 %arrayidx = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom store i32 %a, ptr %arrayidx, align 4, !tbaa !5 %cmp1.i = icmp slt i32 %.fr, -1 br i1 %cmp1.i, label %entry.split.us, label %for.cond entry.split.us: ; preds = %entry %.fr.nonneg = sub i32 0, %.fr %div.us192426 = lshr i32 %.fr.nonneg, 1 %div.us1924.neg = sub nsw i32 0, %div.us192426 %cmp.i.us20 = icmp ult i32 %inc, %div.us1924.neg br i1 %cmp.i.us20, label %for.body.us, label %for.end for.body.us: ; preds = %entry.split.us, %for.body.us %div.us22 = phi i32 [ %div.us, %for.body.us ], [ %div.us1924.neg, %entry.split.us ] %i.0.us21 = phi i32 [ %div.us22, %for.body.us ], [ %.fr, %entry.split.us ] %idxprom2.us = sext i32 %div.us22 to i64 %arrayidx3.us = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.us %2 = load i32, ptr %arrayidx3.us, align 4, !tbaa !5 %idxprom4.us = sext i32 %i.0.us21 to i64 %arrayidx5.us = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4.us store i32 %2, ptr %arrayidx5.us, align 4, !tbaa !5 %div.us = sdiv i32 %div.us22, 2 %cmp.i.us = icmp slt i32 %inc, %div.us br i1 %cmp.i.us, label %for.body.us, label %for.end, !llvm.loop !9 for.cond: ; preds = %entry, %for.body %i.0 = phi i32 [ %div, %for.body ], [ %.fr, %entry ] %div = sdiv i32 %i.0, 2 %cmp.i = icmp slt i32 %inc, %div br i1 %cmp.i, label %for.cond.for.body_crit_edge, label %if.end.i for.cond.for.body_crit_edge: ; preds = %for.cond %idxprom2.phi.trans.insert = sext i32 %div to i64 %arrayidx3.phi.trans.insert = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.phi.trans.insert %.pre = load i32, ptr %arrayidx3.phi.trans.insert, align 4, !tbaa !5 br label %for.body if.end.i: ; preds = %for.cond %i.0.off = add i32 %i.0, 1 %cmp2.i = icmp ult i32 %i.0.off, 3 br i1 %cmp2.i, label %for.end, label %hyouka.exit hyouka.exit: ; preds = %if.end.i %3 = load i32, ptr @H, align 16, !tbaa !5 %idxprom5.i = sext i32 %3 to i64 %arrayidx6.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i %4 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5 %idxprom7.i = sext i32 %div to i64 %arrayidx8.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i %5 = load i32, ptr %arrayidx8.i, align 4, !tbaa !5 %idxprom9.i = sext i32 %5 to i64 %arrayidx10.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i %6 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5 %cmp11.i.not = icmp slt i32 %4, %6 br i1 %cmp11.i.not, label %for.body, label %for.end for.body: ; preds = %for.cond.for.body_crit_edge, %hyouka.exit %7 = phi i32 [ %.pre, %for.cond.for.body_crit_edge ], [ %5, %hyouka.exit ] %idxprom4 = sext i32 %i.0 to i64 %arrayidx5 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4 store i32 %7, ptr %arrayidx5, align 4, !tbaa !5 br label %for.cond, !llvm.loop !9 for.end: ; preds = %hyouka.exit, %if.end.i, %for.body.us, %entry.split.us %.us-phi = phi i32 [ %.fr, %entry.split.us ], [ %div.us22, %for.body.us ], [ %i.0, %if.end.i ], [ %i.0, %hyouka.exit ] %inc7 = add nsw i32 %1, 1 store i32 %inc7, ptr @R, align 4, !tbaa !5 %idxprom8 = sext i32 %.us-phi to i64 %arrayidx9 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom8 store i32 %1, ptr %arrayidx9, align 4, !tbaa !5 ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i32 @hout() local_unnamed_addr #2 { entry: %0 = load i32, ptr getelementptr inbounds ([2000010 x i32], ptr @H, i64 0, i64 1), align 4, !tbaa !5 %1 = load i32, ptr @C, align 4, !tbaa !5 %.fr = freeze i32 %1 %dec = add i32 %.fr, -1 store i32 %dec, ptr @C, align 4, !tbaa !5 %idxprom = sext i32 %dec to i64 %arrayidx = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom %2 = load i32, ptr %arrayidx, align 4, !tbaa !5 %or.cond.i35 = icmp slt i32 %.fr, 2 br i1 %or.cond.i35, label %for.end, label %hyouka.exit.lr.ph.split hyouka.exit.lr.ph.split: ; preds = %entry %idxprom5.i40 = sext i32 %0 to i64 %arrayidx6.i41 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i40 %3 = load i32, ptr %arrayidx6.i41, align 4, !tbaa !5 %idxprom9.i42 = sext i32 %2 to i64 %arrayidx10.i43 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i42 %4 = load i32, ptr %arrayidx10.i43, align 4, !tbaa !5 %cmp11.i.not44 = icmp slt i32 %3, %4 br i1 %cmp11.i.not44, label %for.body, label %for.end hyouka.exit: ; preds = %hyouka.exit31 %5 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %idxprom5.i = sext i32 %5 to i64 %arrayidx6.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i %6 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5 %7 = load i32, ptr %arrayidx, align 4, !tbaa !5 %idxprom9.i = sext i32 %7 to i64 %arrayidx10.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i %8 = load i32, ptr %arrayidx10.i, align 4, !tbaa !5 %cmp11.i.not = icmp slt i32 %6, %8 br i1 %cmp11.i.not, label %for.body, label %for.end.loopexit, !llvm.loop !11 for.body: ; preds = %hyouka.exit.lr.ph.split, %hyouka.exit %i.03745 = phi i32 [ %sub, %hyouka.exit ], [ 1, %hyouka.exit.lr.ph.split ] %mul = shl nsw i32 %i.03745, 1 %add = or i32 %mul, 1 %cmp.i16.not = icmp sgt i32 %.fr, %add br i1 %cmp.i16.not, label %if.end.i17, label %hyouka.exit31 if.end.i17: ; preds = %for.body %cmp1.i18.not = icmp sgt i32 %.fr, %mul br i1 %cmp1.i18.not, label %if.end4.i19, label %hyouka.exit31 if.end4.i19: ; preds = %if.end.i17 %idxprom.i20 = sext i32 %mul to i64 %arrayidx.i21 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom.i20 %9 = load i32, ptr %arrayidx.i21, align 8, !tbaa !5 %idxprom5.i22 = sext i32 %9 to i64 %arrayidx6.i23 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i22 %10 = load i32, ptr %arrayidx6.i23, align 4, !tbaa !5 %idxprom7.i24 = sext i32 %add to i64 %arrayidx8.i25 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i24 %11 = load i32, ptr %arrayidx8.i25, align 4, !tbaa !5 %idxprom9.i26 = sext i32 %11 to i64 %arrayidx10.i27 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i26 %12 = load i32, ptr %arrayidx10.i27, align 4, !tbaa !5 %cmp11.i28 = icmp slt i32 %10, %12 %cond.i29.neg = sext i1 %cmp11.i28 to i32 br label %hyouka.exit31 hyouka.exit31: ; preds = %for.body, %if.end.i17, %if.end4.i19 %retval.0.i30.neg = phi i32 [ %cond.i29.neg, %if.end4.i19 ], [ -1, %for.body ], [ 0, %if.end.i17 ] %sub = add i32 %retval.0.i30.neg, %add %idxprom5 = sext i32 %sub to i64 %arrayidx6 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom5 %13 = load i32, ptr %arrayidx6, align 4, !tbaa !5 %idxprom7 = sext i32 %i.03745 to i64 %arrayidx8 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7 store i32 %13, ptr %arrayidx8, align 4, !tbaa !5 %cmp1.i.not = icmp sgt i32 %.fr, %sub br i1 %cmp1.i.not, label %hyouka.exit, label %for.end.loopexit, !llvm.loop !11 for.end.loopexit: ; preds = %hyouka.exit31, %hyouka.exit %14 = sdiv i32 %sub, 2 %15 = sext i32 %14 to i64 br label %for.end for.end: ; preds = %for.end.loopexit, %hyouka.exit.lr.ph.split, %entry %j.0.lcssa = phi i64 [ 1, %entry ], [ 1, %hyouka.exit.lr.ph.split ], [ %15, %for.end.loopexit ] %arrayidx10 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %j.0.lcssa store i32 %2, ptr %arrayidx10, align 4, !tbaa !5 ret i32 %0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #4 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %a = alloca i64, align 8 %b = alloca [100010 x i64], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #7 call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %b) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp37 = icmp sgt i32 %0, 0 br i1 %cmp37, label %for.body.preheader, label %for.end19 for.body.preheader: ; preds = %entry %.pre = load i32, ptr @R, align 4, !tbaa !5 br label %for.body for.cond2.preheader: ; preds = %hin.exit %cmp341 = icmp sgt i32 %11, 0 br i1 %cmp341, label %for.body5.preheader, label %for.end19 for.body5.preheader: ; preds = %for.cond2.preheader %m.promoted = load i32, ptr %m, align 4, !tbaa !5 br label %for.body5 for.body: ; preds = %for.body.preheader, %hin.exit %1 = phi i32 [ %inc7.i, %hin.exit ], [ %.pre, %for.body.preheader ] %i.038 = phi i32 [ %inc, %hin.exit ], [ 0, %for.body.preheader ] %idxprom = sext i32 %1 to i64 %arrayidx = getelementptr inbounds [100010 x i64], ptr %b, i64 0, i64 %idxprom %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx) %2 = load i64, ptr %a, align 8, !tbaa !12 %conv = trunc i64 %2 to i32 %3 = load i32, ptr @C, align 4, !tbaa !5 %.fr.i = freeze i32 %3 %inc.i = add i32 %.fr.i, 1 store i32 %inc.i, ptr @C, align 4, !tbaa !5 %4 = load i32, ptr @R, align 4, !tbaa !5 store i32 %4, ptr @H, align 16, !tbaa !5 %idxprom.i = sext i32 %4 to i64 %arrayidx.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom.i store i32 %conv, ptr %arrayidx.i, align 4, !tbaa !5 %cmp1.i.i = icmp slt i32 %.fr.i, -1 br i1 %cmp1.i.i, label %entry.split.us.i, label %for.cond.i entry.split.us.i: ; preds = %for.body %.fr.nonneg.i = sub i32 0, %.fr.i %div.us192426.i = lshr i32 %.fr.nonneg.i, 1 %div.us1924.neg.i = sub nsw i32 0, %div.us192426.i %cmp.i.us20.i = icmp ult i32 %inc.i, %div.us1924.neg.i br i1 %cmp.i.us20.i, label %for.body.us.i, label %hin.exit for.body.us.i: ; preds = %entry.split.us.i, %for.body.us.i %div.us22.i = phi i32 [ %div.us.i, %for.body.us.i ], [ %div.us1924.neg.i, %entry.split.us.i ] %i.0.us21.i = phi i32 [ %div.us22.i, %for.body.us.i ], [ %.fr.i, %entry.split.us.i ] %idxprom2.us.i = sext i32 %div.us22.i to i64 %arrayidx3.us.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.us.i %5 = load i32, ptr %arrayidx3.us.i, align 4, !tbaa !5 %idxprom4.us.i = sext i32 %i.0.us21.i to i64 %arrayidx5.us.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4.us.i store i32 %5, ptr %arrayidx5.us.i, align 4, !tbaa !5 %div.us.i = sdiv i32 %div.us22.i, 2 %cmp.i.us.i = icmp slt i32 %inc.i, %div.us.i br i1 %cmp.i.us.i, label %for.body.us.i, label %hin.exit, !llvm.loop !9 for.cond.i: ; preds = %for.body, %for.body.i %i.0.i = phi i32 [ %div.i, %for.body.i ], [ %.fr.i, %for.body ] %div.i = sdiv i32 %i.0.i, 2 %cmp.i.i = icmp slt i32 %inc.i, %div.i br i1 %cmp.i.i, label %for.cond.for.body_crit_edge.i, label %if.end.i.i for.cond.for.body_crit_edge.i: ; preds = %for.cond.i %idxprom2.phi.trans.insert.i = sext i32 %div.i to i64 %arrayidx3.phi.trans.insert.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom2.phi.trans.insert.i %.pre.i = load i32, ptr %arrayidx3.phi.trans.insert.i, align 4, !tbaa !5 br label %for.body.i if.end.i.i: ; preds = %for.cond.i %i.0.off.i = add i32 %i.0.i, 1 %cmp2.i.i = icmp ult i32 %i.0.off.i, 3 br i1 %cmp2.i.i, label %hin.exit, label %hyouka.exit.i hyouka.exit.i: ; preds = %if.end.i.i %6 = load i32, ptr @H, align 16, !tbaa !5 %idxprom5.i.i = sext i32 %6 to i64 %arrayidx6.i.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i.i %7 = load i32, ptr %arrayidx6.i.i, align 4, !tbaa !5 %idxprom7.i.i = sext i32 %div.i to i64 %arrayidx8.i.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i.i %8 = load i32, ptr %arrayidx8.i.i, align 4, !tbaa !5 %idxprom9.i.i = sext i32 %8 to i64 %arrayidx10.i.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i.i %9 = load i32, ptr %arrayidx10.i.i, align 4, !tbaa !5 %cmp11.i.not.i = icmp slt i32 %7, %9 br i1 %cmp11.i.not.i, label %for.body.i, label %hin.exit for.body.i: ; preds = %hyouka.exit.i, %for.cond.for.body_crit_edge.i %10 = phi i32 [ %.pre.i, %for.cond.for.body_crit_edge.i ], [ %8, %hyouka.exit.i ] %idxprom4.i = sext i32 %i.0.i to i64 %arrayidx5.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom4.i store i32 %10, ptr %arrayidx5.i, align 4, !tbaa !5 br label %for.cond.i, !llvm.loop !9 hin.exit: ; preds = %if.end.i.i, %hyouka.exit.i, %for.body.us.i, %entry.split.us.i %.us-phi.i = phi i32 [ %.fr.i, %entry.split.us.i ], [ %div.us22.i, %for.body.us.i ], [ %i.0.i, %hyouka.exit.i ], [ %i.0.i, %if.end.i.i ] %inc7.i = add nsw i32 %4, 1 store i32 %inc7.i, ptr @R, align 4, !tbaa !5 %idxprom8.i = sext i32 %.us-phi.i to i64 %arrayidx9.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom8.i store i32 %4, ptr %arrayidx9.i, align 4, !tbaa !5 %inc = add nuw nsw i32 %i.038, 1 %11 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %11 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !14 for.body5: ; preds = %for.body5.preheader, %hout.exit %s.045 = phi i64 [ %add, %hout.exit ], [ 0, %for.body5.preheader ] %i.144 = phi i32 [ %inc18, %hout.exit ], [ 0, %for.body5.preheader ] %dec.i3943 = phi i32 [ %dec.i, %hout.exit ], [ %inc.i, %for.body5.preheader ] %sub4042 = phi i32 [ %sub, %hout.exit ], [ %m.promoted, %for.body5.preheader ] %12 = load i32, ptr getelementptr inbounds ([2000010 x i32], ptr @H, i64 0, i64 1), align 4, !tbaa !5 %dec.i = add i32 %dec.i3943, -1 %idxprom.i27 = sext i32 %dec.i to i64 %arrayidx.i28 = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom.i27 %13 = load i32, ptr %arrayidx.i28, align 4, !tbaa !5 %or.cond.i35.i = icmp slt i32 %dec.i3943, 2 %idxprom7.phi.trans.insert = sext i32 %12 to i64 %arrayidx15.phi.trans.insert = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom7.phi.trans.insert %.pre50 = load i32, ptr %arrayidx15.phi.trans.insert, align 4, !tbaa !5 br i1 %or.cond.i35.i, label %hout.exit, label %hyouka.exit.lr.ph.split.i hyouka.exit.lr.ph.split.i: ; preds = %for.body5 %idxprom9.i42.i = sext i32 %13 to i64 %arrayidx10.i43.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i42.i %14 = load i32, ptr %arrayidx10.i43.i, align 4, !tbaa !5 %cmp11.i.not44.i = icmp slt i32 %.pre50, %14 br i1 %cmp11.i.not44.i, label %for.body.i29, label %hout.exit hyouka.exit.i30: ; preds = %hyouka.exit31.i %15 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5 %idxprom5.i.i31 = sext i32 %15 to i64 %arrayidx6.i.i32 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i.i31 %16 = load i32, ptr %arrayidx6.i.i32, align 4, !tbaa !5 %17 = load i32, ptr %arrayidx.i28, align 4, !tbaa !5 %idxprom9.i.i33 = sext i32 %17 to i64 %arrayidx10.i.i34 = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i.i33 %18 = load i32, ptr %arrayidx10.i.i34, align 4, !tbaa !5 %cmp11.i.not.i35 = icmp slt i32 %16, %18 br i1 %cmp11.i.not.i35, label %for.body.i29, label %for.end.loopexit.i, !llvm.loop !11 for.body.i29: ; preds = %hyouka.exit.lr.ph.split.i, %hyouka.exit.i30 %i.03745.i = phi i32 [ %sub.i, %hyouka.exit.i30 ], [ 1, %hyouka.exit.lr.ph.split.i ] %mul.i = shl nsw i32 %i.03745.i, 1 %add.i = or i32 %mul.i, 1 %cmp.i16.not.i = icmp sgt i32 %dec.i3943, %add.i br i1 %cmp.i16.not.i, label %if.end4.i19.i, label %hyouka.exit31.i if.end4.i19.i: ; preds = %for.body.i29 %idxprom.i20.i = sext i32 %mul.i to i64 %arrayidx.i21.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom.i20.i %19 = load i32, ptr %arrayidx.i21.i, align 8, !tbaa !5 %idxprom5.i22.i = sext i32 %19 to i64 %arrayidx6.i23.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom5.i22.i %20 = load i32, ptr %arrayidx6.i23.i, align 4, !tbaa !5 %idxprom7.i24.i = sext i32 %add.i to i64 %arrayidx8.i25.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i24.i %21 = load i32, ptr %arrayidx8.i25.i, align 4, !tbaa !5 %idxprom9.i26.i = sext i32 %21 to i64 %arrayidx10.i27.i = getelementptr inbounds [2000010 x i32], ptr @N, i64 0, i64 %idxprom9.i26.i %22 = load i32, ptr %arrayidx10.i27.i, align 4, !tbaa !5 %cmp11.i28.i = icmp slt i32 %20, %22 %cond.i29.neg.i = sext i1 %cmp11.i28.i to i32 br label %hyouka.exit31.i hyouka.exit31.i: ; preds = %if.end4.i19.i, %for.body.i29 %retval.0.i30.neg.i = phi i32 [ %cond.i29.neg.i, %if.end4.i19.i ], [ -1, %for.body.i29 ] %sub.i = add i32 %retval.0.i30.neg.i, %add.i %idxprom5.i = sext i32 %sub.i to i64 %arrayidx6.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom5.i %23 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5 %idxprom7.i = sext i32 %i.03745.i to i64 %arrayidx8.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %idxprom7.i store i32 %23, ptr %arrayidx8.i, align 4, !tbaa !5 %cmp1.i.not.i = icmp sgt i32 %dec.i3943, %sub.i br i1 %cmp1.i.not.i, label %hyouka.exit.i30, label %for.end.loopexit.i, !llvm.loop !11 for.end.loopexit.i: ; preds = %hyouka.exit31.i, %hyouka.exit.i30 %24 = sdiv i32 %sub.i, 2 %25 = sext i32 %24 to i64 br label %hout.exit hout.exit: ; preds = %for.body5, %hyouka.exit.lr.ph.split.i, %for.end.loopexit.i %j.0.lcssa.i = phi i64 [ 1, %hyouka.exit.lr.ph.split.i ], [ %25, %for.end.loopexit.i ], [ 1, %for.body5 ] %arrayidx10.i = getelementptr inbounds [2000010 x i32], ptr @H, i64 0, i64 %j.0.lcssa.i store i32 %13, ptr %arrayidx10.i, align 4, !tbaa !5 %arrayidx8 = getelementptr inbounds [100010 x i64], ptr %b, i64 0, i64 %idxprom7.phi.trans.insert %26 = load i64, ptr %arrayidx8, align 8, !tbaa !12 %conv9 = trunc i64 %26 to i32 %cond.i = call i32 @llvm.smin.i32(i32 %sub4042, i32 %conv9) %conv11 = sext i32 %cond.i to i64 %sub = sub i32 %sub4042, %cond.i %conv16 = sext i32 %.pre50 to i64 %mul = mul nsw i64 %conv16, %conv11 %add = add nsw i64 %mul, %s.045 %inc18 = add nuw nsw i32 %i.144, 1 %exitcond.not = icmp eq i32 %inc18, %11 br i1 %exitcond.not, label %for.cond2.for.end19_crit_edge, label %for.body5, !llvm.loop !15 for.cond2.for.end19_crit_edge: ; preds = %hout.exit store i32 %dec.i, ptr @C, align 4, !tbaa !5 store i64 %conv11, ptr %a, align 8, !tbaa !12 store i32 %sub, ptr %m, align 4, !tbaa !5 br label %for.end19 for.end19: ; preds = %entry, %for.cond2.for.end19_crit_edge, %for.cond2.preheader %s.0.lcssa = phi i64 [ %add, %for.cond2.for.end19_crit_edge ], [ 0, %for.cond2.preheader ], [ 0, %entry ] %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %s.0.lcssa) call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %b) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #6 attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = !{!13, !13, i64 0} !13 = !{!"long long", !7, i64 0} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10}
#include <stdio.h> #include <stdlib.h> int main() { int i,j,x,n,flag; scanf("%d %d",&x,&n); int num[n]; for(i=0;i<n;i++) { scanf("%d",&num[i]); } for(i=0;;i++) { flag=1; for(j=0;j<n;j++) { if((x-i)!=num[j])flag*=1; if((x-i)==num[j])flag*=0; } if(flag==1) { printf("%d",x-i); return 0; } flag=1; for(j=0;j<n;j++) { if((x+i)!=num[j])flag*=1; if((x+i)==num[j])flag*=0; } if(flag==1) { printf("%d",x+i); return 0; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_294974/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_294974/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %n = 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 %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, 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 %cmp77 = icmp sgt i32 %3, 0 br i1 %cmp77, label %for.body, label %for.cond2.preheader.thread for.cond2.preheader.thread: ; preds = %entry %4 = load i32, ptr %x, align 4 br label %if.then20 for.cond2.preheader: ; preds = %for.body %cmp479 = icmp sgt i32 %24, 0 %5 = load i32, ptr %x, align 4 br i1 %cmp479, label %for.cond2.us.us.preheader, label %if.then20 for.cond2.us.us.preheader: ; preds = %for.cond2.preheader %wide.trip.count = zext i32 %24 to i64 %min.iters.check135 = icmp ult i32 %24, 8 %n.vec138 = and i64 %wide.trip.count, 4294967288 %cmp.n140 = icmp eq i64 %n.vec138, %wide.trip.count %min.iters.check = icmp ult i32 %24, 8 %n.vec = and i64 %wide.trip.count, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br label %for.cond2.us.us for.cond2.us.us: ; preds = %for.cond2.us.us.preheader, %for.inc48.us.us %i.1.us.us = phi i32 [ %inc49.us.us, %for.inc48.us.us ], [ 0, %for.cond2.us.us.preheader ] %sub.us.us = sub nsw i32 %5, %i.1.us.us br i1 %min.iters.check135, label %for.body5.us.us.preheader, label %vector.ph136 vector.ph136: ; preds = %for.cond2.us.us %broadcast.splatinsert147 = insertelement <4 x i32> poison, i32 %sub.us.us, i64 0 %broadcast.splat148 = shufflevector <4 x i32> %broadcast.splatinsert147, <4 x i32> poison, <4 x i32> zeroinitializer br label %vector.body141 vector.body141: ; preds = %vector.body141, %vector.ph136 %index142 = phi i64 [ 0, %vector.ph136 ], [ %index.next149, %vector.body141 ] %vec.phi143 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph136 ], [ %10, %vector.body141 ] %vec.phi144 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph136 ], [ %11, %vector.body141 ] %6 = getelementptr inbounds i32, ptr %vla, i64 %index142 %wide.load145 = load <4 x i32>, ptr %6, align 16, !tbaa !5 %7 = getelementptr inbounds i32, ptr %6, i64 4 %wide.load146 = load <4 x i32>, ptr %7, align 16, !tbaa !5 %8 = icmp eq <4 x i32> %broadcast.splat148, %wide.load145 %9 = icmp eq <4 x i32> %broadcast.splat148, %wide.load146 %10 = select <4 x i1> %8, <4 x i32> zeroinitializer, <4 x i32> %vec.phi143 %11 = select <4 x i1> %9, <4 x i32> zeroinitializer, <4 x i32> %vec.phi144 %index.next149 = add nuw i64 %index142, 8 %12 = icmp eq i64 %index.next149, %n.vec138 br i1 %12, label %middle.block133, label %vector.body141, !llvm.loop !9 middle.block133: ; preds = %vector.body141 %rdx.select.cmp150.not = icmp ne <4 x i32> %10, <i32 1, i32 1, i32 1, i32 1> %rdx.select.cmp152155 = icmp ne <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1> %rdx.select.cmp152 = select <4 x i1> %rdx.select.cmp150.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp152155 %13 = bitcast <4 x i1> %rdx.select.cmp152 to i4 %.not = icmp eq i4 %13, 0 %rdx.select153 = zext i1 %.not to i32 br i1 %cmp.n140, label %for.cond3.for.end18_crit_edge.us.us, label %for.body5.us.us.preheader for.body5.us.us.preheader: ; preds = %for.cond2.us.us, %middle.block133 %indvars.iv117.ph = phi i64 [ 0, %for.cond2.us.us ], [ %n.vec138, %middle.block133 ] %flag.081.us.us.ph = phi i32 [ 1, %for.cond2.us.us ], [ %rdx.select153, %middle.block133 ] br label %for.body5.us.us for.inc48.us.us: ; preds = %for.cond24.for.end42_crit_edge.us.us %inc49.us.us = add nuw nsw i32 %i.1.us.us, 1 br label %for.cond2.us.us for.body26.us.us: ; preds = %for.body26.us.us.preheader, %for.body26.us.us %indvars.iv120 = phi i64 [ %indvars.iv.next121, %for.body26.us.us ], [ %indvars.iv120.ph, %for.body26.us.us.preheader ] %flag.385.us.us = phi i32 [ %flag.5.us.us, %for.body26.us.us ], [ %flag.385.us.us.ph, %for.body26.us.us.preheader ] %arrayidx28.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv120 %14 = load i32, ptr %arrayidx28.us.us, align 4, !tbaa !5 %cmp36.us.us = icmp eq i32 %add.us.us, %14 %flag.5.us.us = select i1 %cmp36.us.us, i32 0, i32 %flag.385.us.us %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1 %exitcond124.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count br i1 %exitcond124.not, label %for.cond24.for.end42_crit_edge.us.us, label %for.body26.us.us, !llvm.loop !13 for.body5.us.us: ; preds = %for.body5.us.us.preheader, %for.body5.us.us %indvars.iv117 = phi i64 [ %indvars.iv.next118, %for.body5.us.us ], [ %indvars.iv117.ph, %for.body5.us.us.preheader ] %flag.081.us.us = phi i32 [ %flag.2.us.us, %for.body5.us.us ], [ %flag.081.us.us.ph, %for.body5.us.us.preheader ] %arrayidx7.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv117 %15 = load i32, ptr %arrayidx7.us.us, align 4, !tbaa !5 %cmp12.us.us = icmp eq i32 %sub.us.us, %15 %flag.2.us.us = select i1 %cmp12.us.us, i32 0, i32 %flag.081.us.us %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1 %exitcond.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count br i1 %exitcond.not, label %for.cond3.for.end18_crit_edge.us.us, label %for.body5.us.us, !llvm.loop !14 for.cond24.preheader.us.us: ; preds = %for.cond3.for.end18_crit_edge.us.us %add.us.us = add nsw i32 %5, %i.1.us.us br i1 %min.iters.check, label %for.body26.us.us.preheader, label %vector.ph vector.ph: ; preds = %for.cond24.preheader.us.us %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %add.us.us, 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> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %20, %vector.body ] %vec.phi129 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %21, %vector.body ] %16 = getelementptr inbounds i32, ptr %vla, i64 %index %wide.load = load <4 x i32>, ptr %16, align 16, !tbaa !5 %17 = getelementptr inbounds i32, ptr %16, i64 4 %wide.load130 = load <4 x i32>, ptr %17, align 16, !tbaa !5 %18 = icmp eq <4 x i32> %broadcast.splat, %wide.load %19 = icmp eq <4 x i32> %broadcast.splat, %wide.load130 %20 = select <4 x i1> %18, <4 x i32> zeroinitializer, <4 x i32> %vec.phi %21 = select <4 x i1> %19, <4 x i32> zeroinitializer, <4 x i32> %vec.phi129 %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 %rdx.select.cmp.not = icmp ne <4 x i32> %20, <i32 1, i32 1, i32 1, i32 1> %rdx.select.cmp131156 = icmp ne <4 x i32> %21, <i32 1, i32 1, i32 1, i32 1> %rdx.select.cmp131 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp131156 %23 = bitcast <4 x i1> %rdx.select.cmp131 to i4 %.not157 = icmp eq i4 %23, 0 %rdx.select132 = zext i1 %.not157 to i32 br i1 %cmp.n, label %for.cond24.for.end42_crit_edge.us.us, label %for.body26.us.us.preheader for.body26.us.us.preheader: ; preds = %for.cond24.preheader.us.us, %middle.block %indvars.iv120.ph = phi i64 [ 0, %for.cond24.preheader.us.us ], [ %n.vec, %middle.block ] %flag.385.us.us.ph = phi i32 [ 1, %for.cond24.preheader.us.us ], [ %rdx.select132, %middle.block ] br label %for.body26.us.us for.cond3.for.end18_crit_edge.us.us: ; preds = %for.body5.us.us, %middle.block133 %flag.2.us.us.lcssa = phi i32 [ %rdx.select153, %middle.block133 ], [ %flag.2.us.us, %for.body5.us.us ] %cmp19.us.us = icmp eq i32 %flag.2.us.us.lcssa, 1 br i1 %cmp19.us.us, label %if.then20, label %for.cond24.preheader.us.us for.cond24.for.end42_crit_edge.us.us: ; preds = %for.body26.us.us, %middle.block %flag.5.us.us.lcssa = phi i32 [ %rdx.select132, %middle.block ], [ %flag.5.us.us, %for.body26.us.us ] %cmp43.us.us = icmp eq i32 %flag.5.us.us.lcssa, 1 br i1 %cmp43.us.us, label %if.then44, label %for.inc48.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.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %24 = load i32, ptr %n, align 4, !tbaa !5 %25 = sext i32 %24 to i64 %cmp = icmp slt i64 %indvars.iv.next, %25 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !16 if.then20: ; preds = %for.cond3.for.end18_crit_edge.us.us, %for.cond2.preheader.thread, %for.cond2.preheader %26 = phi i32 [ %5, %for.cond2.preheader ], [ %4, %for.cond2.preheader.thread ], [ %5, %for.cond3.for.end18_crit_edge.us.us ] %.us-phi = phi i32 [ 0, %for.cond2.preheader ], [ 0, %for.cond2.preheader.thread ], [ %i.1.us.us, %for.cond3.for.end18_crit_edge.us.us ] %sub21 = sub nsw i32 %26, %.us-phi br label %cleanup if.then44: ; preds = %for.cond24.for.end42_crit_edge.us.us %add45 = add nsw i32 %5, %i.1.us.us br label %cleanup cleanup: ; preds = %if.then44, %if.then20 %add45.sink = phi i32 [ %add45, %if.then44 ], [ %sub21, %if.then20 ] %call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add45.sink) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 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, !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 <float.h> #include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> // 内部定数 #define D_ON 1 // 汎用フラグ - ON #define D_OFF 0 // 汎用フラグ - OFF #define D_VAL_MAX 105 // 最大値 // 内部変数 static FILE *szpFpI; // 入力 static char sc1Val[D_VAL_MAX]; // 値リスト // 内部変数 - テスト用 #ifdef D_TEST static int siRes; static FILE *szpFpA; static int siTNo; #endif // 1行出力 int fOutLine( char *pcpLine // <I> 1行 ) { char lc1Buf[1024]; #ifdef D_TEST lc1Buf[0] = '\0'; fgets(lc1Buf, sizeof(lc1Buf), szpFpA); if (strcmp(lc1Buf, pcpLine)) { siRes = -1; } #else printf("%s", pcpLine); #endif return 0; } // 実行メイン int fMain( ) { int i; char lc1Buf[1024]; // データ - 初期化 memset(sc1Val, D_ON, sizeof(sc1Val)); // X, 配列数 - 取得 int liX, liACnt; fgets(lc1Buf, sizeof(lc1Buf), szpFpI); sscanf(lc1Buf, "%d%d", &liX, &liACnt); // 値リスト - セット for (i = 0; i < liACnt; i++) { int liVal; fscanf(szpFpI, "%d", &liVal); sc1Val[liVal] = D_OFF; } fgets(lc1Buf, sizeof(lc1Buf), szpFpI); // 最小値 - 取得 int liMin = INT_MAX; int liNum; for (i = 0; i < D_VAL_MAX; i++) { if (sc1Val[i] == D_ON) { int liDF = abs(liX - i); if (liMin > liDF) { liMin = liDF; liNum = i; } } } return liNum; } // 1回実行 int fOne( ) { int liRet; char lc1Buf[1024]; // 入力 - セット #ifdef D_TEST sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo); szpFpI = fopen(lc1Buf, "r"); sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo); szpFpA = fopen(lc1Buf, "r"); siRes = 0; #else szpFpI = stdin; #endif // 実行メイン liRet = fMain(); // 出力 if (liRet == 0) { sprintf(lc1Buf, "Yes\n"); } else { sprintf(lc1Buf, "No\n"); } sprintf(lc1Buf, "%d\n", liRet); fOutLine(lc1Buf); // 残データ有無 #ifdef D_TEST lc1Buf[0] = '\0'; fgets(lc1Buf, sizeof(lc1Buf), szpFpA); if (strcmp(lc1Buf, "")) { siRes = -1; } #endif // テストファイルクローズ #ifdef D_TEST fclose(szpFpI); fclose(szpFpA); #endif // テスト結果 #ifdef D_TEST if (siRes == 0) { printf("OK %d\n", siTNo); } else { printf("NG %d\n", siTNo); } #endif return 0; } // プログラム開始 int main() { #ifdef D_TEST int i; for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) { siTNo = i; fOne(); } #else fOne(); #endif return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295016/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295016/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @sc1Val = internal unnamed_addr global [105 x i8] zeroinitializer, align 16 @szpFpI = internal unnamed_addr global ptr null, align 8 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @stdin = external local_unnamed_addr global ptr, align 8 @.str.3 = private unnamed_addr constant [5 x i8] c"Yes\0A\00", align 1 @.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @fOutLine(ptr noundef %pcpLine) local_unnamed_addr #0 { entry: %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %pcpLine) ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nounwind uwtable define dso_local i32 @fMain() local_unnamed_addr #3 { entry: %lc1Buf = alloca [1024 x i8], align 16 %liX = alloca i32, align 4 %liACnt = alloca i32, align 4 %liVal = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #9 tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(105) @sc1Val, i8 1, i64 105, i1 false) call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %liX) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %liACnt) #9 %0 = load ptr, ptr @szpFpI, align 8, !tbaa !5 %call = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %0) %call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %lc1Buf, ptr noundef nonnull @.str.1, ptr noundef nonnull %liX, ptr noundef nonnull %liACnt) #9 %1 = load i32, ptr %liACnt, align 4, !tbaa !9 %cmp28 = icmp sgt i32 %1, 0 br i1 %cmp28, label %for.body, label %for.end for.body: ; preds = %entry, %for.body %i.029 = phi i32 [ %inc, %for.body ], [ 0, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %liVal) #9 %2 = load ptr, ptr @szpFpI, align 8, !tbaa !5 %call3 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %2, ptr noundef nonnull @.str.2, ptr noundef nonnull %liVal) #9 %3 = load i32, ptr %liVal, align 4, !tbaa !9 %idxprom = sext i32 %3 to i64 %arrayidx = getelementptr inbounds [105 x i8], ptr @sc1Val, i64 0, i64 %idxprom store i8 0, ptr %arrayidx, align 1, !tbaa !11 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %liVal) #9 %inc = add nuw nsw i32 %i.029, 1 %4 = load i32, ptr %liACnt, align 4, !tbaa !9 %cmp = icmp slt i32 %inc, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !12 for.end: ; preds = %for.body, %entry %5 = load ptr, ptr @szpFpI, align 8, !tbaa !5 %call5 = call ptr @fgets(ptr noundef nonnull %lc1Buf, i32 noundef 1024, ptr noundef %5) %6 = load i32, ptr %liX, align 4 br label %for.body8 for.body8: ; preds = %for.inc17.1, %for.end %indvars.iv = phi i64 [ 0, %for.end ], [ %indvars.iv.next.1, %for.inc17.1 ] %liNum.031 = phi i32 [ undef, %for.end ], [ %liNum.2.1, %for.inc17.1 ] %liMin.030 = phi i32 [ 2147483647, %for.end ], [ %liMin.2.1, %for.inc17.1 ] %arrayidx10 = getelementptr inbounds [105 x i8], ptr @sc1Val, i64 0, i64 %indvars.iv %7 = load i8, ptr %arrayidx10, align 2, !tbaa !11 %cmp11 = icmp eq i8 %7, 1 br i1 %cmp11, label %if.then, label %for.inc17 if.then: ; preds = %for.body8 %8 = trunc i64 %indvars.iv to i32 %sub = sub nsw i32 %6, %8 %9 = call i32 @llvm.abs.i32(i32 %sub, i1 true) %cmp13 = icmp sgt i32 %liMin.030, %9 %spec.select = call i32 @llvm.smin.i32(i32 %liMin.030, i32 %9) %spec.select27 = select i1 %cmp13, i32 %8, i32 %liNum.031 br label %for.inc17 for.inc17: ; preds = %for.body8, %if.then %liMin.2 = phi i32 [ %spec.select, %if.then ], [ %liMin.030, %for.body8 ] %liNum.2 = phi i32 [ %spec.select27, %if.then ], [ %liNum.031, %for.body8 ] %indvars.iv.next = or i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, 105 br i1 %exitcond.not, label %for.end19, label %for.body8.1, !llvm.loop !14 for.body8.1: ; preds = %for.inc17 %arrayidx10.1 = getelementptr inbounds [105 x i8], ptr @sc1Val, i64 0, i64 %indvars.iv.next %10 = load i8, ptr %arrayidx10.1, align 1, !tbaa !11 %cmp11.1 = icmp eq i8 %10, 1 br i1 %cmp11.1, label %if.then.1, label %for.inc17.1 if.then.1: ; preds = %for.body8.1 %11 = trunc i64 %indvars.iv.next to i32 %sub.1 = sub nsw i32 %6, %11 %12 = call i32 @llvm.abs.i32(i32 %sub.1, i1 true) %cmp13.1 = icmp sgt i32 %liMin.2, %12 %spec.select.1 = call i32 @llvm.smin.i32(i32 %liMin.2, i32 %12) %spec.select27.1 = select i1 %cmp13.1, i32 %11, i32 %liNum.2 br label %for.inc17.1 for.inc17.1: ; preds = %if.then.1, %for.body8.1 %liMin.2.1 = phi i32 [ %spec.select.1, %if.then.1 ], [ %liMin.2, %for.body8.1 ] %liNum.2.1 = phi i32 [ %spec.select27.1, %if.then.1 ], [ %liNum.2, %for.body8.1 ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 br label %for.body8 for.end19: ; preds = %for.inc17 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %liACnt) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %liX) #9 call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #9 ret i32 %liNum.2 } ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 ; Function Attrs: nofree nounwind declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2 declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #5 ; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #6 ; Function Attrs: nounwind uwtable define dso_local i32 @fOne() local_unnamed_addr #3 { entry: %lc1Buf = alloca [1024 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf) #9 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 store ptr %0, ptr @szpFpI, align 8, !tbaa !5 %call = tail call i32 @fMain() %cmp = icmp eq i32 %call, 0 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) %lc1Buf, ptr noundef nonnull align 1 dereferenceable(5) @.str.3, i64 5, i1 false) br label %if.end if.else: ; preds = %entry store i32 683854, ptr %lc1Buf, align 16 br label %if.end if.end: ; preds = %if.else, %if.then %call5 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf, ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %call) #9 %call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf) call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf) #9 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nounwind uwtable define dso_local i32 @main() local_unnamed_addr #3 { entry: %lc1Buf.i = alloca [1024 x i8], align 16 call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %lc1Buf.i) #9 %0 = load ptr, ptr @stdin, align 8, !tbaa !5 store ptr %0, ptr @szpFpI, align 8, !tbaa !5 %call.i = tail call i32 @fMain() %cmp.i = icmp eq i32 %call.i, 0 br i1 %cmp.i, label %if.then.i, label %if.else.i if.then.i: ; preds = %entry call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(5) %lc1Buf.i, ptr noundef nonnull align 1 dereferenceable(5) @.str.3, i64 5, i1 false) br label %fOne.exit if.else.i: ; preds = %entry store i32 683854, ptr %lc1Buf.i, align 16 br label %fOne.exit fOne.exit: ; preds = %if.then.i, %if.else.i %call5.i = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %lc1Buf.i, ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %call.i) #9 %call.i.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %lc1Buf.i) call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %lc1Buf.i) #9 ret i32 0 } ; 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) #7 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="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 uwtable "min-legal-vector-width"="0" "no-trapping-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: write) } attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #9 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!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 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.mustprogress"} !14 = distinct !{!14, !13}
#include<stdio.h> int swap(int a[],int n) { int i,min=1000,min1=1000,x=0; for(i=0;i<n;i++) { if(min>a[i]) { min=a[i]; x=i; } } for(i=0;i<n;i++) { if(min1>a[i]) { if(i==x)continue; min1=a[i]; } } return min+min1; } int main() { int t,n,m,i,j,s=0; scanf("%d",&t); for(j=0;j<t;j++){ scanf("%d %d",&n,&m); int a[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) { if(a[i]>m) { a[i]=swap(a,n); } } for(i=0;i<n;i++) {if(a[i]>m) { s=1; break; }} if(s==1){printf("NO\n"); s=0;} else {printf("YES\n");} } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29506/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29506/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @str = private unnamed_addr constant [4 x i8] c"YES\00", align 1 @str.4 = private unnamed_addr constant [3 x i8] c"NO\00", align 1 ; Function Attrs: nofree nosync nounwind memory(argmem: read) uwtable define dso_local i32 @swap(ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #0 { entry: %cmp37 = icmp sgt i32 %n, 0 br i1 %cmp37, label %for.body.preheader, label %for.end19 for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %xtraiter = and i64 %wide.trip.count, 3 %0 = icmp ult i32 %n, 4 br i1 %0, label %for.cond4.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.cond4.preheader.unr-lcssa: ; preds = %for.body, %for.body.preheader %spec.select.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %spec.select.3, %for.body ] %spec.select36.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %spec.select36.3, %for.body ] %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.3, %for.body ] %x.040.unr = phi i32 [ 0, %for.body.preheader ], [ %spec.select36.3, %for.body ] %min.039.unr = phi i32 [ 1000, %for.body.preheader ], [ %spec.select.3, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond4.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond4.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond4.preheader.unr-lcssa ] %x.040.epil = phi i32 [ %spec.select36.epil, %for.body.epil ], [ %x.040.unr, %for.cond4.preheader.unr-lcssa ] %min.039.epil = phi i32 [ %spec.select.epil, %for.body.epil ], [ %min.039.unr, %for.cond4.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond4.preheader.unr-lcssa ] %arrayidx.epil = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.epil %1 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5 %cmp1.epil = icmp sgt i32 %min.039.epil, %1 %spec.select.epil = tail call i32 @llvm.smin.i32(i32 %min.039.epil, i32 %1) %2 = trunc i64 %indvars.iv.epil to i32 %spec.select36.epil = select i1 %cmp1.epil, i32 %2, i32 %x.040.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.cond4.preheader, label %for.body.epil, !llvm.loop !9 for.cond4.preheader: ; preds = %for.body.epil, %for.cond4.preheader.unr-lcssa %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %for.cond4.preheader.unr-lcssa ], [ %spec.select.epil, %for.body.epil ] %spec.select36.lcssa = phi i32 [ %spec.select36.lcssa.ph, %for.cond4.preheader.unr-lcssa ], [ %spec.select36.epil, %for.body.epil ] %3 = zext i32 %spec.select36.lcssa to i64 br i1 %cmp37, label %for.body6.preheader, label %for.end19 for.body6.preheader: ; preds = %for.cond4.preheader %xtraiter57 = and i64 %wide.trip.count, 3 %4 = icmp ult i32 %n, 4 br i1 %4, label %for.end19.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter61 = and i64 %wide.trip.count, 4294967292 br label %for.body6 for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.3, %for.body ] %x.040 = phi i32 [ 0, %for.body.preheader.new ], [ %spec.select36.3, %for.body ] %min.039 = phi i32 [ 1000, %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 i32, ptr %a, i64 %indvars.iv %5 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp1 = icmp sgt i32 %min.039, %5 %spec.select = tail call i32 @llvm.smin.i32(i32 %min.039, i32 %5) %6 = trunc i64 %indvars.iv to i32 %spec.select36 = select i1 %cmp1, i32 %6, i32 %x.040 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next %7 = load i32, ptr %arrayidx.1, align 4, !tbaa !5 %cmp1.1 = icmp sgt i32 %spec.select, %7 %spec.select.1 = tail call i32 @llvm.smin.i32(i32 %spec.select, i32 %7) %8 = trunc i64 %indvars.iv.next to i32 %spec.select36.1 = select i1 %cmp1.1, i32 %8, i32 %spec.select36 %indvars.iv.next.1 = or i64 %indvars.iv, 2 %arrayidx.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.1 %9 = load i32, ptr %arrayidx.2, align 4, !tbaa !5 %cmp1.2 = icmp sgt i32 %spec.select.1, %9 %spec.select.2 = tail call i32 @llvm.smin.i32(i32 %spec.select.1, i32 %9) %10 = trunc i64 %indvars.iv.next.1 to i32 %spec.select36.2 = select i1 %cmp1.2, i32 %10, i32 %spec.select36.1 %indvars.iv.next.2 = or i64 %indvars.iv, 3 %arrayidx.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next.2 %11 = load i32, ptr %arrayidx.3, align 4, !tbaa !5 %cmp1.3 = icmp sgt i32 %spec.select.2, %11 %spec.select.3 = tail call i32 @llvm.smin.i32(i32 %spec.select.2, i32 %11) %12 = trunc i64 %indvars.iv.next.2 to i32 %spec.select36.3 = select i1 %cmp1.3, i32 %12, i32 %spec.select36.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.cond4.preheader.unr-lcssa, label %for.body, !llvm.loop !11 for.body6: ; preds = %for.body6, %for.body6.preheader.new %indvars.iv47 = phi i64 [ 0, %for.body6.preheader.new ], [ %indvars.iv.next48.3, %for.body6 ] %min1.044 = phi i32 [ 1000, %for.body6.preheader.new ], [ %min1.1.3, %for.body6 ] %niter62 = phi i64 [ 0, %for.body6.preheader.new ], [ %niter62.next.3, %for.body6 ] %arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv47 %13 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %cmp9 = icmp sle i32 %min1.044, %13 %cmp11 = icmp eq i64 %indvars.iv47, %3 %or.cond = select i1 %cmp9, i1 true, i1 %cmp11 %min1.1 = select i1 %or.cond, i32 %min1.044, i32 %13 %indvars.iv.next48 = or i64 %indvars.iv47, 1 %arrayidx8.1 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next48 %14 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5 %cmp9.1 = icmp sle i32 %min1.1, %14 %cmp11.1 = icmp eq i64 %indvars.iv.next48, %3 %or.cond.1 = select i1 %cmp9.1, i1 true, i1 %cmp11.1 %min1.1.1 = select i1 %or.cond.1, i32 %min1.1, i32 %14 %indvars.iv.next48.1 = or i64 %indvars.iv47, 2 %arrayidx8.2 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next48.1 %15 = load i32, ptr %arrayidx8.2, align 4, !tbaa !5 %cmp9.2 = icmp sle i32 %min1.1.1, %15 %cmp11.2 = icmp eq i64 %indvars.iv.next48.1, %3 %or.cond.2 = select i1 %cmp9.2, i1 true, i1 %cmp11.2 %min1.1.2 = select i1 %or.cond.2, i32 %min1.1.1, i32 %15 %indvars.iv.next48.2 = or i64 %indvars.iv47, 3 %arrayidx8.3 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv.next48.2 %16 = load i32, ptr %arrayidx8.3, align 4, !tbaa !5 %cmp9.3 = icmp sle i32 %min1.1.2, %16 %cmp11.3 = icmp eq i64 %indvars.iv.next48.2, %3 %or.cond.3 = select i1 %cmp9.3, i1 true, i1 %cmp11.3 %min1.1.3 = select i1 %or.cond.3, i32 %min1.1.2, i32 %16 %indvars.iv.next48.3 = add nuw nsw i64 %indvars.iv47, 4 %niter62.next.3 = add i64 %niter62, 4 %niter62.ncmp.3 = icmp eq i64 %niter62.next.3, %unroll_iter61 br i1 %niter62.ncmp.3, label %for.end19.loopexit.unr-lcssa, label %for.body6, !llvm.loop !13 for.end19.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %min1.1.lcssa.ph = phi i32 [ undef, %for.body6.preheader ], [ %min1.1.3, %for.body6 ] %indvars.iv47.unr = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next48.3, %for.body6 ] %min1.044.unr = phi i32 [ 1000, %for.body6.preheader ], [ %min1.1.3, %for.body6 ] %lcmp.mod59.not = icmp eq i64 %xtraiter57, 0 br i1 %lcmp.mod59.not, label %for.end19, label %for.body6.epil for.body6.epil: ; preds = %for.end19.loopexit.unr-lcssa, %for.body6.epil %indvars.iv47.epil = phi i64 [ %indvars.iv.next48.epil, %for.body6.epil ], [ %indvars.iv47.unr, %for.end19.loopexit.unr-lcssa ] %min1.044.epil = phi i32 [ %min1.1.epil, %for.body6.epil ], [ %min1.044.unr, %for.end19.loopexit.unr-lcssa ] %epil.iter58 = phi i64 [ %epil.iter58.next, %for.body6.epil ], [ 0, %for.end19.loopexit.unr-lcssa ] %arrayidx8.epil = getelementptr inbounds i32, ptr %a, i64 %indvars.iv47.epil %17 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5 %cmp9.epil = icmp sle i32 %min1.044.epil, %17 %cmp11.epil = icmp eq i64 %indvars.iv47.epil, %3 %or.cond.epil = select i1 %cmp9.epil, i1 true, i1 %cmp11.epil %min1.1.epil = select i1 %or.cond.epil, i32 %min1.044.epil, i32 %17 %indvars.iv.next48.epil = add nuw nsw i64 %indvars.iv47.epil, 1 %epil.iter58.next = add i64 %epil.iter58, 1 %epil.iter58.cmp.not = icmp eq i64 %epil.iter58.next, %xtraiter57 br i1 %epil.iter58.cmp.not, label %for.end19, label %for.body6.epil, !llvm.loop !14 for.end19: ; preds = %for.end19.loopexit.unr-lcssa, %for.body6.epil, %entry, %for.cond4.preheader %min.0.lcssa54 = phi i32 [ %spec.select.lcssa, %for.cond4.preheader ], [ 1000, %entry ], [ %spec.select.lcssa, %for.body6.epil ], [ %spec.select.lcssa, %for.end19.loopexit.unr-lcssa ] %min1.0.lcssa = phi i32 [ 1000, %for.cond4.preheader ], [ 1000, %entry ], [ %min1.1.lcssa.ph, %for.end19.loopexit.unr-lcssa ], [ %min1.1.epil, %for.body6.epil ] %add = add nsw i32 %min1.0.lcssa, %min.0.lcssa54 ret i32 %add } ; 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 %m = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t) %0 = load i32, ptr %t, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %0, 0 br i1 %cmp54, label %for.body, label %for.end36 for.body: ; preds = %entry, %if.end33 %j.055 = phi i32 [ %inc35, %if.end33 ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %m) %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = zext i32 %1 to i64 %3 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %2, align 16 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp348 = icmp sgt i32 %4, 0 br i1 %cmp348, label %for.body4, label %if.end33 for.cond6.preheader: ; preds = %for.body4 %cmp750 = icmp sgt i32 %25, 0 br i1 %cmp750, label %for.body8.lr.ph, label %if.end33 for.body8.lr.ph: ; preds = %for.cond6.preheader %5 = load i32, ptr %m, align 4, !tbaa !5 %wide.trip.count.i = zext i32 %25 to i64 %xtraiter = and i64 %wide.trip.count.i, 3 %6 = icmp ult i32 %25, 4 %unroll_iter = and i64 %wide.trip.count.i, 4294967292 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 %xtraiter74 = and i64 %wide.trip.count.i, 3 %7 = icmp ult i32 %25, 4 %unroll_iter78 = and i64 %wide.trip.count.i, 4294967292 %lcmp.mod76.not = icmp eq i64 %xtraiter74, 0 br label %for.body8.us for.body8.us: ; preds = %for.inc15.us, %for.body8.lr.ph %indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.inc15.us ], [ 0, %for.body8.lr.ph ] %arrayidx10.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv58 %8 = load i32, ptr %arrayidx10.us, align 4, !tbaa !5 %cmp11.us = icmp sgt i32 %8, %5 br i1 %cmp11.us, label %for.body.i.us.preheader, label %for.inc15.us for.body.i.us.preheader: ; preds = %for.body8.us br i1 %6, label %for.body6.preheader.i.us.unr-lcssa, label %for.body.i.us for.body.i.us: ; preds = %for.body.i.us.preheader, %for.body.i.us %indvars.iv.i.us = phi i64 [ %indvars.iv.next.i.us.3, %for.body.i.us ], [ 0, %for.body.i.us.preheader ] %x.040.i.us = phi i32 [ %spec.select36.i.us.3, %for.body.i.us ], [ 0, %for.body.i.us.preheader ] %min.039.i.us = phi i32 [ %spec.select.i.us.3, %for.body.i.us ], [ 1000, %for.body.i.us.preheader ] %niter = phi i64 [ %niter.next.3, %for.body.i.us ], [ 0, %for.body.i.us.preheader ] %arrayidx.i.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i.us %9 = load i32, ptr %arrayidx.i.us, align 16, !tbaa !5 %cmp1.i.us = icmp sgt i32 %min.039.i.us, %9 %spec.select.i.us = call i32 @llvm.smin.i32(i32 %min.039.i.us, i32 %9) %10 = trunc i64 %indvars.iv.i.us to i32 %spec.select36.i.us = select i1 %cmp1.i.us, i32 %10, i32 %x.040.i.us %indvars.iv.next.i.us = or i64 %indvars.iv.i.us, 1 %arrayidx.i.us.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i.us %11 = load i32, ptr %arrayidx.i.us.1, align 4, !tbaa !5 %cmp1.i.us.1 = icmp sgt i32 %spec.select.i.us, %11 %spec.select.i.us.1 = call i32 @llvm.smin.i32(i32 %spec.select.i.us, i32 %11) %12 = trunc i64 %indvars.iv.next.i.us to i32 %spec.select36.i.us.1 = select i1 %cmp1.i.us.1, i32 %12, i32 %spec.select36.i.us %indvars.iv.next.i.us.1 = or i64 %indvars.iv.i.us, 2 %arrayidx.i.us.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i.us.1 %13 = load i32, ptr %arrayidx.i.us.2, align 8, !tbaa !5 %cmp1.i.us.2 = icmp sgt i32 %spec.select.i.us.1, %13 %spec.select.i.us.2 = call i32 @llvm.smin.i32(i32 %spec.select.i.us.1, i32 %13) %14 = trunc i64 %indvars.iv.next.i.us.1 to i32 %spec.select36.i.us.2 = select i1 %cmp1.i.us.2, i32 %14, i32 %spec.select36.i.us.1 %indvars.iv.next.i.us.2 = or i64 %indvars.iv.i.us, 3 %arrayidx.i.us.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next.i.us.2 %15 = load i32, ptr %arrayidx.i.us.3, align 4, !tbaa !5 %cmp1.i.us.3 = icmp sgt i32 %spec.select.i.us.2, %15 %spec.select.i.us.3 = call i32 @llvm.smin.i32(i32 %spec.select.i.us.2, i32 %15) %16 = trunc i64 %indvars.iv.next.i.us.2 to i32 %spec.select36.i.us.3 = select i1 %cmp1.i.us.3, i32 %16, i32 %spec.select36.i.us.2 %indvars.iv.next.i.us.3 = add nuw nsw i64 %indvars.iv.i.us, 4 %niter.next.3 = add i64 %niter, 4 %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter br i1 %niter.ncmp.3, label %for.body6.preheader.i.us.unr-lcssa, label %for.body.i.us, !llvm.loop !11 for.body6.preheader.i.us.unr-lcssa: ; preds = %for.body.i.us, %for.body.i.us.preheader %spec.select.i.us.lcssa.ph = phi i32 [ undef, %for.body.i.us.preheader ], [ %spec.select.i.us.3, %for.body.i.us ] %spec.select36.i.us.lcssa.ph = phi i32 [ undef, %for.body.i.us.preheader ], [ %spec.select36.i.us.3, %for.body.i.us ] %indvars.iv.i.us.unr = phi i64 [ 0, %for.body.i.us.preheader ], [ %indvars.iv.next.i.us.3, %for.body.i.us ] %x.040.i.us.unr = phi i32 [ 0, %for.body.i.us.preheader ], [ %spec.select36.i.us.3, %for.body.i.us ] %min.039.i.us.unr = phi i32 [ 1000, %for.body.i.us.preheader ], [ %spec.select.i.us.3, %for.body.i.us ] br i1 %lcmp.mod.not, label %for.body6.preheader.i.us, label %for.body.i.us.epil for.body.i.us.epil: ; preds = %for.body6.preheader.i.us.unr-lcssa, %for.body.i.us.epil %indvars.iv.i.us.epil = phi i64 [ %indvars.iv.next.i.us.epil, %for.body.i.us.epil ], [ %indvars.iv.i.us.unr, %for.body6.preheader.i.us.unr-lcssa ] %x.040.i.us.epil = phi i32 [ %spec.select36.i.us.epil, %for.body.i.us.epil ], [ %x.040.i.us.unr, %for.body6.preheader.i.us.unr-lcssa ] %min.039.i.us.epil = phi i32 [ %spec.select.i.us.epil, %for.body.i.us.epil ], [ %min.039.i.us.unr, %for.body6.preheader.i.us.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.i.us.epil ], [ 0, %for.body6.preheader.i.us.unr-lcssa ] %arrayidx.i.us.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.i.us.epil %17 = load i32, ptr %arrayidx.i.us.epil, align 4, !tbaa !5 %cmp1.i.us.epil = icmp sgt i32 %min.039.i.us.epil, %17 %spec.select.i.us.epil = call i32 @llvm.smin.i32(i32 %min.039.i.us.epil, i32 %17) %18 = trunc i64 %indvars.iv.i.us.epil to i32 %spec.select36.i.us.epil = select i1 %cmp1.i.us.epil, i32 %18, i32 %x.040.i.us.epil %indvars.iv.next.i.us.epil = add nuw nsw i64 %indvars.iv.i.us.epil, 1 %epil.iter.next = add i64 %epil.iter, 1 %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter br i1 %epil.iter.cmp.not, label %for.body6.preheader.i.us, label %for.body.i.us.epil, !llvm.loop !15 for.body6.preheader.i.us: ; preds = %for.body.i.us.epil, %for.body6.preheader.i.us.unr-lcssa %spec.select.i.us.lcssa = phi i32 [ %spec.select.i.us.lcssa.ph, %for.body6.preheader.i.us.unr-lcssa ], [ %spec.select.i.us.epil, %for.body.i.us.epil ] %spec.select36.i.us.lcssa = phi i32 [ %spec.select36.i.us.lcssa.ph, %for.body6.preheader.i.us.unr-lcssa ], [ %spec.select36.i.us.epil, %for.body.i.us.epil ] %19 = zext i32 %spec.select36.i.us.lcssa to i64 br i1 %7, label %swap.exit.loopexit.us.unr-lcssa, label %for.body6.i.us for.body6.i.us: ; preds = %for.body6.preheader.i.us, %for.body6.i.us %indvars.iv47.i.us = phi i64 [ %indvars.iv.next48.i.us.3, %for.body6.i.us ], [ 0, %for.body6.preheader.i.us ] %min1.044.i.us = phi i32 [ %min1.1.i.us.3, %for.body6.i.us ], [ 1000, %for.body6.preheader.i.us ] %niter79 = phi i64 [ %niter79.next.3, %for.body6.i.us ], [ 0, %for.body6.preheader.i.us ] %arrayidx8.i.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47.i.us %20 = load i32, ptr %arrayidx8.i.us, align 16, !tbaa !5 %cmp9.i.us = icmp sle i32 %min1.044.i.us, %20 %cmp11.i.us = icmp eq i64 %indvars.iv47.i.us, %19 %or.cond.i.us = select i1 %cmp9.i.us, i1 true, i1 %cmp11.i.us %min1.1.i.us = select i1 %or.cond.i.us, i32 %min1.044.i.us, i32 %20 %indvars.iv.next48.i.us = or i64 %indvars.iv47.i.us, 1 %arrayidx8.i.us.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next48.i.us %21 = load i32, ptr %arrayidx8.i.us.1, align 4, !tbaa !5 %cmp9.i.us.1 = icmp sle i32 %min1.1.i.us, %21 %cmp11.i.us.1 = icmp eq i64 %indvars.iv.next48.i.us, %19 %or.cond.i.us.1 = select i1 %cmp9.i.us.1, i1 true, i1 %cmp11.i.us.1 %min1.1.i.us.1 = select i1 %or.cond.i.us.1, i32 %min1.1.i.us, i32 %21 %indvars.iv.next48.i.us.1 = or i64 %indvars.iv47.i.us, 2 %arrayidx8.i.us.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next48.i.us.1 %22 = load i32, ptr %arrayidx8.i.us.2, align 8, !tbaa !5 %cmp9.i.us.2 = icmp sle i32 %min1.1.i.us.1, %22 %cmp11.i.us.2 = icmp eq i64 %indvars.iv.next48.i.us.1, %19 %or.cond.i.us.2 = select i1 %cmp9.i.us.2, i1 true, i1 %cmp11.i.us.2 %min1.1.i.us.2 = select i1 %or.cond.i.us.2, i32 %min1.1.i.us.1, i32 %22 %indvars.iv.next48.i.us.2 = or i64 %indvars.iv47.i.us, 3 %arrayidx8.i.us.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next48.i.us.2 %23 = load i32, ptr %arrayidx8.i.us.3, align 4, !tbaa !5 %cmp9.i.us.3 = icmp sle i32 %min1.1.i.us.2, %23 %cmp11.i.us.3 = icmp eq i64 %indvars.iv.next48.i.us.2, %19 %or.cond.i.us.3 = select i1 %cmp9.i.us.3, i1 true, i1 %cmp11.i.us.3 %min1.1.i.us.3 = select i1 %or.cond.i.us.3, i32 %min1.1.i.us.2, i32 %23 %indvars.iv.next48.i.us.3 = add nuw nsw i64 %indvars.iv47.i.us, 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 %swap.exit.loopexit.us.unr-lcssa, label %for.body6.i.us, !llvm.loop !13 for.inc15.us: ; preds = %swap.exit.loopexit.us, %for.body8.us %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1 %exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count.i br i1 %exitcond.not, label %for.cond18.preheader, label %for.body8.us, !llvm.loop !16 swap.exit.loopexit.us.unr-lcssa: ; preds = %for.body6.i.us, %for.body6.preheader.i.us %min1.1.i.us.lcssa.ph = phi i32 [ undef, %for.body6.preheader.i.us ], [ %min1.1.i.us.3, %for.body6.i.us ] %indvars.iv47.i.us.unr = phi i64 [ 0, %for.body6.preheader.i.us ], [ %indvars.iv.next48.i.us.3, %for.body6.i.us ] %min1.044.i.us.unr = phi i32 [ 1000, %for.body6.preheader.i.us ], [ %min1.1.i.us.3, %for.body6.i.us ] br i1 %lcmp.mod76.not, label %swap.exit.loopexit.us, label %for.body6.i.us.epil for.body6.i.us.epil: ; preds = %swap.exit.loopexit.us.unr-lcssa, %for.body6.i.us.epil %indvars.iv47.i.us.epil = phi i64 [ %indvars.iv.next48.i.us.epil, %for.body6.i.us.epil ], [ %indvars.iv47.i.us.unr, %swap.exit.loopexit.us.unr-lcssa ] %min1.044.i.us.epil = phi i32 [ %min1.1.i.us.epil, %for.body6.i.us.epil ], [ %min1.044.i.us.unr, %swap.exit.loopexit.us.unr-lcssa ] %epil.iter75 = phi i64 [ %epil.iter75.next, %for.body6.i.us.epil ], [ 0, %swap.exit.loopexit.us.unr-lcssa ] %arrayidx8.i.us.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47.i.us.epil %24 = load i32, ptr %arrayidx8.i.us.epil, align 4, !tbaa !5 %cmp9.i.us.epil = icmp sle i32 %min1.044.i.us.epil, %24 %cmp11.i.us.epil = icmp eq i64 %indvars.iv47.i.us.epil, %19 %or.cond.i.us.epil = select i1 %cmp9.i.us.epil, i1 true, i1 %cmp11.i.us.epil %min1.1.i.us.epil = select i1 %or.cond.i.us.epil, i32 %min1.044.i.us.epil, i32 %24 %indvars.iv.next48.i.us.epil = add nuw nsw i64 %indvars.iv47.i.us.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 %swap.exit.loopexit.us, label %for.body6.i.us.epil, !llvm.loop !17 swap.exit.loopexit.us: ; preds = %for.body6.i.us.epil, %swap.exit.loopexit.us.unr-lcssa %min1.1.i.us.lcssa = phi i32 [ %min1.1.i.us.lcssa.ph, %swap.exit.loopexit.us.unr-lcssa ], [ %min1.1.i.us.epil, %for.body6.i.us.epil ] %add.i.us = add nsw i32 %min1.1.i.us.lcssa, %spec.select.i.us.lcssa store i32 %add.i.us, ptr %arrayidx10.us, align 4, !tbaa !5 br label %for.inc15.us for.body4: ; preds = %for.body, %for.body4 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 0, %for.body ] %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %25 = load i32, ptr %n, align 4, !tbaa !5 %26 = sext i32 %25 to i64 %cmp3 = icmp slt i64 %indvars.iv.next, %26 br i1 %cmp3, label %for.body4, label %for.cond6.preheader, !llvm.loop !18 for.cond18.preheader: ; preds = %for.inc15.us br i1 %cmp750, label %for.body20.lr.ph, label %if.end33 for.body20.lr.ph: ; preds = %for.cond18.preheader %27 = load i32, ptr %m, align 4, !tbaa !5 %wide.trip.count64 = zext i32 %25 to i64 br label %for.body20 for.cond18: ; preds = %for.body20 %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1 %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64 br i1 %exitcond65.not, label %if.end33, label %for.body20, !llvm.loop !19 for.body20: ; preds = %for.body20.lr.ph, %for.cond18 %indvars.iv61 = phi i64 [ 0, %for.body20.lr.ph ], [ %indvars.iv.next62, %for.cond18 ] %arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv61 %28 = load i32, ptr %arrayidx22, align 4, !tbaa !5 %cmp23 = icmp sgt i32 %28, %27 br i1 %cmp23, label %if.end33, label %for.cond18 if.end33: ; preds = %for.cond18, %for.body20, %for.cond18.preheader, %for.cond6.preheader, %for.body %str.sink = phi ptr [ @str, %for.body ], [ @str, %for.cond6.preheader ], [ @str, %for.cond18.preheader ], [ @str.4, %for.body20 ], [ @str, %for.cond18 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.stackrestore.p0(ptr %3) %inc35 = add nuw nsw i32 %j.055, 1 %29 = load i32, ptr %t, align 4, !tbaa !5 %cmp = icmp slt i32 %inc35, %29 br i1 %cmp, label %for.body, label %for.end36, !llvm.loop !20 for.end36: ; preds = %if.end33, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #7 ret i32 0 } ; 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 declare void @llvm.stackrestore.p0(ptr) #4 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #6 attributes #0 = { nofree nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #5 = { nofree nounwind } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.unroll.disable"} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10} !16 = distinct !{!16, !12} !17 = distinct !{!17, !10} !18 = distinct !{!18, !12} !19 = distinct !{!19, !12} !20 = distinct !{!20, !12}
#include <stdio.h> #include <stdlib.h> int main(){ int X,N; scanf("%d",&X); scanf("%d",&N); int p[100]; for (int i=0; i<N; i++){ scanf("%d", p+i); } int l[100][2]; for (int i=0; i<100; i++){ l[i][0] = 0; l[i][1] = 0; } for (int i=0; i<N; i++){ if (p[i] == X){ l[0][0] = 1; l[0][1] = 1; }else if (p[i] < X){ l[abs(p[i] - X)][0] = 1; }else{ l[abs(p[i] - X)][1] = 1; } } for (int i=0; i<100; i++){ if (l[i][0] == 0){ printf("%d",X-i); return 0; } else if (l[i][1] == 0){ printf("%d",X+i); return 0; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295102/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295102/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %X = alloca i32, align 4 %N = alloca i32, align 4 %p = alloca [100 x i32], align 16 %l = alloca [100 x [2 x i32]], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #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 %X) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %p) #4 %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp93 = icmp sgt i32 %0, 0 br i1 %cmp93, label %for.body, label %for.cond.cleanup.thread for.cond.cleanup.thread: ; preds = %entry call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %l) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %l, i8 0, i64 800, i1 false), !tbaa !5 br label %for.body51.preheader for.cond.cleanup: ; preds = %for.body call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %l) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %l, i8 0, i64 800, i1 false), !tbaa !5 %cmp1796 = icmp sgt i32 %1, 0 br i1 %cmp1796, label %for.body19.lr.ph, label %for.body51.preheader for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %add.ptr = getelementptr inbounds i32, ptr %p, 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 %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.cond.cleanup, !llvm.loop !9 for.body19.lr.ph: ; preds = %for.cond.cleanup %3 = load i32, ptr %X, align 4, !tbaa !5 %arrayidx26 = getelementptr inbounds [2 x i32], ptr %l, i64 0, i64 1 %wide.trip.count = zext i32 %1 to i64 br label %for.body19 for.body19: ; preds = %for.body19.lr.ph, %for.inc44 %indvars.iv106 = phi i64 [ 0, %for.body19.lr.ph ], [ %indvars.iv.next107, %for.inc44 ] %arrayidx21 = getelementptr inbounds [100 x i32], ptr %p, i64 0, i64 %indvars.iv106 %4 = load i32, ptr %arrayidx21, align 4, !tbaa !5 %cmp22 = icmp eq i32 %4, %3 br i1 %cmp22, label %if.then, label %if.else if.then: ; preds = %for.body19 store i32 1, ptr %l, align 16, !tbaa !5 store i32 1, ptr %arrayidx26, align 4, !tbaa !5 br label %for.inc44 if.else: ; preds = %for.body19 %cmp29 = icmp slt i32 %4, %3 br i1 %cmp29, label %if.then30, label %if.else36 if.then30: ; preds = %if.else %sub.neg = sub nsw i32 %3, %4 %idxprom33 = zext i32 %sub.neg to i64 %arrayidx34 = getelementptr inbounds [100 x [2 x i32]], ptr %l, i64 0, i64 %idxprom33 store i32 1, ptr %arrayidx34, align 8, !tbaa !5 br label %for.inc44 if.else36: ; preds = %if.else %sub39 = sub nsw i32 %4, %3 %idxprom40 = zext i32 %sub39 to i64 %arrayidx42 = getelementptr inbounds [100 x [2 x i32]], ptr %l, i64 0, i64 %idxprom40, i64 1 store i32 1, ptr %arrayidx42, align 4, !tbaa !5 br label %for.inc44 for.inc44: ; preds = %if.then, %if.else36, %if.then30 %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1 %exitcond.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count br i1 %exitcond.not, label %for.body51.preheader, label %for.body19, !llvm.loop !11 for.body51.preheader: ; preds = %for.inc44, %for.cond.cleanup.thread, %for.cond.cleanup br label %for.body51 for.body51: ; preds = %for.inc68.1, %for.body51.preheader %indvars.iv109 = phi i64 [ 0, %for.body51.preheader ], [ %indvars.iv.next110.1, %for.inc68.1 ] %arrayidx53 = getelementptr inbounds [100 x [2 x i32]], ptr %l, i64 0, i64 %indvars.iv109 %5 = load i32, ptr %arrayidx53, align 16, !tbaa !5 %cmp55 = icmp eq i32 %5, 0 br i1 %cmp55, label %if.then56, label %if.else59 if.then56: ; preds = %for.inc68, %for.body51 %indvars.iv109.lcssa = phi i64 [ %indvars.iv109, %for.body51 ], [ %indvars.iv.next110, %for.inc68 ] %6 = trunc i64 %indvars.iv109.lcssa to i32 %7 = load i32, ptr %X, align 4, !tbaa !5 %sub57 = sub nsw i32 %7, %6 br label %cleanup71.sink.split if.else59: ; preds = %for.body51 %arrayidx62 = getelementptr inbounds [100 x [2 x i32]], ptr %l, i64 0, i64 %indvars.iv109, i64 1 %8 = load i32, ptr %arrayidx62, align 4, !tbaa !5 %cmp63 = icmp eq i32 %8, 0 br i1 %cmp63, label %if.then64, label %for.inc68 if.then64: ; preds = %if.else59.1, %if.else59 %indvars.iv109.lcssa119 = phi i64 [ %indvars.iv109, %if.else59 ], [ %indvars.iv.next110, %if.else59.1 ] %9 = trunc i64 %indvars.iv109.lcssa119 to i32 %10 = load i32, ptr %X, align 4, !tbaa !5 %add = add nsw i32 %10, %9 br label %cleanup71.sink.split for.inc68: ; preds = %if.else59 %indvars.iv.next110 = or i64 %indvars.iv109, 1 %arrayidx53.1 = getelementptr inbounds [100 x [2 x i32]], ptr %l, i64 0, i64 %indvars.iv.next110 %11 = load i32, ptr %arrayidx53.1, align 8, !tbaa !5 %cmp55.1 = icmp eq i32 %11, 0 br i1 %cmp55.1, label %if.then56, label %if.else59.1 if.else59.1: ; preds = %for.inc68 %arrayidx62.1 = getelementptr inbounds [100 x [2 x i32]], ptr %l, i64 0, i64 %indvars.iv.next110, i64 1 %12 = load i32, ptr %arrayidx62.1, align 4, !tbaa !5 %cmp63.1 = icmp eq i32 %12, 0 br i1 %cmp63.1, label %if.then64, label %for.inc68.1 for.inc68.1: ; preds = %if.else59.1 %indvars.iv.next110.1 = add nuw nsw i64 %indvars.iv109, 2 %exitcond112.1 = icmp eq i64 %indvars.iv.next110.1, 100 br i1 %exitcond112.1, label %cleanup71, label %for.body51, !llvm.loop !12 cleanup71.sink.split: ; preds = %if.then64, %if.then56 %sub57.sink = phi i32 [ %sub57, %if.then56 ], [ %add, %if.then64 ] %call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub57.sink) br label %cleanup71 cleanup71: ; preds = %for.inc68.1, %cleanup71.sink.split call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %l) #4 call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> #include <stdlib.h> int main(void){ int x,n; scanf("%d %d",&x,&n); int p[101]={0}; for(int i=1;i<=n;i++){ scanf("%d",&p[i]); } int tmp; for (int i=1; i<=n; ++i) { for (int j=i+1; j<=n; ++j) { if (p[i] > p[j]) { tmp = p[i]; p[i] = p[j]; p[j] = tmp; } } } for (int i=1; i<=n; i++) { if(x<p[i]){ printf("%d",x); return 0; } if(x==p[i]){ for(int j=1;j<i;j++){ if(p[i-j]!=x-j){ printf("%d",x-j); return 0; } if(p[i+j]!=x+j){ printf("%d",x+j); return 0; } } printf("%d",x-i); return 0; } } printf("%d",x); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295146/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295146/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %x = alloca i32, align 4 %n = alloca i32, align 4 %p = alloca [101 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #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 %x, ptr noundef nonnull %n) call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %p) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) %p, i8 0, i64 404, i1 false) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not118 = icmp slt i32 %0, 1 br i1 %cmp.not118, label %for.cond31.preheader.thread, label %for.body for.cond3.preheader: ; preds = %for.body %cmp4.not122 = icmp slt i32 %4, 1 br i1 %cmp4.not122, label %for.cond31.preheader.thread, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond3.preheader %1 = add nuw i32 %4, 1 %2 = zext i32 %4 to i64 %wide.trip.count = zext i32 %1 to i64 %3 = add i32 %4, -2 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [101 x i32], ptr %p, 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 %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %5 br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !9 for.cond3.loopexit: ; preds = %for.body10.prol.loopexit, %for.inc24.1, %for.body6 %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1 %exitcond142.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count %indvar.next = add i32 %indvar, 1 br i1 %exitcond142.not, label %for.cond31.preheader, label %for.body6, !llvm.loop !11 for.cond31.preheader.thread: ; preds = %for.cond3.preheader, %entry %.pre167 = load i32, ptr %x, align 4, !tbaa !5 br label %cleanup79 for.cond31.preheader: ; preds = %for.cond3.loopexit %.pre = load i32, ptr %x, align 4, !tbaa !5 br i1 %cmp4.not122, label %cleanup79, label %for.body34.lr.ph for.body34.lr.ph: ; preds = %for.cond31.preheader %6 = add nuw i32 %4, 1 %wide.trip.count146 = zext i32 %6 to i64 br label %for.body34 for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit %indvar = phi i32 [ 0, %for.body6.preheader ], [ %indvar.next, %for.cond3.loopexit ] %indvars.iv139 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next140, %for.cond3.loopexit ] %indvars.iv134 = phi i64 [ 2, %for.body6.preheader ], [ %indvars.iv.next135, %for.cond3.loopexit ] %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1 %cmp8.not120.not = icmp ult i64 %indvars.iv139, %2 br i1 %cmp8.not120.not, label %for.body10.lr.ph, label %for.cond3.loopexit for.body10.lr.ph: ; preds = %for.body6 %7 = xor i32 %indvar, -1 %8 = add i32 %4, %7 %arrayidx12 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv139 %xtraiter = and i32 %8, 1 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body10.prol.loopexit, label %for.body10.prol for.body10.prol: ; preds = %for.body10.lr.ph %9 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %arrayidx14.prol = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv134 %10 = load i32, ptr %arrayidx14.prol, align 4, !tbaa !5 %cmp15.prol = icmp sgt i32 %9, %10 br i1 %cmp15.prol, label %if.then.prol, label %for.inc24.prol if.then.prol: ; preds = %for.body10.prol store i32 %10, ptr %arrayidx12, align 4, !tbaa !5 store i32 %9, ptr %arrayidx14.prol, align 4, !tbaa !5 br label %for.inc24.prol for.inc24.prol: ; preds = %if.then.prol, %for.body10.prol %indvars.iv.next137.prol = add nuw nsw i64 %indvars.iv134, 1 br label %for.body10.prol.loopexit for.body10.prol.loopexit: ; preds = %for.inc24.prol, %for.body10.lr.ph %indvars.iv136.unr = phi i64 [ %indvars.iv134, %for.body10.lr.ph ], [ %indvars.iv.next137.prol, %for.inc24.prol ] %11 = icmp eq i32 %3, %indvar br i1 %11, label %for.cond3.loopexit, label %for.body10 for.body10: ; preds = %for.body10.prol.loopexit, %for.inc24.1 %indvars.iv136 = phi i64 [ %indvars.iv.next137.1, %for.inc24.1 ], [ %indvars.iv136.unr, %for.body10.prol.loopexit ] %12 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %arrayidx14 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv136 %13 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %cmp15 = icmp sgt i32 %12, %13 br i1 %cmp15, label %if.then, label %for.inc24 if.then: ; preds = %for.body10 store i32 %13, ptr %arrayidx12, align 4, !tbaa !5 store i32 %12, ptr %arrayidx14, align 4, !tbaa !5 br label %for.inc24 for.inc24: ; preds = %for.body10, %if.then %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1 %14 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %arrayidx14.1 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv.next137 %15 = load i32, ptr %arrayidx14.1, align 4, !tbaa !5 %cmp15.1 = icmp sgt i32 %14, %15 br i1 %cmp15.1, label %if.then.1, label %for.inc24.1 if.then.1: ; preds = %for.inc24 store i32 %15, ptr %arrayidx12, align 4, !tbaa !5 store i32 %14, ptr %arrayidx14.1, align 4, !tbaa !5 br label %for.inc24.1 for.inc24.1: ; preds = %if.then.1, %for.inc24 %indvars.iv.next137.1 = add nuw nsw i64 %indvars.iv136, 2 %lftr.wideiv.1 = trunc i64 %indvars.iv.next137.1 to i32 %exitcond.not.1 = icmp eq i32 %1, %lftr.wideiv.1 br i1 %exitcond.not.1, label %for.cond3.loopexit, label %for.body10, !llvm.loop !12 for.body34: ; preds = %for.body34.lr.ph, %for.inc73 %indvars.iv155 = phi i32 [ 1, %for.body34.lr.ph ], [ %indvars.iv.next156, %for.inc73 ] %indvars.iv143 = phi i64 [ 1, %for.body34.lr.ph ], [ %indvars.iv.next144, %for.inc73 ] %arrayidx36 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %indvars.iv143 %16 = load i32, ptr %arrayidx36, align 4, !tbaa !5 %cmp37 = icmp slt i32 %.pre, %16 br i1 %cmp37, label %cleanup79, label %if.end40 if.end40: ; preds = %for.body34 %cmp43 = icmp eq i32 %.pre, %16 br i1 %cmp43, label %for.cond46.preheader, label %for.inc73 for.cond46.preheader: ; preds = %if.end40 %17 = trunc i64 %indvars.iv143 to i32 %cmp47.not126 = icmp ugt i32 %17, 1 br i1 %cmp47.not126, label %for.body49.preheader, label %for.end69 for.body49.preheader: ; preds = %for.cond46.preheader %sext = shl i64 %indvars.iv143, 32 %18 = ashr exact i64 %sext, 32 %wide.trip.count159 = zext i32 %indvars.iv155 to i64 br label %for.body49 for.cond46: ; preds = %if.end57 %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1 %exitcond160.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count159 br i1 %exitcond160.not, label %for.end69, label %for.body49, !llvm.loop !13 for.body49: ; preds = %for.body49.preheader, %for.cond46 %indvars.iv148 = phi i64 [ 1, %for.body49.preheader ], [ %indvars.iv.next149, %for.cond46 ] %19 = sub nsw i64 %18, %indvars.iv148 %arrayidx51 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %19 %20 = load i32, ptr %arrayidx51, align 4, !tbaa !5 %21 = trunc i64 %indvars.iv148 to i32 %22 = sub i32 %.pre, %21 %cmp53.not = icmp eq i32 %20, %22 br i1 %cmp53.not, label %if.end57, label %cleanup79 if.end57: ; preds = %for.body49 %23 = add nuw i64 %indvars.iv148, %indvars.iv143 %idxprom59 = and i64 %23, 4294967295 %arrayidx60 = getelementptr inbounds [101 x i32], ptr %p, i64 0, i64 %idxprom59 %24 = load i32, ptr %arrayidx60, align 4, !tbaa !5 %25 = trunc i64 %indvars.iv148 to i32 %26 = add i32 %.pre, %25 %cmp62.not = icmp eq i32 %24, %26 br i1 %cmp62.not, label %for.cond46, label %cleanup79 for.end69: ; preds = %for.cond46, %for.cond46.preheader %sub70 = sub nsw i32 %.pre, %17 br label %cleanup79 for.inc73: ; preds = %if.end40 %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1 %exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count146 %indvars.iv.next156 = add nuw i32 %indvars.iv155, 1 br i1 %exitcond147.not, label %cleanup79, label %for.body34, !llvm.loop !14 cleanup79: ; preds = %for.inc73, %for.body34, %if.end57, %for.body49, %for.cond31.preheader, %for.cond31.preheader.thread, %for.end69 %.pre.sink = phi i32 [ %sub70, %for.end69 ], [ %.pre167, %for.cond31.preheader.thread ], [ %.pre, %for.cond31.preheader ], [ %22, %for.body49 ], [ %26, %if.end57 ], [ %.pre, %for.body34 ], [ %.pre, %for.inc73 ] %call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.pre.sink) call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10}
#include <stdio.h> int a,b,K; int main() { scanf("%d%d%d",&K,&a,&b); if(a>=K && b>=K) printf("%d",a/K+b/K); else if(a>=K && b<K) printf("%d",a%K ? -1 : a/K); else if(a<K && b>=K) printf("%d",b%K ? -1 : b/K); else printf("-1"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29519/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29519/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @K = dso_local global i32 0, align 4 @a = dso_local global i32 0, align 4 @b = dso_local global i32 0, align 4 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @K, ptr noundef nonnull @a, ptr noundef nonnull @b) %0 = load i32, ptr @a, align 4, !tbaa !5 %1 = load i32, ptr @K, align 4, !tbaa !5 %cmp.not = icmp slt i32 %0, %1 %2 = load i32, ptr @b, align 4 %cmp6 = icmp slt i32 %2, %1 br i1 %cmp.not, label %land.lhs.true12, label %land.lhs.true land.lhs.true: ; preds = %entry br i1 %cmp6, label %if.then7, label %if.then if.then: ; preds = %land.lhs.true %div = sdiv i32 %0, %1 %div2 = sdiv i32 %2, %1 %add = add nsw i32 %div2, %div %call3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) br label %if.end26 if.then7: ; preds = %land.lhs.true %rem = srem i32 %0, %1 %div8 = sdiv i32 %0, %1 %tobool.not = icmp eq i32 %rem, 0 %spec.select = select i1 %tobool.not, i32 %div8, i32 -1 %call9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select) br label %if.end26 land.lhs.true12: ; preds = %entry br i1 %cmp6, label %if.else23, label %if.then14 if.then14: ; preds = %land.lhs.true12 %rem15 = srem i32 %2, %1 %div19 = sdiv i32 %2, %1 %tobool16.not = icmp eq i32 %rem15, 0 %spec.select38 = select i1 %tobool16.not, i32 %div19, i32 -1 %call22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select38) br label %if.end26 if.else23: ; preds = %land.lhs.true12 %call24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2) br label %if.end26 if.end26: ; preds = %if.then7, %if.else23, %if.then14, %if.then ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(){ int n; int f[100001]; int e[100001]; int c[100001]; int i; int cnt=0; scanf("%d", &n); for(i=1;i<=n;++i){ scanf("%d", &f[i]); e[i] = 0; } for(i=1;i<=n;++i){ if(f[f[i]] != f[i]){ printf("-1\n"); return 0; } if(!e[f[i]]){ e[f[i]] = ++cnt; c[cnt] = f[i]; } } printf("%d\n", cnt); for(i=1;i<n;++i){ printf("%d ", e[f[i]]); } printf("%d\n", e[f[n]]); for(i=1;i<cnt;++i){ printf("%d ", c[i]); } printf("%d\n", c[cnt]); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29524/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29524/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d \00", align 1 @str = private unnamed_addr constant [3 x i8] c"-1\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %f = alloca [100001 x i32], align 16 %e = alloca [100001 x i32], align 16 %c = alloca [100001 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %f) #4 call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %e) #4 call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %c) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not89 = icmp slt i32 %0, 1 br i1 %cmp.not89, label %for.end32, label %for.body for.cond4.preheader: ; preds = %for.body %cmp5.not91 = icmp slt i32 %2, 1 br i1 %cmp5.not91, label %for.end32, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond4.preheader %1 = add nuw i32 %2, 1 %wide.trip.count = zext i32 %1 to i64 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ] %arrayidx = getelementptr inbounds [100001 x i32], ptr %f, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %arrayidx3 = getelementptr inbounds [100001 x i32], ptr %e, i64 0, i64 %indvars.iv store i32 0, ptr %arrayidx3, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, label %for.body, label %for.cond4.preheader, !llvm.loop !9 for.body6: ; preds = %for.body6.preheader, %for.inc30 %indvars.iv103 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next104, %for.inc30 ] %cnt.093 = phi i32 [ 0, %for.body6.preheader ], [ %cnt.1, %for.inc30 ] %arrayidx8 = getelementptr inbounds [100001 x i32], ptr %f, i64 0, i64 %indvars.iv103 %4 = load i32, ptr %arrayidx8, align 4, !tbaa !5 %idxprom9 = sext i32 %4 to i64 %arrayidx10 = getelementptr inbounds [100001 x i32], ptr %f, i64 0, i64 %idxprom9 %5 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %cmp13.not = icmp eq i32 %5, %4 br i1 %cmp13.not, label %if.end, label %if.then if.then: ; preds = %for.body6 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup if.end: ; preds = %for.body6 %arrayidx18 = getelementptr inbounds [100001 x i32], ptr %e, i64 0, i64 %idxprom9 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %tobool.not = icmp eq i32 %6, 0 br i1 %tobool.not, label %if.then19, label %for.inc30 if.then19: ; preds = %if.end %inc20 = add nsw i32 %cnt.093, 1 store i32 %inc20, ptr %arrayidx18, align 4, !tbaa !5 %idxprom27 = sext i32 %inc20 to i64 %arrayidx28 = getelementptr inbounds [100001 x i32], ptr %c, i64 0, i64 %idxprom27 store i32 %4, ptr %arrayidx28, align 4, !tbaa !5 br label %for.inc30 for.inc30: ; preds = %if.end, %if.then19 %cnt.1 = phi i32 [ %cnt.093, %if.end ], [ %inc20, %if.then19 ] %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1 %exitcond.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count br i1 %exitcond.not, label %for.end32, label %for.body6, !llvm.loop !11 for.end32: ; preds = %for.inc30, %entry, %for.cond4.preheader %cnt.0.lcssa = phi i32 [ 0, %for.cond4.preheader ], [ 0, %entry ], [ %cnt.1, %for.inc30 ] %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa) %7 = load i32, ptr %n, align 4, !tbaa !5 %cmp3595 = icmp sgt i32 %7, 1 br i1 %cmp3595, label %for.body36, label %for.end32.for.end44_crit_edge for.end32.for.end44_crit_edge: ; preds = %for.end32 %.pre = sext i32 %7 to i64 br label %for.end44 for.body36: ; preds = %for.end32, %for.body36 %indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.body36 ], [ 1, %for.end32 ] %arrayidx38 = getelementptr inbounds [100001 x i32], ptr %f, i64 0, i64 %indvars.iv106 %8 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %idxprom39 = sext i32 %8 to i64 %arrayidx40 = getelementptr inbounds [100001 x i32], ptr %e, i64 0, i64 %idxprom39 %9 = load i32, ptr %arrayidx40, align 4, !tbaa !5 %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %9) %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1 %10 = load i32, ptr %n, align 4, !tbaa !5 %11 = sext i32 %10 to i64 %cmp35 = icmp slt i64 %indvars.iv.next107, %11 br i1 %cmp35, label %for.body36, label %for.end44, !llvm.loop !12 for.end44: ; preds = %for.body36, %for.end32.for.end44_crit_edge %idxprom45.pre-phi = phi i64 [ %.pre, %for.end32.for.end44_crit_edge ], [ %11, %for.body36 ] %arrayidx46 = getelementptr inbounds [100001 x i32], ptr %f, i64 0, i64 %idxprom45.pre-phi %12 = load i32, ptr %arrayidx46, align 4, !tbaa !5 %idxprom47 = sext i32 %12 to i64 %arrayidx48 = getelementptr inbounds [100001 x i32], ptr %e, i64 0, i64 %idxprom47 %13 = load i32, ptr %arrayidx48, align 4, !tbaa !5 %call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13) %cmp5198 = icmp sgt i32 %cnt.0.lcssa, 1 br i1 %cmp5198, label %for.body52.preheader, label %for.end58 for.body52.preheader: ; preds = %for.end44 %wide.trip.count112 = zext i32 %cnt.0.lcssa to i64 br label %for.body52 for.body52: ; preds = %for.body52.preheader, %for.body52 %indvars.iv109 = phi i64 [ 1, %for.body52.preheader ], [ %indvars.iv.next110, %for.body52 ] %arrayidx54 = getelementptr inbounds [100001 x i32], ptr %c, i64 0, i64 %indvars.iv109 %14 = load i32, ptr %arrayidx54, align 4, !tbaa !5 %call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %14) %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1 %exitcond113.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count112 br i1 %exitcond113.not, label %for.end58, label %for.body52, !llvm.loop !13 for.end58: ; preds = %for.body52, %for.end44 %idxprom59 = sext i32 %cnt.0.lcssa to i64 %arrayidx60 = getelementptr inbounds [100001 x i32], ptr %c, i64 0, i64 %idxprom59 %15 = load i32, ptr %arrayidx60, align 4, !tbaa !5 %call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %15) br label %cleanup cleanup: ; preds = %for.end58, %if.then call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %c) #4 call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %e) #4 call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %f) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @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){ long int n,k,ans; scanf("%ld %ld",&n,&k); long int nk=n%k; long int k_nk=k-(n%k); if(nk<=k_nk){ ans=nk; }else{ ans=k_nk; } printf("%ld",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295283/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295283/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %n, align 8, !tbaa !5 %1 = load i64, ptr %k, align 8, !tbaa !5 %rem = srem i64 %0, %1 %sub = sub nsw i64 %1, %rem %sub.rem = call i64 @llvm.smin.i64(i64 %rem, i64 %sub) %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub.rem) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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.smin.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 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> int main(void){ long n,k,min; scanf("%ld %ld", &n,&k); n%=k; min=n; while(1){ n-=k; if(n<0){ n*=-1; } /*nを正にする*/ if(n<min){ min=n; } else{ break; } } printf("%ld\n",min); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295333/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295333/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %k, align 8, !tbaa !5 %1 = load i64, ptr %n, align 8, !tbaa !5 %rem = srem i64 %1, %0 br label %while.cond while.cond: ; preds = %while.cond, %entry %min.0 = phi i64 [ %rem, %entry ], [ %spec.select, %while.cond ] %sub = sub nsw i64 %min.0, %0 %spec.select = call i64 @llvm.abs.i64(i64 %sub, i1 true) %cmp1 = icmp slt i64 %spec.select, %min.0 br i1 %cmp1, label %while.cond, label %while.end while.end: ; preds = %while.cond store i64 %spec.select, ptr %n, align 8, !tbaa !5 %call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %min.0) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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.abs.i64(i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree 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 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> int main(void) { long int a, b; long int check = 0; scanf("%ld %ld", &a, &b); a = a % b; for (;;) { check = a - b; if (check < 0) { check = check * (-1); } if (a > check) { a = check; } else { printf("%ld", a); break; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295384/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295384/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b) %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %rem = srem i64 %0, %1 br label %for.cond for.cond: ; preds = %for.cond, %entry %storemerge = phi i64 [ %rem, %entry ], [ %spec.select, %for.cond ] %sub = sub nsw i64 %storemerge, %1 %spec.select = call i64 @llvm.abs.i64(i64 %sub, i1 true) %cmp1 = icmp sgt i64 %storemerge, %spec.select br i1 %cmp1, label %for.cond, label %if.else if.else: ; preds = %for.cond store i64 %storemerge, ptr %a, align 8, !tbaa !5 %call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %storemerge) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree 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 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> int main(void) { long long int i,j,n,k; scanf("%lld%lld",&n,&k); i=n%k; if(k-i<0){ if(i-k>i) printf("%lld",i); else printf("%lld",i-k); } else{ if(k-i>i) printf("%lld",i); else printf("%lld",k-i); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295434/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295434/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i64, ptr %n, align 8, !tbaa !5 %1 = load i64, ptr %k, align 8, !tbaa !5 %rem = srem i64 %0, %1 %sub = sub nsw i64 %1, %rem %cmp = icmp slt i64 %sub, 0 br i1 %cmp, label %if.then, label %if.else7 if.then: ; preds = %entry %sub1 = call i64 @llvm.smax.i64(i64 %1, i64 0) %spec.select = sub nsw i64 %rem, %sub1 br label %if.end16 if.else7: ; preds = %entry %rem.sub = call i64 @llvm.smin.i64(i64 %sub, i64 %rem) br label %if.end16 if.end16: ; preds = %if.then, %if.else7 %rem.sink = phi i64 [ %rem.sub, %if.else7 ], [ %spec.select, %if.then ] %call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %rem.sink) call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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.smin.i64(i64, i64) #3 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <malloc.h> #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> //abc140D int main(void) { int n, i=0, k, c=0; char sx; scanf("%d %d", &n, &k); int s[n]; for(i=0; i < n; i++){ scanf(" %c", &sx); if(sx == 'L') s[i]=0; else s[i]=2; } for(i=0; i < n; i++){ //s: 0 LUnhappy,1 LHappy,2 RU,3 RH if(s[i] == 0 && i != 0 && s[i - 1] <= 1) c++; else if(s[i] == 2 && i != n - 1 && s[i + 1] >= 2) c++; } if(c + 2 * k < n) printf("%d", c + 2 * k); else printf("%d", n - 1); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295485/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295485/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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" %c\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 %k = alloca i32, align 4 %sx = alloca i8, align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %sx) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %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 %cmp72 = icmp sgt i32 %3, 0 br i1 %cmp72, label %for.body, label %for.end43 for.cond6.preheader: ; preds = %for.body %cmp774 = icmp sgt i32 %7, 0 br i1 %cmp774, label %for.body9.lr.ph, label %for.end43 for.body9.lr.ph: ; preds = %for.cond6.preheader %sub29 = add nsw i32 %7, -1 %4 = zext i32 %sub29 to i64 %wide.trip.count = zext i32 %7 to i64 %invariant.gep = getelementptr i32, ptr %vla, i64 1 %invariant.gep88 = getelementptr i32, ptr %vla, i64 -1 br label %for.body9 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %sx) %5 = load i8, ptr %sx, align 1, !tbaa !9 %cmp2 = icmp eq i8 %5, 76 %spec.select90 = select i1 %cmp2, i32 0, i32 2 %6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv store i32 %spec.select90, ptr %6, align 4 %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.cond6.preheader, !llvm.loop !10 for.body9: ; preds = %for.body9.lr.ph, %for.inc41 %indvars.iv80 = phi i64 [ 0, %for.body9.lr.ph ], [ %indvars.iv.next81, %for.inc41 ] %c.075 = phi i32 [ 0, %for.body9.lr.ph ], [ %c.1, %for.inc41 ] %arrayidx11 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv80 %9 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %cmp12 = icmp eq i32 %9, 0 %cmp14 = icmp ne i64 %indvars.iv80, 0 %or.cond = and i1 %cmp14, %cmp12 br i1 %or.cond, label %land.lhs.true16, label %if.else23 land.lhs.true16: ; preds = %for.body9 %gep89 = getelementptr i32, ptr %invariant.gep88, i64 %indvars.iv80 %10 = load i32, ptr %gep89, align 4, !tbaa !5 %cmp19 = icmp slt i32 %10, 2 %inc22 = zext i1 %cmp19 to i32 %spec.select70 = add nsw i32 %c.075, %inc22 br label %for.inc41 if.else23: ; preds = %for.body9 %cmp26 = icmp ne i32 %9, 2 %cmp30.not = icmp eq i64 %indvars.iv80, %4 %or.cond71 = select i1 %cmp26, i1 true, i1 %cmp30.not br i1 %or.cond71, label %for.inc41, label %land.lhs.true32 land.lhs.true32: ; preds = %if.else23 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv80 %11 = load i32, ptr %gep, align 4, !tbaa !5 %cmp35 = icmp sgt i32 %11, 1 %inc38 = zext i1 %cmp35 to i32 %spec.select = add nsw i32 %c.075, %inc38 br label %for.inc41 for.inc41: ; preds = %land.lhs.true16, %land.lhs.true32, %if.else23 %c.1 = phi i32 [ %c.075, %if.else23 ], [ %spec.select, %land.lhs.true32 ], [ %spec.select70, %land.lhs.true16 ] %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count br i1 %exitcond.not, label %for.end43, label %for.body9, !llvm.loop !12 for.end43: ; preds = %for.inc41, %entry, %for.cond6.preheader %.lcssa87 = phi i32 [ %7, %for.cond6.preheader ], [ %3, %entry ], [ %7, %for.inc41 ] %c.0.lcssa = phi i32 [ 0, %for.cond6.preheader ], [ 0, %entry ], [ %c.1, %for.inc41 ] %12 = load i32, ptr %k, align 4, !tbaa !5 %mul = shl nsw i32 %12, 1 %add44 = add nsw i32 %mul, %c.0.lcssa %cmp45 = icmp slt i32 %add44, %.lcssa87 %sub52 = add nsw i32 %.lcssa87, -1 %sub52.sink = select i1 %cmp45, i32 %add44, i32 %sub52 %call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub52.sink) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %sx) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11}
#include <stdio.h> char s[100001]; void swap(int l, int r) { char c,d; while (l<=r) { if (s[l]=='L') c='R'; else c='L'; if (s[r]=='L') d='R'; else d='L'; s[l]=d; s[r]=c; l++;r--; } } int main(){ int n,k,i,j,l,a; scanf("%d %d",&n,&k); scanf("%s",s); for (j=i=0;i<k;i++) { for (;j<n-2;j++) if (s[j]=='L' && s[j+1]=='R') { for (l=j+1;l<n-1;l++) if (s[l]=='R' && s[l+1]=='L') break; if (l==n-1) continue; swap(j+1,l); break; } else if (s[j]=='R' && s[j+1]=='L') { for (l=j+1;l<n-1;l++) if (s[l]=='L' && s[l+1]=='R') break; if (l==n-1) continue; swap(j+1,l); break; } if (j==n-2) break; } if (i<k) { for (i=1;i<n;i++) if (s[0]!=s[i]) break; if (i<n) { j=i; for (;i<n;i++) if (s[0]==s[i]) break; if (i==n) swap(j,n-1); } } for (a=i=0;i<n;i++) if (s[i]=='L' && i>0 && s[i-1]=='L') a++; else if (s[i]=='R' && i<n-1 && s[i+1]=='R') a++; printf("%d",a); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295528/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295528/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @s = dso_local global [100001 x i8] zeroinitializer, align 16 @.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @swap(i32 noundef %l, i32 noundef %r) local_unnamed_addr #0 { entry: %cmp.not21 = icmp sgt i32 %l, %r br i1 %cmp.not21, label %while.end, label %while.body.preheader while.body.preheader: ; preds = %entry %0 = sext i32 %r to i64 %1 = sext i32 %l to i64 br label %while.body while.body: ; preds = %while.body.preheader, %while.body %indvars.iv24 = phi i64 [ %1, %while.body.preheader ], [ %indvars.iv.next25, %while.body ] %indvars.iv = phi i64 [ %0, %while.body.preheader ], [ %indvars.iv.next, %while.body ] %arrayidx = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv24 %2 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp1 = icmp eq i8 %2, 76 %. = select i1 %cmp1, i8 82, i8 76 %arrayidx4 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv %3 = load i8, ptr %arrayidx4, align 1, !tbaa !5 %cmp6 = icmp eq i8 %3, 76 %d.0 = select i1 %cmp6, i8 82, i8 76 store i8 %d.0, ptr %arrayidx, align 1, !tbaa !5 store i8 %., ptr %arrayidx4, align 1, !tbaa !5 %indvars.iv.next25 = add nsw i64 %indvars.iv24, 1 %indvars.iv.next = add nsw i64 %indvars.iv, -1 %cmp.not.not = icmp slt i64 %indvars.iv24, %indvars.iv.next br i1 %cmp.not.not, label %while.body, label %while.end, !llvm.loop !8 while.end: ; preds = %while.body, %entry ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #2 { entry: %n = alloca i32, align 4 %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, ptr noundef nonnull %k) %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @s) %0 = load i32, ptr %k, align 4, !tbaa !10 %cmp286 = icmp sgt i32 %0, 0 %.pre = load i32, ptr %n, align 4, !tbaa !10 br i1 %cmp286, label %for.cond2.preheader.lr.ph, label %if.end134 for.cond2.preheader.lr.ph: ; preds = %entry %sub = add nsw i32 %.pre, -2 %sub52 = add i32 %.pre, -1 %1 = sext i32 %sub52 to i64 %wide.trip.count = sext i32 %sub to i64 br label %for.cond2.preheader for.cond: ; preds = %for.end83 %inc90 = add nuw nsw i32 %i.0287, 1 %exitcond319.not = icmp eq i32 %inc90, %0 br i1 %exitcond319.not, label %if.end134, label %for.cond2.preheader, !llvm.loop !12 for.cond2.preheader: ; preds = %for.cond2.preheader.lr.ph, %for.cond %j.0288 = phi i32 [ 0, %for.cond2.preheader.lr.ph ], [ %j.1270, %for.cond ] %i.0287 = phi i32 [ 0, %for.cond2.preheader.lr.ph ], [ %inc90, %for.cond ] %cmp3282 = icmp slt i32 %j.0288, %sub br i1 %cmp3282, label %for.body4.preheader, label %for.end83 for.body4.preheader: ; preds = %for.cond2.preheader %2 = sext i32 %j.0288 to i64 br label %for.body4 for.body4: ; preds = %for.body4.preheader, %for.inc81 %indvars.iv314 = phi i64 [ %2, %for.body4.preheader ], [ %.pre338, %for.inc81 ] %indvars.iv.in = phi i64 [ %2, %for.body4.preheader ], [ %indvars.iv, %for.inc81 ] %indvars.iv = add nsw i64 %indvars.iv.in, 1 %arrayidx = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv314 %3 = load i8, ptr %arrayidx, align 1, !tbaa !5 %.pre338 = add nsw i64 %indvars.iv314, 1 switch i8 %3, label %for.inc81 [ i8 76, label %land.lhs.true i8 82, label %land.lhs.true42 ] land.lhs.true: ; preds = %for.body4 %arrayidx8 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %.pre338 %4 = load i8, ptr %arrayidx8, align 1, !tbaa !5 %cmp10 = icmp eq i8 %4, 82 br i1 %cmp10, label %for.cond13.preheader, label %for.inc81 for.cond13.preheader: ; preds = %land.lhs.true %cmp15276 = icmp slt i64 %.pre338, %1 br i1 %cmp15276, label %for.body17, label %for.end for.body17: ; preds = %for.cond13.preheader, %for.inc %indvars.iv310 = phi i64 [ %6, %for.inc ], [ %indvars.iv, %for.cond13.preheader ] %arrayidx19 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv310 %5 = load i8, ptr %arrayidx19, align 1, !tbaa !5 %cmp21 = icmp eq i8 %5, 82 %6 = add nsw i64 %indvars.iv310, 1 br i1 %cmp21, label %land.lhs.true23, label %for.inc land.lhs.true23: ; preds = %for.body17 %arrayidx26 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %6 %7 = load i8, ptr %arrayidx26, align 1, !tbaa !5 %cmp28 = icmp eq i8 %7, 76 br i1 %cmp28, label %for.end, label %for.inc for.inc: ; preds = %for.body17, %land.lhs.true23 %cmp15 = icmp slt i64 %6, %1 br i1 %cmp15, label %for.body17, label %for.inc81, !llvm.loop !13 for.end: ; preds = %land.lhs.true23, %for.cond13.preheader %l.0.lcssa.in = phi i64 [ %.pre338, %for.cond13.preheader ], [ %indvars.iv310, %land.lhs.true23 ] %l.0.lcssa = trunc i64 %l.0.lcssa.in to i32 %cmp32 = icmp eq i32 %sub52, %l.0.lcssa br i1 %cmp32, label %for.inc81, label %if.end35 if.end35: ; preds = %for.end %8 = trunc i64 %indvars.iv314 to i32 %cmp.not21.i.not = icmp sgt i32 %l.0.lcssa, %8 br i1 %cmp.not21.i.not, label %while.body.preheader.i, label %for.end83 while.body.preheader.i: ; preds = %if.end35 %sext363 = shl i64 %l.0.lcssa.in, 32 %9 = ashr exact i64 %sext363, 32 br label %while.body.i while.body.i: ; preds = %while.body.i, %while.body.preheader.i %indvars.iv24.i = phi i64 [ %.pre338, %while.body.preheader.i ], [ %indvars.iv.next25.i, %while.body.i ] %indvars.iv.i = phi i64 [ %9, %while.body.preheader.i ], [ %indvars.iv.next.i, %while.body.i ] %arrayidx.i = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv24.i %10 = load i8, ptr %arrayidx.i, align 1, !tbaa !5 %cmp1.i = icmp eq i8 %10, 76 %..i = select i1 %cmp1.i, i8 82, i8 76 %arrayidx4.i = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv.i %11 = load i8, ptr %arrayidx4.i, align 1, !tbaa !5 %cmp6.i = icmp eq i8 %11, 76 %d.0.i = select i1 %cmp6.i, i8 82, i8 76 store i8 %d.0.i, ptr %arrayidx.i, align 1, !tbaa !5 store i8 %..i, ptr %arrayidx4.i, align 1, !tbaa !5 %indvars.iv.next25.i = add nsw i64 %indvars.iv24.i, 1 %indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1 %cmp.not.not.i = icmp slt i64 %indvars.iv24.i, %indvars.iv.next.i br i1 %cmp.not.not.i, label %while.body.i, label %for.end83, !llvm.loop !8 land.lhs.true42: ; preds = %for.body4 %arrayidx45 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %.pre338 %12 = load i8, ptr %arrayidx45, align 1, !tbaa !5 %cmp47 = icmp eq i8 %12, 76 br i1 %cmp47, label %for.cond51.preheader, label %for.inc81 for.cond51.preheader: ; preds = %land.lhs.true42 %cmp53271 = icmp slt i64 %.pre338, %1 br i1 %cmp53271, label %for.body55, label %for.end72 for.body55: ; preds = %for.cond51.preheader, %for.inc70 %indvars.iv306 = phi i64 [ %14, %for.inc70 ], [ %indvars.iv, %for.cond51.preheader ] %arrayidx57 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv306 %13 = load i8, ptr %arrayidx57, align 1, !tbaa !5 %cmp59 = icmp eq i8 %13, 76 %14 = add nsw i64 %indvars.iv306, 1 br i1 %cmp59, label %land.lhs.true61, label %for.inc70 land.lhs.true61: ; preds = %for.body55 %arrayidx64 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %14 %15 = load i8, ptr %arrayidx64, align 1, !tbaa !5 %cmp66 = icmp eq i8 %15, 82 br i1 %cmp66, label %for.end72, label %for.inc70 for.inc70: ; preds = %for.body55, %land.lhs.true61 %cmp53 = icmp slt i64 %14, %1 br i1 %cmp53, label %for.body55, label %for.inc81, !llvm.loop !14 for.end72: ; preds = %land.lhs.true61, %for.cond51.preheader %l.1.lcssa.in = phi i64 [ %.pre338, %for.cond51.preheader ], [ %indvars.iv306, %land.lhs.true61 ] %l.1.lcssa = trunc i64 %l.1.lcssa.in to i32 %cmp74 = icmp eq i32 %sub52, %l.1.lcssa br i1 %cmp74, label %for.inc81, label %if.end77 if.end77: ; preds = %for.end72 %16 = trunc i64 %indvars.iv314 to i32 %cmp.not21.i224.not = icmp sgt i32 %l.1.lcssa, %16 br i1 %cmp.not21.i224.not, label %while.body.preheader.i225, label %for.end83 while.body.preheader.i225: ; preds = %if.end77 %sext = shl i64 %l.1.lcssa.in, 32 %17 = ashr exact i64 %sext, 32 br label %while.body.i226 while.body.i226: ; preds = %while.body.i226, %while.body.preheader.i225 %indvars.iv24.i227 = phi i64 [ %.pre338, %while.body.preheader.i225 ], [ %indvars.iv.next25.i235, %while.body.i226 ] %indvars.iv.i228 = phi i64 [ %17, %while.body.preheader.i225 ], [ %indvars.iv.next.i236, %while.body.i226 ] %arrayidx.i229 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv24.i227 %18 = load i8, ptr %arrayidx.i229, align 1, !tbaa !5 %cmp1.i230 = icmp eq i8 %18, 76 %..i231 = select i1 %cmp1.i230, i8 82, i8 76 %arrayidx4.i232 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv.i228 %19 = load i8, ptr %arrayidx4.i232, align 1, !tbaa !5 %cmp6.i233 = icmp eq i8 %19, 76 %d.0.i234 = select i1 %cmp6.i233, i8 82, i8 76 store i8 %d.0.i234, ptr %arrayidx.i229, align 1, !tbaa !5 store i8 %..i231, ptr %arrayidx4.i232, align 1, !tbaa !5 %indvars.iv.next25.i235 = add nsw i64 %indvars.iv24.i227, 1 %indvars.iv.next.i236 = add nsw i64 %indvars.iv.i228, -1 %cmp.not.not.i237 = icmp slt i64 %indvars.iv24.i227, %indvars.iv.next.i236 br i1 %cmp.not.not.i237, label %while.body.i226, label %for.end83, !llvm.loop !8 for.inc81: ; preds = %for.inc70, %for.inc, %for.body4, %land.lhs.true, %land.lhs.true42, %for.end72, %for.end %exitcond.not = icmp eq i64 %.pre338, %wide.trip.count br i1 %exitcond.not, label %for.cond95.preheader, label %for.body4, !llvm.loop !15 for.end83: ; preds = %while.body.i226, %while.body.i, %for.cond2.preheader, %if.end77, %if.end35 %j.1270 = phi i32 [ %16, %if.end77 ], [ %8, %if.end35 ], [ %j.0288, %for.cond2.preheader ], [ %8, %while.body.i ], [ %16, %while.body.i226 ] %cmp85 = icmp eq i32 %j.1270, %sub br i1 %cmp85, label %for.cond95.preheader, label %for.cond for.cond95.preheader: ; preds = %for.end83, %for.inc81 %cmp96289 = icmp sgt i32 %.pre, 1 br i1 %cmp96289, label %for.body98.lr.ph, label %if.end134 for.body98.lr.ph: ; preds = %for.cond95.preheader %20 = load i8, ptr @s, align 16, !tbaa !5 %wide.trip.count323 = zext i32 %.pre to i64 br label %for.body98 for.body98: ; preds = %for.body98.lr.ph, %for.inc107 %indvars.iv320 = phi i64 [ 1, %for.body98.lr.ph ], [ %indvars.iv.next321, %for.inc107 ] %arrayidx101 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv320 %21 = load i8, ptr %arrayidx101, align 1, !tbaa !5 %cmp103.not = icmp eq i8 %20, %21 br i1 %cmp103.not, label %for.inc107, label %for.cond113.preheader for.cond113.preheader: ; preds = %for.body98 %22 = trunc i64 %indvars.iv320 to i32 %cmp114291 = icmp sgt i32 %.pre, %22 br i1 %cmp114291, label %for.body116, label %for.end127 for.inc107: ; preds = %for.body98 %indvars.iv.next321 = add nuw nsw i64 %indvars.iv320, 1 %exitcond324.not = icmp eq i64 %indvars.iv.next321, %wide.trip.count323 br i1 %exitcond324.not, label %if.end134, label %for.body98, !llvm.loop !16 for.body116: ; preds = %for.cond113.preheader, %for.inc125 %indvars.iv326 = phi i64 [ %indvars.iv.next327, %for.inc125 ], [ %indvars.iv320, %for.cond113.preheader ] %arrayidx119 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv326 %23 = load i8, ptr %arrayidx119, align 1, !tbaa !5 %cmp121 = icmp eq i8 %20, %23 br i1 %cmp121, label %for.end127.loopexit, label %for.inc125 for.inc125: ; preds = %for.body116 %indvars.iv.next327 = add nuw nsw i64 %indvars.iv326, 1 %exitcond330.not = icmp eq i64 %indvars.iv.next327, %wide.trip.count323 br i1 %exitcond330.not, label %while.body.preheader.i240, label %for.body116, !llvm.loop !17 for.end127.loopexit: ; preds = %for.body116 %24 = trunc i64 %indvars.iv326 to i32 br label %for.end127 for.end127: ; preds = %for.end127.loopexit, %for.cond113.preheader %i.2.lcssa = phi i32 [ %22, %for.cond113.preheader ], [ %24, %for.end127.loopexit ] %cmp128 = icmp eq i32 %i.2.lcssa, %.pre br i1 %cmp128, label %while.body.preheader.i240, label %if.end134 while.body.preheader.i240: ; preds = %for.inc125, %for.end127 %25 = and i64 %indvars.iv320, 4294967295 br label %while.body.i241 while.body.i241: ; preds = %while.body.i241, %while.body.preheader.i240 %indvars.iv24.i242 = phi i64 [ %25, %while.body.preheader.i240 ], [ %indvars.iv.next25.i250, %while.body.i241 ] %indvars.iv.i243 = phi i64 [ %1, %while.body.preheader.i240 ], [ %indvars.iv.next.i251, %while.body.i241 ] %arrayidx.i244 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv24.i242 %26 = load i8, ptr %arrayidx.i244, align 1, !tbaa !5 %cmp1.i245 = icmp eq i8 %26, 76 %..i246 = select i1 %cmp1.i245, i8 82, i8 76 %arrayidx4.i247 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv.i243 %27 = load i8, ptr %arrayidx4.i247, align 1, !tbaa !5 %cmp6.i248 = icmp eq i8 %27, 76 %d.0.i249 = select i1 %cmp6.i248, i8 82, i8 76 store i8 %d.0.i249, ptr %arrayidx.i244, align 1, !tbaa !5 store i8 %..i246, ptr %arrayidx4.i247, align 1, !tbaa !5 %indvars.iv.next25.i250 = add nuw nsw i64 %indvars.iv24.i242, 1 %indvars.iv.next.i251 = add nsw i64 %indvars.iv.i243, -1 %cmp.not.not.i252 = icmp slt i64 %indvars.iv24.i242, %indvars.iv.next.i251 br i1 %cmp.not.not.i252, label %while.body.i241, label %if.end134, !llvm.loop !8 if.end134: ; preds = %for.cond, %for.inc107, %while.body.i241, %entry, %for.cond95.preheader, %for.end127 %cmp136295 = icmp sgt i32 %.pre, 0 br i1 %cmp136295, label %for.body138.lr.ph, label %for.end179 for.body138.lr.ph: ; preds = %if.end134 %sub163 = add nsw i32 %.pre, -1 %28 = zext i32 %sub163 to i64 %wide.trip.count336 = zext i32 %.pre to i64 br label %for.body138 for.body138: ; preds = %for.body138.lr.ph, %for.inc177 %indvars.iv331 = phi i64 [ 0, %for.body138.lr.ph ], [ %indvars.iv.next332, %for.inc177 ] %a.0297 = phi i32 [ 0, %for.body138.lr.ph ], [ %a.1, %for.inc177 ] %arrayidx140 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %indvars.iv331 %29 = load i8, ptr %arrayidx140, align 1, !tbaa !5 %cmp142 = icmp eq i8 %29, 76 %cmp145 = icmp ne i64 %indvars.iv331, 0 %or.cond = and i1 %cmp145, %cmp142 br i1 %or.cond, label %land.lhs.true147, label %if.else156 land.lhs.true147: ; preds = %for.body138 %30 = add nuw i64 %indvars.iv331, 4294967295 %idxprom149 = and i64 %30, 4294967295 br label %for.inc177.sink.split if.else156: ; preds = %for.body138 %cmp160 = icmp eq i8 %29, 82 %cmp164 = icmp ult i64 %indvars.iv331, %28 %or.cond257 = select i1 %cmp160, i1 %cmp164, i1 false br i1 %or.cond257, label %land.lhs.true166, label %for.inc177 land.lhs.true166: ; preds = %if.else156 %31 = add nuw nsw i64 %indvars.iv331, 1 br label %for.inc177.sink.split for.inc177.sink.split: ; preds = %land.lhs.true166, %land.lhs.true147 %idxprom149.sink = phi i64 [ %idxprom149, %land.lhs.true147 ], [ %31, %land.lhs.true166 ] %.sink362 = phi i8 [ 76, %land.lhs.true147 ], [ 82, %land.lhs.true166 ] %arrayidx150 = getelementptr inbounds [100001 x i8], ptr @s, i64 0, i64 %idxprom149.sink %32 = load i8, ptr %arrayidx150, align 1, !tbaa !5 %cmp152 = icmp eq i8 %32, %.sink362 %inc155 = zext i1 %cmp152 to i32 %spec.select256 = add nsw i32 %a.0297, %inc155 br label %for.inc177 for.inc177: ; preds = %for.inc177.sink.split, %if.else156 %a.1 = phi i32 [ %a.0297, %if.else156 ], [ %spec.select256, %for.inc177.sink.split ] %indvars.iv.next332 = add nuw nsw i64 %indvars.iv331, 1 %exitcond337.not = icmp eq i64 %indvars.iv.next332, %wide.trip.count336 br i1 %exitcond337.not, label %for.end179, label %for.body138, !llvm.loop !18 for.end179: ; preds = %for.inc177, %if.end134 %a.0.lcssa = phi i32 [ 0, %if.end134 ], [ %a.1, %for.inc177 ] %call180 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %a.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 attributes #0 = { nofree 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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 = distinct !{!13, !9} !14 = distinct !{!14, !9} !15 = distinct !{!15, !9} !16 = distinct !{!16, !9} !17 = distinct !{!17, !9} !18 = distinct !{!18, !9}
#include<stdio.h> int max(int,int); int main(void){ int n,m,h[201],r[201],i,j,t,dp[201],res; while(scanf("%d",&n),n){ for(i=0;i<n;i++)scanf("%d %d",&h[i],&r[i]); scanf("%d",&m); for(i=n;i<n+m;i++)scanf("%d %d",&h[i],&r[i]); for(i=0;i<n+m;i++){ for(j=i;j<n+m;j++){ if(h[i]>h[j]){ t=h[i]; h[i]=h[j]; h[j]=t; t=r[i]; r [i]=r[j]; r[j]=t; } if(h[i]==h[j] && r[i]>r[j]){ t=h[i]; h[i]=h[j]; h[j]=t; t=r[i]; r [i]=r[j]; r[j]=t; } } } for(i=0;i<n+m;i++)dp[i]=0; dp[0]=1; for(i=0;i<n+m;i++){ for(j=i+1;j<n+m;j++){ if(h[i]<h[j] && r[i]<r[j] && dp[i]>=dp[j])dp[j]=dp[i]+1; } } res=0; for(i=0;i<n+m;i++)res=max(res,dp[i]); printf("%d\n",res); } return 0; } int max(int x,int y){ return x>y?x:y; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295571/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295571/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %m = alloca i32, align 4 %h = alloca [201 x i32], align 16 %r = alloca [201 x i32], align 16 %dp = alloca [201 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %h) #6 call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %r) #6 call void @llvm.lifetime.start.p0(i64 804, ptr nonnull %dp) #6 %call217 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not218 = icmp eq i32 %0, 0 br i1 %tobool.not218, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end137 %1 = phi i32 [ %35, %for.end137 ], [ %0, %entry ] %cmp199 = icmp sgt i32 %1, 0 br i1 %cmp199, label %for.body, label %for.end for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds [201 x i32], ptr %h, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %2 = load i32, ptr %n, align 4, !tbaa !5 %3 = sext i32 %2 to i64 %cmp = icmp slt i64 %indvars.iv.next, %3 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body, %for.cond.preheader %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %4 = load i32, ptr %n, align 4, !tbaa !5 %5 = load i32, ptr %m, align 4, !tbaa !5 %add201 = add nsw i32 %5, %4 %cmp6202 = icmp sgt i32 %5, 0 br i1 %cmp6202, label %for.body7.preheader, label %for.cond16.preheader for.body7.preheader: ; preds = %for.end %6 = sext i32 %4 to i64 br label %for.body7 for.cond16.preheader: ; preds = %for.body7, %for.end %add.lcssa = phi i32 [ %add201, %for.end ], [ %add, %for.body7 ] %cmp18205 = icmp sgt i32 %add.lcssa, 0 br i1 %cmp18205, label %for.cond20.preheader.preheader, label %for.end137 for.cond20.preheader.preheader: ; preds = %for.cond16.preheader %7 = zext i32 %add.lcssa to i64 %wide.trip.count = zext i32 %add.lcssa to i64 br label %for.cond20.preheader for.body7: ; preds = %for.body7.preheader, %for.body7 %indvars.iv221 = phi i64 [ %6, %for.body7.preheader ], [ %indvars.iv.next222, %for.body7 ] %arrayidx9 = getelementptr inbounds [201 x i32], ptr %h, i64 0, i64 %indvars.iv221 %arrayidx11 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv221 %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx9, ptr noundef nonnull %arrayidx11) %indvars.iv.next222 = add nsw i64 %indvars.iv221, 1 %8 = load i32, ptr %n, align 4, !tbaa !5 %9 = load i32, ptr %m, align 4, !tbaa !5 %add = add nsw i32 %9, %8 %10 = sext i32 %add to i64 %cmp6 = icmp slt i64 %indvars.iv.next222, %10 br i1 %cmp6, label %for.body7, label %for.cond16.preheader, !llvm.loop !11 for.cond79.preheader: ; preds = %for.inc76 br i1 %cmp18205, label %for.body92.preheader, label %for.end137 for.cond20.preheader: ; preds = %for.cond20.preheader.preheader, %for.inc76 %indvars.iv224 = phi i64 [ 0, %for.cond20.preheader.preheader ], [ %indvars.iv.next225, %for.inc76 ] %arrayidx25 = getelementptr inbounds [201 x i32], ptr %h, i64 0, i64 %indvars.iv224 %arrayidx38 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv224 br label %for.body23 for.body23: ; preds = %for.cond20.preheader, %for.inc73 %indvars.iv226 = phi i64 [ %indvars.iv224, %for.cond20.preheader ], [ %indvars.iv.next227, %for.inc73 ] %11 = load i32, ptr %arrayidx25, align 4, !tbaa !5 %arrayidx27 = getelementptr inbounds [201 x i32], ptr %h, i64 0, i64 %indvars.iv226 %12 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %cmp28 = icmp sgt i32 %11, %12 br i1 %cmp28, label %if.then, label %if.end if.then: ; preds = %for.body23 store i32 %12, ptr %arrayidx25, align 4, !tbaa !5 store i32 %11, ptr %arrayidx27, align 4, !tbaa !5 %13 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %arrayidx40 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv226 %14 = load i32, ptr %arrayidx40, align 4, !tbaa !5 store i32 %14, ptr %arrayidx38, align 4, !tbaa !5 store i32 %13, ptr %arrayidx40, align 4, !tbaa !5 %.pre = load i32, ptr %arrayidx25, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %for.body23 %15 = phi i32 [ %11, %if.then ], [ %12, %for.body23 ] %16 = phi i32 [ %.pre, %if.then ], [ %11, %for.body23 ] %cmp49 = icmp eq i32 %16, %15 br i1 %cmp49, label %land.lhs.true, label %for.inc73 land.lhs.true: ; preds = %if.end %17 = load i32, ptr %arrayidx38, align 4, !tbaa !5 %arrayidx53 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv226 %18 = load i32, ptr %arrayidx53, align 4, !tbaa !5 %cmp54 = icmp sgt i32 %17, %18 br i1 %cmp54, label %if.then55, label %for.inc73 if.then55: ; preds = %land.lhs.true store i32 %15, ptr %arrayidx25, align 4, !tbaa !5 store i32 %15, ptr %arrayidx27, align 4, !tbaa !5 store i32 %18, ptr %arrayidx38, align 4, !tbaa !5 store i32 %17, ptr %arrayidx53, align 4, !tbaa !5 br label %for.inc73 for.inc73: ; preds = %if.end, %land.lhs.true, %if.then55 %indvars.iv.next227 = add nuw nsw i64 %indvars.iv226, 1 %cmp22 = icmp ult i64 %indvars.iv.next227, %7 br i1 %cmp22, label %for.body23, label %for.inc76, !llvm.loop !12 for.inc76: ; preds = %for.inc73 %indvars.iv.next225 = add nuw nsw i64 %indvars.iv224, 1 %exitcond.not = icmp eq i64 %indvars.iv.next225, %wide.trip.count br i1 %exitcond.not, label %for.cond79.preheader, label %for.cond20.preheader, !llvm.loop !13 for.body92.preheader: ; preds = %for.cond79.preheader %19 = zext i32 %add.lcssa to i64 %20 = shl nuw nsw i64 %19, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %dp, i8 0, i64 %20, i1 false), !tbaa !5 store i32 1, ptr %dp, align 16, !tbaa !5 %21 = zext i32 %add.lcssa to i64 %wide.trip.count243 = zext i32 %add.lcssa to i64 br label %for.body92 for.cond89.loopexit: ; preds = %for.inc122, %for.body92 %indvars.iv.next234 = add nuw nsw i64 %indvars.iv233, 1 %exitcond244.not = icmp eq i64 %indvars.iv.next241, %wide.trip.count243 br i1 %exitcond244.not, label %for.cond128.preheader, label %for.body92, !llvm.loop !14 for.cond128.preheader: ; preds = %for.cond89.loopexit br i1 %cmp18205, label %for.body131.preheader, label %for.end137 for.body131.preheader: ; preds = %for.cond128.preheader %wide.trip.count248 = zext i32 %add.lcssa to i64 %min.iters.check = icmp ult i32 %add.lcssa, 8 br i1 %min.iters.check, label %for.body131.preheader254, label %vector.ph vector.ph: ; preds = %for.body131.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.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ] %vec.phi252 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %25, %vector.body ] %22 = getelementptr inbounds [201 x i32], ptr %dp, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %22, align 16, !tbaa !5 %23 = getelementptr inbounds i32, ptr %22, i64 4 %wide.load253 = load <4 x i32>, ptr %23, align 16, !tbaa !5 %24 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %wide.load) %25 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi252, <4 x i32> %wide.load253) %index.next = add nuw i64 %index, 8 %26 = icmp eq i64 %index.next, %n.vec br i1 %26, label %middle.block, label %vector.body, !llvm.loop !15 middle.block: ; preds = %vector.body %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %24, <4 x i32> %25) %27 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end137, label %for.body131.preheader254 for.body131.preheader254: ; preds = %for.body131.preheader, %middle.block %indvars.iv245.ph = phi i64 [ 0, %for.body131.preheader ], [ %n.vec, %middle.block ] %res.0215.ph = phi i32 [ 0, %for.body131.preheader ], [ %27, %middle.block ] br label %for.body131 for.body92: ; preds = %for.body92.preheader, %for.cond89.loopexit %indvars.iv240 = phi i64 [ 0, %for.body92.preheader ], [ %indvars.iv.next241, %for.cond89.loopexit ] %indvars.iv233 = phi i64 [ 1, %for.body92.preheader ], [ %indvars.iv.next234, %for.cond89.loopexit ] %indvars.iv.next241 = add nuw nsw i64 %indvars.iv240, 1 %cmp96209 = icmp ult i64 %indvars.iv.next241, %21 br i1 %cmp96209, label %for.body97.lr.ph, label %for.cond89.loopexit for.body97.lr.ph: ; preds = %for.body92 %arrayidx99 = getelementptr inbounds [201 x i32], ptr %h, i64 0, i64 %indvars.iv240 %28 = load i32, ptr %arrayidx99, align 4, !tbaa !5 %arrayidx105 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv240 %arrayidx111 = getelementptr inbounds [201 x i32], ptr %dp, i64 0, i64 %indvars.iv240 br label %for.body97 for.body97: ; preds = %for.body97.lr.ph, %for.inc122 %indvars.iv235 = phi i64 [ %indvars.iv233, %for.body97.lr.ph ], [ %indvars.iv.next236, %for.inc122 ] %arrayidx101 = getelementptr inbounds [201 x i32], ptr %h, i64 0, i64 %indvars.iv235 %29 = load i32, ptr %arrayidx101, align 4, !tbaa !5 %cmp102 = icmp slt i32 %28, %29 br i1 %cmp102, label %land.lhs.true103, label %for.inc122 land.lhs.true103: ; preds = %for.body97 %30 = load i32, ptr %arrayidx105, align 4, !tbaa !5 %arrayidx107 = getelementptr inbounds [201 x i32], ptr %r, i64 0, i64 %indvars.iv235 %31 = load i32, ptr %arrayidx107, align 4, !tbaa !5 %cmp108 = icmp slt i32 %30, %31 br i1 %cmp108, label %land.lhs.true109, label %for.inc122 land.lhs.true109: ; preds = %land.lhs.true103 %32 = load i32, ptr %arrayidx111, align 4, !tbaa !5 %arrayidx113 = getelementptr inbounds [201 x i32], ptr %dp, i64 0, i64 %indvars.iv235 %33 = load i32, ptr %arrayidx113, align 4, !tbaa !5 %cmp114.not = icmp slt i32 %32, %33 br i1 %cmp114.not, label %for.inc122, label %if.then115 if.then115: ; preds = %land.lhs.true109 %add118 = add nsw i32 %32, 1 store i32 %add118, ptr %arrayidx113, align 4, !tbaa !5 br label %for.inc122 for.inc122: ; preds = %for.body97, %land.lhs.true103, %land.lhs.true109, %if.then115 %indvars.iv.next236 = add nuw nsw i64 %indvars.iv235, 1 %exitcond239.not = icmp eq i64 %indvars.iv.next236, %wide.trip.count243 br i1 %exitcond239.not, label %for.cond89.loopexit, label %for.body97, !llvm.loop !18 for.body131: ; preds = %for.body131.preheader254, %for.body131 %indvars.iv245 = phi i64 [ %indvars.iv.next246, %for.body131 ], [ %indvars.iv245.ph, %for.body131.preheader254 ] %res.0215 = phi i32 [ %cond.i, %for.body131 ], [ %res.0215.ph, %for.body131.preheader254 ] %arrayidx133 = getelementptr inbounds [201 x i32], ptr %dp, i64 0, i64 %indvars.iv245 %34 = load i32, ptr %arrayidx133, align 4, !tbaa !5 %cond.i = call i32 @llvm.smax.i32(i32 %res.0215, i32 %34) %indvars.iv.next246 = add nuw nsw i64 %indvars.iv245, 1 %exitcond249.not = icmp eq i64 %indvars.iv.next246, %wide.trip.count248 br i1 %exitcond249.not, label %for.end137, label %for.body131, !llvm.loop !19 for.end137: ; preds = %for.body131, %middle.block, %for.cond79.preheader, %for.cond16.preheader, %for.cond128.preheader %res.0.lcssa = phi i32 [ 0, %for.cond128.preheader ], [ 0, %for.cond16.preheader ], [ 0, %for.cond79.preheader ], [ %27, %middle.block ], [ %cond.i, %for.body131 ] %call138 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %res.0.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %35 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %35, 0 br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !20 while.end: ; preds = %for.end137, %entry call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %dp) #6 call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %r) #6 call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %h) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i32 @max(i32 noundef %x, i32 noundef %y) local_unnamed_addr #3 { entry: %cond = tail call i32 @llvm.smax.i32(i32 %x, i32 %y) ret i32 %cond } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #4 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10} !14 = distinct !{!14, !10} !15 = distinct !{!15, !10, !16, !17} !16 = !{!"llvm.loop.isvectorized", i32 1} !17 = !{!"llvm.loop.unroll.runtime.disable"} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10, !17, !16} !20 = distinct !{!20, !10}
#include <stdio.h> #include <string.h> #define ll long long #define rep(i,l,r)for(ll i=(l);i<(r);i++) #define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k)) #define INF ((1LL<<62)-(1LL<<31)) #define max(p,q)((p)>(q)?(p):(q)) #define min(p,q)((p)<(q)?(p):(q)) char s[20]; int main(){ scanf("%s",s); ll n=strlen(s); if(n==1){ printf("%s\n",s); return 0; } ll flag=1; rep(i,1,n)flag&=(s[i]=='9'); printf("%lld\n",(n-1)*9+(s[0]-48)-1+flag); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_295629/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_295629/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @s = dso_local global [20 x i8] zeroinitializer, align 16 @.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: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s) %call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @s) #4 %cmp = icmp eq i64 %call1, 1 br i1 %cmp, label %if.then, label %for.cond.preheader for.cond.preheader: ; preds = %entry %cmp318 = icmp sgt i64 %call1, 1 br i1 %cmp318, label %for.body.preheader, label %for.cond.cleanup for.body.preheader: ; preds = %for.cond.preheader %0 = add i64 %call1, -1 %min.iters.check = icmp ult i64 %call1, 5 br i1 %min.iters.check, label %for.body.preheader26, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %0, -4 %ind.end = or i64 %n.vec, 1 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <2 x i64> [ <i64 1, i64 1>, %vector.ph ], [ %5, %vector.body ] %vec.phi21 = phi <2 x i64> [ <i64 1, i64 1>, %vector.ph ], [ %6, %vector.body ] %offset.idx = or i64 %index, 1 %1 = getelementptr inbounds [20 x i8], ptr @s, i64 0, i64 %offset.idx %wide.load = load <2 x i8>, ptr %1, align 1, !tbaa !5 %2 = getelementptr inbounds i8, ptr %1, i64 2 %wide.load22 = load <2 x i8>, ptr %2, align 1, !tbaa !5 %3 = icmp eq <2 x i8> %wide.load, <i8 57, i8 57> %4 = icmp eq <2 x i8> %wide.load22, <i8 57, i8 57> %5 = select <2 x i1> %3, <2 x i64> %vec.phi, <2 x i64> zeroinitializer %6 = select <2 x i1> %4, <2 x i64> %vec.phi21, <2 x i64> zeroinitializer %index.next = add nuw i64 %index, 4 %7 = icmp eq i64 %index.next, %n.vec br i1 %7, label %middle.block, label %vector.body, !llvm.loop !8 middle.block: ; preds = %vector.body %rdx.select.cmp.not = icmp ne <2 x i64> %5, <i64 1, i64 1> %rdx.select.cmp2325 = icmp ne <2 x i64> %6, <i64 1, i64 1> %rdx.select.cmp23 = select <2 x i1> %rdx.select.cmp.not, <2 x i1> <i1 true, i1 true>, <2 x i1> %rdx.select.cmp2325 %8 = bitcast <2 x i1> %rdx.select.cmp23 to i2 %.not = icmp eq i2 %8, 0 %rdx.select24 = zext i1 %.not to i64 %cmp.n = icmp eq i64 %0, %n.vec br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader26 for.body.preheader26: ; preds = %for.body.preheader, %middle.block %i.020.ph = phi i64 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ] %flag.019.ph = phi i64 [ 1, %for.body.preheader ], [ %rdx.select24, %middle.block ] br label %for.body if.then: ; preds = %entry %puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @s) br label %cleanup for.cond.cleanup: ; preds = %for.body, %middle.block, %for.cond.preheader %flag.0.lcssa = phi i64 [ 1, %for.cond.preheader ], [ %rdx.select24, %middle.block ], [ %and, %for.body ] %9 = mul i64 %call1, 9 %10 = load i8, ptr @s, align 16, !tbaa !5 %conv7 = sext i8 %10 to i64 %sub8 = add i64 %9, -58 %sub10 = add i64 %sub8, %flag.0.lcssa %add11 = add i64 %sub10, %conv7 %call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %add11) br label %cleanup for.body: ; preds = %for.body.preheader26, %for.body %i.020 = phi i64 [ %inc, %for.body ], [ %i.020.ph, %for.body.preheader26 ] %flag.019 = phi i64 [ %and, %for.body ], [ %flag.019.ph, %for.body.preheader26 ] %arrayidx = getelementptr inbounds [20 x i8], ptr @s, i64 0, i64 %i.020 %11 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp4 = icmp eq i8 %11, 57 %and = select i1 %cmp4, i64 %flag.019, i64 0 %inc = add nuw nsw i64 %i.020, 1 %exitcond.not = icmp eq i64 %inc, %call1 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !12 cleanup: ; preds = %for.cond.cleanup, %if.then ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9, !10, !11} !9 = !{!"llvm.loop.mustprogress"} !10 = !{!"llvm.loop.isvectorized", i32 1} !11 = !{!"llvm.loop.unroll.runtime.disable"} !12 = distinct !{!12, !9, !11, !10}
#include <stdio.h> #include<stdlib.h> #include<string.h> int main() { char s[502]; int a[27] = {0}; scanf("%s",s); int i; if(s[0] != 'a') { printf("NO"); return 0; } char z = 'a'; a[0] = 1; int l = strlen(s); for(i=1;i<l;i++) { if(s[i]!= s[i-1] && (a[s[i] - 97] == 0) && (s[i] - z)!=1) { printf("NO"); return 0; } else { a[s[i]-97] = 1; if(s[i]>z) z = s[i]; } } printf("YES"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_29568/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_29568/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"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: %s = alloca [502 x i8], align 16 %a = alloca [27 x i32], align 16 call void @llvm.lifetime.start.p0(i64 502, ptr nonnull %s) #6 call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %a) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(108) %a, i8 0, i64 108, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %0 = load i8, ptr %s, align 16, !tbaa !5 %cmp.not = icmp eq i8 %0, 97 br i1 %cmp.not, label %if.end, label %cleanup53 if.end: ; preds = %entry store i32 1, ptr %a, align 16, !tbaa !8 %call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #7 %conv6 = trunc i64 %call5 to i32 %cmp765 = icmp sgt i32 %conv6, 1 br i1 %cmp765, label %for.body.preheader, label %cleanup53 for.body.preheader: ; preds = %if.end %wide.trip.count = and i64 %call5, 4294967295 br label %for.body for.body: ; preds = %for.body.preheader, %if.else %1 = phi i8 [ 97, %for.body.preheader ], [ %2, %if.else ] %indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %if.else ] %z.067 = phi i8 [ 97, %for.body.preheader ], [ %spec.select, %if.else ] %arrayidx9 = getelementptr inbounds [502 x i8], ptr %s, i64 0, i64 %indvars.iv %2 = load i8, ptr %arrayidx9, align 1, !tbaa !5 %conv10 = sext i8 %2 to i32 %cmp14.not = icmp eq i8 %2, %1 br i1 %cmp14.not, label %if.else, label %land.lhs.true land.lhs.true: ; preds = %for.body %sub19 = add nsw i32 %conv10, -97 %idxprom20 = sext i32 %sub19 to i64 %arrayidx21 = getelementptr inbounds [27 x i32], ptr %a, i64 0, i64 %idxprom20 %3 = load i32, ptr %arrayidx21, align 4, !tbaa !8 %cmp22 = icmp eq i32 %3, 0 br i1 %cmp22, label %land.lhs.true24, label %if.else land.lhs.true24: ; preds = %land.lhs.true %conv28 = zext i8 %z.067 to i32 %sub29 = sub nsw i32 %conv10, %conv28 %cmp30.not = icmp eq i32 %sub29, 1 br i1 %cmp30.not, label %if.else, label %cleanup53 if.else: ; preds = %land.lhs.true24, %land.lhs.true, %for.body %conv36 = sext i8 %2 to i64 %sub37 = add nsw i64 %conv36, -97 %arrayidx39 = getelementptr inbounds [27 x i32], ptr %a, i64 0, i64 %sub37 store i32 1, ptr %arrayidx39, align 4, !tbaa !8 %spec.select = call i8 @llvm.smax.i8(i8 %2, i8 %z.067) %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 %cleanup53, label %for.body, !llvm.loop !10 cleanup53: ; preds = %if.else, %land.lhs.true24, %if.end, %entry %.str.1.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.end ], [ @.str.1, %land.lhs.true24 ], [ @.str.2, %if.else ] %call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink) call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %a) #6 call void @llvm.lifetime.end.p0(i64 502, 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: 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 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: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i8 @llvm.smax.i8(i8, i8) #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: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } attributes #7 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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 () { char a[1005]; int b[123],i,c=0; memset(b,0,sizeof(b)); scanf("%[^\n]%s",a); for(i=0;i<strlen(a);i++) { if(a[i]>=97&&a[i]<=122) b[(int)a[i]]=1; } for(i=97;i<=123;i++) { if(b[i]==1) c++; } printf("%d\n",c); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10001/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10001/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%[^\0A]%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca [1005 x i8], align 16 %b = alloca [123 x i32], align 16 call void @llvm.lifetime.start.p0(i64 1005, ptr nonnull %a) #6 call void @llvm.lifetime.start.p0(i64 492, ptr nonnull %b) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(492) %b, i8 0, i64 492, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #7 %cmp41.not = icmp eq i64 %call3, 0 br i1 %cmp41.not, label %for.cond18.preheader, label %for.body.preheader for.body.preheader: ; preds = %entry %min.iters.check = icmp ult i64 %call3, 8 br i1 %min.iters.check, label %for.body.preheader89, label %vector.ph vector.ph: ; preds = %for.body.preheader %n.vec = and i64 %call3, -8 br label %vector.body vector.body: ; preds = %pred.store.continue84, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue84 ] %0 = getelementptr inbounds [1005 x i8], ptr %a, i64 0, i64 %index %wide.load = load <4 x i8>, ptr %0, align 8, !tbaa !5 %1 = getelementptr inbounds i8, ptr %0, i64 4 %wide.load70 = load <4 x i8>, ptr %1, align 4, !tbaa !5 %2 = add <4 x i8> %wide.load, <i8 -97, i8 -97, i8 -97, i8 -97> %3 = add <4 x i8> %wide.load70, <i8 -97, i8 -97, i8 -97, i8 -97> %4 = icmp ult <4 x i8> %2, <i8 26, i8 26, i8 26, i8 26> %5 = icmp ult <4 x i8> %3, <i8 26, i8 26, i8 26, i8 26> %6 = extractelement <4 x i1> %4, i64 0 br i1 %6, label %pred.store.if, label %pred.store.continue pred.store.if: ; preds = %vector.body %7 = extractelement <4 x i8> %wide.load, i64 0 %8 = zext i8 %7 to i64 %9 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %8 store i32 1, ptr %9, align 4, !tbaa !8 br label %pred.store.continue pred.store.continue: ; preds = %pred.store.if, %vector.body %10 = extractelement <4 x i1> %4, i64 1 br i1 %10, label %pred.store.if71, label %pred.store.continue72 pred.store.if71: ; preds = %pred.store.continue %11 = extractelement <4 x i8> %wide.load, i64 1 %12 = zext i8 %11 to i64 %13 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %12 store i32 1, ptr %13, align 4, !tbaa !8 br label %pred.store.continue72 pred.store.continue72: ; preds = %pred.store.if71, %pred.store.continue %14 = extractelement <4 x i1> %4, i64 2 br i1 %14, label %pred.store.if73, label %pred.store.continue74 pred.store.if73: ; preds = %pred.store.continue72 %15 = extractelement <4 x i8> %wide.load, i64 2 %16 = zext i8 %15 to i64 %17 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %16 store i32 1, ptr %17, align 4, !tbaa !8 br label %pred.store.continue74 pred.store.continue74: ; preds = %pred.store.if73, %pred.store.continue72 %18 = extractelement <4 x i1> %4, i64 3 br i1 %18, label %pred.store.if75, label %pred.store.continue76 pred.store.if75: ; preds = %pred.store.continue74 %19 = extractelement <4 x i8> %wide.load, i64 3 %20 = zext i8 %19 to i64 %21 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %20 store i32 1, ptr %21, align 4, !tbaa !8 br label %pred.store.continue76 pred.store.continue76: ; preds = %pred.store.if75, %pred.store.continue74 %22 = extractelement <4 x i1> %5, i64 0 br i1 %22, label %pred.store.if77, label %pred.store.continue78 pred.store.if77: ; preds = %pred.store.continue76 %23 = extractelement <4 x i8> %wide.load70, i64 0 %24 = zext i8 %23 to i64 %25 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %24 store i32 1, ptr %25, align 4, !tbaa !8 br label %pred.store.continue78 pred.store.continue78: ; preds = %pred.store.if77, %pred.store.continue76 %26 = extractelement <4 x i1> %5, i64 1 br i1 %26, label %pred.store.if79, label %pred.store.continue80 pred.store.if79: ; preds = %pred.store.continue78 %27 = extractelement <4 x i8> %wide.load70, i64 1 %28 = zext i8 %27 to i64 %29 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %28 store i32 1, ptr %29, align 4, !tbaa !8 br label %pred.store.continue80 pred.store.continue80: ; preds = %pred.store.if79, %pred.store.continue78 %30 = extractelement <4 x i1> %5, i64 2 br i1 %30, label %pred.store.if81, label %pred.store.continue82 pred.store.if81: ; preds = %pred.store.continue80 %31 = extractelement <4 x i8> %wide.load70, i64 2 %32 = zext i8 %31 to i64 %33 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %32 store i32 1, ptr %33, align 4, !tbaa !8 br label %pred.store.continue82 pred.store.continue82: ; preds = %pred.store.if81, %pred.store.continue80 %34 = extractelement <4 x i1> %5, i64 3 br i1 %34, label %pred.store.if83, label %pred.store.continue84 pred.store.if83: ; preds = %pred.store.continue82 %35 = extractelement <4 x i8> %wide.load70, i64 3 %36 = zext i8 %35 to i64 %37 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %36 store i32 1, ptr %37, align 4, !tbaa !8 br label %pred.store.continue84 pred.store.continue84: ; preds = %pred.store.if83, %pred.store.continue82 %index.next = add nuw i64 %index, 8 %38 = icmp eq i64 %index.next, %n.vec br i1 %38, label %middle.block, label %vector.body, !llvm.loop !10 middle.block: ; preds = %pred.store.continue84 %cmp.n = icmp eq i64 %call3, %n.vec br i1 %cmp.n, label %for.cond18.preheader.loopexit, label %for.body.preheader89 for.body.preheader89: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond18.preheader.loopexit: ; preds = %for.inc, %middle.block %arrayidx23.phi.trans.insert = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 97 %arrayidx23.16.phi.trans.insert = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 113 %39 = load <16 x i32>, ptr %arrayidx23.phi.trans.insert, align 4, !tbaa !8 %40 = icmp eq <16 x i32> %39, <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1> %41 = load <4 x i32>, ptr %arrayidx23.16.phi.trans.insert, align 4, !tbaa !8 %42 = icmp eq <4 x i32> %41, <i32 1, i32 1, i32 1, i32 1> %43 = bitcast <16 x i1> %40 to i16 %44 = call i16 @llvm.ctpop.i16(i16 %43), !range !14 %45 = zext i16 %44 to i32 %46 = bitcast <4 x i1> %42 to i4 %47 = call i4 @llvm.ctpop.i4(i4 %46), !range !15 %48 = zext i4 %47 to i32 %op.rdx = add nuw nsw i32 %45, %48 br label %for.cond18.preheader for.cond18.preheader: ; preds = %for.cond18.preheader.loopexit, %entry %spec.select.19 = phi i32 [ %op.rdx, %for.cond18.preheader.loopexit ], [ 0, %entry ] %arrayidx23.20 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 117 %49 = load <4 x i32>, ptr %arrayidx23.20, align 4, !tbaa !8 %50 = icmp eq <4 x i32> %49, <i32 1, i32 1, i32 1, i32 1> %arrayidx23.24 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 121 %51 = load i32, ptr %arrayidx23.24, align 4, !tbaa !8 %cmp24.24 = icmp eq i32 %51, 1 %inc27.24 = zext i1 %cmp24.24 to i32 %arrayidx23.25 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 122 %52 = load i32, ptr %arrayidx23.25, align 8, !tbaa !8 %cmp24.25 = icmp eq i32 %52, 1 %inc27.25 = zext i1 %cmp24.25 to i32 %arrayidx23.26 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 123 %53 = load i32, ptr %arrayidx23.26, align 4, !tbaa !8 %cmp24.26 = icmp eq i32 %53, 1 %inc27.26 = zext i1 %cmp24.26 to i32 %54 = bitcast <4 x i1> %50 to i4 %55 = call i4 @llvm.ctpop.i4(i4 %54), !range !15 %56 = zext i4 %55 to i32 %op.rdx85 = add nuw nsw i32 %56, %inc27.24 %op.rdx86 = add nuw nsw i32 %inc27.25, %inc27.26 %op.rdx87 = add nuw nsw i32 %op.rdx85, %op.rdx86 %op.rdx88 = add nsw i32 %op.rdx87, %spec.select.19 %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %op.rdx88) call void @llvm.lifetime.end.p0(i64 492, ptr nonnull %b) #6 call void @llvm.lifetime.end.p0(i64 1005, ptr nonnull %a) #6 ret i32 0 for.body: ; preds = %for.body.preheader89, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.body.preheader89 ] %arrayidx = getelementptr inbounds [1005 x i8], ptr %a, i64 0, i64 %indvars.iv %57 = load i8, ptr %arrayidx, align 1, !tbaa !5 %58 = add i8 %57, -97 %or.cond = icmp ult i8 %58, 26 br i1 %or.cond, label %if.then, label %for.inc if.then: ; preds = %for.body %conv5 = zext i8 %57 to i64 %arrayidx17 = getelementptr inbounds [123 x i32], ptr %b, i64 0, i64 %conv5 store i32 1, ptr %arrayidx17, align 4, !tbaa !8 br label %for.inc for.inc: ; preds = %for.body, %if.then %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %call3 br i1 %exitcond.not, label %for.cond18.preheader.loopexit, label %for.body, !llvm.loop !16 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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: 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 i16 @llvm.ctpop.i16(i16) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i4 @llvm.ctpop.i4(i4) #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: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } attributes #7 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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 = !{i16 0, i16 17} !15 = !{i4 0, i4 5} !16 = distinct !{!16, !11, !13, !12}
#include<stdio.h> int main(void){ int h, w, i, j; for(;;){ 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_100053/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100053/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call40 = 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 %cmp41 = icmp eq i32 %0, 0 %1 = load i32, ptr %w, align 4 %cmp142 = icmp eq i32 %1, 0 %or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false br i1 %or.cond43, label %for.end22, label %for.cond2.preheader for.cond2.preheader: ; preds = %entry, %for.end20 %2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ] %cmp3.not37 = icmp slt i32 %2, 1 br i1 %cmp3.not37, label %for.end20, label %for.cond4.preheader for.cond4.preheader: ; preds = %for.cond2.preheader, %for.end %i.038 = phi i32 [ %inc19, %for.end ], [ 1, %for.cond2.preheader ] %3 = load i32, ptr %w, align 4, !tbaa !5 %cmp5.not34 = icmp slt i32 %3, 1 br i1 %cmp5.not34, label %for.end, label %for.body6.lr.ph for.body6.lr.ph: ; preds = %for.cond4.preheader %cmp7 = icmp eq i32 %i.038, 1 br i1 %cmp7, label %for.body6.us, label %for.body6 for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us %j.035.us = phi i32 [ %inc.us, %for.body6.us ], [ 1, %for.body6.lr.ph ] %putchar32.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 %cmp5.not.us.not = icmp slt i32 %j.035.us, %4 br i1 %cmp5.not.us.not, label %for.body6.us, label %for.end, !llvm.loop !9 for.body6: ; preds = %for.body6.lr.ph, %for.body6 %5 = phi i32 [ %7, %for.body6 ], [ %3, %for.body6.lr.ph ] %j.035 = phi i32 [ %inc, %for.body6 ], [ 1, %for.body6.lr.ph ] %6 = load i32, ptr %h, align 4, !tbaa !5 %cmp8 = icmp eq i32 %i.038, %6 %cmp10 = icmp eq i32 %j.035, 1 %or.cond23 = or i1 %cmp10, %cmp8 %cmp12 = icmp eq i32 %j.035, %5 %or.cond33 = or i1 %cmp12, %or.cond23 %. = select i1 %or.cond33, i32 35, i32 46 %putchar32 = call i32 @putchar(i32 %.) %inc = add nuw nsw i32 %j.035, 1 %7 = load i32, ptr %w, align 4, !tbaa !5 %cmp5.not.not = icmp slt i32 %j.035, %7 br i1 %cmp5.not.not, label %for.body6, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body6, %for.body6.us, %for.cond4.preheader %putchar30 = call i32 @putchar(i32 10) %inc19 = add nuw nsw i32 %i.038, 1 %8 = load i32, ptr %h, align 4, !tbaa !5 %cmp3.not.not = icmp slt i32 %i.038, %8 br i1 %cmp3.not.not, label %for.cond4.preheader, label %for.end20, !llvm.loop !11 for.end20: ; 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) %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.end22, label %for.cond2.preheader for.end22: ; 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(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++){ if(i==0||i==(H-1)) for(j=0;j<W;j++) printf("#"); else{ printf("#"); for(j=1;j<(W-1);j++) printf("."); printf("#"); } printf("\n"); } printf("\n"); } return(0); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100103/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100103/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call45 = 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 %cmp46 = icmp eq i32 %0, 0 %1 = load i32, ptr %W, align 4 %cmp147 = icmp eq i32 %1, 0 %or.cond48 = select i1 %cmp46, i1 %cmp147, i1 false br i1 %or.cond48, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end24 %2 = phi i32 [ %9, %for.end24 ], [ %0, %entry ] %cmp243 = icmp sgt i32 %2, 0 br i1 %cmp243, label %for.body, label %for.end24 for.body: ; preds = %for.cond.preheader, %if.end20 %3 = phi i32 [ %8, %if.end20 ], [ %2, %for.cond.preheader ] %i.044 = phi i32 [ %inc23, %if.end20 ], [ 0, %for.cond.preheader ] %cmp3 = icmp eq i32 %i.044, 0 %sub = add nsw i32 %3, -1 %cmp4 = icmp eq i32 %i.044, %sub %or.cond37 = select i1 %cmp3, i1 true, i1 %cmp4 br i1 %or.cond37, label %for.cond6.preheader, label %if.else for.cond6.preheader: ; preds = %for.body %4 = load i32, ptr %W, align 4, !tbaa !5 %cmp741 = icmp sgt i32 %4, 0 br i1 %cmp741, label %for.body8, label %if.end20 for.body8: ; preds = %for.cond6.preheader, %for.body8 %j.042 = phi i32 [ %inc, %for.body8 ], [ 0, %for.cond6.preheader ] %putchar36 = call i32 @putchar(i32 35) %inc = add nuw nsw i32 %j.042, 1 %5 = load i32, ptr %W, align 4, !tbaa !5 %cmp7 = icmp slt i32 %inc, %5 br i1 %cmp7, label %for.body8, label %if.end20, !llvm.loop !9 if.else: ; preds = %for.body %putchar32 = call i32 @putchar(i32 35) %6 = load i32, ptr %W, align 4, !tbaa !5 %cmp1339 = icmp sgt i32 %6, 2 br i1 %cmp1339, label %for.body14, label %for.end18 for.body14: ; preds = %if.else, %for.body14 %j.140 = phi i32 [ %inc17, %for.body14 ], [ 1, %if.else ] %putchar34 = call i32 @putchar(i32 46) %inc17 = add nuw nsw i32 %j.140, 1 %7 = load i32, ptr %W, align 4, !tbaa !5 %sub12 = add nsw i32 %7, -1 %cmp13 = icmp slt i32 %inc17, %sub12 br i1 %cmp13, label %for.body14, label %for.end18, !llvm.loop !11 for.end18: ; preds = %for.body14, %if.else %putchar33 = call i32 @putchar(i32 35) br label %if.end20 if.end20: ; preds = %for.body8, %for.cond6.preheader, %for.end18 %putchar35 = call i32 @putchar(i32 10) %inc23 = add nuw nsw i32 %i.044, 1 %8 = load i32, ptr %H, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc23, %8 br i1 %cmp2, label %for.body, label %for.end24, !llvm.loop !12 for.end24: ; preds = %if.end20, %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.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 = distinct !{!12, !10}
#include <stdio.h> int main(void){ int i=0,j=0,a,b; while(1){ scanf("%d %d",&a,&b); if(a == 0 && b == 0){break;} while(j != a){ while(i != b){ if(j == 0 || j == a-1){printf("#");} else if(i == 0 || i == b-1){printf("#");} else{printf(".");} ++i; } printf("\n"); ++j; i = 0; } j = 0; printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100154/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100154/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %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 %call44 = 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 %cmp45 = icmp eq i32 %0, 0 %1 = load i32, ptr %b, align 4 %cmp146 = icmp eq i32 %1, 0 %or.cond47 = select i1 %cmp45, i1 %cmp146, i1 false br i1 %or.cond47, label %while.end26, label %while.cond2.preheader while.cond2.preheader: ; preds = %entry, %while.end24 %2 = phi i32 [ %11, %while.end24 ], [ %0, %entry ] %cmp3.not41 = icmp eq i32 %2, 0 br i1 %cmp3.not41, label %while.end24, label %while.cond5.preheader while.cond5.preheader: ; preds = %while.cond2.preheader, %while.end %j.142 = phi i32 [ %inc23, %while.end ], [ 0, %while.cond2.preheader ] %3 = load i32, ptr %b, align 4, !tbaa !5 %cmp6.not38 = icmp eq i32 %3, 0 br i1 %cmp6.not38, label %while.end, label %while.body7.lr.ph while.body7.lr.ph: ; preds = %while.cond5.preheader %cmp8 = icmp eq i32 %j.142, 0 br i1 %cmp8, label %while.body7.us, label %while.body7.preheader while.body7.preheader: ; preds = %while.body7.lr.ph %putchar36.peel = call i32 @putchar(i32 35) %4 = load i32, ptr %b, align 4, !tbaa !5 %cmp6.not.peel = icmp eq i32 %4, 1 br i1 %cmp6.not.peel, label %while.end, label %while.body7 while.body7.us: ; preds = %while.body7.lr.ph, %while.body7.us %i.239.us = phi i32 [ %inc.us, %while.body7.us ], [ 0, %while.body7.lr.ph ] %putchar36.us = call i32 @putchar(i32 35) %inc.us = add nuw nsw i32 %i.239.us, 1 %5 = load i32, ptr %b, align 4, !tbaa !5 %cmp6.not.us = icmp eq i32 %inc.us, %5 br i1 %cmp6.not.us, label %while.end, label %while.body7.us, !llvm.loop !9 while.body7: ; preds = %while.body7.preheader, %while.body7 %6 = phi i32 [ %9, %while.body7 ], [ %4, %while.body7.preheader ] %i.239 = phi i32 [ %inc, %while.body7 ], [ 1, %while.body7.preheader ] %7 = load i32, ptr %a, align 4, !tbaa !5 %sub = add nsw i32 %7, -1 %cmp9 = icmp eq i32 %j.142, %sub %sub14 = add nsw i32 %6, -1 %cmp15 = icmp eq i32 %i.239, %sub14 %8 = select i1 %cmp9, i1 true, i1 %cmp15 %.sink = select i1 %8, i32 35, i32 46 %putchar35 = call i32 @putchar(i32 %.sink) %inc = add nuw nsw i32 %i.239, 1 %9 = load i32, ptr %b, align 4, !tbaa !5 %cmp6.not = icmp eq i32 %inc, %9 br i1 %cmp6.not, label %while.end, label %while.body7, !llvm.loop !11 while.end: ; preds = %while.body7, %while.body7.us, %while.body7.preheader, %while.cond5.preheader %putchar33 = call i32 @putchar(i32 10) %inc23 = add nuw nsw i32 %j.142, 1 %10 = load i32, ptr %a, align 4, !tbaa !5 %cmp3.not = icmp eq i32 %inc23, %10 br i1 %cmp3.not, label %while.end24, label %while.cond5.preheader, !llvm.loop !13 while.end24: ; preds = %while.end, %while.cond2.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) %11 = load i32, ptr %a, align 4, !tbaa !5 %cmp = icmp eq i32 %11, 0 %12 = load i32, ptr %b, align 4 %cmp1 = icmp eq i32 %12, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %while.end26, label %while.cond2.preheader while.end26: ; preds = %while.end24, %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, !12} !12 = !{!"llvm.loop.peeled.count", i32 1} !13 = distinct !{!13, !10}
#include<stdio.h> int main(){ int i,j; int H,W; for(;scanf("%d%d",&H,&W),H,W;){ 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_100198/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100198/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %W) %0 = load i32, ptr %W, align 4, !tbaa !5 %tobool.not38 = icmp eq i32 %0, 0 br i1 %tobool.not38, label %for.end20, label %for.cond1.preheader for.cond1.preheader: ; preds = %entry, %for.end18 %1 = load i32, ptr %H, align 4, !tbaa !5 %cmp34 = icmp sgt i32 %1, 0 br i1 %cmp34, label %for.cond3.preheader, label %for.end18 for.cond3.preheader: ; preds = %for.cond1.preheader, %for.end %i.035 = phi i32 [ %inc17, %for.end ], [ 0, %for.cond1.preheader ] %2 = load i32, ptr %W, align 4, !tbaa !5 %cmp431 = icmp sgt i32 %2, 0 br i1 %cmp431, label %for.body5.lr.ph, label %for.end for.body5.lr.ph: ; preds = %for.cond3.preheader %cmp6 = icmp eq i32 %i.035, 0 br i1 %cmp6, label %for.body5.us, label %for.body5 for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us %j.032.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ] %putchar29.us = call i32 @putchar(i32 35) %inc.us = add nuw nsw i32 %j.032.us, 1 %3 = load i32, ptr %W, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %inc.us, %3 br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9 for.body5: ; preds = %for.body5.lr.ph, %for.body5 %4 = phi i32 [ %6, %for.body5 ], [ %2, %for.body5.lr.ph ] %j.032 = phi i32 [ %inc, %for.body5 ], [ 0, %for.body5.lr.ph ] %5 = load i32, ptr %H, align 4, !tbaa !5 %sub = add nsw i32 %5, -1 %cmp7 = icmp eq i32 %i.035, %sub %cmp9 = icmp eq i32 %j.032, 0 %or.cond = or i1 %cmp9, %cmp7 %sub11 = add nsw i32 %4, -1 %cmp12 = icmp eq i32 %j.032, %sub11 %or.cond30 = select i1 %or.cond, i1 true, i1 %cmp12 %. = select i1 %or.cond30, i32 35, i32 46 %putchar29 = call i32 @putchar(i32 %.) %inc = add nuw nsw i32 %j.032, 1 %6 = load i32, ptr %W, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc, %6 br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body5, %for.body5.us, %for.cond3.preheader %putchar27 = call i32 @putchar(i32 10) %inc17 = add nuw nsw i32 %i.035, 1 %7 = load i32, ptr %H, align 4, !tbaa !5 %cmp = icmp slt i32 %inc17, %7 br i1 %cmp, label %for.cond3.preheader, label %for.end18, !llvm.loop !11 for.end18: ; preds = %for.end, %for.cond1.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) %8 = load i32, ptr %W, align 4, !tbaa !5 %tobool.not = icmp eq i32 %8, 0 br i1 %tobool.not, label %for.end20, label %for.cond1.preheader, !llvm.loop !12 for.end20: ; preds = %for.end18, %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,n; while(1){ scanf("%d %d",&h,&w); if(h==0&&w==0){break;}else { for(i=0;i<h;i++){ for(n=0;n<w;n++){ if(i==0||i==h-1||n==0||n==w-1){printf("#");} else{printf(".");} } printf("\n"); } } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100240/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100240/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call40 = 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 %cmp41 = icmp eq i32 %0, 0 %1 = load i32, ptr %w, align 4 %cmp142 = icmp eq i32 %1, 0 %or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false br i1 %or.cond43, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %if.end21 %2 = phi i32 [ %9, %if.end21 ], [ %0, %entry ] %cmp237 = icmp sgt i32 %2, 0 br i1 %cmp237, label %for.cond3.preheader, label %if.end21 for.cond3.preheader: ; preds = %for.cond.preheader, %for.end %i.038 = phi i32 [ %inc19, %for.end ], [ 0, %for.cond.preheader ] %3 = load i32, ptr %w, align 4, !tbaa !5 %cmp434 = icmp sgt i32 %3, 0 br i1 %cmp434, label %for.body5.lr.ph, label %for.end for.body5.lr.ph: ; preds = %for.cond3.preheader %cmp6 = icmp eq i32 %i.038, 0 br i1 %cmp6, label %for.body5.us, label %for.body5 for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us %n.035.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ] %putchar32.us = call i32 @putchar(i32 35) %inc.us = add nuw nsw i32 %n.035.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 ] %n.035 = 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.038, %sub %cmp9 = icmp eq i32 %n.035, 0 %or.cond23 = or i1 %cmp9, %cmp7 %sub11 = add nsw i32 %5, -1 %cmp12 = icmp eq i32 %n.035, %sub11 %or.cond33 = select i1 %or.cond23, i1 true, i1 %cmp12 %. = select i1 %or.cond33, i32 35, i32 46 %putchar32 = call i32 @putchar(i32 %.) %inc = add nuw nsw i32 %n.035, 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 %putchar30 = call i32 @putchar(i32 10) %inc19 = add nuw nsw i32 %i.038, 1 %8 = load i32, ptr %h, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc19, %8 br i1 %cmp2, label %for.cond3.preheader, label %if.end21, !llvm.loop !11 if.end21: ; 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 = %if.end21, %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_100284/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100284/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 a,b,H,W; while(1){ scanf("%d%d",&H,&W); if(H==0&&W==0){ break; } for(a=0;a<H;a++){ for(b=0;b<W;b++){ if(a==H-1||b==W-1||a==0||b==0){ printf("#"); }else{ printf("."); } } printf("\n"); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100334/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100334/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %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.end20 %2 = phi i32 [ %9, %for.end20 ], [ %0, %entry ] %cmp235 = icmp sgt i32 %2, 0 br i1 %cmp235, label %for.cond3.preheader, label %for.end20 for.cond3.preheader: ; preds = %for.cond.preheader, %for.end %a.036 = 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 %cmp10 = icmp eq i32 %a.036, 0 br i1 %cmp10, label %for.body5.us, label %for.body5 for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us %b.034.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ] %putchar32.us = call i32 @putchar(i32 35) %inc.us = add nuw nsw i32 %b.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.inc %5 = phi i32 [ %7, %for.inc ], [ %3, %for.body5.lr.ph ] %b.034 = phi i32 [ %inc, %for.inc ], [ 0, %for.body5.lr.ph ] %6 = load i32, ptr %H, align 4, !tbaa !5 %sub = add nsw i32 %6, -1 %cmp6 = icmp eq i32 %a.036, %sub br i1 %cmp6, label %for.inc, label %lor.lhs.false lor.lhs.false: ; preds = %for.body5 %sub7 = add nsw i32 %5, -1 %cmp8 = icmp eq i32 %b.034, %sub7 %cmp12 = icmp eq i32 %b.034, 0 %or.cond23 = or i1 %cmp12, %cmp8 %spec.select = select i1 %or.cond23, i32 35, i32 46 br label %for.inc for.inc: ; preds = %lor.lhs.false, %for.body5 %.sink = phi i32 [ 35, %for.body5 ], [ %spec.select, %lor.lhs.false ] %putchar32 = call i32 @putchar(i32 %.sink) %inc = add nuw nsw i32 %b.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.inc, %for.body5.us, %for.cond3.preheader %putchar30 = call i32 @putchar(i32 10) %inc19 = add nuw nsw i32 %a.036, 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(void){ int i, j, h, w; 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_100420/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100420/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %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 argc, const char * argv[]) { int depth,width,i,j; while(1){ scanf("%d %d",&depth,&width); if(depth==0 && width==0){ break; } for(i = 0;depth > i;i+=1){ for(j = 0;width > j;j+=1){ if(i==0||j==0||j==width-1||i==depth-1){ printf("#"); }else{ printf("."); } } printf("\n"); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100550/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100550/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 { entry: %depth = alloca i32, align 4 %width = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %depth) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %width) #4 %call38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %depth, ptr noundef nonnull %width) %0 = load i32, ptr %depth, align 4, !tbaa !5 %cmp39 = icmp eq i32 %0, 0 %1 = load i32, ptr %width, 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.end20 %2 = phi i32 [ %10, %for.end20 ], [ %0, %entry ] %cmp235 = icmp sgt i32 %2, 0 br i1 %cmp235, label %for.cond3.preheader, label %for.end20 for.cond3.preheader: ; preds = %for.cond.preheader, %for.end %i.036 = phi i32 [ %add19, %for.end ], [ 0, %for.cond.preheader ] %3 = load i32, ptr %width, 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.036, 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 %width, align 4, !tbaa !5 %cmp4.peel = icmp sgt i32 %.pre, 1 br i1 %cmp4.peel, label %for.body5, label %for.end for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us %j.034.us = phi i32 [ %add.us, %for.body5.us ], [ 0, %for.body5.lr.ph ] %putchar31.us = call i32 @putchar(i32 35) %add.us = add nuw nsw i32 %j.034.us, 1 %4 = load i32, ptr %width, align 4, !tbaa !5 %cmp4.us = icmp sgt i32 %4, %add.us br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !9 for.body5: ; preds = %for.inc.peel, %for.body5 %5 = phi i32 [ %8, %for.body5 ], [ %.pre, %for.inc.peel ] %j.034 = phi i32 [ %add, %for.body5 ], [ 1, %for.inc.peel ] %sub = add nsw i32 %5, -1 %cmp9 = icmp eq i32 %j.034, %sub %6 = load i32, ptr %depth, align 4 %sub11 = add nsw i32 %6, -1 %cmp12 = icmp eq i32 %i.036, %sub11 %7 = select i1 %cmp9, i1 true, i1 %cmp12 %.sink = select i1 %7, i32 35, i32 46 %putchar31 = call i32 @putchar(i32 %.sink) %add = add nuw nsw i32 %j.034, 1 %8 = load i32, ptr %width, align 4, !tbaa !5 %cmp4 = icmp sgt i32 %8, %add br i1 %cmp4, 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) %add19 = add nuw nsw i32 %i.036, 1 %9 = load i32, ptr %depth, align 4, !tbaa !5 %cmp2 = icmp sgt i32 %9, %add19 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 %depth, ptr noundef nonnull %width) %10 = load i32, ptr %depth, align 4, !tbaa !5 %cmp = icmp eq i32 %10, 0 %11 = load i32, ptr %width, 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.end20, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %width) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %depth) #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,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_100600/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100600/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %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> void sp(int n, int m) { int i, j; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { if (i == 0 && n - 1 && m - 1 || j == 0 && n - 1 && m - 1 || i == n - 1 && n - 1 && m - 1 || j == m - 1 && m - 1 && m - 1) putchar('#'); else putchar('.'); }putchar('\n'); } } int main() { int H[300], W[300]; int i; for (i = 0;; i++) { scanf("%d %d", &H[i], &W[i]); if (H[i] == 0 && W[i] == 0) break; } for (int k = 0; k < i; k++) { sp(H[k], W[k]); putchar('\n'); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100666/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100666/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local void @sp(i32 noundef %n, i32 noundef %m) local_unnamed_addr #0 { entry: %cmp74 = icmp sgt i32 %n, 0 br i1 %cmp74, label %for.cond1.preheader.lr.ph, label %for.end37 for.cond1.preheader.lr.ph: ; preds = %entry %cmp262 = icmp sgt i32 %m, 0 %tobool7.not = icmp eq i32 %m, 1 %sub16 = add nsw i32 %n, -1 %tobool20.not = icmp eq i32 %sub16, 0 %sub25 = add i32 %m, -1 %tobool29.not = icmp eq i32 %sub25, 0 br i1 %cmp262, label %for.cond1.preheader.lr.ph.split.us, label %for.cond1.preheader for.cond1.preheader.lr.ph.split.us: ; preds = %for.cond1.preheader.lr.ph %tobool.not = icmp eq i32 %n, 1 %0 = or i1 %tobool7.not, %tobool.not br i1 %0, label %for.cond1.preheader.lr.ph.split.us.split.us.split.us.split.us, label %for.cond1.preheader.us for.cond1.preheader.lr.ph.split.us.split.us.split.us.split.us: ; preds = %for.cond1.preheader.lr.ph.split.us br i1 %tobool29.not, label %for.cond1.preheader.us.us.us.us.us, label %for.cond1.preheader.us.us.us.us for.cond1.preheader.us.us.us.us.us: ; preds = %for.cond1.preheader.lr.ph.split.us.split.us.split.us.split.us, %for.cond1.preheader.us.us.us.us.us %i.075.us.us.us.us.us = phi i32 [ %inc36.us.us.us.us.us, %for.cond1.preheader.us.us.us.us.us ], [ 0, %for.cond1.preheader.lr.ph.split.us.split.us.split.us.split.us ] %cmp17.us.us.us.us.us = icmp ne i32 %i.075.us.us.us.us.us, %sub16 %or.cond57.us.us.us.us.us = or i1 %tobool20.not, %cmp17.us.us.us.us.us %or.cond57.us.us.us.us.us.fr = freeze i1 %or.cond57.us.us.us.us.us %or.cond58.us.us.us.us.us = or i1 %tobool7.not, %or.cond57.us.us.us.us.us.fr %spec.select = select i1 %or.cond58.us.us.us.us.us, i32 46, i32 35 %1 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i.us.us71.us.us.us.us.us = tail call i32 @putc(i32 noundef %spec.select, ptr noundef %1) %2 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i61.us.us.us.us.us = tail call i32 @putc(i32 noundef 10, ptr noundef %2) %inc36.us.us.us.us.us = add nuw nsw i32 %i.075.us.us.us.us.us, 1 %exitcond133.not = icmp eq i32 %inc36.us.us.us.us.us, %n br i1 %exitcond133.not, label %for.end37, label %for.cond1.preheader.us.us.us.us.us, !llvm.loop !9 for.cond1.preheader.us.us.us.us: ; preds = %for.cond1.preheader.lr.ph.split.us.split.us.split.us.split.us, %for.cond1.for.end_crit_edge.split.us.us.us.us.us %i.075.us.us.us.us = phi i32 [ %inc36.us.us.us.us, %for.cond1.for.end_crit_edge.split.us.us.us.us.us ], [ 0, %for.cond1.preheader.lr.ph.split.us.split.us.split.us.split.us ] %cmp17.us.us.us.us = icmp ne i32 %i.075.us.us.us.us, %sub16 %or.cond57.us.us.us.us = or i1 %tobool20.not, %cmp17.us.us.us.us %or.cond57.us.us.us.us.fr = freeze i1 %or.cond57.us.us.us.us %or.cond58.us.us.us.us = or i1 %tobool7.not, %or.cond57.us.us.us.us.fr br i1 %or.cond58.us.us.us.us, label %for.body3.us.us.us.us.us.us.us95, label %for.body3.us.us64.us.us.us.us for.cond1.for.end_crit_edge.split.us.us.us.us.us: ; preds = %for.body3.us.us64.us.us.us.us, %for.body3.us.us.us.us.us.us.us95 %3 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i61.us.us.us.us = tail call i32 @putc(i32 noundef 10, ptr noundef %3) %inc36.us.us.us.us = add nuw nsw i32 %i.075.us.us.us.us, 1 %exitcond130.not = icmp eq i32 %inc36.us.us.us.us, %n br i1 %exitcond130.not, label %for.end37, label %for.cond1.preheader.us.us.us.us, !llvm.loop !9 for.body3.us.us64.us.us.us.us: ; preds = %for.cond1.preheader.us.us.us.us, %for.body3.us.us64.us.us.us.us %j.063.us.us65.us.us.us.us = phi i32 [ %inc.us.us72.us.us.us.us, %for.body3.us.us64.us.us.us.us ], [ 0, %for.cond1.preheader.us.us.us.us ] %4 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i.us.us71.us.us.us.us = tail call i32 @putc(i32 noundef 35, ptr noundef %4) %inc.us.us72.us.us.us.us = add nuw nsw i32 %j.063.us.us65.us.us.us.us, 1 %exitcond128.not = icmp eq i32 %inc.us.us72.us.us.us.us, %m br i1 %exitcond128.not, label %for.cond1.for.end_crit_edge.split.us.us.us.us.us, label %for.body3.us.us64.us.us.us.us, !llvm.loop !11 for.body3.us.us.us.us.us.us.us95: ; preds = %for.cond1.preheader.us.us.us.us, %for.body3.us.us.us.us.us.us.us95 %j.063.us.us.us.us.us.us.us96 = phi i32 [ %inc.us.us.us.us.us.us.us98, %for.body3.us.us.us.us.us.us.us95 ], [ 0, %for.cond1.preheader.us.us.us.us ] %cmp26.us.us.us.us.us.us.us.not = icmp eq i32 %j.063.us.us.us.us.us.us.us96, %sub25 %5 = load ptr, ptr @stdout, align 8, !tbaa !5 %. = select i1 %cmp26.us.us.us.us.us.us.us.not, i32 35, i32 46 %call.i60.us.us.us.us.us.us.us97 = tail call i32 @putc(i32 noundef %., ptr noundef %5) %inc.us.us.us.us.us.us.us98 = add nuw nsw i32 %j.063.us.us.us.us.us.us.us96, 1 %exitcond129.not = icmp eq i32 %inc.us.us.us.us.us.us.us98, %m br i1 %exitcond129.not, label %for.cond1.for.end_crit_edge.split.us.us.us.us.us, label %for.body3.us.us.us.us.us.us.us95, !llvm.loop !11 for.cond1.preheader.us: ; preds = %for.cond1.preheader.lr.ph.split.us, %for.cond1.for.end_crit_edge.us %i.075.us = phi i32 [ %inc36.us, %for.cond1.for.end_crit_edge.us ], [ 0, %for.cond1.preheader.lr.ph.split.us ] %cmp4.us.not = icmp eq i32 %i.075.us, 0 br i1 %cmp4.us.not, label %for.body3.us76, label %for.body3.lr.ph.split.us.us for.body3.us76: ; preds = %for.cond1.preheader.us, %for.body3.us76 %j.063.us77 = phi i32 [ %inc.us79, %for.body3.us76 ], [ 0, %for.cond1.preheader.us ] %6 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i.us78 = tail call i32 @putc(i32 noundef 35, ptr noundef %6) %inc.us79 = add nuw nsw i32 %j.063.us77, 1 %exitcond116.not = icmp eq i32 %inc.us79, %m br i1 %exitcond116.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us76, !llvm.loop !11 for.cond1.for.end_crit_edge.us: ; preds = %for.body3.us.us83, %for.body3.us.us.us, %for.body3.us76 %7 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i61.us = tail call i32 @putc(i32 noundef 10, ptr noundef %7) %inc36.us = add nuw nsw i32 %i.075.us, 1 %exitcond119.not = icmp eq i32 %inc36.us, %n br i1 %exitcond119.not, label %for.end37, label %for.cond1.preheader.us, !llvm.loop !9 for.body3.lr.ph.split.us.us: ; preds = %for.cond1.preheader.us %cmp17.us = icmp ne i32 %i.075.us, %sub16 %or.cond57.us = or i1 %tobool20.not, %cmp17.us %or.cond57.us.fr = freeze i1 %or.cond57.us br i1 %or.cond57.us.fr, label %for.body3.us.us.us, label %for.body3.us.us83 for.body3.us.us83: ; preds = %for.body3.lr.ph.split.us.us, %for.body3.us.us83 %j.063.us.us84 = phi i32 [ %inc.us.us89, %for.body3.us.us83 ], [ 0, %for.body3.lr.ph.split.us.us ] %8 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i.us.us88 = tail call i32 @putc(i32 noundef 35, ptr noundef %8) %inc.us.us89 = add nuw nsw i32 %j.063.us.us84, 1 %exitcond117.not = icmp eq i32 %inc.us.us89, %m br i1 %exitcond117.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us.us83, !llvm.loop !11 for.body3.us.us.us: ; preds = %for.body3.lr.ph.split.us.us, %for.body3.us.us.us %j.063.us.us.us = phi i32 [ %inc.us.us.us, %for.body3.us.us.us ], [ 0, %for.body3.lr.ph.split.us.us ] %cmp8.us.us.us = icmp ne i32 %j.063.us.us.us, 0 %cmp26.us.us.us = icmp ne i32 %j.063.us.us.us, %sub25 %or.cond59.us.us.us = or i1 %tobool29.not, %cmp26.us.us.us %or.cond103 = and i1 %cmp8.us.us.us, %or.cond59.us.us.us %9 = load ptr, ptr @stdout, align 8, !tbaa !5 %.142 = select i1 %or.cond103, i32 46, i32 35 %call.i60.us.us.us = tail call i32 @putc(i32 noundef %.142, ptr noundef %9) %inc.us.us.us = add nuw nsw i32 %j.063.us.us.us, 1 %exitcond118.not = icmp eq i32 %inc.us.us.us, %m br i1 %exitcond118.not, label %for.cond1.for.end_crit_edge.us, label %for.body3.us.us.us, !llvm.loop !11 for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.preheader %i.075 = phi i32 [ %inc36, %for.cond1.preheader ], [ 0, %for.cond1.preheader.lr.ph ] %10 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i61 = tail call i32 @putc(i32 noundef 10, ptr noundef %10) %inc36 = add nuw nsw i32 %i.075, 1 %exitcond.not = icmp eq i32 %inc36, %n br i1 %exitcond.not, label %for.end37, label %for.cond1.preheader, !llvm.loop !9 for.end37: ; preds = %for.cond1.preheader, %for.cond1.for.end_crit_edge.us, %for.cond1.for.end_crit_edge.split.us.us.us.us.us, %for.cond1.preheader.us.us.us.us.us, %entry ret void } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree 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 [300 x i32], align 16 %W = alloca [300 x i32], align 16 call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %H) #3 call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %W) #3 br label %for.cond for.cond: ; preds = %for.inc, %entry %indvars.iv32 = phi i32 [ %indvars.iv.next33, %for.inc ], [ 0, %entry ] %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ] %arrayidx = getelementptr inbounds [300 x i32], ptr %H, i64 0, i64 %indvars.iv %arrayidx2 = getelementptr inbounds [300 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 !12 %cmp = icmp eq i32 %0, 0 br i1 %cmp, label %land.lhs.true, label %for.inc land.lhs.true: ; preds = %for.cond %1 = load i32, ptr %arrayidx2, align 4, !tbaa !12 %cmp7 = icmp eq i32 %1, 0 br i1 %cmp7, label %for.cond8.preheader, label %for.inc for.cond8.preheader: ; preds = %land.lhs.true %2 = and i64 %indvars.iv, 4294967295 %cmp926.not = icmp eq i64 %2, 0 br i1 %cmp926.not, label %for.cond.cleanup, label %for.body.preheader for.body.preheader: ; preds = %for.cond8.preheader %wide.trip.count = zext i32 %indvars.iv32 to i64 br label %for.body for.inc: ; preds = %for.cond, %land.lhs.true %indvars.iv.next = add nuw i64 %indvars.iv, 1 %indvars.iv.next33 = add nuw i32 %indvars.iv32, 1 br label %for.cond for.cond.cleanup: ; preds = %for.body, %for.cond8.preheader call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %W) #3 call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %H) #3 ret i32 0 for.body: ; preds = %for.body.preheader, %for.body %indvars.iv29 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next30, %for.body ] %arrayidx11 = getelementptr inbounds [300 x i32], ptr %H, i64 0, i64 %indvars.iv29 %3 = load i32, ptr %arrayidx11, align 4, !tbaa !12 %arrayidx13 = getelementptr inbounds [300 x i32], ptr %W, i64 0, i64 %indvars.iv29 %4 = load i32, ptr %arrayidx13, align 4, !tbaa !12 call void @sp(i32 noundef %3, i32 noundef %4) %5 = load ptr, ptr @stdout, align 8, !tbaa !5 %call.i = call i32 @putc(i32 noundef 10, ptr noundef %5) %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1 %exitcond.not = icmp eq i64 %indvars.iv.next30, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !14 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="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 = !{!"any pointer", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = !{!13, !13, i64 0} !13 = !{!"int", !7, i64 0} !14 = distinct !{!14, !10}
#include <stdio.h> int main(){ int h, w; while(1){ scanf("%d %d", &h, &w); if(h == 0 && w == 0){break;} 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"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100709/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100709/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call40 = 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 %cmp41 = icmp eq i32 %0, 0 %1 = load i32, ptr %w, align 4 %cmp142 = icmp eq i32 %1, 0 %or.cond43 = select i1 %cmp41, i1 %cmp142, i1 false br i1 %or.cond43, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.cond.cleanup %2 = phi i32 [ %5, %for.cond.cleanup ], [ %0, %entry ] %cmp237 = icmp sgt i32 %2, 0 br i1 %cmp237, label %for.cond3.preheader, label %for.cond.cleanup for.cond3.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup5 %i.038 = phi i32 [ %inc20, %for.cond.cleanup5 ], [ 0, %for.cond.preheader ] %3 = load i32, ptr %w, align 4, !tbaa !5 %cmp434 = icmp sgt i32 %3, 0 br i1 %cmp434, label %for.body6.lr.ph, label %for.cond.cleanup5 for.body6.lr.ph: ; preds = %for.cond3.preheader %cmp7 = icmp eq i32 %i.038, 0 br i1 %cmp7, label %for.body6.us, label %for.body6 for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us %j.035.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ] %putchar32.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.us = icmp slt i32 %inc.us, %4 br i1 %cmp4.us, label %for.body6.us, label %for.cond.cleanup5, !llvm.loop !9 for.cond.cleanup: ; preds = %for.cond.cleanup5, %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) %5 = load i32, ptr %h, align 4, !tbaa !5 %cmp = icmp eq i32 %5, 0 %6 = load i32, ptr %w, align 4 %cmp1 = icmp eq i32 %6, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %while.end, label %for.cond.preheader for.cond.cleanup5: ; preds = %for.body6, %for.body6.us, %for.cond3.preheader %putchar30 = call i32 @putchar(i32 10) %inc20 = add nuw nsw i32 %i.038, 1 %7 = load i32, ptr %h, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc20, %7 br i1 %cmp2, label %for.cond3.preheader, label %for.cond.cleanup, !llvm.loop !11 for.body6: ; preds = %for.body6.lr.ph, %for.body6 %8 = phi i32 [ %10, %for.body6 ], [ %3, %for.body6.lr.ph ] %j.035 = phi i32 [ %inc, %for.body6 ], [ 0, %for.body6.lr.ph ] %9 = load i32, ptr %h, align 4, !tbaa !5 %sub = add nsw i32 %9, -1 %cmp8 = icmp eq i32 %i.038, %sub %cmp10 = icmp eq i32 %j.035, 0 %or.cond23 = or i1 %cmp10, %cmp8 %sub12 = add nsw i32 %8, -1 %cmp13 = icmp eq i32 %j.035, %sub12 %or.cond33 = select i1 %or.cond23, i1 true, i1 %cmp13 %. = select i1 %or.cond33, i32 35, i32 46 %putchar32 = call i32 @putchar(i32 %.) %inc = add nuw nsw i32 %j.035, 1 %10 = load i32, ptr %w, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc, %10 br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !9 while.end: ; preds = %for.cond.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(void){ int H, W; while(1){ scanf("%d %d", &H, &W); if(H == 0 && W == 0) break; for(int i=0; i<H; i++){ for(int j=0; j<W; j++){ if(i == 0 || i == H-1) printf("#"); else if(j == 0 || j == W-1) printf("#"); else if(i != 0 && i != H-1) printf("."); } printf("\n"); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_100882/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100882/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call51 = 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 %cmp52 = icmp eq i32 %0, 0 %1 = load i32, ptr %W, align 4 %cmp153 = icmp eq i32 %1, 0 %or.cond54 = select i1 %cmp52, i1 %cmp153, i1 false br i1 %or.cond54, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.cond.cleanup %2 = phi i32 [ %6, %for.cond.cleanup ], [ %0, %entry ] %cmp248 = icmp sgt i32 %2, 0 br i1 %cmp248, label %for.cond3.preheader, label %for.cond.cleanup for.cond3.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup5 %i.049 = phi i32 [ %inc29, %for.cond.cleanup5 ], [ 0, %for.cond.preheader ] %3 = load i32, ptr %W, align 4, !tbaa !5 %cmp445 = icmp sgt i32 %3, 0 br i1 %cmp445, label %for.body6.lr.ph, label %for.cond.cleanup5 for.body6.lr.ph: ; preds = %for.cond3.preheader %cmp7 = icmp eq i32 %i.049, 0 br i1 %cmp7, label %for.body6.us, label %for.body6.preheader for.body6.preheader: ; preds = %for.body6.lr.ph %putchar43.peel = call i32 @putchar(i32 35) %4 = load i32, ptr %W, align 4, !tbaa !5 %cmp4.peel = icmp sgt i32 %4, 1 br i1 %cmp4.peel, label %for.body6, label %for.cond.cleanup5 for.body6.us: ; preds = %for.body6.lr.ph, %for.body6.us %j.046.us = phi i32 [ %inc.us, %for.body6.us ], [ 0, %for.body6.lr.ph ] %putchar43.us = call i32 @putchar(i32 35) %inc.us = add nuw nsw i32 %j.046.us, 1 %5 = load i32, ptr %W, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %inc.us, %5 br i1 %cmp4.us, label %for.body6.us, label %for.cond.cleanup5, !llvm.loop !9 for.cond.cleanup: ; preds = %for.cond.cleanup5, %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) %6 = load i32, ptr %H, align 4, !tbaa !5 %cmp = icmp eq i32 %6, 0 %7 = load i32, ptr %W, align 4 %cmp1 = icmp eq i32 %7, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %while.end, label %for.cond.preheader for.cond.cleanup5: ; preds = %for.body6, %for.body6.us, %for.body6.preheader, %for.cond3.preheader %putchar40 = call i32 @putchar(i32 10) %inc29 = add nuw nsw i32 %i.049, 1 %8 = load i32, ptr %H, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc29, %8 br i1 %cmp2, label %for.cond3.preheader, label %for.cond.cleanup, !llvm.loop !11 for.body6: ; preds = %for.body6.preheader, %for.body6 %9 = phi i32 [ %12, %for.body6 ], [ %4, %for.body6.preheader ] %j.046 = phi i32 [ %inc, %for.body6 ], [ 1, %for.body6.preheader ] %10 = load i32, ptr %H, align 4, !tbaa !5 %sub = add nsw i32 %10, -1 %cmp8 = icmp eq i32 %i.049, %sub %sub13 = add nsw i32 %9, -1 %cmp14 = icmp eq i32 %j.046, %sub13 %11 = select i1 %cmp8, i1 true, i1 %cmp14 %.sink = select i1 %11, i32 35, i32 46 %putchar43 = call i32 @putchar(i32 %.sink) %inc = add nuw nsw i32 %j.046, 1 %12 = load i32, ptr %W, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc, %12 br i1 %cmp4, label %for.body6, label %for.cond.cleanup5, !llvm.loop !12 while.end: ; preds = %for.cond.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} !12 = distinct !{!12, !10, !13} !13 = !{!"llvm.loop.peeled.count", i32 1}
#include <stdio.h> int main(void) { int h,w,i,j; while(1){ scanf("%d%d",&h,&w); if(h==0 && w==0){ break; } i=h; j=w; 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_100932/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_100932/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %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 argc, const char * argv[]) { int H,W; while (1) { scanf("%d %d",&H,&W); if(H==0 && W==0) break; for(int i=0; i<H; i++) { if (i==0 || i==H-1) { for(int j=0; j<W; j++) { printf("#"); } } else { for(int j=0; j<W; j++) { if(j==0 || j==W-1) { printf("#"); }else { printf("."); } } } printf("\n"); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101025/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101025/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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(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) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4 %call55 = 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 %cmp56 = icmp eq i32 %0, 0 %1 = load i32, ptr %W, align 4 %cmp157 = icmp eq i32 %1, 0 %or.cond58 = select i1 %cmp56, i1 %cmp157, i1 false br i1 %or.cond58, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.cond.cleanup %2 = phi i32 [ %3, %for.cond.cleanup ], [ %0, %entry ] %cmp253 = icmp sgt i32 %2, 0 br i1 %cmp253, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %if.end28, %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) %3 = load i32, ptr %H, align 4, !tbaa !5 %cmp = icmp eq i32 %3, 0 %4 = load i32, ptr %W, align 4 %cmp1 = icmp eq i32 %4, 0 %or.cond = select i1 %cmp, i1 %cmp1, i1 false br i1 %or.cond, label %while.end, label %for.cond.preheader for.body: ; preds = %for.cond.preheader, %if.end28 %5 = phi i32 [ %10, %if.end28 ], [ %2, %for.cond.preheader ] %i.054 = phi i32 [ %inc31, %if.end28 ], [ 0, %for.cond.preheader ] %cmp3 = icmp eq i32 %i.054, 0 %sub = add nsw i32 %5, -1 %cmp4 = icmp eq i32 %i.054, %sub %or.cond46 = select i1 %cmp3, i1 true, i1 %cmp4 %6 = load i32, ptr %W, align 4, !tbaa !5 %cmp751 = icmp sgt i32 %6, 0 br i1 %or.cond46, label %for.cond6.preheader, label %for.cond12.preheader for.cond12.preheader: ; preds = %for.body br i1 %cmp751, label %for.inc25.peel, label %if.end28 for.inc25.peel: ; preds = %for.cond12.preheader %putchar43.peel = call i32 @putchar(i32 35) %.pre = load i32, ptr %W, align 4, !tbaa !5 %cmp13.peel = icmp sgt i32 %.pre, 1 br i1 %cmp13.peel, label %for.body15, label %if.end28 for.cond6.preheader: ; preds = %for.body br i1 %cmp751, label %for.body9, label %if.end28 for.body9: ; preds = %for.cond6.preheader, %for.body9 %j.052 = phi i32 [ %inc, %for.body9 ], [ 0, %for.cond6.preheader ] %putchar45 = call i32 @putchar(i32 35) %inc = add nuw nsw i32 %j.052, 1 %7 = load i32, ptr %W, align 4, !tbaa !5 %cmp7 = icmp slt i32 %inc, %7 br i1 %cmp7, label %for.body9, label %if.end28, !llvm.loop !9 for.body15: ; preds = %for.inc25.peel, %for.body15 %8 = phi i32 [ %9, %for.body15 ], [ %.pre, %for.inc25.peel ] %j11.050 = phi i32 [ %inc26, %for.body15 ], [ 1, %for.inc25.peel ] %sub18 = add nsw i32 %8, -1 %cmp19 = icmp eq i32 %j11.050, %sub18 %. = select i1 %cmp19, i32 35, i32 46 %putchar43 = call i32 @putchar(i32 %.) %inc26 = add nuw nsw i32 %j11.050, 1 %9 = load i32, ptr %W, align 4, !tbaa !5 %cmp13 = icmp slt i32 %inc26, %9 br i1 %cmp13, label %for.body15, label %if.end28, !llvm.loop !11 if.end28: ; preds = %for.body15, %for.body9, %for.inc25.peel, %for.cond12.preheader, %for.cond6.preheader %putchar44 = call i32 @putchar(i32 10) %inc31 = add nuw nsw i32 %i.054, 1 %10 = load i32, ptr %H, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc31, %10 br i1 %cmp2, label %for.body, label %for.cond.cleanup, !llvm.loop !13 while.end: ; preds = %for.cond.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, !12} !12 = !{!"llvm.loop.peeled.count", i32 1} !13 = distinct !{!13, !10}
#include<stdio.h> int main(){ int H=0; int W=0; do{ scanf("%d %d",&H,&W); if(H*W==0)break; for(int i=0;i<H;i++){ for(int j=0;j<W;j++){ if((i%(H-1)!=0)&&(j%(W-1)!=0)){ printf("."); } else{ printf("#"); } } puts(""); } puts(""); }while(H*W!=0); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101111/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101111/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 store i32 0, ptr %H, align 4, !tbaa !5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %W) #4 store i32 0, ptr %W, align 4, !tbaa !5 br label %do.body do.body: ; preds = %for.cond.cleanup, %entry %call = 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 %1 = load i32, ptr %W, align 4, !tbaa !5 %mul = mul nsw i32 %1, %0 %cmp = icmp eq i32 %mul, 0 br i1 %cmp, label %do.end, label %for.cond.preheader for.cond.preheader: ; preds = %do.body %cmp131 = icmp sgt i32 %0, 0 br i1 %cmp131, label %for.cond2.preheader, label %for.cond.cleanup for.cond2.preheader: ; preds = %for.cond.preheader, %for.cond.cleanup4 %i.032 = phi i32 [ %inc16, %for.cond.cleanup4 ], [ 0, %for.cond.preheader ] %2 = load i32, ptr %W, align 4, !tbaa !5 %cmp328 = icmp sgt i32 %2, 0 br i1 %cmp328, label %for.body5, label %for.cond.cleanup4 for.cond.cleanup: ; preds = %for.cond.cleanup4, %for.cond.preheader %putchar = call i32 @putchar(i32 10) %3 = load i32, ptr %H, align 4, !tbaa !5 %4 = load i32, ptr %W, align 4, !tbaa !5 %mul19 = mul nsw i32 %4, %3 %cmp20.not = icmp eq i32 %mul19, 0 br i1 %cmp20.not, label %do.end, label %do.body, !llvm.loop !9 for.cond.cleanup4: ; preds = %for.inc, %for.cond2.preheader %putchar25 = call i32 @putchar(i32 10) %inc16 = add nuw nsw i32 %i.032, 1 %5 = load i32, ptr %H, align 4, !tbaa !5 %cmp1 = icmp slt i32 %inc16, %5 br i1 %cmp1, label %for.cond2.preheader, label %for.cond.cleanup, !llvm.loop !11 for.body5: ; preds = %for.cond2.preheader, %for.inc %6 = phi i32 [ %8, %for.inc ], [ %2, %for.cond2.preheader ] %j.029 = phi i32 [ %inc, %for.inc ], [ 0, %for.cond2.preheader ] %7 = load i32, ptr %H, align 4, !tbaa !5 %sub = add nsw i32 %7, -1 %rem = srem i32 %i.032, %sub %cmp6.not = icmp eq i32 %rem, 0 br i1 %cmp6.not, label %if.else, label %land.lhs.true land.lhs.true: ; preds = %for.body5 %sub7 = add nsw i32 %6, -1 %rem8 = srem i32 %j.029, %sub7 %cmp9.not = icmp eq i32 %rem8, 0 br i1 %cmp9.not, label %if.else, label %for.inc if.else: ; preds = %land.lhs.true, %for.body5 br label %for.inc for.inc: ; preds = %land.lhs.true, %if.else %.sink = phi i32 [ 35, %if.else ], [ 46, %land.lhs.true ] %putchar27 = call i32 @putchar(i32 %.sink) %inc = add nuw nsw i32 %j.029, 1 %8 = load i32, ptr %W, align 4, !tbaa !5 %cmp3 = icmp slt i32 %inc, %8 br i1 %cmp3, label %for.body5, label %for.cond.cleanup4, !llvm.loop !12 do.end: ; preds = %do.body, %for.cond.cleanup 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; int i = 0; char sh = '#'; char dot ='.'; for (; i < 10000; i++){ scanf("%d %d", &H, &W); if( H == 0 && W == 0){ break; } int j = 0; for(; j < H;j++){ int k = 0; for(; k < W; k++){ if(j ==0 || j==H-1 || k==0 || k==W-1){ printf("%c",sh); }else{ printf("%c",dot); } } printf("\n"); } printf("\n"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101155/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101155/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 br label %for.body for.body: ; preds = %entry, %for.end24 %i.047 = phi i32 [ 0, %entry ], [ %inc27, %for.end24 ] %call = 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 %cmp1 = icmp eq i32 %0, 0 %1 = load i32, ptr %W, align 4 %cmp2 = icmp eq i32 %1, 0 %or.cond = select i1 %cmp1, i1 %cmp2, i1 false br i1 %or.cond, label %for.end28, label %for.cond3.preheader for.cond3.preheader: ; preds = %for.body %cmp444 = icmp sgt i32 %0, 0 br i1 %cmp444, label %for.cond6.preheader, label %for.end24 for.cond6.preheader: ; preds = %for.cond3.preheader, %for.end %j.045 = phi i32 [ %inc23, %for.end ], [ 0, %for.cond3.preheader ] %2 = load i32, ptr %W, align 4, !tbaa !5 %cmp741 = icmp sgt i32 %2, 0 br i1 %cmp741, label %for.body8.lr.ph, label %for.end for.body8.lr.ph: ; preds = %for.cond6.preheader %cmp9 = icmp eq i32 %j.045, 0 br i1 %cmp9, label %for.body8.us, label %for.body8 for.body8.us: ; preds = %for.body8.lr.ph, %for.body8.us %k.042.us = phi i32 [ %inc.us, %for.body8.us ], [ 0, %for.body8.lr.ph ] %putchar39.us = call i32 @putchar(i32 35) %inc.us = add nuw nsw i32 %k.042.us, 1 %3 = load i32, ptr %W, align 4, !tbaa !5 %cmp7.us = icmp slt i32 %inc.us, %3 br i1 %cmp7.us, label %for.body8.us, label %for.end, !llvm.loop !9 for.body8: ; preds = %for.body8.lr.ph, %for.body8 %4 = phi i32 [ %6, %for.body8 ], [ %2, %for.body8.lr.ph ] %k.042 = phi i32 [ %inc, %for.body8 ], [ 0, %for.body8.lr.ph ] %5 = load i32, ptr %H, align 4, !tbaa !5 %sub = add nsw i32 %5, -1 %cmp10 = icmp eq i32 %j.045, %sub %cmp12 = icmp eq i32 %k.042, 0 %or.cond29 = or i1 %cmp12, %cmp10 %sub14 = add nsw i32 %4, -1 %cmp15 = icmp eq i32 %k.042, %sub14 %or.cond40 = select i1 %or.cond29, i1 true, i1 %cmp15 %. = select i1 %or.cond40, i32 35, i32 46 %putchar39 = call i32 @putchar(i32 %.) %inc = add nuw nsw i32 %k.042, 1 %6 = load i32, ptr %W, align 4, !tbaa !5 %cmp7 = icmp slt i32 %inc, %6 br i1 %cmp7, label %for.body8, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body8, %for.body8.us, %for.cond6.preheader %putchar37 = call i32 @putchar(i32 10) %inc23 = add nuw nsw i32 %j.045, 1 %7 = load i32, ptr %H, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc23, %7 br i1 %cmp4, label %for.cond6.preheader, label %for.end24, !llvm.loop !11 for.end24: ; preds = %for.end, %for.cond3.preheader %putchar = call i32 @putchar(i32 10) %inc27 = add nuw nsw i32 %i.047, 1 %exitcond.not = icmp eq i32 %inc27, 10000 br i1 %exitcond.not, label %for.end28, label %for.body, !llvm.loop !12 for.end28: ; preds = %for.body, %for.end24 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() { int i, j; int h, w; 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) { putchar('#'); } else { if (j == 0 || j == w - 1) { putchar('#'); } else { putchar('.'); } } } putchar('\n'); } putchar('\n'); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101199/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101199/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @stdout = external local_unnamed_addr global ptr, align 8 ; 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) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3 %call42 = 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 %cmp43 = icmp eq i32 %0, 0 %1 = load i32, ptr %w, align 4 %cmp144 = icmp eq i32 %1, 0 %or.cond45 = select i1 %cmp43, i1 %cmp144, i1 false br i1 %or.cond45, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end23 %2 = phi i32 [ %16, %for.end23 ], [ %0, %entry ] %cmp239 = icmp sgt i32 %2, 0 br i1 %cmp239, label %for.cond3.preheader, label %for.end23 for.cond3.preheader: ; preds = %for.cond.preheader, %for.end %i.040 = phi i32 [ %inc22, %for.end ], [ 0, %for.cond.preheader ] %3 = load i32, ptr %w, align 4, !tbaa !5 %cmp436 = icmp sgt i32 %3, 0 br i1 %cmp436, label %for.body5.lr.ph, label %for.end for.body5.lr.ph: ; preds = %for.cond3.preheader %cmp6 = icmp eq i32 %i.040, 0 br i1 %cmp6, label %for.body5.us, label %for.body5.preheader for.body5.preheader: ; preds = %for.body5.lr.ph %4 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i.peel = call i32 @putc(i32 noundef 35, ptr noundef %4) %5 = load i32, ptr %w, align 4, !tbaa !5 %cmp4.peel = icmp sgt i32 %5, 1 br i1 %cmp4.peel, label %for.body5, label %for.end for.body5.us: ; preds = %for.body5.lr.ph, %for.body5.us %j.037.us = phi i32 [ %inc.us, %for.body5.us ], [ 0, %for.body5.lr.ph ] %6 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i.us = call i32 @putc(i32 noundef 35, ptr noundef %6) %inc.us = add nuw nsw i32 %j.037.us, 1 %7 = load i32, ptr %w, align 4, !tbaa !5 %cmp4.us = icmp slt i32 %inc.us, %7 br i1 %cmp4.us, label %for.body5.us, label %for.end, !llvm.loop !11 for.body5: ; preds = %for.body5.preheader, %for.inc %8 = phi i32 [ %12, %for.inc ], [ %5, %for.body5.preheader ] %j.037 = phi i32 [ %inc, %for.inc ], [ 1, %for.body5.preheader ] %9 = load i32, ptr %h, align 4, !tbaa !5 %sub = add nsw i32 %9, -1 %cmp7 = icmp eq i32 %i.040, %sub br i1 %cmp7, label %if.then8, label %if.else if.then8: ; preds = %for.body5 %10 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i = call i32 @putc(i32 noundef 35, ptr noundef %10) br label %for.inc if.else: ; preds = %for.body5 %sub12 = add nsw i32 %8, -1 %cmp13 = icmp eq i32 %j.037, %sub12 %11 = load ptr, ptr @stdout, align 8, !tbaa !9 br i1 %cmp13, label %if.then14, label %if.else16 if.then14: ; preds = %if.else %call.i32 = call i32 @putc(i32 noundef 35, ptr noundef %11) br label %for.inc if.else16: ; preds = %if.else %call.i33 = call i32 @putc(i32 noundef 46, ptr noundef %11) br label %for.inc for.inc: ; preds = %if.then8, %if.else16, %if.then14 %inc = add nuw nsw i32 %j.037, 1 %12 = load i32, ptr %w, align 4, !tbaa !5 %cmp4 = icmp slt i32 %inc, %12 br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !13 for.end: ; preds = %for.inc, %for.body5.us, %for.body5.preheader, %for.cond3.preheader %13 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i34 = call i32 @putc(i32 noundef 10, ptr noundef %13) %inc22 = add nuw nsw i32 %i.040, 1 %14 = load i32, ptr %h, align 4, !tbaa !5 %cmp2 = icmp slt i32 %inc22, %14 br i1 %cmp2, label %for.cond3.preheader, label %for.end23, !llvm.loop !15 for.end23: ; preds = %for.end, %for.cond.preheader %15 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i35 = call i32 @putc(i32 noundef 10, ptr noundef %15) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w) %16 = load i32, ptr %h, align 4, !tbaa !5 %cmp = icmp eq i32 %16, 0 %17 = load i32, ptr %w, align 4 %cmp1 = icmp eq i32 %17, 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.end23, %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, !14} !14 = !{!"llvm.loop.peeled.count", i32 1} !15 = distinct !{!15, !12}
#include <stdio.h> int main(void) { int h, w; int i, j; while (scanf("%d %d", &h, &w), h || w) { 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_101256/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101256/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @stdout = external local_unnamed_addr global ptr, align 8 ; 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) #3 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #3 %call36 = 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 %tobool37 = icmp ne i32 %0, 0 %1 = load i32, ptr %w, align 4 %tobool138 = icmp ne i32 %1, 0 %2 = select i1 %tobool37, i1 true, i1 %tobool138 br i1 %2, label %for.cond.preheader, label %while.end for.cond.preheader: ; preds = %entry, %for.end17 %3 = phi i32 [ %14, %for.end17 ], [ %0, %entry ] %cmp33 = icmp sgt i32 %3, 0 br i1 %cmp33, label %for.cond2.preheader, label %for.end17 for.cond2.preheader: ; preds = %for.cond.preheader, %for.end %i.034 = phi i32 [ %inc16, %for.end ], [ 0, %for.cond.preheader ] %4 = load i32, ptr %w, align 4, !tbaa !5 %cmp330 = icmp sgt i32 %4, 0 br i1 %cmp330, label %for.body4.lr.ph, label %for.end for.body4.lr.ph: ; preds = %for.cond2.preheader %cmp5 = icmp eq i32 %i.034, 0 br i1 %cmp5, label %for.body4.us, label %for.body4 for.body4.us: ; preds = %for.body4.lr.ph, %for.body4.us %j.031.us = phi i32 [ %inc.us, %for.body4.us ], [ 0, %for.body4.lr.ph ] %5 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i.us = call noundef i32 @putc(i32 noundef 35, ptr noundef %5) %inc.us = add nuw nsw i32 %j.031.us, 1 %6 = load i32, ptr %w, align 4, !tbaa !5 %cmp3.us = icmp slt i32 %inc.us, %6 br i1 %cmp3.us, label %for.body4.us, label %for.end, !llvm.loop !11 for.body4: ; preds = %for.body4.lr.ph, %for.body4 %7 = phi i32 [ %10, %for.body4 ], [ %4, %for.body4.lr.ph ] %j.031 = phi i32 [ %inc, %for.body4 ], [ 0, %for.body4.lr.ph ] %8 = load i32, ptr %h, align 4, !tbaa !5 %sub = add nsw i32 %8, -1 %cmp6 = icmp eq i32 %i.034, %sub %cmp8 = icmp eq i32 %j.031, 0 %or.cond = or i1 %cmp8, %cmp6 %sub10 = add nsw i32 %7, -1 %cmp11 = icmp eq i32 %j.031, %sub10 %or.cond26 = select i1 %or.cond, i1 true, i1 %cmp11 %9 = load ptr, ptr @stdout, align 8, !tbaa !9 %. = select i1 %or.cond26, i32 35, i32 46 %call.i = call noundef i32 @putc(i32 noundef %., ptr noundef %9) %inc = add nuw nsw i32 %j.031, 1 %10 = load i32, ptr %w, align 4, !tbaa !5 %cmp3 = icmp slt i32 %inc, %10 br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !11 for.end: ; preds = %for.body4, %for.body4.us, %for.cond2.preheader %11 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i28 = call noundef i32 @putc(i32 noundef 10, ptr noundef %11) %inc16 = add nuw nsw i32 %i.034, 1 %12 = load i32, ptr %h, align 4, !tbaa !5 %cmp = icmp slt i32 %inc16, %12 br i1 %cmp, label %for.cond2.preheader, label %for.end17, !llvm.loop !13 for.end17: ; preds = %for.end, %for.cond.preheader %13 = load ptr, ptr @stdout, align 8, !tbaa !9 %call.i29 = call noundef i32 @putc(i32 noundef 10, ptr noundef %13) %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 %tobool = icmp ne i32 %14, 0 %15 = load i32, ptr %w, align 4 %tobool1 = icmp ne i32 %15, 0 %16 = select i1 %tobool, i1 true, i1 %tobool1 br i1 %16, label %for.cond.preheader, label %while.end, !llvm.loop !14 while.end: ; preds = %for.end17, %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} !14 = distinct !{!14, !12}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> char arr1[200000 + 20]; char arr2[200000 + 20]; char arr3[200000 + 20]; char ans[300000 + 30]; int vote[200]; int main(void) { int TC, tcase, n; scanf("%d", &TC); for (tcase = 0; tcase < TC; ++tcase) { int c1 = 0, c2 = 0, c3 = 0; scanf("%d", &n); scanf("%s", arr1); scanf("%s", arr2); scanf("%s", arr3); for (int i = 0; i < 3 * n; i++) { vote['0'] = vote['1'] = 0; if (c1 < 2 * n) vote[arr1[c1]]++; if (c2 < 2 * n) vote[arr2[c2]]++; if (c3 < 2 * n) vote[arr3[c3]]++; if (vote['0'] > vote['1']) { ans[i] = '0'; if (arr1[c1] == '0') c1++; if (arr2[c2] == '0') c2++; if (arr3[c3] == '0') c3++; } else if (vote['0'] < vote['1']) { ans[i] = '1'; if (arr1[c1] == '1') c1++; if (arr2[c2] == '1') c2++; if (arr3[c3] == '1') c3++; } else { if (c1 >= 2*n) { if (c2 >= c3) { ans[i] = arr2[c2++]; } else { ans[i] = arr3[c3++]; } } else if (c2 >= 2*n) { if (c1 >= c3) { ans[i] = arr1[c1++]; } else { ans[i] = arr3[c3++]; } } else if(c3 >= 2*n) { if (c1 >= c2) { ans[i] = arr1[c1++]; } else { ans[i] = arr2[c2++]; } } else { ans[i] = '0'; } } } ans[3*n] = '\0'; printf("%s\n", ans); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1013/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1013/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @arr1 = dso_local global [200020 x i8] zeroinitializer, align 16 @arr2 = dso_local global [200020 x i8] zeroinitializer, align 16 @arr3 = dso_local global [200020 x i8] zeroinitializer, align 16 @vote = dso_local local_unnamed_addr global [200 x i32] zeroinitializer, align 16 @ans = dso_local global [300030 x i8] zeroinitializer, align 16 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %TC = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %TC) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %TC) %0 = load i32, ptr %TC, align 4, !tbaa !5 %cmp212 = icmp sgt i32 %0, 0 br i1 %cmp212, label %for.body, label %for.end161 for.body: ; preds = %entry, %for.cond.cleanup %tcase.0213 = phi i32 [ %inc160, %for.cond.cleanup ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @arr1) %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @arr2) %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @arr3) %1 = load i32, ptr %n, align 4, !tbaa !5 %mul = mul i32 %1, 3 %cmp6207 = icmp sgt i32 %1, 0 br i1 %cmp6207, label %for.body7.lr.ph, label %for.cond.cleanup for.body7.lr.ph: ; preds = %for.body %mul8 = shl nuw nsw i32 %1, 1 %smax = call i32 @llvm.smax.i32(i32 %mul, i32 1) %wide.trip.count = zext i32 %smax to i64 br label %for.body7 for.cond.cleanup: ; preds = %for.inc, %for.body %idxprom156 = sext i32 %mul to i64 %arrayidx157 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %idxprom156 store i8 0, ptr %arrayidx157, align 1, !tbaa !9 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @ans) %inc160 = add nuw nsw i32 %tcase.0213, 1 %2 = load i32, ptr %TC, align 4, !tbaa !5 %cmp = icmp slt i32 %inc160, %2 br i1 %cmp, label %for.body, label %for.end161, !llvm.loop !10 for.body7: ; preds = %for.body7.lr.ph, %for.inc %indvars.iv = phi i64 [ 0, %for.body7.lr.ph ], [ %indvars.iv.next, %for.inc ] %c3.0210 = phi i32 [ 0, %for.body7.lr.ph ], [ %c3.1, %for.inc ] %c2.0209 = phi i32 [ 0, %for.body7.lr.ph ], [ %c2.3, %for.inc ] %c1.0208 = phi i32 [ 0, %for.body7.lr.ph ], [ %c1.3, %for.inc ] store i32 0, ptr getelementptr inbounds ([200 x i32], ptr @vote, i64 0, i64 49), align 4, !tbaa !5 store i32 0, ptr getelementptr inbounds ([200 x i32], ptr @vote, i64 0, i64 48), align 16, !tbaa !5 %cmp9 = icmp slt i32 %c1.0208, %mul8 br i1 %cmp9, label %if.then, label %if.end if.then: ; preds = %for.body7 %idxprom = sext i32 %c1.0208 to i64 %arrayidx = getelementptr inbounds [200020 x i8], ptr @arr1, i64 0, i64 %idxprom %3 = load i8, ptr %arrayidx, align 1, !tbaa !9 %idxprom10 = sext i8 %3 to i64 %arrayidx11 = getelementptr inbounds [200 x i32], ptr @vote, i64 0, i64 %idxprom10 %4 = load i32, ptr %arrayidx11, align 4, !tbaa !5 %inc = add nsw i32 %4, 1 store i32 %inc, ptr %arrayidx11, align 4, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %for.body7 %cmp13 = icmp slt i32 %c2.0209, %mul8 br i1 %cmp13, label %if.then14, label %if.end20 if.then14: ; preds = %if.end %idxprom15 = sext i32 %c2.0209 to i64 %arrayidx16 = getelementptr inbounds [200020 x i8], ptr @arr2, i64 0, i64 %idxprom15 %5 = load i8, ptr %arrayidx16, align 1, !tbaa !9 %idxprom17 = sext i8 %5 to i64 %arrayidx18 = getelementptr inbounds [200 x i32], ptr @vote, i64 0, i64 %idxprom17 %6 = load i32, ptr %arrayidx18, align 4, !tbaa !5 %inc19 = add nsw i32 %6, 1 store i32 %inc19, ptr %arrayidx18, align 4, !tbaa !5 br label %if.end20 if.end20: ; preds = %if.then14, %if.end %cmp22 = icmp slt i32 %c3.0210, %mul8 br i1 %cmp22, label %if.then23, label %if.end29 if.then23: ; preds = %if.end20 %idxprom24 = sext i32 %c3.0210 to i64 %arrayidx25 = getelementptr inbounds [200020 x i8], ptr @arr3, i64 0, i64 %idxprom24 %7 = load i8, ptr %arrayidx25, align 1, !tbaa !9 %idxprom26 = sext i8 %7 to i64 %arrayidx27 = getelementptr inbounds [200 x i32], ptr @vote, i64 0, i64 %idxprom26 %8 = load i32, ptr %arrayidx27, align 4, !tbaa !5 %inc28 = add nsw i32 %8, 1 store i32 %inc28, ptr %arrayidx27, align 4, !tbaa !5 br label %if.end29 if.end29: ; preds = %if.then23, %if.end20 %9 = load i32, ptr getelementptr inbounds ([200 x i32], ptr @vote, i64 0, i64 48), align 16, !tbaa !5 %10 = load i32, ptr getelementptr inbounds ([200 x i32], ptr @vote, i64 0, i64 49), align 4, !tbaa !5 %cmp30 = icmp sgt i32 %9, %10 br i1 %cmp30, label %if.then31, label %if.else if.then31: ; preds = %if.end29 %arrayidx33 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %indvars.iv store i8 48, ptr %arrayidx33, align 1, !tbaa !9 %idxprom34 = sext i32 %c1.0208 to i64 %arrayidx35 = getelementptr inbounds [200020 x i8], ptr @arr1, i64 0, i64 %idxprom34 %11 = load i8, ptr %arrayidx35, align 1, !tbaa !9 %cmp36 = icmp eq i8 %11, 48 %inc39 = zext i1 %cmp36 to i32 %spec.select = add nsw i32 %c1.0208, %inc39 %idxprom41 = sext i32 %c2.0209 to i64 %arrayidx42 = getelementptr inbounds [200020 x i8], ptr @arr2, i64 0, i64 %idxprom41 %12 = load i8, ptr %arrayidx42, align 1, !tbaa !9 %cmp44 = icmp eq i8 %12, 48 %inc47 = zext i1 %cmp44 to i32 %c2.1 = add nsw i32 %c2.0209, %inc47 %idxprom49 = sext i32 %c3.0210 to i64 %arrayidx50 = getelementptr inbounds [200020 x i8], ptr @arr3, i64 0, i64 %idxprom49 %13 = load i8, ptr %arrayidx50, align 1, !tbaa !9 %cmp52 = icmp eq i8 %13, 48 %inc55 = zext i1 %cmp52 to i32 %spec.select205 = add nsw i32 %c3.0210, %inc55 br label %for.inc if.else: ; preds = %if.end29 %cmp57 = icmp slt i32 %9, %10 br i1 %cmp57, label %if.then59, label %if.else86 if.then59: ; preds = %if.else %arrayidx61 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %indvars.iv store i8 49, ptr %arrayidx61, align 1, !tbaa !9 %idxprom62 = sext i32 %c1.0208 to i64 %arrayidx63 = getelementptr inbounds [200020 x i8], ptr @arr1, i64 0, i64 %idxprom62 %14 = load i8, ptr %arrayidx63, align 1, !tbaa !9 %cmp65 = icmp eq i8 %14, 49 %inc68 = zext i1 %cmp65 to i32 %spec.select204 = add nsw i32 %c1.0208, %inc68 %idxprom70 = sext i32 %c2.0209 to i64 %arrayidx71 = getelementptr inbounds [200020 x i8], ptr @arr2, i64 0, i64 %idxprom70 %15 = load i8, ptr %arrayidx71, align 1, !tbaa !9 %cmp73 = icmp eq i8 %15, 49 %inc76 = zext i1 %cmp73 to i32 %c2.2 = add nsw i32 %c2.0209, %inc76 %idxprom78 = sext i32 %c3.0210 to i64 %arrayidx79 = getelementptr inbounds [200020 x i8], ptr @arr3, i64 0, i64 %idxprom78 %16 = load i8, ptr %arrayidx79, align 1, !tbaa !9 %cmp81 = icmp eq i8 %16, 49 %inc84 = zext i1 %cmp81 to i32 %spec.select206 = add nsw i32 %c3.0210, %inc84 br label %for.inc if.else86: ; preds = %if.else br i1 %cmp9, label %if.else106, label %if.then90 if.then90: ; preds = %if.else86 %cmp91.not = icmp slt i32 %c2.0209, %c3.0210 %arrayidx104 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %indvars.iv br i1 %cmp91.not, label %if.else99, label %if.then93 if.then93: ; preds = %if.then90 %inc94 = add nsw i32 %c2.0209, 1 %idxprom95 = sext i32 %c2.0209 to i64 %arrayidx96 = getelementptr inbounds [200020 x i8], ptr @arr2, i64 0, i64 %idxprom95 %17 = load i8, ptr %arrayidx96, align 1, !tbaa !9 store i8 %17, ptr %arrayidx104, align 1, !tbaa !9 br label %for.inc if.else99: ; preds = %if.then90 %inc100 = add nsw i32 %c3.0210, 1 %idxprom101 = sext i32 %c3.0210 to i64 %arrayidx102 = getelementptr inbounds [200020 x i8], ptr @arr3, i64 0, i64 %idxprom101 %18 = load i8, ptr %arrayidx102, align 1, !tbaa !9 store i8 %18, ptr %arrayidx104, align 1, !tbaa !9 br label %for.inc if.else106: ; preds = %if.else86 br i1 %cmp13, label %if.else126, label %if.then110 if.then110: ; preds = %if.else106 %cmp111.not = icmp slt i32 %c1.0208, %c3.0210 %arrayidx124 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %indvars.iv br i1 %cmp111.not, label %if.else119, label %if.then113 if.then113: ; preds = %if.then110 %inc114 = add nsw i32 %c1.0208, 1 %idxprom115 = sext i32 %c1.0208 to i64 %arrayidx116 = getelementptr inbounds [200020 x i8], ptr @arr1, i64 0, i64 %idxprom115 %19 = load i8, ptr %arrayidx116, align 1, !tbaa !9 store i8 %19, ptr %arrayidx124, align 1, !tbaa !9 br label %for.inc if.else119: ; preds = %if.then110 %inc120 = add nsw i32 %c3.0210, 1 %idxprom121 = sext i32 %c3.0210 to i64 %arrayidx122 = getelementptr inbounds [200020 x i8], ptr @arr3, i64 0, i64 %idxprom121 %20 = load i8, ptr %arrayidx122, align 1, !tbaa !9 store i8 %20, ptr %arrayidx124, align 1, !tbaa !9 br label %for.inc if.else126: ; preds = %if.else106 br i1 %cmp22, label %if.else146, label %if.then130 if.then130: ; preds = %if.else126 %cmp131.not = icmp slt i32 %c1.0208, %c2.0209 %arrayidx144 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %indvars.iv br i1 %cmp131.not, label %if.else139, label %if.then133 if.then133: ; preds = %if.then130 %inc134 = add nsw i32 %c1.0208, 1 %idxprom135 = sext i32 %c1.0208 to i64 %arrayidx136 = getelementptr inbounds [200020 x i8], ptr @arr1, i64 0, i64 %idxprom135 %21 = load i8, ptr %arrayidx136, align 1, !tbaa !9 store i8 %21, ptr %arrayidx144, align 1, !tbaa !9 br label %for.inc if.else139: ; preds = %if.then130 %inc140 = add nsw i32 %c2.0209, 1 %idxprom141 = sext i32 %c2.0209 to i64 %arrayidx142 = getelementptr inbounds [200020 x i8], ptr @arr2, i64 0, i64 %idxprom141 %22 = load i8, ptr %arrayidx142, align 1, !tbaa !9 store i8 %22, ptr %arrayidx144, align 1, !tbaa !9 br label %for.inc if.else146: ; preds = %if.else126 %arrayidx148 = getelementptr inbounds [300030 x i8], ptr @ans, i64 0, i64 %indvars.iv store i8 48, ptr %arrayidx148, align 1, !tbaa !9 br label %for.inc for.inc: ; preds = %if.then59, %if.then31, %if.else99, %if.then93, %if.else146, %if.else139, %if.then133, %if.then113, %if.else119 %c1.3 = phi i32 [ %c1.0208, %if.then93 ], [ %c1.0208, %if.else99 ], [ %inc114, %if.then113 ], [ %c1.0208, %if.else119 ], [ %inc134, %if.then133 ], [ %c1.0208, %if.else139 ], [ %c1.0208, %if.else146 ], [ %spec.select, %if.then31 ], [ %spec.select204, %if.then59 ] %c2.3 = phi i32 [ %inc94, %if.then93 ], [ %c2.0209, %if.else99 ], [ %c2.0209, %if.then113 ], [ %c2.0209, %if.else119 ], [ %c2.0209, %if.then133 ], [ %inc140, %if.else139 ], [ %c2.0209, %if.else146 ], [ %c2.1, %if.then31 ], [ %c2.2, %if.then59 ] %c3.1 = phi i32 [ %c3.0210, %if.then93 ], [ %inc100, %if.else99 ], [ %c3.0210, %if.then113 ], [ %inc120, %if.else119 ], [ %c3.0210, %if.then133 ], [ %c3.0210, %if.else139 ], [ %c3.0210, %if.else146 ], [ %spec.select205, %if.then31 ], [ %spec.select206, %if.then59 ] %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup, label %for.body7, !llvm.loop !12 for.end161: ; preds = %for.cond.cleanup, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %TC) #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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11}
#include<stdio.h> int main(){ int h,w,i,j,k; scanf("%d %d",&h,&w); for(i=0;;i++){ for(j=0;j<h;j++){ for(k=0;k<w;k++){ if(k>0&&k<w-1&&j!=0&&j!=h-1){ printf("."); }else{ printf("#"); } if(j==h-1&&k==w-1){ printf("\n"); } } printf("\n"); } h=0; w=0; scanf("%d %d",&h,&w); if(h==0&&w==0){ break; } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101342/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101342/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w) %.pre = load i32, ptr %h, align 4, !tbaa !5 br label %for.cond for.cond: ; preds = %for.end25, %entry %0 = phi i32 [ %10, %for.end25 ], [ %.pre, %entry ] %cmp50 = icmp sgt i32 %0, 0 br i1 %cmp50, label %for.cond2.preheader, label %for.end25 for.cond2.preheader: ; preds = %for.cond, %for.end %j.051 = phi i32 [ %inc24, %for.end ], [ 0, %for.cond ] %1 = load i32, ptr %w, align 4, !tbaa !5 %cmp347 = icmp sgt i32 %1, 0 br i1 %cmp347, label %for.body4.lr.ph, label %for.end for.body4.lr.ph: ; preds = %for.cond2.preheader %cmp8.not = icmp eq i32 %j.051, 0 br i1 %cmp8.not, label %for.body4.us, label %if.end.peel if.end.peel: ; preds = %for.body4.lr.ph %putchar44.peel = call i32 @putchar(i32 35) %.pre57.pre = load i32, ptr %w, align 4, !tbaa !5 %.pre55 = load i32, ptr %h, align 4, !tbaa !5 %sub14.peel = add nsw i32 %.pre55, -1 %cmp15.peel = icmp eq i32 %j.051, %sub14.peel %cmp18.peel = icmp eq i32 %.pre57.pre, 1 %or.cond = select i1 %cmp15.peel, i1 %cmp18.peel, i1 false br i1 %or.cond, label %if.then19.peel, label %for.inc.peel if.then19.peel: ; preds = %if.end.peel %putchar46.peel = call i32 @putchar(i32 10) %.pre56 = load i32, ptr %w, align 4, !tbaa !5 br label %for.inc.peel for.inc.peel: ; preds = %if.then19.peel, %if.end.peel %2 = phi i32 [ %.pre56, %if.then19.peel ], [ %.pre57.pre, %if.end.peel ] %cmp3.peel = icmp sgt i32 %2, 1 br i1 %cmp3.peel, label %for.body4, label %for.end for.body4.us: ; preds = %for.body4.lr.ph, %for.inc.us %k.048.us = phi i32 [ %inc.us, %for.inc.us ], [ 0, %for.body4.lr.ph ] %putchar44.us = call i32 @putchar(i32 35) %3 = load i32, ptr %h, align 4, !tbaa !5 %cmp15.us = icmp eq i32 %3, 1 %.pre61 = load i32, ptr %w, align 4, !tbaa !5 %sub17.us = add nsw i32 %.pre61, -1 %cmp18.us = icmp eq i32 %k.048.us, %sub17.us %or.cond68 = select i1 %cmp15.us, i1 %cmp18.us, i1 false br i1 %or.cond68, label %if.then19.us, label %for.inc.us if.then19.us: ; preds = %for.body4.us %putchar46.us = call i32 @putchar(i32 10) %.pre60 = load i32, ptr %w, align 4, !tbaa !5 br label %for.inc.us for.inc.us: ; preds = %if.then19.us, %for.body4.us %4 = phi i32 [ %.pre60, %if.then19.us ], [ %.pre61, %for.body4.us ] %inc.us = add nuw nsw i32 %k.048.us, 1 %cmp3.us = icmp slt i32 %inc.us, %4 br i1 %cmp3.us, label %for.body4.us, label %for.end, !llvm.loop !9 for.body4: ; preds = %for.inc.peel, %for.inc %5 = phi i32 [ %8, %for.inc ], [ %2, %for.inc.peel ] %k.048 = phi i32 [ %inc, %for.inc ], [ 1, %for.inc.peel ] %sub = add nsw i32 %5, -1 %cmp6 = icmp slt i32 %k.048, %sub br i1 %cmp6, label %land.lhs.true9, label %if.else land.lhs.true9: ; preds = %for.body4 %6 = load i32, ptr %h, align 4, !tbaa !5 %sub10 = add nsw i32 %6, -1 %cmp11.not = icmp eq i32 %j.051, %sub10 br i1 %cmp11.not, label %if.else, label %if.end if.else: ; preds = %land.lhs.true9, %for.body4 br label %if.end if.end: ; preds = %land.lhs.true9, %if.else %.sink = phi i32 [ 35, %if.else ], [ 46, %land.lhs.true9 ] %putchar44 = call i32 @putchar(i32 %.sink) %7 = load i32, ptr %h, align 4, !tbaa !5 %sub14 = add nsw i32 %7, -1 %cmp15 = icmp eq i32 %j.051, %sub14 %.pre59 = load i32, ptr %w, align 4, !tbaa !5 %sub17 = add nsw i32 %.pre59, -1 %cmp18 = icmp eq i32 %k.048, %sub17 %or.cond69 = select i1 %cmp15, i1 %cmp18, i1 false br i1 %or.cond69, label %if.then19, label %for.inc if.then19: ; preds = %if.end %putchar46 = call i32 @putchar(i32 10) %.pre58 = load i32, ptr %w, align 4, !tbaa !5 br label %for.inc for.inc: ; preds = %if.end, %if.then19 %8 = phi i32 [ %.pre59, %if.end ], [ %.pre58, %if.then19 ] %inc = add nuw nsw i32 %k.048, 1 %cmp3 = icmp slt i32 %inc, %8 br i1 %cmp3, label %for.body4, label %for.end, !llvm.loop !11 for.end: ; preds = %for.inc, %for.inc.us, %for.inc.peel, %for.cond2.preheader %putchar = call i32 @putchar(i32 10) %inc24 = add nuw nsw i32 %j.051, 1 %9 = load i32, ptr %h, align 4, !tbaa !5 %cmp = icmp slt i32 %inc24, %9 br i1 %cmp, label %for.cond2.preheader, label %for.end25, !llvm.loop !13 for.end25: ; preds = %for.end, %for.cond store i32 0, ptr %h, align 4, !tbaa !5 store i32 0, ptr %w, align 4, !tbaa !5 %call26 = 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 %cmp27 = icmp eq i32 %10, 0 %11 = load i32, ptr %w, align 4 %cmp29 = icmp eq i32 %11, 0 %or.cond35 = select i1 %cmp27, i1 %cmp29, i1 false br i1 %or.cond35, label %for.end34, label %for.cond for.end34: ; preds = %for.end25 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> #define ll long long ll dp[400][400]; ll presum[401]; ll getsum(int l,int r){ l++;r++; return presum[r]-presum[l-1]; } int a[400]; ll min(ll a, ll b){ return a < b ? a: b; } ll mincost(int l,int r){ if(dp[l][r]!=0) return dp[l][r]; if (r-l+1==2) return a[l]+a[r]; if (l==r) return 0; ll mc = __LONG_LONG_MAX__; for(int i = l+1;i<=r;i++){ ll L = mincost(l,i-1) ; ll R = mincost(i,r) ; mc = min(mc, L + R ); } return dp[l][r] = mc + getsum(l,r); } int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=1;i<=n;i++) presum[i] = presum[i-1] + a[i-1]; printf("%lld",mincost(0,n-1) ); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101393/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101393/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @presum = dso_local local_unnamed_addr global [401 x i64] zeroinitializer, align 16 @dp = dso_local local_unnamed_addr global [400 x [400 x i64]] zeroinitializer, align 16 @a = dso_local global [400 x i32] zeroinitializer, 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"%lld\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i64 @getsum(i32 noundef %l, i32 noundef %r) local_unnamed_addr #0 { entry: %inc1 = add nsw i32 %r, 1 %idxprom = sext i32 %inc1 to i64 %arrayidx = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %idxprom %0 = load i64, ptr %arrayidx, align 8, !tbaa !5 %idxprom2 = sext i32 %l to i64 %arrayidx3 = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %idxprom2 %1 = load i64, ptr %arrayidx3, align 8, !tbaa !5 %sub4 = sub nsw i64 %0, %1 ret i64 %sub4 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 { entry: %cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b) ret i64 %cond } ; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local i64 @mincost(i32 noundef %l, i32 noundef %r) local_unnamed_addr #2 { entry: %idxprom = sext i32 %l to i64 %idxprom1 = sext i32 %r to i64 %arrayidx2 = getelementptr inbounds [400 x [400 x i64]], ptr @dp, i64 0, i64 %idxprom, i64 %idxprom1 %0 = load i64, ptr %arrayidx2, align 8, !tbaa !5 %cmp.not = icmp eq i64 %0, 0 br i1 %cmp.not, label %if.end, label %return if.end: ; preds = %entry %sub = sub nsw i32 %r, %l %cmp7 = icmp eq i32 %sub, 1 br i1 %cmp7, label %if.then8, label %if.end14 if.then8: ; preds = %if.end %arrayidx10 = getelementptr inbounds [400 x i32], ptr @a, i64 0, i64 %idxprom %1 = load i32, ptr %arrayidx10, align 4, !tbaa !9 %arrayidx12 = getelementptr inbounds [400 x i32], ptr @a, i64 0, i64 %idxprom1 %2 = load i32, ptr %arrayidx12, align 4, !tbaa !9 %add13 = add nsw i32 %2, %1 %conv = sext i32 %add13 to i64 br label %return if.end14: ; preds = %if.end %cmp15 = icmp eq i32 %l, %r br i1 %cmp15, label %return, label %for.cond.preheader for.cond.preheader: ; preds = %if.end14 %cmp20.not.not52 = icmp slt i32 %l, %r br i1 %cmp20.not.not52, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %for.cond.preheader %mc.0.lcssa = phi i64 [ 9223372036854775807, %for.cond.preheader ], [ %cond.i, %for.body ] %inc1.i = add nsw i32 %r, 1 %idxprom.i = sext i32 %inc1.i to i64 %arrayidx.i = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %idxprom.i %3 = load i64, ptr %arrayidx.i, align 8, !tbaa !5 %arrayidx3.i = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %idxprom %4 = load i64, ptr %arrayidx3.i, align 8, !tbaa !5 %sub4.i = sub nsw i64 %3, %4 %add27 = add nsw i64 %sub4.i, %mc.0.lcssa store i64 %add27, ptr %arrayidx2, align 8, !tbaa !5 br label %return for.body: ; preds = %for.cond.preheader, %for.body %mc.054 = phi i64 [ %cond.i, %for.body ], [ 9223372036854775807, %for.cond.preheader ] %i.0.in53 = phi i32 [ %i.0, %for.body ], [ %l, %for.cond.preheader ] %i.0 = add nsw i32 %i.0.in53, 1 %call = tail call i64 @mincost(i32 noundef %l, i32 noundef %i.0.in53) %call23 = tail call i64 @mincost(i32 noundef %i.0, i32 noundef %r) %add24 = add nsw i64 %call23, %call %cond.i = tail call i64 @llvm.smin.i64(i64 %mc.054, i64 %add24) %exitcond.not = icmp eq i32 %i.0, %r br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !11 return: ; preds = %if.end14, %entry, %for.cond.cleanup, %if.then8 %retval.0 = phi i64 [ %conv, %if.then8 ], [ %add27, %for.cond.cleanup ], [ %0, %entry ], [ 0, %if.end14 ] ret i64 %retval.0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 nounwind uwtable define dso_local i32 @main() local_unnamed_addr #4 { entry: %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !9 %cmp26 = icmp sgt i32 %0, 0 br i1 %cmp26, label %for.body, label %for.cond.cleanup5 for.cond3.preheader: ; preds = %for.body %cmp4.not28 = icmp slt i32 %3, 1 br i1 %cmp4.not28, label %for.cond.cleanup5, label %for.body6.preheader for.body6.preheader: ; preds = %for.cond3.preheader %.pre = load i64, ptr @presum, align 16, !tbaa !5 %1 = zext i32 %3 to i64 %xtraiter = and i64 %1, 1 %2 = icmp eq i32 %3, 1 br i1 %2, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6.preheader.new for.body6.preheader.new: ; preds = %for.body6.preheader %unroll_iter = and i64 %1, 4294967294 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [400 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 !9 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !13 for.cond.cleanup5.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.preheader %.unr = phi i64 [ %.pre, %for.body6.preheader ], [ %add.1, %for.body6 ] %indvars.iv32.unr = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next33.1, %for.body6 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil for.body6.epil: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa %5 = add nsw i64 %indvars.iv32.unr, -1 %arrayidx11.epil = getelementptr inbounds [400 x i32], ptr @a, i64 0, i64 %5 %6 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !9 %conv.epil = sext i32 %6 to i64 %add.epil = add nsw i64 %.unr, %conv.epil %arrayidx13.epil = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %indvars.iv32.unr store i64 %add.epil, ptr %arrayidx13.epil, align 8, !tbaa !5 br label %for.cond.cleanup5 for.cond.cleanup5: ; preds = %for.body6.epil, %for.cond.cleanup5.loopexit.unr-lcssa, %entry, %for.cond3.preheader %.lcssa38 = phi i32 [ %3, %for.cond3.preheader ], [ %0, %entry ], [ %3, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %3, %for.body6.epil ] %sub17 = add nsw i32 %.lcssa38, -1 %call18 = call i64 @mincost(i32 noundef 0, i32 noundef %sub17) %call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %call18) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 for.body6: ; preds = %for.body6, %for.body6.preheader.new %7 = phi i64 [ %.pre, %for.body6.preheader.new ], [ %add.1, %for.body6 ] %indvars.iv32 = phi i64 [ 1, %for.body6.preheader.new ], [ %indvars.iv.next33.1, %for.body6 ] %niter = phi i64 [ 0, %for.body6.preheader.new ], [ %niter.next.1, %for.body6 ] %8 = add nsw i64 %indvars.iv32, -1 %arrayidx11 = getelementptr inbounds [400 x i32], ptr @a, i64 0, i64 %8 %9 = load i32, ptr %arrayidx11, align 4, !tbaa !9 %conv = sext i32 %9 to i64 %add = add nsw i64 %7, %conv %arrayidx13 = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %indvars.iv32 store i64 %add, ptr %arrayidx13, align 8, !tbaa !5 %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1 %arrayidx11.1 = getelementptr inbounds [400 x i32], ptr @a, i64 0, i64 %indvars.iv32 %10 = load i32, ptr %arrayidx11.1, align 4, !tbaa !9 %conv.1 = sext i32 %10 to i64 %add.1 = add nsw i64 %add, %conv.1 %arrayidx13.1 = getelementptr inbounds [401 x i64], ptr @presum, i64 0, i64 %indvars.iv.next33 store i64 %add.1, ptr %arrayidx13.1, align 8, !tbaa !5 %indvars.iv.next33.1 = add nuw nsw i64 %indvars.iv32, 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.cleanup5.loopexit.unr-lcssa, label %for.body6, !llvm.loop !14 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #6 attributes #0 = { 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 #1 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"int", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12}
#include <stdio.h> int main(void){ int n,a,b,c,x,y[100],i,cnt; while(1){ BACK: scanf("%d %d %d %d %d",&n,&a,&b,&c,&x); if(!n) break; for(i=0;i<n;i++) scanf("%d",&y[i]); cnt=0; i=0; while(1){ if(x==y[i]) i++; if(i==n) break; x=(a*x+b)%c; cnt++; if(cnt>10000){ puts("-1"); goto BACK; } } printf("%d\n",cnt); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101472/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101472/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [3 x i8] c"-1\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %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 %call3133 = 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 %tobool.not3234 = icmp eq i32 %0, 0 br i1 %tobool.not3234, label %while.end19, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.cond.preheader.backedge %1 = phi i32 [ %.be, %for.cond.preheader.backedge ], [ %0, %entry ] %cmp28 = icmp sgt i32 %1, 0 br i1 %cmp28, label %for.body, label %while.cond2.preheader while.cond2.preheader: ; preds = %for.body, %for.cond.preheader %.lcssa = phi i32 [ %1, %for.cond.preheader ], [ %5, %for.body ] %x.promoted = load i32, ptr %x, align 4, !tbaa !5 %2 = load i32, ptr %a, align 4 %3 = load i32, ptr %b, align 4 %4 = load i32, ptr %c, align 4 br label %while.cond2 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %arrayidx = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %5 = load i32, ptr %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 %while.cond2.preheader, !llvm.loop !9 while.cond2: ; preds = %while.cond2.preheader, %if.end12 %rem30 = phi i32 [ %rem, %if.end12 ], [ %x.promoted, %while.cond2.preheader ] %i.1 = phi i32 [ %spec.select, %if.end12 ], [ 0, %while.cond2.preheader ] %cnt.0 = phi i32 [ %inc13, %if.end12 ], [ 0, %while.cond2.preheader ] %idxprom4 = zext i32 %i.1 to i64 %arrayidx5 = getelementptr inbounds [100 x i32], ptr %y, i64 0, i64 %idxprom4 %7 = load i32, ptr %arrayidx5, align 4, !tbaa !5 %cmp6 = icmp eq i32 %rem30, %7 %inc8 = zext i1 %cmp6 to i32 %spec.select = add nuw nsw i32 %i.1, %inc8 %cmp10 = icmp eq i32 %spec.select, %.lcssa br i1 %cmp10, label %while.end, label %if.end12 if.end12: ; preds = %while.cond2 %mul = mul nsw i32 %2, %rem30 %add = add nsw i32 %mul, %3 %rem = srem i32 %add, %4 store i32 %rem, ptr %x, align 4, !tbaa !5 %inc13 = add nuw nsw i32 %cnt.0, 1 %exitcond = icmp eq i32 %inc13, 10001 br i1 %exitcond, label %if.then15, label %while.cond2 if.then15: ; preds = %if.end12 %call16 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2) %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) %8 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %8, 0 br i1 %tobool.not, label %while.end19, label %for.cond.preheader.backedge for.cond.preheader.backedge: ; preds = %if.then15, %while.end %.be = phi i32 [ %8, %if.then15 ], [ %9, %while.end ] br label %for.cond.preheader while.end: ; preds = %while.cond2 %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %cnt.0) %call31 = 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) %9 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not32 = icmp eq i32 %9, 0 br i1 %tobool.not32, label %while.end19, label %for.cond.preheader.backedge while.end19: ; preds = %while.end, %if.then15, %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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<stdlib.h> int asc(const void* a,const void* b) { if (*(long long int*)a < *(long long int*) b)return 1; if (*(long long int*)a > * (long long int*) b)return -1; return 0; } int main() { long long int n, k; scanf("%lld %lld", &n, &k); long long int i, a[200005], f[200005]; for (i = 0; i < n; i++) scanf("%lld", &a[i]); for (i = 0; i < n; i++) scanf("%lld", &f[i]); qsort(a, n, sizeof(long long int), asc); qsort(f, n, sizeof(long long int), asc); long long int count, min, max, mid; long long int c[200005]; count = 0; for (i = 0; i < n; i++) count += a[i]; if (count <= k) { printf("0\n"); return 0; } max = 0; for (i = 0; i < n; i++) max += a[i] * f[n - i - 1]; min = 0; while (max - min > 1) { mid = (max + min) / 2; for (i = 0; i < n; i++) c[i] = mid / f[n - i - 1]; count = 0; for (i = 0; i < n; i++) if (a[i] > c[i]) count += a[i] - c[i]; if (count <= k) max = mid; else min = mid; } printf("%lld\n", max); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101544/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101544/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 { entry: %0 = load i64, ptr %a, align 8, !tbaa !5 %1 = load i64, ptr %b, align 8, !tbaa !5 %cmp = icmp slt i64 %0, %1 %cmp1 = icmp sgt i64 %0, %1 %. = 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 %a = alloca [200005 x i64], align 16 %f = alloca [200005 x i64], align 16 %c = alloca [200005 x i64], align 16 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #7 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k) call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %a) #7 call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %f) #7 %0 = load i64, ptr %n, align 8, !tbaa !5 %cmp108 = icmp sgt i64 %0, 0 br i1 %cmp108, label %for.body, label %for.end9 for.cond2.preheader: ; preds = %for.body %cmp3110 = icmp sgt i64 %1, 0 br i1 %cmp3110, label %for.body4, label %for.end9 for.body: ; preds = %entry, %for.body %i.0109 = phi i64 [ %inc, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.0109 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %i.0109, 1 %1 = load i64, ptr %n, align 8, !tbaa !5 %cmp = icmp slt i64 %inc, %1 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.body4: ; preds = %for.cond2.preheader, %for.body4 %i.1111 = phi i64 [ %inc8, %for.body4 ], [ 0, %for.cond2.preheader ] %arrayidx5 = getelementptr inbounds [200005 x i64], ptr %f, i64 0, i64 %i.1111 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx5) %inc8 = add nuw nsw i64 %i.1111, 1 %2 = load i64, ptr %n, align 8, !tbaa !5 %cmp3 = icmp slt i64 %inc8, %2 br i1 %cmp3, label %for.body4, label %for.end9, !llvm.loop !11 for.end9: ; preds = %for.body4, %entry, %for.cond2.preheader %.lcssa107 = phi i64 [ %1, %for.cond2.preheader ], [ %0, %entry ], [ %2, %for.body4 ] call void @qsort(ptr noundef nonnull %a, i64 noundef %.lcssa107, i64 noundef 8, ptr noundef nonnull @asc) #7 %3 = load i64, ptr %n, align 8, !tbaa !5 call void @qsort(ptr noundef nonnull %f, i64 noundef %3, i64 noundef 8, ptr noundef nonnull @asc) #7 call void @llvm.lifetime.start.p0(i64 1600040, ptr nonnull %c) #7 %4 = load i64, ptr %n, align 8, !tbaa !5 %cmp12112 = icmp sgt i64 %4, 0 br i1 %cmp12112, label %for.body13.preheader, label %for.end17.thread for.body13.preheader: ; preds = %for.end9 %min.iters.check = icmp ult i64 %4, 4 br i1 %min.iters.check, label %for.body13.preheader237, label %vector.ph vector.ph: ; preds = %for.body13.preheader %n.vec = and i64 %4, -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 ], [ %7, %vector.body ] %vec.phi188 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ] %5 = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %index %wide.load = load <2 x i64>, ptr %5, align 16, !tbaa !5 %6 = getelementptr inbounds i64, ptr %5, i64 2 %wide.load189 = load <2 x i64>, ptr %6, align 16, !tbaa !5 %7 = add <2 x i64> %wide.load, %vec.phi %8 = add <2 x i64> %wide.load189, %vec.phi188 %index.next = add nuw i64 %index, 4 %9 = icmp eq i64 %index.next, %n.vec br i1 %9, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %bin.rdx = add <2 x i64> %8, %7 %10 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx) %cmp.n = icmp eq i64 %4, %n.vec br i1 %cmp.n, label %for.end17, label %for.body13.preheader237 for.body13.preheader237: ; preds = %for.body13.preheader, %middle.block %count.0114.ph = phi i64 [ 0, %for.body13.preheader ], [ %10, %middle.block ] %i.2113.ph = phi i64 [ 0, %for.body13.preheader ], [ %n.vec, %middle.block ] br label %for.body13 for.body13: ; preds = %for.body13.preheader237, %for.body13 %count.0114 = phi i64 [ %add, %for.body13 ], [ %count.0114.ph, %for.body13.preheader237 ] %i.2113 = phi i64 [ %inc16, %for.body13 ], [ %i.2113.ph, %for.body13.preheader237 ] %arrayidx14 = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.2113 %11 = load i64, ptr %arrayidx14, align 8, !tbaa !5 %add = add nsw i64 %11, %count.0114 %inc16 = add nuw nsw i64 %i.2113, 1 %exitcond.not = icmp eq i64 %inc16, %4 br i1 %exitcond.not, label %for.end17, label %for.body13, !llvm.loop !15 for.end17: ; preds = %for.body13, %middle.block %add.lcssa = phi i64 [ %10, %middle.block ], [ %add, %for.body13 ] %12 = load i64, ptr %k, align 8, !tbaa !5 %.fr = freeze i64 %12 %cmp18.not = icmp sgt i64 %add.lcssa, %.fr br i1 %cmp18.not, label %for.cond20.preheader, label %if.then for.end17.thread: ; preds = %for.end9 %13 = load i64, ptr %k, align 8, !tbaa !5 %.fr176 = freeze i64 %13 %cmp18.not177 = icmp slt i64 %.fr176, 0 br i1 %cmp18.not177, label %while.end, label %if.then for.cond20.preheader: ; preds = %for.end17 br i1 %cmp12112, label %for.body22.preheader, label %while.end for.body22.preheader: ; preds = %for.cond20.preheader %min.iters.check192 = icmp ult i64 %4, 4 br i1 %min.iters.check192, label %for.body22.preheader233, label %vector.ph193 vector.ph193: ; preds = %for.body22.preheader %n.vec195 = and i64 %4, -4 br label %vector.body198 vector.body198: ; preds = %vector.body198, %vector.ph193 %index199 = phi i64 [ 0, %vector.ph193 ], [ %index.next207, %vector.body198 ] %vec.phi200 = phi <2 x i64> [ zeroinitializer, %vector.ph193 ], [ %23, %vector.body198 ] %vec.phi201 = phi <2 x i64> [ zeroinitializer, %vector.ph193 ], [ %24, %vector.body198 ] %14 = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %index199 %wide.load202 = load <2 x i64>, ptr %14, align 16, !tbaa !5 %15 = getelementptr inbounds i64, ptr %14, i64 2 %wide.load203 = load <2 x i64>, ptr %15, align 16, !tbaa !5 %16 = xor i64 %index199, -1 %17 = add i64 %4, %16 %18 = getelementptr inbounds [200005 x i64], ptr %f, i64 0, i64 %17 %19 = getelementptr inbounds i64, ptr %18, i64 -1 %wide.load204 = load <2 x i64>, ptr %19, align 8, !tbaa !5 %reverse = shufflevector <2 x i64> %wide.load204, <2 x i64> poison, <2 x i32> <i32 1, i32 0> %20 = getelementptr inbounds i64, ptr %18, i64 -3 %wide.load205 = load <2 x i64>, ptr %20, align 8, !tbaa !5 %reverse206 = shufflevector <2 x i64> %wide.load205, <2 x i64> poison, <2 x i32> <i32 1, i32 0> %21 = mul nsw <2 x i64> %reverse, %wide.load202 %22 = mul nsw <2 x i64> %reverse206, %wide.load203 %23 = add <2 x i64> %21, %vec.phi200 %24 = add <2 x i64> %22, %vec.phi201 %index.next207 = add nuw i64 %index199, 4 %25 = icmp eq i64 %index.next207, %n.vec195 br i1 %25, label %middle.block190, label %vector.body198, !llvm.loop !16 middle.block190: ; preds = %vector.body198 %bin.rdx208 = add <2 x i64> %24, %23 %26 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx208) %cmp.n197 = icmp eq i64 %4, %n.vec195 br i1 %cmp.n197, label %while.cond.preheader, label %for.body22.preheader233 for.body22.preheader233: ; preds = %for.body22.preheader, %middle.block190 %max.0119.ph = phi i64 [ 0, %for.body22.preheader ], [ %26, %middle.block190 ] %i.3118.ph = phi i64 [ 0, %for.body22.preheader ], [ %n.vec195, %middle.block190 ] br label %for.body22 if.then: ; preds = %for.end17.thread, %for.end17 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup while.cond.preheader: ; preds = %for.body22, %middle.block190 %add26.lcssa = phi i64 [ %26, %middle.block190 ], [ %add26, %for.body22 ] %cmp31127 = icmp sgt i64 %add26.lcssa, 1 br i1 %cmp31127, label %while.body.lr.ph, label %while.end while.body.lr.ph: ; preds = %while.cond.preheader br i1 %cmp12112, label %while.body.us.preheader, label %while.body.lr.ph.split.split while.body.us.preheader: ; preds = %while.body.lr.ph %xtraiter = and i64 %4, 1 %27 = icmp eq i64 %4, 1 %unroll_iter = and i64 %4, -2 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 %min.iters.check212 = icmp ult i64 %4, 4 %n.vec215 = and i64 %4, -4 %cmp.n217 = icmp eq i64 %4, %n.vec215 br label %while.body.us while.body.us: ; preds = %while.body.us.preheader, %for.end58.us %max.1129.us = phi i64 [ %max.1.div.us, %for.end58.us ], [ %add26.lcssa, %while.body.us.preheader ] %min.0128.us = phi i64 [ %div.min.0.us, %for.end58.us ], [ 0, %while.body.us.preheader ] %add32.us = add nsw i64 %max.1129.us, %min.0128.us %div.us = sdiv i64 %add32.us, 2 br i1 %27, label %for.body46.us.preheader.unr-lcssa, label %for.body35.us for.end58.us: ; preds = %for.body46.us, %middle.block210 %count.2.us.lcssa = phi i64 [ %49, %middle.block210 ], [ %count.2.us, %for.body46.us ] %cmp59.not.us = icmp sgt i64 %count.2.us.lcssa, %.fr %div.min.0.us = select i1 %cmp59.not.us, i64 %div.us, i64 %min.0128.us %max.1.div.us = select i1 %cmp59.not.us, i64 %max.1129.us, i64 %div.us %sub30.us = sub nsw i64 %max.1.div.us, %div.min.0.us %cmp31.us = icmp sgt i64 %sub30.us, 1 br i1 %cmp31.us, label %while.body.us, label %while.end, !llvm.loop !17 for.body46.us: ; preds = %for.body46.us.preheader229, %for.body46.us %count.1125.us = phi i64 [ %count.2.us, %for.body46.us ], [ %count.1125.us.ph, %for.body46.us.preheader229 ] %i.5124.us = phi i64 [ %inc57.us, %for.body46.us ], [ %i.5124.us.ph, %for.body46.us.preheader229 ] %arrayidx47.us = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.5124.us %28 = load i64, ptr %arrayidx47.us, align 8, !tbaa !5 %arrayidx48.us = getelementptr inbounds [200005 x i64], ptr %c, i64 0, i64 %i.5124.us %29 = load i64, ptr %arrayidx48.us, align 8, !tbaa !5 %cmp49.us = icmp sgt i64 %28, %29 %sub53.us = sub nsw i64 %28, %29 %add54.us = select i1 %cmp49.us, i64 %sub53.us, i64 0 %count.2.us = add nsw i64 %add54.us, %count.1125.us %inc57.us = add nuw nsw i64 %i.5124.us, 1 %exitcond173.not = icmp eq i64 %inc57.us, %4 br i1 %exitcond173.not, label %for.end58.us, label %for.body46.us, !llvm.loop !18 for.body35.us: ; preds = %while.body.us, %for.body35.us %i.4122.us = phi i64 [ %inc42.us.1, %for.body35.us ], [ 0, %while.body.us ] %niter = phi i64 [ %niter.next.1, %for.body35.us ], [ 0, %while.body.us ] %30 = xor i64 %i.4122.us, -1 %sub37.us = add i64 %4, %30 %arrayidx38.us = getelementptr inbounds [200005 x i64], ptr %f, i64 0, i64 %sub37.us %31 = load i64, ptr %arrayidx38.us, align 8, !tbaa !5 %div39.us = sdiv i64 %div.us, %31 %arrayidx40.us = getelementptr inbounds [200005 x i64], ptr %c, i64 0, i64 %i.4122.us store i64 %div39.us, ptr %arrayidx40.us, align 16, !tbaa !5 %inc42.us = or i64 %i.4122.us, 1 %32 = xor i64 %i.4122.us, -2 %sub37.us.1 = add i64 %4, %32 %arrayidx38.us.1 = getelementptr inbounds [200005 x i64], ptr %f, i64 0, i64 %sub37.us.1 %33 = load i64, ptr %arrayidx38.us.1, align 8, !tbaa !5 %div39.us.1 = sdiv i64 %div.us, %33 %arrayidx40.us.1 = getelementptr inbounds [200005 x i64], ptr %c, i64 0, i64 %inc42.us store i64 %div39.us.1, ptr %arrayidx40.us.1, align 8, !tbaa !5 %inc42.us.1 = add nuw nsw i64 %i.4122.us, 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.body46.us.preheader.unr-lcssa, label %for.body35.us, !llvm.loop !19 for.body46.us.preheader.unr-lcssa: ; preds = %for.body35.us, %while.body.us %i.4122.us.unr = phi i64 [ 0, %while.body.us ], [ %inc42.us.1, %for.body35.us ] br i1 %lcmp.mod.not, label %for.body46.us.preheader, label %for.body35.us.epil for.body35.us.epil: ; preds = %for.body46.us.preheader.unr-lcssa %34 = xor i64 %i.4122.us.unr, -1 %sub37.us.epil = add i64 %4, %34 %arrayidx38.us.epil = getelementptr inbounds [200005 x i64], ptr %f, i64 0, i64 %sub37.us.epil %35 = load i64, ptr %arrayidx38.us.epil, align 8, !tbaa !5 %div39.us.epil = sdiv i64 %div.us, %35 %arrayidx40.us.epil = getelementptr inbounds [200005 x i64], ptr %c, i64 0, i64 %i.4122.us.unr store i64 %div39.us.epil, ptr %arrayidx40.us.epil, align 8, !tbaa !5 br label %for.body46.us.preheader for.body46.us.preheader: ; preds = %for.body46.us.preheader.unr-lcssa, %for.body35.us.epil br i1 %min.iters.check212, label %for.body46.us.preheader229, label %vector.body218 vector.body218: ; preds = %for.body46.us.preheader, %vector.body218 %index219 = phi i64 [ %index.next226, %vector.body218 ], [ 0, %for.body46.us.preheader ] %vec.phi220 = phi <2 x i64> [ %46, %vector.body218 ], [ zeroinitializer, %for.body46.us.preheader ] %vec.phi221 = phi <2 x i64> [ %47, %vector.body218 ], [ zeroinitializer, %for.body46.us.preheader ] %36 = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %index219 %wide.load222 = load <2 x i64>, ptr %36, align 16, !tbaa !5 %37 = getelementptr inbounds i64, ptr %36, i64 2 %wide.load223 = load <2 x i64>, ptr %37, align 16, !tbaa !5 %38 = getelementptr inbounds [200005 x i64], ptr %c, i64 0, i64 %index219 %wide.load224 = load <2 x i64>, ptr %38, align 16, !tbaa !5 %39 = getelementptr inbounds i64, ptr %38, i64 2 %wide.load225 = load <2 x i64>, ptr %39, align 16, !tbaa !5 %40 = icmp sgt <2 x i64> %wide.load222, %wide.load224 %41 = icmp sgt <2 x i64> %wide.load223, %wide.load225 %42 = sub nsw <2 x i64> %wide.load222, %wide.load224 %43 = sub nsw <2 x i64> %wide.load223, %wide.load225 %44 = select <2 x i1> %40, <2 x i64> %42, <2 x i64> zeroinitializer %45 = select <2 x i1> %41, <2 x i64> %43, <2 x i64> zeroinitializer %46 = add <2 x i64> %44, %vec.phi220 %47 = add <2 x i64> %45, %vec.phi221 %index.next226 = add nuw i64 %index219, 4 %48 = icmp eq i64 %index.next226, %n.vec215 br i1 %48, label %middle.block210, label %vector.body218, !llvm.loop !20 middle.block210: ; preds = %vector.body218 %bin.rdx227 = add <2 x i64> %47, %46 %49 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx227) br i1 %cmp.n217, label %for.end58.us, label %for.body46.us.preheader229 for.body46.us.preheader229: ; preds = %for.body46.us.preheader, %middle.block210 %count.1125.us.ph = phi i64 [ 0, %for.body46.us.preheader ], [ %49, %middle.block210 ] %i.5124.us.ph = phi i64 [ 0, %for.body46.us.preheader ], [ %n.vec215, %middle.block210 ] br label %for.body46.us while.body.lr.ph.split.split: ; preds = %while.body.lr.ph %cmp59.not = icmp slt i64 %.fr, 0 br i1 %cmp59.not, label %while.end, label %while.body for.body22: ; preds = %for.body22.preheader233, %for.body22 %max.0119 = phi i64 [ %add26, %for.body22 ], [ %max.0119.ph, %for.body22.preheader233 ] %i.3118 = phi i64 [ %inc28, %for.body22 ], [ %i.3118.ph, %for.body22.preheader233 ] %arrayidx23 = getelementptr inbounds [200005 x i64], ptr %a, i64 0, i64 %i.3118 %50 = load i64, ptr %arrayidx23, align 8, !tbaa !5 %51 = xor i64 %i.3118, -1 %sub24 = add i64 %4, %51 %arrayidx25 = getelementptr inbounds [200005 x i64], ptr %f, i64 0, i64 %sub24 %52 = load i64, ptr %arrayidx25, align 8, !tbaa !5 %mul = mul nsw i64 %52, %50 %add26 = add nsw i64 %mul, %max.0119 %inc28 = add nuw nsw i64 %i.3118, 1 %exitcond171.not = icmp eq i64 %inc28, %4 br i1 %exitcond171.not, label %while.cond.preheader, label %for.body22, !llvm.loop !21 while.body: ; preds = %while.body.lr.ph.split.split, %while.body %max.1129 = phi i64 [ %div, %while.body ], [ %add26.lcssa, %while.body.lr.ph.split.split ] %div = sdiv i64 %max.1129, 2 %cmp31 = icmp sgt i64 %max.1129, 3 br i1 %cmp31, label %while.body, label %while.end, !llvm.loop !17 while.end: ; preds = %while.body, %for.end58.us, %for.end17.thread, %for.cond20.preheader, %while.body.lr.ph.split.split, %while.cond.preheader %max.1.lcssa = phi i64 [ %add26.lcssa, %while.cond.preheader ], [ %add26.lcssa, %while.body.lr.ph.split.split ], [ 0, %for.cond20.preheader ], [ 0, %for.end17.thread ], [ %max.1.div.us, %for.end58.us ], [ %div, %while.body ] %call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %max.1.lcssa) br label %cleanup cleanup: ; preds = %while.end, %if.then call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %c) #7 call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %f) #7 call void @llvm.lifetime.end.p0(i64 1600040, ptr nonnull %a) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #7 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; 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 #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree "no-trapping-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 nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"long long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = 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} !16 = distinct !{!16, !10, !13, !14} !17 = distinct !{!17, !10} !18 = distinct !{!18, !10, !14, !13} !19 = distinct !{!19, !10} !20 = distinct !{!20, !10, !13, !14} !21 = distinct !{!21, !10, !14, !13}
#include<stdio.h> long combi(int,int); int main(){ long ans=0; int N,P,A,count_e=0,count_o=0; scanf("%d%d",&N,&P); for (int i = 0; i < N; i++) { scanf("%d",&A); if (A%2==0) { count_e++; }else { count_o++; } } if (P) { for (int i = 0; i <= N; i++){ for (int j = 1; j<=i; j+=2){ ans+=combi(count_o,j)*combi(count_e,i-j); } } }else{ for (int i = 0; i <= N; i++){ for (int j = 0; j <= i; j+=2) { ans+=combi(count_o,j)*combi(count_e,i-j); } } } printf("%ld",ans); return 0; } long combi(int n,int r){ long p=1; for (int i=1;i<=r;i++){ p=p*(n-i+1)/i; } return p; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101588/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101588/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %P = alloca i32, align 4 %A = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %P) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %P) %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp115 = icmp sgt i32 %0, 0 br i1 %cmp115, label %for.body, label %for.cond.cleanup for.cond.cleanup.loopexit: ; preds = %for.body %1 = add i32 %count_o.1, 1 %2 = add i32 %count_e.1, 1 br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry %count_e.0.lcssa = phi i32 [ 1, %entry ], [ %2, %for.cond.cleanup.loopexit ] %count_o.0.lcssa = phi i32 [ 1, %entry ], [ %1, %for.cond.cleanup.loopexit ] %.lcssa = phi i32 [ %0, %entry ], [ %9, %for.cond.cleanup.loopexit ] %3 = load i32, ptr %P, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 %cmp26.not131 = icmp slt i32 %.lcssa, 0 br i1 %tobool.not, label %for.cond25.preheader, label %for.cond7.preheader for.cond7.preheader: ; preds = %for.cond.cleanup br i1 %cmp26.not131, label %if.end45, label %for.cond11.preheader.lr.ph for.cond11.preheader.lr.ph: ; preds = %for.cond7.preheader %4 = add nuw i32 %.lcssa, 1 %wide.trip.count = zext i32 %4 to i64 br label %for.cond11.preheader for.cond25.preheader: ; preds = %for.cond.cleanup br i1 %cmp26.not131, label %if.end45, label %for.cond30.preheader.lr.ph for.cond30.preheader.lr.ph: ; preds = %for.cond25.preheader %5 = add nuw i32 %.lcssa, 1 %wide.trip.count149 = zext i32 %5 to i64 br label %for.cond30.preheader for.body: ; preds = %entry, %for.body %i.0118 = phi i32 [ %inc4, %for.body ], [ 0, %entry ] %count_o.0117 = phi i32 [ %count_o.1, %for.body ], [ 0, %entry ] %count_e.0116 = phi i32 [ %count_e.1, %for.body ], [ 0, %entry ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %A) %6 = load i32, ptr %A, align 4, !tbaa !5 %7 = and i32 %6, 1 %8 = xor i32 %7, 1 %count_e.1 = add i32 %8, %count_e.0116 %count_o.1 = add i32 %7, %count_o.0117 %inc4 = add nuw nsw i32 %i.0118, 1 %9 = load i32, ptr %N, align 4, !tbaa !5 %cmp = icmp slt i32 %inc4, %9 br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !9 for.cond11.preheader: ; preds = %for.cond11.preheader.lr.ph, %for.cond.cleanup13 %indvars.iv139 = phi i64 [ 0, %for.cond11.preheader.lr.ph ], [ %indvars.iv.next140, %for.cond.cleanup13 ] %ans.0126 = phi i64 [ 0, %for.cond11.preheader.lr.ph ], [ %ans.1.lcssa, %for.cond.cleanup13 ] %10 = add nsw i64 %indvars.iv139, -1 %11 = add nsw i64 %indvars.iv139, -2 %cmp12.not121 = icmp eq i64 %indvars.iv139, 0 br i1 %cmp12.not121, label %for.cond.cleanup13, label %for.body.lr.ph.i.preheader for.body.lr.ph.i.preheader: ; preds = %for.cond11.preheader %xtraiter158 = and i64 %10, 1 %lcmp.mod159.not = icmp eq i64 %xtraiter158, 0 br label %for.body.lr.ph.i for.cond.cleanup13: ; preds = %combi.exit80, %for.cond11.preheader %ans.1.lcssa = phi i64 [ %ans.0126, %for.cond11.preheader ], [ %add, %combi.exit80 ] %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1 %exitcond.not = icmp eq i64 %indvars.iv.next140, %wide.trip.count br i1 %exitcond.not, label %if.end45, label %for.cond11.preheader, !llvm.loop !11 for.body.lr.ph.i: ; preds = %for.body.lr.ph.i.preheader, %combi.exit80 %indvar = phi i64 [ 0, %for.body.lr.ph.i.preheader ], [ %indvar.next, %combi.exit80 ] %indvars.iv = phi i64 [ 1, %for.body.lr.ph.i.preheader ], [ %indvars.iv.next, %combi.exit80 ] %ans.1122 = phi i64 [ %ans.0126, %for.body.lr.ph.i.preheader ], [ %add, %combi.exit80 ] %12 = mul nsw i64 %indvar, -2 %13 = add i64 %10, %12 %xtraiter = and i64 %indvars.iv, 1 %14 = icmp eq i64 %indvar, 0 br i1 %14, label %combi.exit.unr-lcssa, label %for.body.lr.ph.i.new for.body.lr.ph.i.new: ; preds = %for.body.lr.ph.i %unroll_iter = and i64 %indvars.iv, 9223372036854775806 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.lr.ph.i.new %indvars.iv.i = phi i64 [ 1, %for.body.lr.ph.i.new ], [ %indvars.iv.next.i.1, %for.body.i ] %p.07.i = phi i64 [ 1, %for.body.lr.ph.i.new ], [ %div.i.1, %for.body.i ] %niter = phi i64 [ 0, %for.body.lr.ph.i.new ], [ %niter.next.1, %for.body.i ] %15 = trunc i64 %indvars.iv.i to i32 %add.i = sub i32 %count_o.0.lcssa, %15 %conv.i = sext i32 %add.i to i64 %mul.i = mul nsw i64 %p.07.i, %conv.i %div.i = sdiv i64 %mul.i, %indvars.iv.i %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %16 = trunc i64 %indvars.iv.next.i to i32 %add.i.1 = sub i32 %count_o.0.lcssa, %16 %conv.i.1 = sext i32 %add.i.1 to i64 %mul.i.1 = mul nsw i64 %div.i, %conv.i.1 %div.i.1 = sdiv i64 %mul.i.1, %indvars.iv.next.i %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.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 %combi.exit.unr-lcssa, label %for.body.i, !llvm.loop !12 combi.exit.unr-lcssa: ; preds = %for.body.i, %for.body.lr.ph.i %div.i.lcssa.ph = phi i64 [ undef, %for.body.lr.ph.i ], [ %div.i.1, %for.body.i ] %indvars.iv.i.unr = phi i64 [ 1, %for.body.lr.ph.i ], [ %indvars.iv.next.i.1, %for.body.i ] %p.07.i.unr = phi i64 [ 1, %for.body.lr.ph.i ], [ %div.i.1, %for.body.i ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %combi.exit, label %for.body.i.epil for.body.i.epil: ; preds = %combi.exit.unr-lcssa %17 = trunc i64 %indvars.iv.i.unr to i32 %add.i.epil = sub i32 %count_o.0.lcssa, %17 %conv.i.epil = sext i32 %add.i.epil to i64 %mul.i.epil = mul nsw i64 %p.07.i.unr, %conv.i.epil %div.i.epil = sdiv i64 %mul.i.epil, %indvars.iv.i.unr br label %combi.exit combi.exit: ; preds = %combi.exit.unr-lcssa, %for.body.i.epil %div.i.lcssa = phi i64 [ %div.i.lcssa.ph, %combi.exit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ] %cmp.not6.i66.not = icmp ugt i64 %indvars.iv139, %indvars.iv br i1 %cmp.not6.i66.not, label %for.body.i70.preheader, label %combi.exit80 for.body.i70.preheader: ; preds = %combi.exit %18 = sub i64 0, %12 %19 = icmp eq i64 %11, %18 br i1 %19, label %combi.exit80.loopexit.unr-lcssa, label %for.body.i70.preheader.new for.body.i70.preheader.new: ; preds = %for.body.i70.preheader %unroll_iter161 = sub i64 %13, %xtraiter158 br label %for.body.i70 for.body.i70: ; preds = %for.body.i70, %for.body.i70.preheader.new %indvars.iv.i71 = phi i64 [ 1, %for.body.i70.preheader.new ], [ %indvars.iv.next.i77.1, %for.body.i70 ] %p.07.i72 = phi i64 [ 1, %for.body.i70.preheader.new ], [ %div.i76.1, %for.body.i70 ] %niter162 = phi i64 [ 0, %for.body.i70.preheader.new ], [ %niter162.next.1, %for.body.i70 ] %20 = trunc i64 %indvars.iv.i71 to i32 %add.i73 = sub i32 %count_e.0.lcssa, %20 %conv.i74 = sext i32 %add.i73 to i64 %mul.i75 = mul nsw i64 %p.07.i72, %conv.i74 %div.i76 = sdiv i64 %mul.i75, %indvars.iv.i71 %indvars.iv.next.i77 = add nuw nsw i64 %indvars.iv.i71, 1 %21 = trunc i64 %indvars.iv.next.i77 to i32 %add.i73.1 = sub i32 %count_e.0.lcssa, %21 %conv.i74.1 = sext i32 %add.i73.1 to i64 %mul.i75.1 = mul nsw i64 %div.i76, %conv.i74.1 %div.i76.1 = sdiv i64 %mul.i75.1, %indvars.iv.next.i77 %indvars.iv.next.i77.1 = add nuw nsw i64 %indvars.iv.i71, 2 %niter162.next.1 = add i64 %niter162, 2 %niter162.ncmp.1 = icmp eq i64 %niter162.next.1, %unroll_iter161 br i1 %niter162.ncmp.1, label %combi.exit80.loopexit.unr-lcssa, label %for.body.i70, !llvm.loop !12 combi.exit80.loopexit.unr-lcssa: ; preds = %for.body.i70, %for.body.i70.preheader %div.i76.lcssa.ph = phi i64 [ undef, %for.body.i70.preheader ], [ %div.i76.1, %for.body.i70 ] %indvars.iv.i71.unr = phi i64 [ 1, %for.body.i70.preheader ], [ %indvars.iv.next.i77.1, %for.body.i70 ] %p.07.i72.unr = phi i64 [ 1, %for.body.i70.preheader ], [ %div.i76.1, %for.body.i70 ] br i1 %lcmp.mod159.not, label %combi.exit80, label %for.body.i70.epil for.body.i70.epil: ; preds = %combi.exit80.loopexit.unr-lcssa %22 = trunc i64 %indvars.iv.i71.unr to i32 %add.i73.epil = sub i32 %count_e.0.lcssa, %22 %conv.i74.epil = sext i32 %add.i73.epil to i64 %mul.i75.epil = mul nsw i64 %p.07.i72.unr, %conv.i74.epil %div.i76.epil = sdiv i64 %mul.i75.epil, %indvars.iv.i71.unr br label %combi.exit80 combi.exit80: ; preds = %for.body.i70.epil, %combi.exit80.loopexit.unr-lcssa, %combi.exit %p.0.lcssa.i79 = phi i64 [ 1, %combi.exit ], [ %div.i76.lcssa.ph, %combi.exit80.loopexit.unr-lcssa ], [ %div.i76.epil, %for.body.i70.epil ] %mul = mul nsw i64 %p.0.lcssa.i79, %div.i.lcssa %add = add nsw i64 %mul, %ans.1122 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2 %cmp12.not = icmp ugt i64 %indvars.iv.next, %indvars.iv139 %indvar.next = add i64 %indvar, 1 br i1 %cmp12.not, label %for.cond.cleanup13, label %for.body.lr.ph.i, !llvm.loop !13 for.cond30.preheader: ; preds = %for.cond30.preheader.lr.ph, %for.cond.cleanup32 %indvars.iv146 = phi i64 [ 0, %for.cond30.preheader.lr.ph ], [ %indvars.iv.next147, %for.cond.cleanup32 ] %ans.2132 = phi i64 [ 0, %for.cond30.preheader.lr.ph ], [ %add38, %for.cond.cleanup32 ] %23 = add nsw i64 %indvars.iv146, -1 %xtraiter165 = and i64 %indvars.iv146, 1 %lcmp.mod166.not = icmp eq i64 %xtraiter165, 0 br label %for.body33 for.cond.cleanup32: ; preds = %combi.exit110 %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1 %exitcond150.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count149 br i1 %exitcond150.not, label %if.end45, label %for.cond30.preheader, !llvm.loop !14 for.body33: ; preds = %for.cond30.preheader, %combi.exit110 %indvar163 = phi i64 [ 0, %for.cond30.preheader ], [ %indvar.next164, %combi.exit110 ] %indvars.iv142 = phi i64 [ 0, %for.cond30.preheader ], [ %indvars.iv.next143, %combi.exit110 ] %ans.3129 = phi i64 [ %ans.2132, %for.cond30.preheader ], [ %add38, %combi.exit110 ] %24 = mul nsw i64 %indvar163, -2 %25 = add i64 %indvars.iv146, %24 %cmp.not6.i81 = icmp eq i64 %indvars.iv142, 0 br i1 %cmp.not6.i81, label %combi.exit95, label %for.body.lr.ph.i82 for.body.lr.ph.i82: ; preds = %for.body33 %26 = or i64 %indvars.iv142, 1 br label %for.body.i85 for.body.i85: ; preds = %for.body.i85, %for.body.lr.ph.i82 %indvars.iv.i86 = phi i64 [ 1, %for.body.lr.ph.i82 ], [ %indvars.iv.next.i92.1, %for.body.i85 ] %p.07.i87 = phi i64 [ 1, %for.body.lr.ph.i82 ], [ %div.i91.1, %for.body.i85 ] %27 = trunc i64 %indvars.iv.i86 to i32 %add.i88 = sub i32 %count_o.0.lcssa, %27 %conv.i89 = sext i32 %add.i88 to i64 %mul.i90 = mul nsw i64 %p.07.i87, %conv.i89 %div.i91 = sdiv i64 %mul.i90, %indvars.iv.i86 %indvars.iv.next.i92 = add nuw nsw i64 %indvars.iv.i86, 1 %28 = trunc i64 %indvars.iv.next.i92 to i32 %add.i88.1 = sub i32 %count_o.0.lcssa, %28 %conv.i89.1 = sext i32 %add.i88.1 to i64 %mul.i90.1 = mul nsw i64 %div.i91, %conv.i89.1 %div.i91.1 = sdiv i64 %mul.i90.1, %indvars.iv.next.i92 %indvars.iv.next.i92.1 = add nuw nsw i64 %indvars.iv.i86, 2 %exitcond.not.i93.1 = icmp eq i64 %indvars.iv.next.i92.1, %26 br i1 %exitcond.not.i93.1, label %combi.exit95, label %for.body.i85, !llvm.loop !12 combi.exit95: ; preds = %for.body.i85, %for.body33 %p.0.lcssa.i94 = phi i64 [ 1, %for.body33 ], [ %div.i91.1, %for.body.i85 ] %cmp.not6.i96.not = icmp ugt i64 %indvars.iv146, %indvars.iv142 br i1 %cmp.not6.i96.not, label %for.body.i100.preheader, label %combi.exit110 for.body.i100.preheader: ; preds = %combi.exit95 %29 = sub i64 0, %24 %30 = icmp eq i64 %23, %29 br i1 %30, label %combi.exit110.loopexit.unr-lcssa, label %for.body.i100.preheader.new for.body.i100.preheader.new: ; preds = %for.body.i100.preheader %unroll_iter168 = sub i64 %25, %xtraiter165 br label %for.body.i100 for.body.i100: ; preds = %for.body.i100, %for.body.i100.preheader.new %indvars.iv.i101 = phi i64 [ 1, %for.body.i100.preheader.new ], [ %indvars.iv.next.i107.1, %for.body.i100 ] %p.07.i102 = phi i64 [ 1, %for.body.i100.preheader.new ], [ %div.i106.1, %for.body.i100 ] %niter169 = phi i64 [ 0, %for.body.i100.preheader.new ], [ %niter169.next.1, %for.body.i100 ] %31 = trunc i64 %indvars.iv.i101 to i32 %add.i103 = sub i32 %count_e.0.lcssa, %31 %conv.i104 = sext i32 %add.i103 to i64 %mul.i105 = mul nsw i64 %p.07.i102, %conv.i104 %div.i106 = sdiv i64 %mul.i105, %indvars.iv.i101 %indvars.iv.next.i107 = add nuw nsw i64 %indvars.iv.i101, 1 %32 = trunc i64 %indvars.iv.next.i107 to i32 %add.i103.1 = sub i32 %count_e.0.lcssa, %32 %conv.i104.1 = sext i32 %add.i103.1 to i64 %mul.i105.1 = mul nsw i64 %div.i106, %conv.i104.1 %div.i106.1 = sdiv i64 %mul.i105.1, %indvars.iv.next.i107 %indvars.iv.next.i107.1 = add nuw nsw i64 %indvars.iv.i101, 2 %niter169.next.1 = add i64 %niter169, 2 %niter169.ncmp.1 = icmp eq i64 %niter169.next.1, %unroll_iter168 br i1 %niter169.ncmp.1, label %combi.exit110.loopexit.unr-lcssa, label %for.body.i100, !llvm.loop !12 combi.exit110.loopexit.unr-lcssa: ; preds = %for.body.i100, %for.body.i100.preheader %div.i106.lcssa.ph = phi i64 [ undef, %for.body.i100.preheader ], [ %div.i106.1, %for.body.i100 ] %indvars.iv.i101.unr = phi i64 [ 1, %for.body.i100.preheader ], [ %indvars.iv.next.i107.1, %for.body.i100 ] %p.07.i102.unr = phi i64 [ 1, %for.body.i100.preheader ], [ %div.i106.1, %for.body.i100 ] br i1 %lcmp.mod166.not, label %combi.exit110, label %for.body.i100.epil for.body.i100.epil: ; preds = %combi.exit110.loopexit.unr-lcssa %33 = trunc i64 %indvars.iv.i101.unr to i32 %add.i103.epil = sub i32 %count_e.0.lcssa, %33 %conv.i104.epil = sext i32 %add.i103.epil to i64 %mul.i105.epil = mul nsw i64 %p.07.i102.unr, %conv.i104.epil %div.i106.epil = sdiv i64 %mul.i105.epil, %indvars.iv.i101.unr br label %combi.exit110 combi.exit110: ; preds = %for.body.i100.epil, %combi.exit110.loopexit.unr-lcssa, %combi.exit95 %p.0.lcssa.i109 = phi i64 [ 1, %combi.exit95 ], [ %div.i106.lcssa.ph, %combi.exit110.loopexit.unr-lcssa ], [ %div.i106.epil, %for.body.i100.epil ] %mul37 = mul nsw i64 %p.0.lcssa.i109, %p.0.lcssa.i94 %add38 = add nsw i64 %mul37, %ans.3129 %indvars.iv.next143 = add nuw nsw i64 %indvars.iv142, 2 %cmp31.not = icmp ugt i64 %indvars.iv.next143, %indvars.iv146 %indvar.next164 = add i64 %indvar163, 1 br i1 %cmp31.not, label %for.cond.cleanup32, label %for.body33, !llvm.loop !15 if.end45: ; preds = %for.cond.cleanup13, %for.cond.cleanup32, %for.cond7.preheader, %for.cond25.preheader %ans.4 = phi i64 [ 0, %for.cond25.preheader ], [ 0, %for.cond7.preheader ], [ %add38, %for.cond.cleanup32 ], [ %ans.1.lcssa, %for.cond.cleanup13 ] %call46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.4) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %P) #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 norecurse nosync nounwind memory(none) uwtable define dso_local i64 @combi(i32 noundef %n, i32 noundef %r) local_unnamed_addr #3 { entry: %cmp.not6 = icmp slt i32 %r, 1 br i1 %cmp.not6, label %for.cond.cleanup, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %sub = add i32 %n, 1 %0 = zext i32 %r to i64 %xtraiter = and i64 %0, 1 %1 = icmp eq i32 %r, 1 br i1 %1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new for.body.lr.ph.new: ; preds = %for.body.lr.ph %unroll_iter = and i64 %0, 4294967294 br label %for.body for.cond.cleanup.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph %div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ] %indvars.iv.unr = phi i64 [ 1, %for.body.lr.ph ], [ %indvars.iv.next.1, %for.body ] %p.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.cond.cleanup, label %for.body.epil for.body.epil: ; preds = %for.cond.cleanup.loopexit.unr-lcssa %2 = trunc i64 %indvars.iv.unr to i32 %add.epil = sub i32 %sub, %2 %conv.epil = sext i32 %add.epil to i64 %mul.epil = mul nsw i64 %p.07.unr, %conv.epil %div.epil = sdiv i64 %mul.epil, %indvars.iv.unr br label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body.epil, %for.cond.cleanup.loopexit.unr-lcssa, %entry %p.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.cond.cleanup.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ] ret i64 %p.0.lcssa for.body: ; preds = %for.body, %for.body.lr.ph.new %indvars.iv = phi i64 [ 1, %for.body.lr.ph.new ], [ %indvars.iv.next.1, %for.body ] %p.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ] %niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ] %3 = trunc i64 %indvars.iv to i32 %add = sub i32 %sub, %3 %conv = sext i32 %add to i64 %mul = mul nsw i64 %p.07, %conv %div = sdiv i64 %mul, %indvars.iv %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %4 = trunc i64 %indvars.iv.next to i32 %add.1 = sub i32 %sub, %4 %conv.1 = sext i32 %add.1 to i64 %mul.1 = mul nsw i64 %div, %conv.1 %div.1 = sdiv i64 %mul.1, %indvars.iv.next %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond.cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !12 } ; 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 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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> int main() { int n,p,a[55],i; int num_1=0; long long int ans,m; scanf("%d%d",&n,&p); for(i=0;i<n;i++) { scanf("%d",&a[i]); if(a[i]%2) num_1++; } if(num_1==0) { if(p) { printf("0"); return 0; } else { if(n%2) { ans=1<<(n/2); m=2<<(n/2); printf("%lld",m*ans); return 0; } else { ans=m=1<<(n/2); printf("%lld",ans*m); return 0; } } } ans=1<<(num_1-1); m=1<<(n-num_1); printf("%lld",ans*m); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101630/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101630/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.3 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %p = alloca i32, align 4 %a = alloca [55 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %p) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp47 = icmp sgt i32 %0, 0 br i1 %cmp47, label %for.body, label %if.then6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %num_1.049 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [55 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx) %1 = load i32, ptr %arrayidx, align 4, !tbaa !5 %2 = and i32 %1, 1 %spec.select = add i32 %2, %num_1.049 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp5 = icmp eq i32 %spec.select, 0 br i1 %cmp5, label %if.then6, label %if.end23 if.then6: ; preds = %entry, %for.end %.lcssa56 = phi i32 [ %3, %for.end ], [ %0, %entry ] %5 = load i32, ptr %p, align 4, !tbaa !5 %tobool7.not = icmp eq i32 %5, 0 br i1 %tobool7.not, label %if.else, label %if.then8 if.then8: ; preds = %if.then6 %putchar = call i32 @putchar(i32 48) br label %cleanup if.else: ; preds = %if.then6 %6 = and i32 %.lcssa56, 1 %tobool11.not = icmp eq i32 %6, 0 %div18 = sdiv i32 %.lcssa56, 2 %shl19 = shl nuw i32 1, %div18 %conv20 = sext i32 %shl19 to i64 br i1 %tobool11.not, label %if.else17, label %if.then12 if.then12: ; preds = %if.else %shl14 = shl i32 2, %div18 %conv15 = sext i32 %shl14 to i64 %mul = mul nsw i64 %conv15, %conv20 %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %mul) br label %cleanup if.else17: ; preds = %if.else %mul21 = mul nsw i64 %conv20, %conv20 %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %mul21) br label %cleanup if.end23: ; preds = %for.end %sub = add nsw i32 %spec.select, -1 %shl24 = shl nuw i32 1, %sub %conv25 = sext i32 %shl24 to i64 %sub26 = sub nsw i32 %3, %spec.select %shl27 = shl nuw i32 1, %sub26 %conv28 = sext i32 %shl27 to i64 %mul29 = mul nsw i64 %conv28, %conv25 %call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %mul29) br label %cleanup cleanup: ; preds = %if.end23, %if.else17, %if.then12, %if.then8 call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <limits.h> #include <stdbool.h> #define rep(i, n) for(int i=0; i<(n); ++i) #define max 200001 //qsort(str, n, sizeof(int), up_comp); int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;} int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;} int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );} int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;} int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);} int main(void){ int n, d[50]; int sum=0; scanf("%d", &n); rep(i, n){ scanf("%d", &d[i]); } rep(i, n-1){ 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_101681/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101681/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @up_comp(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 @down_comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 { entry: %0 = load i32, ptr %b, align 4, !tbaa !5 %1 = load i32, ptr %a, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 ret i32 %sub } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @int_sort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #1 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #9 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @count_digit(i32 noundef %a) local_unnamed_addr #3 { entry: %cmp.not3 = icmp eq i32 %a, 0 br i1 %cmp.not3, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %i.05 = phi i32 [ %inc, %while.body ], [ 0, %entry ] %a.addr.04 = phi i32 [ %div, %while.body ], [ %a, %entry ] %div = sdiv i32 %a.addr.04, 10 %inc = add nuw nsw i32 %i.05, 1 %a.addr.04.off = add i32 %a.addr.04, 9 %cmp.not = icmp ult i32 %a.addr.04.off, 19 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %while.body, %entry %i.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ] ret i32 %i.0.lcssa } ; 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 nosync nounwind memory(none) uwtable define dso_local i32 @euclid(i32 noundef %a, i32 noundef %b) local_unnamed_addr #5 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end3, %entry %a.tr = phi i32 [ %a, %entry ], [ %spec.select17, %if.end3 ] %b.tr = phi i32 [ %b, %entry ], [ %rem, %if.end3 ] %spec.select17 = tail call i32 @llvm.smin.i32(i32 %a.tr, i32 %b.tr) %cmp1 = icmp slt i32 %spec.select17, 1 br i1 %cmp1, label %cleanup, label %if.end3 if.end3: ; preds = %tailrecurse %spec.select = tail call i32 @llvm.smax.i32(i32 %a.tr, i32 %b.tr) %rem = srem i32 %spec.select, %spec.select17 %cmp4 = icmp eq i32 %rem, 0 br i1 %cmp4, label %cleanup, label %tailrecurse cleanup: ; preds = %if.end3, %tailrecurse %retval.0 = phi i32 [ -1, %tailrecurse ], [ %spec.select17, %if.end3 ] ret i32 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #6 { entry: %n = alloca i32, align 4 %d = alloca [50 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #10 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %d) #10 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %for.body, label %for.cond.cleanup5 for.cond3.preheader: ; preds = %for.body %cmp437 = icmp sgt i32 %2, 1 br i1 %cmp437, 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.count51 = zext i32 %sub to i64 %wide.trip.count = zext i32 %2 to i64 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [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.cond3.preheader, !llvm.loop !11 for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6 %sum.1.lcssa = phi i32 [ %sum.038, %for.body6 ], [ %15, %middle.block ], [ %add15, %for.body10 ] %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51 br i1 %exitcond52.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !12 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 ] %call22 = 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) #10 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #10 ret i32 0 for.body6: ; preds = %for.body6.preheader, %for.cond3.loopexit %indvars.iv48 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next49, %for.cond3.loopexit ] %indvars.iv43 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next44, %for.cond3.loopexit ] %sum.038 = phi i32 [ 0, %for.body6.preheader ], [ %sum.1.lcssa, %for.cond3.loopexit ] %4 = xor i64 %indvars.iv48, -1 %5 = add nsw i64 %4, %wide.trip.count %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1 %cmp833 = icmp ult i64 %indvars.iv.next49, %1 br i1 %cmp833, label %for.body10.lr.ph, label %for.cond3.loopexit for.body10.lr.ph: ; preds = %for.body6 %arrayidx12 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv48 %6 = load i32, ptr %arrayidx12, 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.iv43, %n.vec %7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.038, 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.phi55 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ] %offset.idx = add i64 %indvars.iv43, %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.load56 = 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.load56, %broadcast.splat %12 = add <4 x i32> %10, %vec.phi %13 = add <4 x i32> %11, %vec.phi55 %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 !13 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.iv45.ph = phi i64 [ %indvars.iv43, %for.body10.lr.ph ], [ %ind.end, %middle.block ] %sum.134.ph = phi i32 [ %sum.038, %for.body10.lr.ph ], [ %15, %middle.block ] br label %for.body10 for.body10: ; preds = %for.body10.preheader, %for.body10 %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ] %sum.134 = phi i32 [ %add15, %for.body10 ], [ %sum.134.ph, %for.body10.preheader ] %arrayidx14 = getelementptr inbounds [50 x i32], ptr %d, i64 0, i64 %indvars.iv45 %16 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %mul = mul nsw i32 %16, %6 %add15 = add nsw i32 %mul, %sum.134 %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.cond3.loopexit, label %for.body10, !llvm.loop !16 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #8 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress 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 norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #5 = { 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 #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #9 = { nounwind willreturn memory(read) } attributes #10 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !10, !14, !15} !14 = !{!"llvm.loop.isvectorized", i32 1} !15 = !{!"llvm.loop.unroll.runtime.disable"} !16 = distinct !{!16, !10, !15, !14}
#include<stdio.h> int main () { int n,i,j,sum=0; scanf("%d", &n); int a[n]; for(i=0;i<n;i++){ scanf("%d", &a[i]); } for(i=0;i<n;i++){ for(j=i+1;j<n;j++){ sum=sum+(a[i]*a[j]); } } printf("%d", sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101724/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101724/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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) %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.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 ] %sum.036 = 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.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 ] %sum.133.ph = phi i32 [ %sum.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 ] %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, 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<stdio.h> int main(void){ int N, d[100], 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("%d", sum/2); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101775/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101775/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [100 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3 call void @llvm.lifetime.start.p0(i64 400, 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 i32 [ 0, %for.cond7.preheader.us.preheader ], [ %sum.2.us.lcssa, %for.cond7.for.cond.cleanup9_crit_edge.us ] %arrayidx13.us = getelementptr inbounds [100 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 i32 [ %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 [100 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 %add.us = add nsw i32 %mul.us, %sum.135.us br label %for.inc16.us for.inc16.us: ; preds = %if.then.us, %for.body10.us %sum.2.us = phi i32 [ %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 [100 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 %add.us.1 = add nsw i32 %mul.us.1, %sum.2.us br label %for.inc16.us.1 for.inc16.us.1: ; preds = %if.then.us.1, %for.inc16.us %sum.2.us.1 = phi i32 [ %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 i32 [ 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 i32 [ %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 [100 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 %add.us.epil = add nsw i32 %mul.us.epil, %sum.135.us.unr 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 i32 [ %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 [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 %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 i32 %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 i32 [ 0, %for.cond3.preheader ], [ %10, %for.cond.cleanup5.loopexit ], [ 0, %entry ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa) call void @llvm.lifetime.end.p0(i64 400, 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> #define MAX 50 int main() { int N,i,j,temp,sum=0; int arr[MAX]; while(scanf("%d",&N)!=EOF) { for(i=0;i<N;i++) { scanf("%d",&temp); arr[i]=temp; } for(i=0;i<N;i++) { for(j=i+1;j<N;j++) { sum+=arr[i]*arr[j]; } } printf("%d\n",sum); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101818/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101818/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %temp = alloca i32, align 4 %arr = 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 4, ptr nonnull %temp) #4 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %arr) #4 %call40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %cmp.not41 = icmp eq i32 %call40, -1 br i1 %cmp.not41, label %while.end, label %for.cond.preheader for.cond.preheader: ; preds = %entry, %for.end19 %sum.042 = phi i32 [ %sum.1.lcssa, %for.end19 ], [ 0, %entry ] %0 = load i32, ptr %N, align 4, !tbaa !5 %cmp130 = icmp sgt i32 %0, 0 br i1 %cmp130, label %for.body, label %for.end19 for.cond3.preheader: ; preds = %for.body %cmp436 = icmp sgt i32 %3, 0 br i1 %cmp436, label %for.body5.preheader, label %for.end19 for.body5.preheader: ; preds = %for.cond3.preheader %1 = zext i32 %3 to i64 %wide.trip.count53 = zext i32 %3 to i64 br label %for.body5 for.body: ; preds = %for.cond.preheader, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ] %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %temp) %2 = load i32, ptr %temp, align 4, !tbaa !5 %arrayidx = getelementptr inbounds [50 x i32], ptr %arr, i64 0, i64 %indvars.iv store i32 %2, ptr %arrayidx, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %3 = load i32, ptr %N, align 4, !tbaa !5 %4 = sext i32 %3 to i64 %cmp1 = icmp slt i64 %indvars.iv.next, %4 br i1 %cmp1, label %for.body, label %for.cond3.preheader, !llvm.loop !9 for.cond3.loopexit: ; preds = %for.body8, %middle.block, %for.body5 %sum.2.lcssa = phi i32 [ %sum.138, %for.body5 ], [ %16, %middle.block ], [ %add13, %for.body8 ] %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53 br i1 %exitcond54.not, label %for.end19, label %for.body5, !llvm.loop !11 for.body5: ; preds = %for.body5.preheader, %for.cond3.loopexit %indvars.iv50 = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next51, %for.cond3.loopexit ] %indvars.iv45 = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next46, %for.cond3.loopexit ] %sum.138 = phi i32 [ %sum.042, %for.body5.preheader ], [ %sum.2.lcssa, %for.cond3.loopexit ] %5 = xor i64 %indvars.iv50, -1 %6 = add nsw i64 %5, %wide.trip.count53 %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %cmp732 = icmp ult i64 %indvars.iv.next51, %1 br i1 %cmp732, label %for.body8.lr.ph, label %for.cond3.loopexit for.body8.lr.ph: ; preds = %for.body5 %arrayidx10 = getelementptr inbounds [50 x i32], ptr %arr, i64 0, i64 %indvars.iv50 %7 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %min.iters.check = icmp ult i64 %6, 8 br i1 %min.iters.check, label %for.body8.preheader, label %vector.ph vector.ph: ; preds = %for.body8.lr.ph %n.vec = and i64 %6, -8 %ind.end = add i64 %indvars.iv45, %n.vec %8 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %sum.138, i64 0 %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %7, 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> [ %8, %vector.ph ], [ %13, %vector.body ] %vec.phi57 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ] %offset.idx = add i64 %indvars.iv45, %index %9 = getelementptr inbounds [50 x i32], ptr %arr, i64 0, i64 %offset.idx %wide.load = load <4 x i32>, ptr %9, align 4, !tbaa !5 %10 = getelementptr inbounds i32, ptr %9, i64 4 %wide.load58 = 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.load58, %broadcast.splat %13 = add <4 x i32> %11, %vec.phi %14 = add <4 x i32> %12, %vec.phi57 %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 %6, %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.iv47.ph = phi i64 [ %indvars.iv45, %for.body8.lr.ph ], [ %ind.end, %middle.block ] %sum.234.ph = phi i32 [ %sum.138, %for.body8.lr.ph ], [ %16, %middle.block ] br label %for.body8 for.body8: ; preds = %for.body8.preheader, %for.body8 %indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body8 ], [ %indvars.iv47.ph, %for.body8.preheader ] %sum.234 = phi i32 [ %add13, %for.body8 ], [ %sum.234.ph, %for.body8.preheader ] %arrayidx12 = getelementptr inbounds [50 x i32], ptr %arr, i64 0, i64 %indvars.iv47 %17 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %mul = mul nsw i32 %17, %7 %add13 = add nsw i32 %mul, %sum.234 %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1 %exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count53 br i1 %exitcond.not, label %for.cond3.loopexit, label %for.body8, !llvm.loop !15 for.end19: ; preds = %for.cond3.loopexit, %for.cond.preheader, %for.cond3.preheader %sum.1.lcssa = phi i32 [ %sum.042, %for.cond3.preheader ], [ %sum.042, %for.cond.preheader ], [ %sum.2.lcssa, %for.cond3.loopexit ] %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.1.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N) %cmp.not = icmp eq i32 %call, -1 br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !16 while.end: ; preds = %for.end19, %entry call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %arr) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %temp) #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} !16 = distinct !{!16, !10}
#include <stdio.h> int main() { int n; scanf("%d", &n); int arr[55]={0}; for(int i=0; i<n; i++) scanf("%d", &arr[i]); int ans = 0; for(int i=0; i<n; i++) for(int j=i+1; j<n; j++) ans += arr[i]*arr[j]; printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101861/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101861/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %arr = alloca [55 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) call void @llvm.lifetime.start.p0(i64 220, ptr nonnull %arr) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(220) %arr, i8 0, i64 220, i1 false) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp31 = icmp sgt i32 %0, 0 br i1 %cmp31, label %for.body, label %for.cond.cleanup5 for.cond3.preheader: ; preds = %for.body %cmp437 = icmp sgt i32 %2, 0 br i1 %cmp437, label %for.body6.preheader, label %for.cond.cleanup5 for.body6.preheader: ; preds = %for.cond3.preheader %1 = zext i32 %2 to i64 %wide.trip.count51 = zext i32 %2 to i64 br label %for.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [55 x i32], ptr %arr, 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.cond3.preheader, !llvm.loop !9 for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6 %ans.1.lcssa = phi i32 [ %ans.038, %for.body6 ], [ %15, %middle.block ], [ %add15, %for.body10 ] %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1 %exitcond52.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count51 br i1 %exitcond52.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !11 for.cond.cleanup5: ; preds = %for.cond3.loopexit, %entry, %for.cond3.preheader %ans.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %ans.1.lcssa, %for.cond3.loopexit ] %call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 220, ptr nonnull %arr) #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.iv48 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next49, %for.cond3.loopexit ] %indvars.iv43 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next44, %for.cond3.loopexit ] %ans.038 = phi i32 [ 0, %for.body6.preheader ], [ %ans.1.lcssa, %for.cond3.loopexit ] %4 = xor i64 %indvars.iv48, -1 %5 = add nsw i64 %4, %wide.trip.count51 %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1 %cmp833 = icmp ult i64 %indvars.iv.next49, %1 br i1 %cmp833, label %for.body10.lr.ph, label %for.cond3.loopexit for.body10.lr.ph: ; preds = %for.body6 %arrayidx12 = getelementptr inbounds [55 x i32], ptr %arr, i64 0, i64 %indvars.iv48 %6 = load i32, ptr %arrayidx12, 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.iv43, %n.vec %7 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.038, 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.phi55 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ] %offset.idx = add i64 %indvars.iv43, %index %8 = getelementptr inbounds [55 x i32], ptr %arr, 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.load56 = 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.load56, %broadcast.splat %12 = add <4 x i32> %10, %vec.phi %13 = add <4 x i32> %11, %vec.phi55 %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.iv45.ph = phi i64 [ %indvars.iv43, %for.body10.lr.ph ], [ %ind.end, %middle.block ] %ans.134.ph = phi i32 [ %ans.038, %for.body10.lr.ph ], [ %15, %middle.block ] br label %for.body10 for.body10: ; preds = %for.body10.preheader, %for.body10 %indvars.iv45 = phi i64 [ %indvars.iv.next46, %for.body10 ], [ %indvars.iv45.ph, %for.body10.preheader ] %ans.134 = phi i32 [ %add15, %for.body10 ], [ %ans.134.ph, %for.body10.preheader ] %arrayidx14 = getelementptr inbounds [55 x i32], ptr %arr, i64 0, i64 %indvars.iv45 %16 = load i32, ptr %arrayidx14, align 4, !tbaa !5 %mul = mul nsw i32 %16, %6 %add15 = add nsw i32 %mul, %ans.134 %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1 %exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count51 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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10, !13, !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; scanf("%d", &n); int d[n], ans=0; 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++) { ans += d[i]*d[j]; } } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101904/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101904/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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.cond.cleanup5 for.cond3.preheader: ; preds = %for.body %cmp435 = icmp sgt i32 %5, 1 br i1 %cmp435, label %for.body6.preheader, label %for.cond.cleanup5 for.body6.preheader: ; preds = %for.cond3.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.body6 for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %add.ptr = getelementptr inbounds i32, ptr %vla, 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 %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.cond3.preheader, !llvm.loop !9 for.cond3.loopexit: ; preds = %for.body10, %middle.block, %for.body6 %ans.1.lcssa = phi i32 [ %ans.036, %for.body6 ], [ %19, %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 %ans.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ 0, %entry ], [ %ans.1.lcssa, %for.cond3.loopexit ] %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) 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 ] %ans.036 = phi i32 [ 0, %for.body6.preheader ], [ %ans.1.lcssa, %for.cond3.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 %cmp831 = icmp ult i64 %indvars.iv.next47, %4 br i1 %cmp831, label %for.body10.lr.ph, label %for.cond3.loopexit for.body10.lr.ph: ; preds = %for.body6 %arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv46 %9 = load i32, ptr %arrayidx, align 4, !tbaa !5 %min.iters.check = icmp ult i64 %8, 8 br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph vector.ph: ; preds = %for.body10.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 %ans.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.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 ] %ans.132.ph = phi i32 [ %ans.036, %for.body10.lr.ph ], [ %19, %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 ] %ans.132 = phi i32 [ %add13, %for.body10 ], [ %ans.132.ph, %for.body10.preheader ] %arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv43 %20 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %mul = mul nsw i32 %20, %9 %add13 = add nsw i32 %mul, %ans.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: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: 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,i,j; scanf("%d",&N); int d[N+1],S=0,a=0; for(j=1;j<=N;j++){ scanf("%d",&d[j]); } if(N==2){ S = d[1]*d[2]; }else{ for(i=0;i<=N-2;i++){ a += d[N-i]; S += d[N-i-1]*a; } } printf("%d",S); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101948/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101948/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not29 = icmp slt i32 %3, 1 br i1 %cmp.not29, label %if.end, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %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 %4 = load i32, ptr %N, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %5 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9 for.end: ; preds = %for.body %cmp2 = icmp eq i32 %4, 2 br i1 %cmp2, label %if.then, label %for.cond5.preheader for.cond5.preheader: ; preds = %for.end %cmp6.not31 = icmp slt i32 %4, 2 br i1 %cmp6.not31, label %if.end, label %for.body7.preheader for.body7.preheader: ; preds = %for.cond5.preheader %6 = zext i32 %4 to i64 %7 = add nsw i32 %4, -1 %wide.trip.count = zext i32 %7 to i64 %invariant.gep = getelementptr i32, ptr %vla, i64 -1 %xtraiter = and i64 %wide.trip.count, 1 %8 = icmp eq i32 %7, 1 br i1 %8, label %if.end.loopexit.unr-lcssa, label %for.body7.preheader.new for.body7.preheader.new: ; preds = %for.body7.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body7 if.then: ; preds = %for.end %arrayidx3 = getelementptr inbounds i32, ptr %vla, i64 1 %9 = load i32, ptr %arrayidx3, align 4, !tbaa !5 %arrayidx4 = getelementptr inbounds i32, ptr %vla, i64 2 %10 = load i32, ptr %arrayidx4, align 8, !tbaa !5 %mul = mul nsw i32 %10, %9 br label %if.end for.body7: ; preds = %for.body7, %for.body7.preheader.new %indvars.iv38 = phi i64 [ 0, %for.body7.preheader.new ], [ %indvars.iv.next39.1, %for.body7 ] %a.034 = phi i32 [ 0, %for.body7.preheader.new ], [ %add11.1, %for.body7 ] %S.033 = phi i32 [ 0, %for.body7.preheader.new ], [ %add17.1, %for.body7 ] %niter = phi i64 [ 0, %for.body7.preheader.new ], [ %niter.next.1, %for.body7 ] %11 = sub nsw i64 %6, %indvars.iv38 %arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %11 %12 = load i32, ptr %arrayidx10, align 4, !tbaa !5 %add11 = add nsw i32 %12, %a.034 %gep = getelementptr i32, ptr %invariant.gep, i64 %11 %13 = load i32, ptr %gep, align 4, !tbaa !5 %mul16 = mul nsw i32 %13, %add11 %add17 = add nsw i32 %mul16, %S.033 %indvars.iv.next39.neg = xor i64 %indvars.iv38, -1 %14 = add nsw i64 %indvars.iv.next39.neg, %6 %arrayidx10.1 = getelementptr inbounds i32, ptr %vla, i64 %14 %15 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5 %add11.1 = add nsw i32 %15, %add11 %gep.1 = getelementptr i32, ptr %invariant.gep, i64 %14 %16 = load i32, ptr %gep.1, align 4, !tbaa !5 %mul16.1 = mul nsw i32 %16, %add11.1 %add17.1 = add nsw i32 %mul16.1, %add17 %indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38, 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 %if.end.loopexit.unr-lcssa, label %for.body7, !llvm.loop !11 if.end.loopexit.unr-lcssa: ; preds = %for.body7, %for.body7.preheader %add17.lcssa.ph = phi i32 [ undef, %for.body7.preheader ], [ %add17.1, %for.body7 ] %indvars.iv38.unr = phi i64 [ 0, %for.body7.preheader ], [ %indvars.iv.next39.1, %for.body7 ] %a.034.unr = phi i32 [ 0, %for.body7.preheader ], [ %add11.1, %for.body7 ] %S.033.unr = phi i32 [ 0, %for.body7.preheader ], [ %add17.1, %for.body7 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %if.end, label %for.body7.epil for.body7.epil: ; preds = %if.end.loopexit.unr-lcssa %17 = sub nsw i64 %6, %indvars.iv38.unr %arrayidx10.epil = getelementptr inbounds i32, ptr %vla, i64 %17 %18 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5 %add11.epil = add nsw i32 %18, %a.034.unr %gep.epil = getelementptr i32, ptr %invariant.gep, i64 %17 %19 = load i32, ptr %gep.epil, align 4, !tbaa !5 %mul16.epil = mul nsw i32 %19, %add11.epil %add17.epil = add nsw i32 %mul16.epil, %S.033.unr br label %if.end if.end: ; preds = %for.body7.epil, %if.end.loopexit.unr-lcssa, %entry, %for.cond5.preheader, %if.then %S.1 = phi i32 [ %mul, %if.then ], [ 0, %for.cond5.preheader ], [ 0, %entry ], [ %add17.lcssa.ph, %if.end.loopexit.unr-lcssa ], [ %add17.epil, %for.body7.epil ] %call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %S.1) 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main(void){ int n; int d[200]; int count; int sum=0; int count2; scanf("%d",&n); for(count=0;count<=n;count++){ scanf("%d",&d[count]); } for(count2=0;count2<n;count2++){ for(count=count2+1;count<n;count++){ sum=sum+(d[count2]*d[count]); } } printf("%d\n",sum); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_101991/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_101991/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [200 x i32], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.start.p0(i64 800, 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 %cmp.not29 = icmp slt i32 %0, 0 br i1 %cmp.not29, label %for.end18, label %for.body 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 [200 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.not.not = icmp slt i64 %indvars.iv, %3 br i1 %cmp.not.not, 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.036, %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.036 = 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 [200 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.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 [200 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.036, %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 [200 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 800, 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> #include <string.h> #include <math.h> int main(void){ int i,j; int N; long ans=0; scanf("%d",&N); int d[N+1]; for(i=1; i<=N; i++){ scanf("%d",&d[i]); } for(i=1;i<=N-1; i++){ for(j=i+1; j<=N; j++){ ans+=d[i]*d[j]; } } printf("%ld\n",ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102033/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102033/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 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 %add = add nsw i32 %0, 1 %1 = zext i32 %add to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %N, align 4, !tbaa !5 %cmp.not30 = icmp slt i32 %3, 1 br i1 %cmp.not30, label %for.end19, label %for.body for.cond2.preheader: ; preds = %for.body %cmp3.not.not36 = icmp sgt i32 %7, 1 br i1 %cmp3.not.not36, label %for.body4.preheader, label %for.end19 for.body4.preheader: ; preds = %for.cond2.preheader %4 = add nuw i32 %7, 1 %wide.trip.count50 = zext i32 %7 to i64 %wide.trip.count = zext i32 %4 to i64 %5 = add nsw i64 %wide.trip.count50, -1 %xtraiter = and i64 %5, 1 %6 = icmp eq i32 %7, 2 br i1 %6, label %for.end19.loopexit.unr-lcssa, label %for.body4.preheader.new for.body4.preheader.new: ; preds = %for.body4.preheader %unroll_iter = and i64 %5, -2 %invariant.gep = getelementptr i32, ptr %vla, i64 1 br label %for.body8.lr.ph for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %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 %7 = load i32, ptr %N, align 4, !tbaa !5 %8 = sext i32 %7 to i64 %cmp.not.not = icmp slt i64 %indvars.iv, %8 br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9 for.cond2.loopexit: ; preds = %for.body8 %indvars.iv.next43 = or i64 %indvars.iv42, 1 %indvars.iv.next48.1 = add nuw nsw i64 %indvars.iv47, 2 %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv47 %9 = load i32, ptr %gep, align 4, !tbaa !5 br label %for.body8.1 for.body8.1: ; preds = %for.body8.1, %for.cond2.loopexit %indvars.iv44.1 = phi i64 [ %indvars.iv.next43, %for.cond2.loopexit ], [ %indvars.iv.next45.1, %for.body8.1 ] %ans.134.1 = phi i64 [ %add13, %for.cond2.loopexit ], [ %add13.1, %for.body8.1 ] %arrayidx12.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv44.1 %10 = load i32, ptr %arrayidx12.1, align 4, !tbaa !5 %mul.1 = mul nsw i32 %10, %9 %conv.1 = sext i32 %mul.1 to i64 %add13.1 = add nsw i64 %ans.134.1, %conv.1 %indvars.iv.next45.1 = add nuw nsw i64 %indvars.iv44.1, 1 %exitcond.not.1 = icmp eq i64 %indvars.iv.next45.1, %wide.trip.count br i1 %exitcond.not.1, label %for.cond2.loopexit.1, label %for.body8.1, !llvm.loop !11 for.cond2.loopexit.1: ; preds = %for.body8.1 %indvars.iv.next43.1 = add nuw nsw i64 %indvars.iv42, 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.end19.loopexit.unr-lcssa, label %for.body8.lr.ph, !llvm.loop !12 for.body8.lr.ph: ; preds = %for.cond2.loopexit.1, %for.body4.preheader.new %indvars.iv47 = phi i64 [ 1, %for.body4.preheader.new ], [ %indvars.iv.next48.1, %for.cond2.loopexit.1 ] %indvars.iv42 = phi i64 [ 2, %for.body4.preheader.new ], [ %indvars.iv.next43.1, %for.cond2.loopexit.1 ] %ans.037 = phi i64 [ 0, %for.body4.preheader.new ], [ %add13.1, %for.cond2.loopexit.1 ] %niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.1, %for.cond2.loopexit.1 ] %arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47 %11 = load i32, ptr %arrayidx10, align 4, !tbaa !5 br label %for.body8 for.body8: ; preds = %for.body8.lr.ph, %for.body8 %indvars.iv44 = phi i64 [ %indvars.iv42, %for.body8.lr.ph ], [ %indvars.iv.next45, %for.body8 ] %ans.134 = phi i64 [ %ans.037, %for.body8.lr.ph ], [ %add13, %for.body8 ] %arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv44 %12 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %mul = mul nsw i32 %12, %11 %conv = sext i32 %mul to i64 %add13 = add nsw i64 %ans.134, %conv %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1 %exitcond.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count br i1 %exitcond.not, label %for.cond2.loopexit, label %for.body8, !llvm.loop !11 for.end19.loopexit.unr-lcssa: ; preds = %for.cond2.loopexit.1, %for.body4.preheader %add13.lcssa.lcssa.ph = phi i64 [ undef, %for.body4.preheader ], [ %add13.1, %for.cond2.loopexit.1 ] %indvars.iv47.unr = phi i64 [ 1, %for.body4.preheader ], [ %indvars.iv.next48.1, %for.cond2.loopexit.1 ] %indvars.iv42.unr = phi i64 [ 2, %for.body4.preheader ], [ %indvars.iv.next43.1, %for.cond2.loopexit.1 ] %ans.037.unr = phi i64 [ 0, %for.body4.preheader ], [ %add13.1, %for.cond2.loopexit.1 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end19, label %for.body8.lr.ph.epil for.body8.lr.ph.epil: ; preds = %for.end19.loopexit.unr-lcssa %arrayidx10.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv47.unr %13 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5 br label %for.body8.epil for.body8.epil: ; preds = %for.body8.epil, %for.body8.lr.ph.epil %indvars.iv44.epil = phi i64 [ %indvars.iv42.unr, %for.body8.lr.ph.epil ], [ %indvars.iv.next45.epil, %for.body8.epil ] %ans.134.epil = phi i64 [ %ans.037.unr, %for.body8.lr.ph.epil ], [ %add13.epil, %for.body8.epil ] %arrayidx12.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv44.epil %14 = load i32, ptr %arrayidx12.epil, align 4, !tbaa !5 %mul.epil = mul nsw i32 %14, %13 %conv.epil = sext i32 %mul.epil to i64 %add13.epil = add nsw i64 %ans.134.epil, %conv.epil %indvars.iv.next45.epil = add nuw nsw i64 %indvars.iv44.epil, 1 %exitcond.not.epil = icmp eq i64 %indvars.iv.next45.epil, %wide.trip.count br i1 %exitcond.not.epil, label %for.end19, label %for.body8.epil, !llvm.loop !11 for.end19: ; preds = %for.end19.loopexit.unr-lcssa, %for.body8.epil, %entry, %for.cond2.preheader %ans.0.lcssa = phi i64 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %add13.lcssa.lcssa.ph, %for.end19.loopexit.unr-lcssa ], [ %add13.epil, %for.body8.epil ] %call20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa) call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10}
#include <stdio.h> struct Node { int parent; int left; int right; }; int n; void Preorder(int); void Inorder(int); void Postorder(int); struct Node tree[30]; int dipth[30],height[30]; int main(){ int i,id,left,right,root; scanf("%d",&n); for(i=0;i<n;i++)tree[i].parent=tree[i].left=tree[i].right=-1; for(i=0;i<n;i++){ scanf("%d %d %d",&id,&left,&right); tree[id].left=left; tree[id].right=right; if(left!=-1)tree[left].parent=id; if(right!=-1)tree[right].parent=id; } for(i=0;i<n;i++){ if(tree[i].parent==-1)root=i; } printf("Preorder\n"); Preorder(root); printf("\nInorder\n"); Inorder(root); printf("\nPostorder\n"); Postorder(root); printf("\n"); return 0; } void Preorder(int u){ if(u==-1)return; printf(" %d",u); Preorder(tree[u].left); Preorder(tree[u].right); } void Inorder(int u){ if(u==-1)return; Inorder(tree[u].left); printf(" %d",u); Inorder(tree[u].right); } void Postorder(int u){ if(u==-1)return; Postorder(tree[u].left); Postorder(tree[u].right); printf(" %d",u); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102077/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102077/source.c" target datalayout = "e-m:e-p270: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 [30 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 @dipth = dso_local local_unnamed_addr global [30 x i32] zeroinitializer, align 16 @height = dso_local local_unnamed_addr global [30 x i32] zeroinitializer, align 16 @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: %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) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #5 %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n) %0 = load i32, ptr @n, align 4, !tbaa !5 %cmp61 = icmp sgt i32 %0, 0 br i1 %cmp61, label %for.body9.preheader, label %for.end41 for.body9.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 @tree, i8 -1, i64 %2, i1 false), !tbaa !5 br label %for.body9 for.cond30.preheader: ; preds = %for.inc27 %cmp3165 = icmp sgt i32 %7, 0 br i1 %cmp3165, label %for.body32.preheader, label %for.end41 for.body32.preheader: ; preds = %for.cond30.preheader %wide.trip.count = zext i32 %7 to i64 %xtraiter = and i64 %wide.trip.count, 3 %3 = icmp ult i32 %7, 4 br i1 %3, label %for.end41.loopexit.unr-lcssa, label %for.body32.preheader.new for.body32.preheader.new: ; preds = %for.body32.preheader %unroll_iter = and i64 %wide.trip.count, 4294967292 br label %for.body32 for.body9: ; preds = %for.body9.preheader, %for.inc27 %i.164 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ] %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right) %4 = load i32, ptr %left, align 4, !tbaa !5 %5 = load i32, ptr %id, align 4, !tbaa !5 %idxprom11 = sext i32 %5 to i64 %left13 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom11, i32 1 store i32 %4, ptr %left13, align 4, !tbaa !9 %6 = load i32, ptr %right, align 4, !tbaa !5 %right16 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom11, i32 2 store i32 %6, ptr %right16, align 4, !tbaa !11 %cmp17.not = icmp eq i32 %4, -1 br i1 %cmp17.not, label %if.end, label %if.then if.then: ; preds = %for.body9 %idxprom18 = sext i32 %4 to i64 %arrayidx19 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom18 store i32 %5, ptr %arrayidx19, align 4, !tbaa !12 br label %if.end if.end: ; preds = %if.then, %for.body9 %cmp21.not = icmp eq i32 %6, -1 br i1 %cmp21.not, label %for.inc27, label %if.then22 if.then22: ; preds = %if.end %idxprom23 = sext i32 %6 to i64 %arrayidx24 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom23 store i32 %5, ptr %arrayidx24, align 4, !tbaa !12 br label %for.inc27 for.inc27: ; preds = %if.end, %if.then22 %inc28 = add nuw nsw i32 %i.164, 1 %7 = load i32, ptr @n, align 4, !tbaa !5 %cmp8 = icmp slt i32 %inc28, %7 br i1 %cmp8, label %for.body9, label %for.cond30.preheader, !llvm.loop !13 for.body32: ; preds = %for.body32, %for.body32.preheader.new %indvars.iv = phi i64 [ 0, %for.body32.preheader.new ], [ %indvars.iv.next.3, %for.body32 ] %root.067 = phi i32 [ undef, %for.body32.preheader.new ], [ %spec.select.3, %for.body32 ] %niter = phi i64 [ 0, %for.body32.preheader.new ], [ %niter.next.3, %for.body32 ] %arrayidx34 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv %8 = load i32, ptr %arrayidx34, align 16, !tbaa !12 %cmp36 = icmp eq i32 %8, -1 %9 = trunc i64 %indvars.iv to i32 %spec.select = select i1 %cmp36, i32 %9, i32 %root.067 %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx34.1 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next %10 = load i32, ptr %arrayidx34.1, align 4, !tbaa !12 %cmp36.1 = icmp eq i32 %10, -1 %11 = trunc i64 %indvars.iv.next to i32 %spec.select.1 = select i1 %cmp36.1, i32 %11, i32 %spec.select %indvars.iv.next.1 = or i64 %indvars.iv, 2 %arrayidx34.2 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next.1 %12 = load i32, ptr %arrayidx34.2, align 8, !tbaa !12 %cmp36.2 = icmp eq i32 %12, -1 %13 = trunc i64 %indvars.iv.next.1 to i32 %spec.select.2 = select i1 %cmp36.2, i32 %13, i32 %spec.select.1 %indvars.iv.next.2 = or i64 %indvars.iv, 3 %arrayidx34.3 = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.next.2 %14 = load i32, ptr %arrayidx34.3, align 4, !tbaa !12 %cmp36.3 = icmp eq i32 %14, -1 %15 = trunc i64 %indvars.iv.next.2 to i32 %spec.select.3 = select i1 %cmp36.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.end41.loopexit.unr-lcssa, label %for.body32, !llvm.loop !15 for.end41.loopexit.unr-lcssa: ; preds = %for.body32, %for.body32.preheader %indvars.iv.unr = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next.3, %for.body32 ] %root.067.unr = phi i32 [ undef, %for.body32.preheader ], [ %spec.select.3, %for.body32 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end41, label %for.body32.epil for.body32.epil: ; preds = %for.end41.loopexit.unr-lcssa, %for.body32.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body32.epil ], [ %indvars.iv.unr, %for.end41.loopexit.unr-lcssa ] %root.067.epil = phi i32 [ %spec.select.epil, %for.body32.epil ], [ %root.067.unr, %for.end41.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body32.epil ], [ 0, %for.end41.loopexit.unr-lcssa ] %arrayidx34.epil = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %indvars.iv.epil %16 = load i32, ptr %arrayidx34.epil, align 4, !tbaa !12 %cmp36.epil = icmp eq i32 %16, -1 %17 = trunc i64 %indvars.iv.epil to i32 %spec.select.epil = select i1 %cmp36.epil, i32 %17, i32 %root.067.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.end41, label %for.body32.epil, !llvm.loop !16 for.end41: ; preds = %for.end41.loopexit.unr-lcssa, %for.body32.epil, %entry, %for.cond30.preheader %root.0.lcssa = phi i32 [ undef, %for.cond30.preheader ], [ undef, %entry ], [ %root.067.unr, %for.end41.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body32.epil ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @Preorder(i32 noundef %root.0.lcssa) %puts59 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @Inorder(i32 noundef %root.0.lcssa) %puts60 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) call void @Postorder(i32 noundef %root.0.lcssa) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #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: nofree nounwind uwtable define dso_local void @Preorder(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 [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %left, align 4, !tbaa !9 tail call void @Preorder(i32 noundef %0) %right = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 2 %1 = load i32, ptr %right, align 4, !tbaa !11 %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 %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 [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %left, align 4, !tbaa !9 tail call void @Inorder(i32 noundef %0) %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %u.tr7) %right = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 2 %1 = load i32, ptr %right, align 4, !tbaa !11 %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 %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 [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %left, align 4, !tbaa !9 tail call void @Postorder(i32 noundef %0) %right = getelementptr inbounds [30 x %struct.Node], ptr @tree, i64 0, i64 %idxprom, i32 2 %1 = load i32, ptr %right, align 4, !tbaa !11 tail call void @Postorder(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 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !6, i64 4} !10 = !{!"Node", !6, i64 0, !6, i64 4, !6, i64 8} !11 = !{!10, !6, i64 8} !12 = !{!10, !6, 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 10000 #define NIL -1 struct Node{ int p, l, r; }; struct Node T[MAX]; int n; void preorder(int); void inorder(int); void postorder(int); int main() { int id, left, right; int i, tmp; scanf("%d", &n); for( i = 0 ; i < n ; i++ ) T[i].p = NIL; for( i = 0 ; i < n ; i++ ){ scanf("%d%d%d", &id, &left, &right); T[id].l = left; T[id].r = right; if( left != NIL ) T[left].p =id; if( right != NIL ) T[right].p = id; } for( i = 0 ; i < n ; i++ ) if( T[i].p == NIL ) tmp = i; printf("Preorder\n"); preorder(tmp); printf("\nInorder\n"); inorder(tmp); printf("\nPostorder\n"); postorder(tmp); printf("\n"); return 0; } void preorder(int u) { if( u == NIL ) return; printf(" %d", u); preorder(T[u].l); preorder(T[u].r); } void inorder(int u) { if( u == NIL ) return; inorder(T[u].l); printf(" %d", u); inorder(T[u].r); } void postorder(int u) { if( u == NIL ) return; postorder(T[u].l); postorder(T[u].r); printf(" %d", u); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102163/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102163/source.c" target datalayout = "e-m:e-p270: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 [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: %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) #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 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, 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 ] %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 %cmp51, 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 ] %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.cond22.preheader: ; preds = %for.inc19 %cmp2355 = icmp sgt i32 %6, 0 br i1 %cmp2355, label %for.body24.preheader, label %for.end33 for.body24.preheader: ; preds = %for.cond22.preheader %wide.trip.count64 = zext i32 %6 to i64 %xtraiter68 = and i64 %wide.trip.count64, 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_iter72 = and i64 %wide.trip.count64, 4294967292 br label %for.body24 for.body3: ; preds = %for.cond1.preheader, %for.inc19 %i.154 = 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 %left, ptr noundef nonnull %right) %3 = load i32, ptr %left, align 4, !tbaa !5 %4 = load i32, ptr %id, align 4, !tbaa !5 %idxprom5 = sext i32 %4 to i64 %l = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 1 store i32 %3, ptr %l, align 4, !tbaa !15 %5 = load i32, ptr %right, align 4, !tbaa !5 %r = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom5, i32 2 store i32 %5, ptr %r, 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 %arrayidx11 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom10 store i32 %4, ptr %arrayidx11, 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 %arrayidx16 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %idxprom15 store i32 %4, ptr %arrayidx16, align 4, !tbaa !9 br label %for.inc19 for.inc19: ; preds = %if.end, %if.then14 %inc20 = add nuw nsw i32 %i.154, 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.iv61 = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next62.3, %for.body24 ] %tmp.057 = phi i32 [ undef, %for.body24.preheader.new ], [ %spec.select.3, %for.body24 ] %niter73 = phi i64 [ 0, %for.body24.preheader.new ], [ %niter73.next.3, %for.body24 ] %arrayidx26 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv61 %7 = load i32, ptr %arrayidx26, align 16, !tbaa !9 %cmp28 = icmp eq i32 %7, -1 %8 = trunc i64 %indvars.iv61 to i32 %spec.select = select i1 %cmp28, i32 %8, i32 %tmp.057 %indvars.iv.next62 = or i64 %indvars.iv61, 1 %arrayidx26.1 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next62 %9 = load i32, ptr %arrayidx26.1, align 4, !tbaa !9 %cmp28.1 = icmp eq i32 %9, -1 %10 = trunc i64 %indvars.iv.next62 to i32 %spec.select.1 = select i1 %cmp28.1, i32 %10, i32 %spec.select %indvars.iv.next62.1 = or i64 %indvars.iv61, 2 %arrayidx26.2 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next62.1 %11 = load i32, ptr %arrayidx26.2, align 8, !tbaa !9 %cmp28.2 = icmp eq i32 %11, -1 %12 = trunc i64 %indvars.iv.next62.1 to i32 %spec.select.2 = select i1 %cmp28.2, i32 %12, i32 %spec.select.1 %indvars.iv.next62.2 = or i64 %indvars.iv61, 3 %arrayidx26.3 = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv.next62.2 %13 = load i32, ptr %arrayidx26.3, align 4, !tbaa !9 %cmp28.3 = icmp eq i32 %13, -1 %14 = trunc i64 %indvars.iv.next62.2 to i32 %spec.select.3 = select i1 %cmp28.3, i32 %14, i32 %spec.select.2 %indvars.iv.next62.3 = add nuw nsw i64 %indvars.iv61, 4 %niter73.next.3 = add i64 %niter73, 4 %niter73.ncmp.3 = icmp eq i64 %niter73.next.3, %unroll_iter72 br i1 %niter73.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.iv61.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next62.3, %for.body24 ] %tmp.057.unr = phi i32 [ undef, %for.body24.preheader ], [ %spec.select.3, %for.body24 ] %lcmp.mod70.not = icmp eq i64 %xtraiter68, 0 br i1 %lcmp.mod70.not, label %for.end33, label %for.body24.epil for.body24.epil: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil %indvars.iv61.epil = phi i64 [ %indvars.iv.next62.epil, %for.body24.epil ], [ %indvars.iv61.unr, %for.end33.loopexit.unr-lcssa ] %tmp.057.epil = phi i32 [ %spec.select.epil, %for.body24.epil ], [ %tmp.057.unr, %for.end33.loopexit.unr-lcssa ] %epil.iter69 = phi i64 [ %epil.iter69.next, %for.body24.epil ], [ 0, %for.end33.loopexit.unr-lcssa ] %arrayidx26.epil = getelementptr inbounds [10000 x %struct.Node], ptr @T, i64 0, i64 %indvars.iv61.epil %15 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !9 %cmp28.epil = icmp eq i32 %15, -1 %16 = trunc i64 %indvars.iv61.epil to i32 %spec.select.epil = select i1 %cmp28.epil, i32 %16, i32 %tmp.057.epil %indvars.iv.next62.epil = add nuw nsw i64 %indvars.iv61.epil, 1 %epil.iter69.next = add i64 %epil.iter69, 1 %epil.iter69.cmp.not = icmp eq i64 %epil.iter69.next, %xtraiter68 br i1 %epil.iter69.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 %tmp.0.lcssa = phi i32 [ undef, %for.cond22.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %tmp.057.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 %tmp.0.lcssa) %puts49 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @inorder(i32 noundef %tmp.0.lcssa) %puts50 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) call void @postorder(i32 noundef %tmp.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 %id) #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 %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 @preorder(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 @inorder(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 @inorder(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 @postorder(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 @postorder(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 @postorder(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 void preParse(int); void inParse(int); void postParse(int); typedef struct node{int p,l,r;}Node; Node T[MAX]; int n; int main(){ int i,l,r,p,root,v; scanf("%d",&n); for(i=0;i<n;i++){ T[i].p=-1; } for(i=0;i<n;i++){ scanf("%d%d%d",&v,&l,&r); T[v].l=l; T[v].r=r; if(l!=-1) T[l].p=v; if(r!=-1) T[r].p=v; } for(i=0;i<n;i++){ if(T[i].p==-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; } void preParse(int u){ if(u==-1) return; printf(" %d",u); preParse(T[u].l); preParse(T[u].r); } void inParse(int u){ if(u==-1) return; inParse(T[u].l); printf(" %d",u); inParse(T[u].r); } void postParse(int u){ if(u==-1) return; postParse(T[u].l); postParse(T[u].r); printf(" %d",u); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102213/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102213/source.c" target datalayout = "e-m:e-p270: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 [25 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: %l = alloca i32, align 4 %r = alloca i32, align 4 %v = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #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 %cmp58 = icmp sgt i32 %0, 0 br i1 %cmp58, label %for.body.preheader, label %for.end36 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.cond2.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.cond2.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.cond2.preheader, label %for.body.epil for.body.epil: ; preds = %for.cond2.preheader.unr-lcssa, %for.body.epil %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond2.preheader.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond2.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.cond2.preheader, label %for.body.epil, !llvm.loop !11 for.cond2.preheader: ; preds = %for.body.epil, %for.cond2.preheader.unr-lcssa br i1 %cmp58, label %for.body4, label %for.end36 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.cond2.preheader.unr-lcssa, label %for.body, !llvm.loop !13 for.cond25.preheader: ; preds = %for.inc22 %cmp2662 = icmp sgt i32 %6, 0 br i1 %cmp2662, label %for.body27.preheader, label %for.end36 for.body27.preheader: ; preds = %for.cond25.preheader %wide.trip.count71 = zext i32 %6 to i64 %xtraiter75 = and i64 %wide.trip.count71, 3 %2 = icmp ult i32 %6, 4 br i1 %2, label %for.end36.loopexit.unr-lcssa, label %for.body27.preheader.new for.body27.preheader.new: ; preds = %for.body27.preheader %unroll_iter79 = and i64 %wide.trip.count71, 4294967292 br label %for.body27 for.body4: ; preds = %for.cond2.preheader, %for.inc22 %i.161 = phi i32 [ %inc23, %for.inc22 ], [ 0, %for.cond2.preheader ] %call5 = 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 %idxprom6 = sext i32 %4 to i64 %l8 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %idxprom6, i32 1 store i32 %3, ptr %l8, align 4, !tbaa !15 %5 = load i32, ptr %r, align 4, !tbaa !5 %r11 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %idxprom6, i32 2 store i32 %5, ptr %r11, align 4, !tbaa !16 %cmp12.not = icmp eq i32 %3, -1 br i1 %cmp12.not, label %if.end, label %if.then if.then: ; preds = %for.body4 %idxprom13 = sext i32 %3 to i64 %arrayidx14 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %idxprom13 store i32 %4, ptr %arrayidx14, align 4, !tbaa !9 br label %if.end if.end: ; preds = %if.then, %for.body4 %cmp16.not = icmp eq i32 %5, -1 br i1 %cmp16.not, label %for.inc22, label %if.then17 if.then17: ; preds = %if.end %idxprom18 = sext i32 %5 to i64 %arrayidx19 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %idxprom18 store i32 %4, ptr %arrayidx19, align 4, !tbaa !9 br label %for.inc22 for.inc22: ; preds = %if.end, %if.then17 %inc23 = add nuw nsw i32 %i.161, 1 %6 = load i32, ptr @n, align 4, !tbaa !5 %cmp3 = icmp slt i32 %inc23, %6 br i1 %cmp3, label %for.body4, label %for.cond25.preheader, !llvm.loop !17 for.body27: ; preds = %for.body27, %for.body27.preheader.new %indvars.iv68 = phi i64 [ 0, %for.body27.preheader.new ], [ %indvars.iv.next69.3, %for.body27 ] %root.064 = phi i32 [ undef, %for.body27.preheader.new ], [ %spec.select.3, %for.body27 ] %niter80 = phi i64 [ 0, %for.body27.preheader.new ], [ %niter80.next.3, %for.body27 ] %arrayidx29 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %indvars.iv68 %7 = load i32, ptr %arrayidx29, align 16, !tbaa !9 %cmp31 = icmp eq i32 %7, -1 %8 = trunc i64 %indvars.iv68 to i32 %spec.select = select i1 %cmp31, i32 %8, i32 %root.064 %indvars.iv.next69 = or i64 %indvars.iv68, 1 %arrayidx29.1 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next69 %9 = load i32, ptr %arrayidx29.1, align 4, !tbaa !9 %cmp31.1 = icmp eq i32 %9, -1 %10 = trunc i64 %indvars.iv.next69 to i32 %spec.select.1 = select i1 %cmp31.1, i32 %10, i32 %spec.select %indvars.iv.next69.1 = or i64 %indvars.iv68, 2 %arrayidx29.2 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next69.1 %11 = load i32, ptr %arrayidx29.2, align 8, !tbaa !9 %cmp31.2 = icmp eq i32 %11, -1 %12 = trunc i64 %indvars.iv.next69.1 to i32 %spec.select.2 = select i1 %cmp31.2, i32 %12, i32 %spec.select.1 %indvars.iv.next69.2 = or i64 %indvars.iv68, 3 %arrayidx29.3 = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %indvars.iv.next69.2 %13 = load i32, ptr %arrayidx29.3, align 4, !tbaa !9 %cmp31.3 = icmp eq i32 %13, -1 %14 = trunc i64 %indvars.iv.next69.2 to i32 %spec.select.3 = select i1 %cmp31.3, i32 %14, i32 %spec.select.2 %indvars.iv.next69.3 = add nuw nsw i64 %indvars.iv68, 4 %niter80.next.3 = add i64 %niter80, 4 %niter80.ncmp.3 = icmp eq i64 %niter80.next.3, %unroll_iter79 br i1 %niter80.ncmp.3, label %for.end36.loopexit.unr-lcssa, label %for.body27, !llvm.loop !18 for.end36.loopexit.unr-lcssa: ; preds = %for.body27, %for.body27.preheader %indvars.iv68.unr = phi i64 [ 0, %for.body27.preheader ], [ %indvars.iv.next69.3, %for.body27 ] %root.064.unr = phi i32 [ undef, %for.body27.preheader ], [ %spec.select.3, %for.body27 ] %lcmp.mod77.not = icmp eq i64 %xtraiter75, 0 br i1 %lcmp.mod77.not, label %for.end36, label %for.body27.epil for.body27.epil: ; preds = %for.end36.loopexit.unr-lcssa, %for.body27.epil %indvars.iv68.epil = phi i64 [ %indvars.iv.next69.epil, %for.body27.epil ], [ %indvars.iv68.unr, %for.end36.loopexit.unr-lcssa ] %root.064.epil = phi i32 [ %spec.select.epil, %for.body27.epil ], [ %root.064.unr, %for.end36.loopexit.unr-lcssa ] %epil.iter76 = phi i64 [ %epil.iter76.next, %for.body27.epil ], [ 0, %for.end36.loopexit.unr-lcssa ] %arrayidx29.epil = getelementptr inbounds [25 x %struct.node], ptr @T, i64 0, i64 %indvars.iv68.epil %15 = load i32, ptr %arrayidx29.epil, align 4, !tbaa !9 %cmp31.epil = icmp eq i32 %15, -1 %16 = trunc i64 %indvars.iv68.epil to i32 %spec.select.epil = select i1 %cmp31.epil, i32 %16, i32 %root.064.epil %indvars.iv.next69.epil = add nuw nsw i64 %indvars.iv68.epil, 1 %epil.iter76.next = add i64 %epil.iter76, 1 %epil.iter76.cmp.not = icmp eq i64 %epil.iter76.next, %xtraiter75 br i1 %epil.iter76.cmp.not, label %for.end36, label %for.body27.epil, !llvm.loop !19 for.end36: ; preds = %for.end36.loopexit.unr-lcssa, %for.body27.epil, %entry, %for.cond2.preheader, %for.cond25.preheader %root.0.lcssa = phi i32 [ undef, %for.cond25.preheader ], [ undef, %for.cond2.preheader ], [ undef, %entry ], [ %root.064.unr, %for.end36.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body27.epil ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @preParse(i32 noundef %root.0.lcssa) %putchar = call i32 @putchar(i32 10) %puts54 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @inParse(i32 noundef %root.0.lcssa) %putchar55 = call i32 @putchar(i32 10) %puts56 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) call void @postParse(i32 noundef %root.0.lcssa) %putchar57 = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: 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 [25 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 [25 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 [25 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 [25 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 [25 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 [25 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 10000 struct node{ int p, q, r; }; struct node T[MAX]; int n; void preorder(int t){ if(t == -1) return; printf(" %d",t); preorder(T[t].q); preorder(T[t].r); } void inorder(int t){ if(t == -1) return; inorder(T[t].q); printf(" %d",t); inorder(T[t].r); } void post(int t){ if(t == -1) return; post(T[t].q); post(T[t].r); printf(" %d",t); } int main(){ int i, v, q, r, root; scanf("%d", &n); for(i = 0; i < n; i++) T[i].p = -1; for(i = 0; i < n; i++){ scanf("%d %d %d", &v, &q, &r); T[v].q = q; T[v].r = r; if(q != -1) T[q].p = v; if(r != -1) T[r].p = v; } for(i = 0; i < n; i++) if(T[i].p == -1) root = i; printf("Preorder\n"); preorder(root); printf("\n"); printf("Inorder\n"); inorder(root); printf("\n"); printf("Postorder\n"); post(root); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102279/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102279/source.c" target datalayout = "e-m:e-p270: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 @preorder(i32 noundef %t) local_unnamed_addr #0 { entry: %cmp6 = icmp eq i32 %t, -1 br i1 %cmp6, label %return, label %if.end if.end: ; preds = %entry, %if.end %t.tr7 = phi i32 [ %1, %if.end ], [ %t, %entry ] %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %t.tr7) %idxprom = sext i32 %t.tr7 to i64 %q = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %q, align 4, !tbaa !5 tail call void @preorder(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 @inorder(i32 noundef %t) local_unnamed_addr #0 { entry: %cmp6 = icmp eq i32 %t, -1 br i1 %cmp6, label %return, label %if.end if.end: ; preds = %entry, %if.end %t.tr7 = phi i32 [ %1, %if.end ], [ %t, %entry ] %idxprom = sext i32 %t.tr7 to i64 %q = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %q, align 4, !tbaa !5 tail call void @inorder(i32 noundef %0) %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %t.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 @post(i32 noundef %t) local_unnamed_addr #0 { entry: %cmp = icmp eq i32 %t, -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 %t to i64 %q = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %q, align 4, !tbaa !5 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 !10 tail call void @post(i32 noundef %1) %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %t) br label %common.ret6 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %v = alloca i32, align 4 %q = 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 %q) #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 %q, ptr noundef nonnull %r) %3 = load i32, ptr %q, align 4, !tbaa !11 %4 = load i32, ptr %v, align 4, !tbaa !11 %idxprom5 = sext i32 %4 to i64 %q7 = getelementptr inbounds [10000 x %struct.node], ptr @T, i64 0, i64 %idxprom5, i32 1 store i32 %3, ptr %q7, 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 @preorder(i32 noundef %root.0.lcssa) %putchar = call i32 @putchar(i32 10) %puts53 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @inorder(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 %q) #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}
//ALDS1_7_C:Tree Walk #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_102321/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102321/source.c" target datalayout = "e-m:e-p270: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 #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_102372/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102372/source.c" target datalayout = "e-m:e-p270: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> typedef struct {/*parent,left child ,right sibling*/ int p,l,r; } node; node T[27]; void Preorder(int ); void Inorder(int ); void Postorder(int ); int main() { int n,i,id,l,r; scanf("%d",&n); for(i=0;i<n;i++) { T[i].p = T[i].l = T[i].r = -1; } for(i=0;i<n;i++) { scanf("%d%d%d",&id,&l,&r); T[id].l = l; T[id].r = r; T[l].p = id; T[r].p = id; } for(i=0;i<n;i++) if(T[i].p == -1) break; printf("Preorder\n"); Preorder(i); printf("\n"); printf("Inorder\n"); Inorder(i); printf("\n"); printf("Postorder\n"); Postorder(i); printf("\n"); return 0; } void Preorder(int id) { printf(" %d",id); if(id != -1) { if(T[id].l != -1) Preorder(T[id].l); if(T[id].r != -1) Preorder(T[id].r); } } void Inorder(int id) { if(id != -1) { if(T[id].l != -1) Inorder(T[id].l); printf(" %d",id); if (T[id].r != -1) Inorder(T[id].r); } } void Postorder(int id) { if(id != -1) { if(T[id].l != -1) Postorder(T[id].l); if (T[id].r != -1) Postorder(T[id].r); } printf(" %d",id); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102422/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102422/source.c" target datalayout = "e-m:e-p270: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 local_unnamed_addr global [27 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: %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) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp58 = icmp sgt i32 %0, 0 br i1 %cmp58, label %for.body9.preheader, label %for.end35 for.body9.preheader: ; preds = %entry %1 = zext i32 %0 to i64 %2 = mul nuw nsw i64 %1, 12 call void @llvm.memset.p0.i64(ptr nonnull align 16 @T, i8 -1, i64 %2, i1 false), !tbaa !5 br label %for.body9 for.cond26.preheader: ; preds = %for.body9 %cmp2762 = icmp sgt i32 %6, 0 br i1 %cmp2762, label %for.body28.preheader, label %for.end35 for.body28.preheader: ; preds = %for.cond26.preheader %wide.trip.count = zext i32 %6 to i64 br label %for.body28 for.body9: ; preds = %for.body9.preheader, %for.body9 %i.161 = phi i32 [ %inc24, %for.body9 ], [ 0, %for.body9.preheader ] %call10 = 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 %idxprom11 = sext i32 %4 to i64 %l13 = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom11, i32 1 store i32 %3, ptr %l13, align 4, !tbaa !9 %5 = load i32, ptr %r, align 4, !tbaa !5 %r16 = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom11, i32 2 store i32 %5, ptr %r16, align 4, !tbaa !11 %idxprom17 = sext i32 %3 to i64 %arrayidx18 = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom17 store i32 %4, ptr %arrayidx18, align 4, !tbaa !12 %idxprom20 = sext i32 %5 to i64 %arrayidx21 = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom20 store i32 %4, ptr %arrayidx21, align 4, !tbaa !12 %inc24 = add nuw nsw i32 %i.161, 1 %6 = load i32, ptr %n, align 4, !tbaa !5 %cmp8 = icmp slt i32 %inc24, %6 br i1 %cmp8, label %for.body9, label %for.cond26.preheader, !llvm.loop !13 for.body28: ; preds = %for.body28.preheader, %for.inc33 %indvars.iv = phi i64 [ 0, %for.body28.preheader ], [ %indvars.iv.next, %for.inc33 ] %arrayidx30 = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %indvars.iv %7 = load i32, ptr %arrayidx30, align 4, !tbaa !12 %cmp32 = icmp eq i32 %7, -1 br i1 %cmp32, label %for.end35.loopexit.split.loop.exit, label %for.inc33 for.inc33: ; preds = %for.body28 %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.end35, label %for.body28, !llvm.loop !15 for.end35.loopexit.split.loop.exit: ; preds = %for.body28 %8 = trunc i64 %indvars.iv to i32 br label %for.end35 for.end35: ; preds = %for.inc33, %for.end35.loopexit.split.loop.exit, %entry, %for.cond26.preheader %i.2.lcssa = phi i32 [ 0, %for.cond26.preheader ], [ 0, %entry ], [ %8, %for.end35.loopexit.split.loop.exit ], [ %6, %for.inc33 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @Preorder(i32 noundef %i.2.lcssa) %putchar = call i32 @putchar(i32 10) %puts54 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @Inorder(i32 noundef %i.2.lcssa) %putchar55 = call i32 @putchar(i32 10) %puts56 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) call void @Postorder(i32 noundef %i.2.lcssa) %putchar57 = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind uwtable define dso_local void @Preorder(i32 noundef %id) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %id.tr = phi i32 [ %id, %entry ], [ %1, %if.end ] %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %id.tr) %cmp.not = icmp eq i32 %id.tr, -1 br i1 %cmp.not, label %if.end14, label %if.then if.then: ; preds = %tailrecurse %idxprom = sext i32 %id.tr to i64 %l = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %l, align 4, !tbaa !9 %cmp1.not = icmp eq i32 %0, -1 br i1 %cmp1.not, label %if.end, label %if.then2 if.then2: ; preds = %if.then tail call void @Preorder(i32 noundef %0) br label %if.end if.end: ; preds = %if.then2, %if.then %r = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 2 %1 = load i32, ptr %r, align 4, !tbaa !11 %cmp8.not = icmp eq i32 %1, -1 br i1 %cmp8.not, label %if.end14, label %tailrecurse if.end14: ; preds = %if.end, %tailrecurse ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @Inorder(i32 noundef %id) local_unnamed_addr #0 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %id.tr = phi i32 [ %id, %entry ], [ %1, %if.end ] %cmp.not = icmp eq i32 %id.tr, -1 br i1 %cmp.not, label %if.end14, label %if.then if.then: ; preds = %tailrecurse %idxprom = sext i32 %id.tr to i64 %l = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %l, align 4, !tbaa !9 %cmp1.not = icmp eq i32 %0, -1 br i1 %cmp1.not, label %if.end, label %if.then2 if.then2: ; preds = %if.then tail call void @Inorder(i32 noundef %0) br label %if.end if.end: ; preds = %if.then2, %if.then %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %id.tr) %r = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 2 %1 = load i32, ptr %r, align 4, !tbaa !11 %cmp8.not = icmp eq i32 %1, -1 br i1 %cmp8.not, label %if.end14, label %tailrecurse if.end14: ; preds = %if.end, %tailrecurse ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @Postorder(i32 noundef %id) local_unnamed_addr #0 { entry: %cmp.not = icmp eq i32 %id, -1 br i1 %cmp.not, label %if.end14, label %if.then if.then: ; preds = %entry %idxprom = sext i32 %id to i64 %l = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 1 %0 = load i32, ptr %l, align 4, !tbaa !9 %cmp1.not = icmp eq i32 %0, -1 br i1 %cmp1.not, label %if.end, label %if.then2 if.then2: ; preds = %if.then tail call void @Postorder(i32 noundef %0) br label %if.end if.end: ; preds = %if.then2, %if.then %r = getelementptr inbounds [27 x %struct.node], ptr @T, i64 0, i64 %idxprom, i32 2 %1 = load i32, ptr %r, align 4, !tbaa !11 %cmp8.not = icmp eq i32 %1, -1 br i1 %cmp8.not, label %if.end14, label %if.then9 if.then9: ; preds = %if.end tail call void @Postorder(i32 noundef %1) br label %if.end14 if.end14: ; preds = %if.end, %if.then9, %entry %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %id) 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 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !6, i64 4} !10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8} !11 = !{!10, !6, i64 8} !12 = !{!10, !6, i64 0} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = distinct !{!15, !14}
#include <stdio.h> typedef struct { int left; int right; int par; }data; void preorder(data* T,int i) { printf(" %d", i); if(T[i].left!=-1) preorder(T,T[i].left); if(T[i].right!=-1) preorder(T,T[i].right); } void inorder(data* T, int i) { if (T[i].left != -1) inorder(T,T[i].left); printf(" %d", i); if(T[i].right!=-1) inorder(T,T[i].right); } void postorder(data* T, int i) { if (T[i].left != -1) postorder(T,T[i].left); if(T[i].right!=-1) postorder(T,T[i].right); printf(" %d", i); } int main() { int i,n; data T[25]; int id, left, right; scanf("%d", &n); for (i = 0; i < n; i++) T[i].left = T[i].right = T[i].par = -1; for (i = 0; i < n; i++){ scanf("%d%d%d", &id, &left, &right); if (left != -1) { T[id].left = left; T[left].par = id; } if (right != -1) { T[id].right = right; T[right].par = id; } } for (i = 0; i < n; i++) if (T[i].par == -1) break; printf("Preorder\n"); preorder(T,i); printf("\n"); printf("Inorder\n"); inorder(T,i); printf("\n"); printf("Postorder\n"); postorder(T,i); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102473/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102473/source.c" target datalayout = "e-m:e-p270: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.data = type { i32, i32, i32 } @.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 [7 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 @preorder(ptr nocapture noundef readonly %T, 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, i32 noundef %i.tr) %idxprom = sext i32 %i.tr to i64 %arrayidx = getelementptr inbounds %struct.data, ptr %T, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp.not = icmp eq i32 %0, -1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @preorder(ptr noundef nonnull %T, i32 noundef %0) br label %if.end if.end: ; preds = %if.then, %tailrecurse %right = getelementptr inbounds %struct.data, ptr %T, i64 %idxprom, i32 1 %1 = load i32, ptr %right, align 4, !tbaa !10 %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 declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1 ; Function Attrs: nofree nounwind uwtable define dso_local void @inorder(ptr nocapture noundef readonly %T, 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 %arrayidx = getelementptr inbounds %struct.data, ptr %T, i64 %idxprom %0 = load i32, ptr %arrayidx, align 4, !tbaa !5 %cmp.not = icmp eq i32 %0, -1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @inorder(ptr noundef nonnull %T, 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, i32 noundef %i.tr) %right = getelementptr inbounds %struct.data, ptr %T, i64 %idxprom, i32 1 %1 = load i32, ptr %right, align 4, !tbaa !10 %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 @postorder(ptr noundef %T, i32 noundef %i) local_unnamed_addr #0 { entry: %idxprom = sext i32 %i to i64 %arrayidx = getelementptr inbounds %struct.data, ptr %T, i64 %idxprom %0 = load i32, ptr %arrayidx, 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 tail call void @postorder(ptr noundef nonnull %T, i32 noundef %0) br label %if.end if.end: ; preds = %if.then, %entry %right = getelementptr inbounds %struct.data, ptr %T, i64 %idxprom, i32 1 %1 = load i32, ptr %right, align 4, !tbaa !10 %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 @postorder(ptr noundef nonnull %T, 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, i32 noundef %i) ret void } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %T = alloca [25 x %struct.data], align 16 %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 %n) #5 call void @llvm.lifetime.start.p0(i64 300, ptr nonnull %T) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %id) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %left) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %right) #5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !11 %cmp67 = icmp sgt i32 %0, 0 br i1 %cmp67, label %for.body9.preheader, label %for.end41 for.body9.preheader: ; preds = %entry %1 = zext i32 %0 to i64 %2 = mul nuw nsw i64 %1, 12 call void @llvm.memset.p0.i64(ptr nonnull align 16 %T, i8 -1, i64 %2, i1 false), !tbaa !11 br label %for.body9 for.cond30.preheader: ; preds = %for.inc27 %cmp3171 = icmp sgt i32 %7, 0 br i1 %cmp3171, label %for.body32.preheader, label %for.end41 for.body32.preheader: ; preds = %for.cond30.preheader %wide.trip.count = zext i32 %7 to i64 br label %for.body32 for.body9: ; preds = %for.body9.preheader, %for.inc27 %i.170 = phi i32 [ %inc28, %for.inc27 ], [ 0, %for.body9.preheader ] %call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %id, ptr noundef nonnull %left, ptr noundef nonnull %right) %3 = load i32, ptr %left, align 4, !tbaa !11 %cmp11.not = icmp eq i32 %3, -1 br i1 %cmp11.not, label %if.end, label %if.then if.then: ; preds = %for.body9 %4 = load i32, ptr %id, align 4, !tbaa !11 %idxprom12 = sext i32 %4 to i64 %arrayidx13 = getelementptr inbounds [25 x %struct.data], ptr %T, i64 0, i64 %idxprom12 store i32 %3, ptr %arrayidx13, align 4, !tbaa !5 %idxprom15 = sext i32 %3 to i64 %par17 = getelementptr inbounds [25 x %struct.data], ptr %T, i64 0, i64 %idxprom15, i32 2 store i32 %4, ptr %par17, align 4, !tbaa !12 br label %if.end if.end: ; preds = %if.then, %for.body9 %5 = load i32, ptr %right, align 4, !tbaa !11 %cmp18.not = icmp eq i32 %5, -1 br i1 %cmp18.not, label %for.inc27, label %if.then19 if.then19: ; preds = %if.end %6 = load i32, ptr %id, align 4, !tbaa !11 %idxprom20 = sext i32 %6 to i64 %right22 = getelementptr inbounds [25 x %struct.data], ptr %T, i64 0, i64 %idxprom20, i32 1 store i32 %5, ptr %right22, align 4, !tbaa !10 %idxprom23 = sext i32 %5 to i64 %par25 = getelementptr inbounds [25 x %struct.data], ptr %T, i64 0, i64 %idxprom23, i32 2 store i32 %6, ptr %par25, align 4, !tbaa !12 br label %for.inc27 for.inc27: ; preds = %if.end, %if.then19 %inc28 = add nuw nsw i32 %i.170, 1 %7 = load i32, ptr %n, align 4, !tbaa !11 %cmp8 = icmp slt i32 %inc28, %7 br i1 %cmp8, label %for.body9, label %for.cond30.preheader, !llvm.loop !13 for.body32: ; preds = %for.body32.preheader, %for.inc39 %indvars.iv = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next, %for.inc39 ] %par35 = getelementptr inbounds [25 x %struct.data], ptr %T, i64 0, i64 %indvars.iv, i32 2 %8 = load i32, ptr %par35, align 4, !tbaa !12 %cmp36 = icmp eq i32 %8, -1 br i1 %cmp36, label %for.end41.loopexit.split.loop.exit, label %for.inc39 for.inc39: ; preds = %for.body32 %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.end41, label %for.body32, !llvm.loop !15 for.end41.loopexit.split.loop.exit: ; preds = %for.body32 %9 = trunc i64 %indvars.iv to i32 br label %for.end41 for.end41: ; preds = %for.inc39, %for.end41.loopexit.split.loop.exit, %entry, %for.cond30.preheader %i.2.lcssa = phi i32 [ 0, %for.cond30.preheader ], [ 0, %entry ], [ %9, %for.end41.loopexit.split.loop.exit ], [ %7, %for.inc39 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @preorder(ptr noundef nonnull %T, i32 noundef %i.2.lcssa) %putchar = call i32 @putchar(i32 10) %puts63 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @inorder(ptr noundef nonnull %T, i32 noundef %i.2.lcssa) %putchar64 = call i32 @putchar(i32 10) %puts65 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) call void @postorder(ptr noundef nonnull %T, i32 noundef %i.2.lcssa) %putchar66 = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %right) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %left) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %id) #5 call void @llvm.lifetime.end.p0(i64 300, ptr nonnull %T) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #5 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !7, i64 0} !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 4} !11 = !{!7, !7, i64 0} !12 = !{!6, !7, i64 8} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.mustprogress"} !15 = distinct !{!15, !14}
#include <stdio.h> #define MAX 100005 #define NIL -1 struct Node { int parent, left, right; }; struct Node Tree[MAX]; int n; void preParse(int u) { if ( u == NIL ) return; printf(" %d",u); preParse(Tree[u].left); preParse(Tree[u].right); } void inParse(int u) { if ( u == NIL ) return; inParse(Tree[u].left); printf(" %d",u); inParse(Tree[u].right); } void postParse(int u) { if ( u == NIL ) return; postParse(Tree[u].left); postParse(Tree[u].right); printf(" %d",u); } int main () { int i, v, 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", &v, &l, &r); Tree[v].left = l; Tree[v].right = r; if (l != NIL) Tree[l].parent = v; if (r != NIL) Tree[r].parent = v; } for ( i = 0; i < n; i++ ) { if (Tree[i].parent == 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_102516/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102516/source.c" target datalayout = "e-m:e-p270: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 @Tree = dso_local local_unnamed_addr global [100005 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 [7 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 %left = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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: %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 %cmp51 = icmp sgt i32 %0, 0 br i1 %cmp51, 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 ] %arrayidx.epil = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, 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 %cmp51, 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 ] %arrayidx = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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 [100005 x %struct.Node], ptr @Tree, 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.cond22.preheader: ; preds = %for.inc19 %cmp2355 = icmp sgt i32 %6, 0 br i1 %cmp2355, label %for.body24.preheader, label %for.end33 for.body24.preheader: ; preds = %for.cond22.preheader %wide.trip.count64 = zext i32 %6 to i64 %xtraiter68 = and i64 %wide.trip.count64, 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_iter72 = and i64 %wide.trip.count64, 4294967292 br label %for.body24 for.body3: ; preds = %for.cond1.preheader, %for.inc19 %i.154 = phi i32 [ %inc20, %for.inc19 ], [ 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 %left = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 1 store i32 %3, ptr %left, align 4, !tbaa !5 %5 = load i32, ptr %r, align 4, !tbaa !11 %right = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom5, i32 2 store i32 %5, ptr %right, align 4, !tbaa !10 %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 %arrayidx11 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom10 store i32 %4, ptr %arrayidx11, align 4, !tbaa !12 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 %arrayidx16 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %idxprom15 store i32 %4, ptr %arrayidx16, align 4, !tbaa !12 br label %for.inc19 for.inc19: ; preds = %if.end, %if.then14 %inc20 = add nuw nsw i32 %i.154, 1 %6 = load i32, ptr @n, align 4, !tbaa !11 %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.iv61 = phi i64 [ 0, %for.body24.preheader.new ], [ %indvars.iv.next62.3, %for.body24 ] %root.057 = phi i32 [ undef, %for.body24.preheader.new ], [ %spec.select.3, %for.body24 ] %niter73 = phi i64 [ 0, %for.body24.preheader.new ], [ %niter73.next.3, %for.body24 ] %arrayidx26 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv61 %7 = load i32, ptr %arrayidx26, align 16, !tbaa !12 %cmp28 = icmp eq i32 %7, -1 %8 = trunc i64 %indvars.iv61 to i32 %spec.select = select i1 %cmp28, i32 %8, i32 %root.057 %indvars.iv.next62 = or i64 %indvars.iv61, 1 %arrayidx26.1 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next62 %9 = load i32, ptr %arrayidx26.1, align 4, !tbaa !12 %cmp28.1 = icmp eq i32 %9, -1 %10 = trunc i64 %indvars.iv.next62 to i32 %spec.select.1 = select i1 %cmp28.1, i32 %10, i32 %spec.select %indvars.iv.next62.1 = or i64 %indvars.iv61, 2 %arrayidx26.2 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next62.1 %11 = load i32, ptr %arrayidx26.2, align 8, !tbaa !12 %cmp28.2 = icmp eq i32 %11, -1 %12 = trunc i64 %indvars.iv.next62.1 to i32 %spec.select.2 = select i1 %cmp28.2, i32 %12, i32 %spec.select.1 %indvars.iv.next62.2 = or i64 %indvars.iv61, 3 %arrayidx26.3 = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv.next62.2 %13 = load i32, ptr %arrayidx26.3, align 4, !tbaa !12 %cmp28.3 = icmp eq i32 %13, -1 %14 = trunc i64 %indvars.iv.next62.2 to i32 %spec.select.3 = select i1 %cmp28.3, i32 %14, i32 %spec.select.2 %indvars.iv.next62.3 = add nuw nsw i64 %indvars.iv61, 4 %niter73.next.3 = add i64 %niter73, 4 %niter73.ncmp.3 = icmp eq i64 %niter73.next.3, %unroll_iter72 br i1 %niter73.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.iv61.unr = phi i64 [ 0, %for.body24.preheader ], [ %indvars.iv.next62.3, %for.body24 ] %root.057.unr = phi i32 [ undef, %for.body24.preheader ], [ %spec.select.3, %for.body24 ] %lcmp.mod70.not = icmp eq i64 %xtraiter68, 0 br i1 %lcmp.mod70.not, label %for.end33, label %for.body24.epil for.body24.epil: ; preds = %for.end33.loopexit.unr-lcssa, %for.body24.epil %indvars.iv61.epil = phi i64 [ %indvars.iv.next62.epil, %for.body24.epil ], [ %indvars.iv61.unr, %for.end33.loopexit.unr-lcssa ] %root.057.epil = phi i32 [ %spec.select.epil, %for.body24.epil ], [ %root.057.unr, %for.end33.loopexit.unr-lcssa ] %epil.iter69 = phi i64 [ %epil.iter69.next, %for.body24.epil ], [ 0, %for.end33.loopexit.unr-lcssa ] %arrayidx26.epil = getelementptr inbounds [100005 x %struct.Node], ptr @Tree, i64 0, i64 %indvars.iv61.epil %15 = load i32, ptr %arrayidx26.epil, align 4, !tbaa !12 %cmp28.epil = icmp eq i32 %15, -1 %16 = trunc i64 %indvars.iv61.epil to i32 %spec.select.epil = select i1 %cmp28.epil, i32 %16, i32 %root.057.epil %indvars.iv.next62.epil = add nuw nsw i64 %indvars.iv61.epil, 1 %epil.iter69.next = add i64 %epil.iter69, 1 %epil.iter69.cmp.not = icmp eq i64 %epil.iter69.next, %xtraiter68 br i1 %epil.iter69.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.057.unr, %for.end33.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body24.epil ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @preParse(i32 noundef %root.0.lcssa) %puts49 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @inParse(i32 noundef %root.0.lcssa) %puts50 = 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> #pragma warning(disable:4996) int main() { int n; scanf("%d", &n); int m = n / 2 + 1; printf("%d\n", m); int r = 1; int c = 1; int k = 1; while (k <= n) { printf("%d %d\n", r, c); if (k % 2 == 0) r++; else c++; k++; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10256/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10256/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 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 %div = sdiv i32 %0, 2 %add = add nsw i32 %div, 1 %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not10 = icmp slt i32 %1, 1 br i1 %cmp.not10, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %k.013 = phi i32 [ %inc5, %while.body ], [ 1, %entry ] %c.012 = phi i32 [ %c.1, %while.body ], [ 1, %entry ] %r.011 = phi i32 [ %r.1, %while.body ], [ 1, %entry ] %call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %r.011, i32 noundef %c.012) %rem = and i32 %k.013, 1 %2 = xor i32 %rem, 1 %r.1 = add i32 %2, %r.011 %c.1 = add i32 %rem, %c.012 %inc5 = add nuw nsw i32 %k.013, 1 %3 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not.not = icmp slt i32 %k.013, %3 br i1 %cmp.not.not, label %while.body, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#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_102602/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102602/source.c" target datalayout = "e-m:e-p270: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> #include <stdlib.h> #include <stdbool.h> typedef struct Node{ int val; struct Node* next; } Node; typedef struct Graph{ Node** tree; } Graph; Node* newNode(int val){ Node* newNode = (Node*) malloc(sizeof(Node)); newNode->val = val; newNode->next = NULL; return newNode; } Graph* newGraph(int graphSize){ Graph* G = (Graph*) malloc(sizeof(Graph)); G->tree = (Node**) malloc(graphSize*sizeof(Node*)); for(int i=0; i<graphSize; i++) G->tree[i] = newNode(i); return G; } void DFS_preorder(Graph* G, int graphSize, int root){ Node* temp = G->tree[root]; printf(" %d",root); if(temp->next->val != -1) DFS_preorder(G,graphSize,temp->next->val); temp = temp->next; if(temp->next->val != -1) DFS_preorder(G,graphSize,temp->next->val); } void DFS_inorder(Graph* G, int graphSize, int root){ Node* temp = G->tree[root]; if(temp->next->val != -1) DFS_inorder(G,graphSize,temp->next->val); printf(" %d",root); temp = temp->next; if(temp->next->val != -1) DFS_inorder(G,graphSize,temp->next->val); } void DFS_postorder(Graph* G, int graphSize, int root){ Node* temp = G->tree[root]; if(temp->next->val != -1) DFS_postorder(G,graphSize,temp->next->val); temp = temp->next; if(temp->next->val != -1) DFS_postorder(G,graphSize,temp->next->val); printf(" %d",root); } int findRoot(Graph* G, int graphSize){ for(int i=0; i<graphSize; i++){ bool b = 0; for(int j=0; j<graphSize; j++){ if(j!=i){ Node* tmp = G->tree[j]; while(tmp->next !=NULL){ tmp = tmp -> next; if(tmp->val == i){ b = 1; break; } } } } if(b == 0) return i; } } int main(){ int n; scanf("%d",&n); Graph* G = newGraph(n); // Input the other vertices into the graph for(int i=0; i<n; i++){ int order; scanf("%d",&order); Node* temp = G->tree[order]; for(int j=0; j<2; j++){ int tmp; scanf("%d",&tmp); Node* N = newNode(tmp); temp->next = N; temp = N; } } int root = findRoot(G,n); G->tree[root]->val = root; printf("Preorder\n"); DFS_preorder(G,n,root); printf("\nInorder\n"); DFS_inorder(G,n,root); printf("\nPostorder\n"); DFS_postorder(G,n,root); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102646/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102646/source.c" target datalayout = "e-m:e-p270: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 } @.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 = 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: mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable define dso_local noalias ptr @newNode(i32 noundef %val) local_unnamed_addr #0 { entry: %call = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8 store i32 %val, ptr %call, align 8, !tbaa !5 %next = getelementptr inbounds %struct.Node, ptr %call, i64 0, i32 1 store ptr null, ptr %next, align 8, !tbaa !11 ret ptr %call } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable define dso_local noalias ptr @newGraph(i32 noundef %graphSize) local_unnamed_addr #3 { entry: %call = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #8 %conv = sext i32 %graphSize to i64 %mul = shl nsw i64 %conv, 3 %call1 = tail call noalias ptr @malloc(i64 noundef %mul) #8 store ptr %call1, ptr %call, align 8, !tbaa !12 %cmp11 = icmp sgt i32 %graphSize, 0 br i1 %cmp11, label %for.body.preheader, label %for.cond.cleanup for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %graphSize to i64 br label %for.body for.cond.cleanup: ; preds = %for.body, %entry ret ptr %call for.body: ; preds = %for.body.preheader, %for.body %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] %call.i = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8 %0 = trunc i64 %indvars.iv to i32 store i32 %0, ptr %call.i, align 8, !tbaa !5 %next.i = getelementptr inbounds %struct.Node, ptr %call.i, i64 0, i32 1 store ptr null, ptr %next.i, align 8, !tbaa !11 %arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv store ptr %call.i, ptr %arrayidx, align 8, !tbaa !14 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15 } ; Function Attrs: nofree nounwind uwtable define dso_local void @DFS_preorder(ptr nocapture noundef readonly %G, i32 noundef %graphSize, i32 noundef %root) local_unnamed_addr #4 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %root.tr = phi i32 [ %root, %entry ], [ %6, %if.end ] %0 = load ptr, ptr %G, align 8, !tbaa !12 %idxprom = sext i32 %root.tr to i64 %arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom %1 = load ptr, ptr %arrayidx, align 8, !tbaa !14 %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %root.tr) %next = getelementptr inbounds %struct.Node, ptr %1, i64 0, i32 1 %2 = load ptr, ptr %next, align 8, !tbaa !11 %3 = load i32, ptr %2, align 8, !tbaa !5 %cmp.not = icmp eq i32 %3, -1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @DFS_preorder(ptr noundef nonnull %G, i32 noundef %graphSize, i32 noundef %3) %.pre = load ptr, ptr %next, align 8, !tbaa !11 br label %if.end if.end: ; preds = %if.then, %tailrecurse %4 = phi ptr [ %.pre, %if.then ], [ %2, %tailrecurse ] %next4 = getelementptr inbounds %struct.Node, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %next4, align 8, !tbaa !11 %6 = load i32, ptr %5, align 8, !tbaa !5 %cmp6.not = icmp eq i32 %6, -1 br i1 %cmp6.not, label %if.end10, label %tailrecurse if.end10: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind uwtable define dso_local void @DFS_inorder(ptr nocapture noundef readonly %G, i32 noundef %graphSize, i32 noundef %root) local_unnamed_addr #4 { entry: br label %tailrecurse tailrecurse: ; preds = %if.end, %entry %root.tr = phi i32 [ %root, %entry ], [ %6, %if.end ] %0 = load ptr, ptr %G, align 8, !tbaa !12 %idxprom = sext i32 %root.tr to i64 %arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom %1 = load ptr, ptr %arrayidx, align 8, !tbaa !14 %next = getelementptr inbounds %struct.Node, ptr %1, i64 0, i32 1 %2 = load ptr, ptr %next, align 8, !tbaa !11 %3 = load i32, ptr %2, align 8, !tbaa !5 %cmp.not = icmp eq i32 %3, -1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %tailrecurse tail call void @DFS_inorder(ptr noundef nonnull %G, i32 noundef %graphSize, i32 noundef %3) br label %if.end if.end: ; preds = %if.then, %tailrecurse %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %root.tr) %4 = load ptr, ptr %next, align 8, !tbaa !11 %next4 = getelementptr inbounds %struct.Node, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %next4, align 8, !tbaa !11 %6 = load i32, ptr %5, align 8, !tbaa !5 %cmp6.not = icmp eq i32 %6, -1 br i1 %cmp6.not, label %if.end10, label %tailrecurse if.end10: ; preds = %if.end ret void } ; Function Attrs: nofree nounwind uwtable define dso_local void @DFS_postorder(ptr noundef %G, i32 noundef %graphSize, i32 noundef %root) local_unnamed_addr #4 { entry: %0 = load ptr, ptr %G, align 8, !tbaa !12 %idxprom = sext i32 %root to i64 %arrayidx = getelementptr inbounds ptr, ptr %0, i64 %idxprom %1 = load ptr, ptr %arrayidx, align 8, !tbaa !14 %next = getelementptr inbounds %struct.Node, ptr %1, i64 0, i32 1 %2 = load ptr, ptr %next, align 8, !tbaa !11 %3 = load i32, ptr %2, align 8, !tbaa !5 %cmp.not = icmp eq i32 %3, -1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %entry tail call void @DFS_postorder(ptr noundef nonnull %G, i32 noundef %graphSize, i32 noundef %3) %.pre = load ptr, ptr %next, align 8, !tbaa !11 br label %if.end if.end: ; preds = %if.then, %entry %4 = phi ptr [ %.pre, %if.then ], [ %2, %entry ] %next4 = getelementptr inbounds %struct.Node, ptr %4, i64 0, i32 1 %5 = load ptr, ptr %next4, align 8, !tbaa !11 %6 = load i32, ptr %5, align 8, !tbaa !5 %cmp6.not = icmp eq i32 %6, -1 br i1 %cmp6.not, label %if.end10, label %if.then7 if.then7: ; preds = %if.end tail call void @DFS_postorder(ptr noundef nonnull %G, i32 noundef %graphSize, i32 noundef %6) br label %if.end10 if.end10: ; preds = %if.then7, %if.end %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %root) ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable define dso_local i32 @findRoot(ptr nocapture noundef readonly %G, i32 noundef %graphSize) local_unnamed_addr #6 { entry: %cmp33 = icmp sgt i32 %graphSize, 0 br i1 %cmp33, label %for.cond1.preheader.us.preheader, label %cleanup17 for.cond1.preheader.us.preheader: ; preds = %entry %wide.trip.count41 = zext i32 %graphSize to i64 %xtraiter = and i64 %wide.trip.count41, 1 %0 = icmp eq i32 %graphSize, 1 %unroll_iter = and i64 %wide.trip.count41, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond1.preheader.us for.cond1.preheader.us: ; preds = %for.cond1.preheader.us.preheader, %for.inc15.us %indvars.iv38 = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvars.iv.next39, %for.inc15.us ] br i1 %0, label %for.cond1.for.cond.cleanup3_crit_edge.us.unr-lcssa, label %for.body4.us for.inc15.us: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1 %exitcond42.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count41 br i1 %exitcond42.not, label %cleanup17, label %for.cond1.preheader.us, !llvm.loop !17 for.body4.us: ; preds = %for.cond1.preheader.us, %for.inc.us.1 %indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc.us.1 ], [ 0, %for.cond1.preheader.us ] %b.031.us = phi i8 [ %b.2.us.1, %for.inc.us.1 ], [ 0, %for.cond1.preheader.us ] %niter = phi i64 [ %niter.next.1, %for.inc.us.1 ], [ 0, %for.cond1.preheader.us ] %cmp5.not.us = icmp eq i64 %indvars.iv, %indvars.iv38 br i1 %cmp5.not.us, label %for.inc.us, label %if.then.us if.then.us: ; preds = %for.body4.us %1 = load ptr, ptr %G, align 8, !tbaa !12 %arrayidx.us = getelementptr inbounds ptr, ptr %1, i64 %indvars.iv %2 = load ptr, ptr %arrayidx.us, align 8, !tbaa !14 br label %while.cond.us while.cond.us: ; preds = %while.body.us, %if.then.us %tmp.0.us = phi ptr [ %2, %if.then.us ], [ %3, %while.body.us ] %next.us = getelementptr inbounds %struct.Node, ptr %tmp.0.us, i64 0, i32 1 %3 = load ptr, ptr %next.us, align 8, !tbaa !11 %cmp6.not.us = icmp eq ptr %3, null br i1 %cmp6.not.us, label %for.inc.us, label %while.body.us while.body.us: ; preds = %while.cond.us %4 = load i32, ptr %3, align 8, !tbaa !5 %5 = zext i32 %4 to i64 %cmp8.us = icmp eq i64 %indvars.iv38, %5 br i1 %cmp8.us, label %for.inc.us, label %while.cond.us, !llvm.loop !18 for.inc.us: ; preds = %while.cond.us, %while.body.us, %for.body4.us %b.2.us = phi i8 [ %b.031.us, %for.body4.us ], [ 1, %while.body.us ], [ %b.031.us, %while.cond.us ] %indvars.iv.next = or i64 %indvars.iv, 1 %cmp5.not.us.1 = icmp eq i64 %indvars.iv.next, %indvars.iv38 br i1 %cmp5.not.us.1, label %for.inc.us.1, label %if.then.us.1 if.then.us.1: ; preds = %for.inc.us %6 = load ptr, ptr %G, align 8, !tbaa !12 %arrayidx.us.1 = getelementptr inbounds ptr, ptr %6, i64 %indvars.iv.next %7 = load ptr, ptr %arrayidx.us.1, align 8, !tbaa !14 br label %while.cond.us.1 while.cond.us.1: ; preds = %while.body.us.1, %if.then.us.1 %tmp.0.us.1 = phi ptr [ %7, %if.then.us.1 ], [ %8, %while.body.us.1 ] %next.us.1 = getelementptr inbounds %struct.Node, ptr %tmp.0.us.1, i64 0, i32 1 %8 = load ptr, ptr %next.us.1, align 8, !tbaa !11 %cmp6.not.us.1 = icmp eq ptr %8, null br i1 %cmp6.not.us.1, label %for.inc.us.1, label %while.body.us.1 while.body.us.1: ; preds = %while.cond.us.1 %9 = load i32, ptr %8, align 8, !tbaa !5 %10 = zext i32 %9 to i64 %cmp8.us.1 = icmp eq i64 %indvars.iv38, %10 br i1 %cmp8.us.1, label %for.inc.us.1, label %while.cond.us.1, !llvm.loop !18 for.inc.us.1: ; preds = %while.cond.us.1, %while.body.us.1, %for.inc.us %b.2.us.1 = phi i8 [ %b.2.us, %for.inc.us ], [ 1, %while.body.us.1 ], [ %b.2.us, %while.cond.us.1 ] %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %niter.next.1 = add i64 %niter, 2 %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter br i1 %niter.ncmp.1, label %for.cond1.for.cond.cleanup3_crit_edge.us.unr-lcssa, label %for.body4.us, !llvm.loop !19 for.cond1.for.cond.cleanup3_crit_edge.us.unr-lcssa: ; preds = %for.inc.us.1, %for.cond1.preheader.us %b.2.us.lcssa.ph = phi i8 [ undef, %for.cond1.preheader.us ], [ %b.2.us.1, %for.inc.us.1 ] %indvars.iv.unr = phi i64 [ 0, %for.cond1.preheader.us ], [ %indvars.iv.next.1, %for.inc.us.1 ] %b.031.us.unr = phi i8 [ 0, %for.cond1.preheader.us ], [ %b.2.us.1, %for.inc.us.1 ] br i1 %lcmp.mod.not, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %for.body4.us.epil for.body4.us.epil: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us.unr-lcssa %cmp5.not.us.epil = icmp eq i64 %indvars.iv.unr, %indvars.iv38 br i1 %cmp5.not.us.epil, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %if.then.us.epil if.then.us.epil: ; preds = %for.body4.us.epil %11 = load ptr, ptr %G, align 8, !tbaa !12 %arrayidx.us.epil = getelementptr inbounds ptr, ptr %11, i64 %indvars.iv.unr %12 = load ptr, ptr %arrayidx.us.epil, align 8, !tbaa !14 br label %while.cond.us.epil while.cond.us.epil: ; preds = %while.body.us.epil, %if.then.us.epil %tmp.0.us.epil = phi ptr [ %12, %if.then.us.epil ], [ %13, %while.body.us.epil ] %next.us.epil = getelementptr inbounds %struct.Node, ptr %tmp.0.us.epil, i64 0, i32 1 %13 = load ptr, ptr %next.us.epil, align 8, !tbaa !11 %cmp6.not.us.epil = icmp eq ptr %13, null br i1 %cmp6.not.us.epil, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %while.body.us.epil while.body.us.epil: ; preds = %while.cond.us.epil %14 = load i32, ptr %13, align 8, !tbaa !5 %15 = zext i32 %14 to i64 %cmp8.us.epil = icmp eq i64 %indvars.iv38, %15 br i1 %cmp8.us.epil, label %for.cond1.for.cond.cleanup3_crit_edge.us, label %while.cond.us.epil, !llvm.loop !18 for.cond1.for.cond.cleanup3_crit_edge.us: ; preds = %for.body4.us.epil, %while.body.us.epil, %while.cond.us.epil, %for.cond1.for.cond.cleanup3_crit_edge.us.unr-lcssa %b.2.us.lcssa = phi i8 [ %b.2.us.lcssa.ph, %for.cond1.for.cond.cleanup3_crit_edge.us.unr-lcssa ], [ %b.031.us.unr, %for.body4.us.epil ], [ 1, %while.body.us.epil ], [ %b.031.us.unr, %while.cond.us.epil ] %16 = and i8 %b.2.us.lcssa, 1 %cmp11.not.us = icmp eq i8 %16, 0 br i1 %cmp11.not.us, label %cleanup17.loopexit.split.loop.exit43, label %for.inc15.us cleanup17.loopexit.split.loop.exit43: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us %17 = trunc i64 %indvars.iv38 to i32 br label %cleanup17 cleanup17: ; preds = %for.inc15.us, %cleanup17.loopexit.split.loop.exit43, %entry %i.0.lcssa = phi i32 [ 0, %entry ], [ %17, %cleanup17.loopexit.split.loop.exit43 ], [ %graphSize, %for.inc15.us ] ret i32 %i.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #4 { entry: %n = alloca i32, align 4 %order = alloca i32, align 4 %tmp = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !20 %call.i = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #8 %conv.i = sext i32 %0 to i64 %mul.i = shl nsw i64 %conv.i, 3 %call1.i = call noalias ptr @malloc(i64 noundef %mul.i) #8 store ptr %call1.i, ptr %call.i, align 8, !tbaa !12 %cmp11.i = icmp sgt i32 %0, 0 br i1 %cmp11.i, label %for.body.preheader.i, label %findRoot.exit for.body.preheader.i: ; preds = %entry %wide.trip.count.i = zext i32 %0 to i64 br label %for.body.i for.body.i: ; preds = %for.body.i, %for.body.preheader.i %indvars.iv.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.body.i ] %call.i.i = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8 %1 = trunc i64 %indvars.iv.i to i32 store i32 %1, ptr %call.i.i, align 8, !tbaa !5 %next.i.i = getelementptr inbounds %struct.Node, ptr %call.i.i, i64 0, i32 1 store ptr null, ptr %next.i.i, align 8, !tbaa !11 %arrayidx.i = getelementptr inbounds ptr, ptr %call1.i, i64 %indvars.iv.i store ptr %call.i.i, ptr %arrayidx.i, align 8, !tbaa !14 %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 %newGraph.exit, label %for.body.i, !llvm.loop !15 newGraph.exit: ; preds = %for.body.i br i1 %cmp11.i, label %for.body, label %findRoot.exit for.cond.cleanup: ; preds = %for.body %cmp33.i = icmp sgt i32 %25, 0 br i1 %cmp33.i, label %for.cond1.preheader.us.preheader.i, label %findRoot.exit for.cond1.preheader.us.preheader.i: ; preds = %for.cond.cleanup %wide.trip.count41.i = zext i32 %25 to i64 %xtraiter = and i64 %wide.trip.count41.i, 1 %2 = icmp eq i32 %25, 1 %unroll_iter = and i64 %wide.trip.count41.i, 4294967294 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br label %for.cond1.preheader.us.i for.cond1.preheader.us.i: ; preds = %for.inc15.us.i, %for.cond1.preheader.us.preheader.i %indvars.iv38.i = phi i64 [ 0, %for.cond1.preheader.us.preheader.i ], [ %indvars.iv.next39.i, %for.inc15.us.i ] br i1 %2, label %for.cond1.for.cond.cleanup3_crit_edge.us.i.unr-lcssa, label %for.body4.us.i for.inc15.us.i: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us.i %indvars.iv.next39.i = add nuw nsw i64 %indvars.iv38.i, 1 %exitcond42.not.i = icmp eq i64 %indvars.iv.next39.i, %wide.trip.count41.i br i1 %exitcond42.not.i, label %findRoot.exit, label %for.cond1.preheader.us.i, !llvm.loop !17 for.body4.us.i: ; preds = %for.cond1.preheader.us.i, %for.inc.us.i.1 %indvars.iv.i34 = phi i64 [ %indvars.iv.next.i35.1, %for.inc.us.i.1 ], [ 0, %for.cond1.preheader.us.i ] %b.031.us.i = phi i8 [ %b.2.us.i.1, %for.inc.us.i.1 ], [ 0, %for.cond1.preheader.us.i ] %niter = phi i64 [ %niter.next.1, %for.inc.us.i.1 ], [ 0, %for.cond1.preheader.us.i ] %cmp5.not.us.i = icmp eq i64 %indvars.iv.i34, %indvars.iv38.i br i1 %cmp5.not.us.i, label %for.inc.us.i, label %if.then.us.i if.then.us.i: ; preds = %for.body4.us.i %arrayidx.us.i = getelementptr inbounds ptr, ptr %call1.i, i64 %indvars.iv.i34 %3 = load ptr, ptr %arrayidx.us.i, align 8, !tbaa !14 br label %while.cond.us.i while.cond.us.i: ; preds = %while.body.us.i, %if.then.us.i %tmp.0.us.i = phi ptr [ %3, %if.then.us.i ], [ %4, %while.body.us.i ] %next.us.i = getelementptr inbounds %struct.Node, ptr %tmp.0.us.i, i64 0, i32 1 %4 = load ptr, ptr %next.us.i, align 8, !tbaa !11 %cmp6.not.us.i = icmp eq ptr %4, null br i1 %cmp6.not.us.i, label %for.inc.us.i, label %while.body.us.i while.body.us.i: ; preds = %while.cond.us.i %5 = load i32, ptr %4, align 8, !tbaa !5 %6 = zext i32 %5 to i64 %cmp8.us.i = icmp eq i64 %indvars.iv38.i, %6 br i1 %cmp8.us.i, label %for.inc.us.i, label %while.cond.us.i, !llvm.loop !18 for.inc.us.i: ; preds = %while.body.us.i, %while.cond.us.i, %for.body4.us.i %b.2.us.i = phi i8 [ %b.031.us.i, %for.body4.us.i ], [ %b.031.us.i, %while.cond.us.i ], [ 1, %while.body.us.i ] %indvars.iv.next.i35 = or i64 %indvars.iv.i34, 1 %cmp5.not.us.i.1 = icmp eq i64 %indvars.iv.next.i35, %indvars.iv38.i br i1 %cmp5.not.us.i.1, label %for.inc.us.i.1, label %if.then.us.i.1 if.then.us.i.1: ; preds = %for.inc.us.i %arrayidx.us.i.1 = getelementptr inbounds ptr, ptr %call1.i, i64 %indvars.iv.next.i35 %7 = load ptr, ptr %arrayidx.us.i.1, align 8, !tbaa !14 br label %while.cond.us.i.1 while.cond.us.i.1: ; preds = %while.body.us.i.1, %if.then.us.i.1 %tmp.0.us.i.1 = phi ptr [ %7, %if.then.us.i.1 ], [ %8, %while.body.us.i.1 ] %next.us.i.1 = getelementptr inbounds %struct.Node, ptr %tmp.0.us.i.1, i64 0, i32 1 %8 = load ptr, ptr %next.us.i.1, align 8, !tbaa !11 %cmp6.not.us.i.1 = icmp eq ptr %8, null br i1 %cmp6.not.us.i.1, label %for.inc.us.i.1, label %while.body.us.i.1 while.body.us.i.1: ; preds = %while.cond.us.i.1 %9 = load i32, ptr %8, align 8, !tbaa !5 %10 = zext i32 %9 to i64 %cmp8.us.i.1 = icmp eq i64 %indvars.iv38.i, %10 br i1 %cmp8.us.i.1, label %for.inc.us.i.1, label %while.cond.us.i.1, !llvm.loop !18 for.inc.us.i.1: ; preds = %while.cond.us.i.1, %while.body.us.i.1, %for.inc.us.i %b.2.us.i.1 = phi i8 [ %b.2.us.i, %for.inc.us.i ], [ %b.2.us.i, %while.cond.us.i.1 ], [ 1, %while.body.us.i.1 ] %indvars.iv.next.i35.1 = add nuw nsw i64 %indvars.iv.i34, 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.cond1.for.cond.cleanup3_crit_edge.us.i.unr-lcssa, label %for.body4.us.i, !llvm.loop !19 for.cond1.for.cond.cleanup3_crit_edge.us.i.unr-lcssa: ; preds = %for.inc.us.i.1, %for.cond1.preheader.us.i %b.2.us.i.lcssa.ph = phi i8 [ undef, %for.cond1.preheader.us.i ], [ %b.2.us.i.1, %for.inc.us.i.1 ] %indvars.iv.i34.unr = phi i64 [ 0, %for.cond1.preheader.us.i ], [ %indvars.iv.next.i35.1, %for.inc.us.i.1 ] %b.031.us.i.unr = phi i8 [ 0, %for.cond1.preheader.us.i ], [ %b.2.us.i.1, %for.inc.us.i.1 ] br i1 %lcmp.mod.not, label %for.cond1.for.cond.cleanup3_crit_edge.us.i, label %for.body4.us.i.epil for.body4.us.i.epil: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us.i.unr-lcssa %cmp5.not.us.i.epil = icmp eq i64 %indvars.iv.i34.unr, %indvars.iv38.i br i1 %cmp5.not.us.i.epil, label %for.cond1.for.cond.cleanup3_crit_edge.us.i, label %if.then.us.i.epil if.then.us.i.epil: ; preds = %for.body4.us.i.epil %arrayidx.us.i.epil = getelementptr inbounds ptr, ptr %call1.i, i64 %indvars.iv.i34.unr %11 = load ptr, ptr %arrayidx.us.i.epil, align 8, !tbaa !14 br label %while.cond.us.i.epil while.cond.us.i.epil: ; preds = %while.body.us.i.epil, %if.then.us.i.epil %tmp.0.us.i.epil = phi ptr [ %11, %if.then.us.i.epil ], [ %12, %while.body.us.i.epil ] %next.us.i.epil = getelementptr inbounds %struct.Node, ptr %tmp.0.us.i.epil, i64 0, i32 1 %12 = load ptr, ptr %next.us.i.epil, align 8, !tbaa !11 %cmp6.not.us.i.epil = icmp eq ptr %12, null br i1 %cmp6.not.us.i.epil, label %for.cond1.for.cond.cleanup3_crit_edge.us.i, label %while.body.us.i.epil while.body.us.i.epil: ; preds = %while.cond.us.i.epil %13 = load i32, ptr %12, align 8, !tbaa !5 %14 = zext i32 %13 to i64 %cmp8.us.i.epil = icmp eq i64 %indvars.iv38.i, %14 br i1 %cmp8.us.i.epil, label %for.cond1.for.cond.cleanup3_crit_edge.us.i, label %while.cond.us.i.epil, !llvm.loop !18 for.cond1.for.cond.cleanup3_crit_edge.us.i: ; preds = %for.body4.us.i.epil, %while.body.us.i.epil, %while.cond.us.i.epil, %for.cond1.for.cond.cleanup3_crit_edge.us.i.unr-lcssa %b.2.us.i.lcssa = phi i8 [ %b.2.us.i.lcssa.ph, %for.cond1.for.cond.cleanup3_crit_edge.us.i.unr-lcssa ], [ %b.031.us.i.unr, %for.body4.us.i.epil ], [ %b.031.us.i.unr, %while.cond.us.i.epil ], [ 1, %while.body.us.i.epil ] %15 = and i8 %b.2.us.i.lcssa, 1 %cmp11.not.us.i = icmp eq i8 %15, 0 br i1 %cmp11.not.us.i, label %cleanup17.loopexit.split.loop.exit43.i, label %for.inc15.us.i cleanup17.loopexit.split.loop.exit43.i: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.us.i %16 = trunc i64 %indvars.iv38.i to i32 br label %findRoot.exit findRoot.exit: ; preds = %for.inc15.us.i, %entry, %newGraph.exit, %for.cond.cleanup, %cleanup17.loopexit.split.loop.exit43.i %i.0.lcssa.i = phi i32 [ 0, %for.cond.cleanup ], [ %16, %cleanup17.loopexit.split.loop.exit43.i ], [ 0, %newGraph.exit ], [ 0, %entry ], [ %25, %for.inc15.us.i ] %idxprom14 = sext i32 %i.0.lcssa.i to i64 %arrayidx15 = getelementptr inbounds ptr, ptr %call1.i, i64 %idxprom14 %17 = load ptr, ptr %arrayidx15, align 8, !tbaa !14 store i32 %i.0.lcssa.i, ptr %17, align 8, !tbaa !5 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) %18 = load i32, ptr %n, align 4, !tbaa !20 call void @DFS_preorder(ptr noundef nonnull %call.i, i32 noundef %18, i32 noundef %i.0.lcssa.i) %puts32 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) %19 = load i32, ptr %n, align 4, !tbaa !20 call void @DFS_inorder(ptr noundef nonnull %call.i, i32 noundef %19, i32 noundef %i.0.lcssa.i) %puts33 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) %20 = load i32, ptr %n, align 4, !tbaa !20 call void @DFS_postorder(ptr noundef nonnull %call.i, i32 noundef %20, i32 noundef %i.0.lcssa.i) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9 ret i32 0 for.body: ; preds = %newGraph.exit, %for.body %i.042 = phi i32 [ %inc10, %for.body ], [ 0, %newGraph.exit ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %order) #9 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %order) %21 = load i32, ptr %order, align 4, !tbaa !20 %idxprom = sext i32 %21 to i64 %arrayidx = getelementptr inbounds ptr, ptr %call1.i, i64 %idxprom %22 = load ptr, ptr %arrayidx, align 8, !tbaa !14 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #9 %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tmp) %23 = load i32, ptr %tmp, align 4, !tbaa !20 %call.i37 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8 store i32 %23, ptr %call.i37, align 8, !tbaa !5 %next.i = getelementptr inbounds %struct.Node, ptr %call.i37, i64 0, i32 1 store ptr null, ptr %next.i, align 8, !tbaa !11 %next = getelementptr inbounds %struct.Node, ptr %22, i64 0, i32 1 store ptr %call.i37, ptr %next, align 8, !tbaa !11 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #9 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #9 %call7.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tmp) %24 = load i32, ptr %tmp, align 4, !tbaa !20 %call.i37.1 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #8 store i32 %24, ptr %call.i37.1, align 8, !tbaa !5 %next.i.1 = getelementptr inbounds %struct.Node, ptr %call.i37.1, i64 0, i32 1 store ptr null, ptr %next.i.1, align 8, !tbaa !11 store ptr %call.i37.1, ptr %next.i, align 8, !tbaa !11 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #9 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %order) #9 %inc10 = add nuw nsw i32 %i.042, 1 %25 = load i32, ptr %n, align 4, !tbaa !20 %cmp = icmp slt i32 %inc10, %25 br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !21 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #7 attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind memory(write, argmem: none, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #6 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #7 = { nofree nounwind } attributes #8 = { nounwind allocsize(0) } attributes #9 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !7, i64 0} !6 = !{!"Node", !7, i64 0, !10, i64 8} !7 = !{!"int", !8, i64 0} !8 = !{!"omnipotent char", !9, i64 0} !9 = !{!"Simple C/C++ TBAA"} !10 = !{!"any pointer", !8, i64 0} !11 = !{!6, !10, i64 8} !12 = !{!13, !10, i64 0} !13 = !{!"Graph", !10, i64 0} !14 = !{!10, !10, i64 0} !15 = distinct !{!15, !16} !16 = !{!"llvm.loop.mustprogress"} !17 = distinct !{!17, !16} !18 = distinct !{!18, !16} !19 = distinct !{!19, !16} !20 = !{!7, !7, i64 0} !21 = distinct !{!21, !16}
#include <stdio.h> int main() { int n,x,a=1,b=1,y,i; scanf("%d",&n); x=(n/2); printf("%d\n",x+1); if(n==1) { printf("1 1\n"); } else { printf("1 1\n"); for(i=2;i<=n;i++) { if(i%2==0) b++; else a++; printf("%d %d\n",a,b); } } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10269/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10269/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @str.4 = private unnamed_addr constant [4 x i8] c"1 1\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 %div = sdiv i32 %0, 2 %add = add nsw i32 %div, 1 %call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add) %1 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp eq i32 %1, 1 br i1 %cmp, label %if.then, label %if.else if.then: ; preds = %entry %puts16 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) br label %if.end11 if.else: ; preds = %entry %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4) %2 = load i32, ptr %n, align 4, !tbaa !5 %cmp4.not17 = icmp slt i32 %2, 2 br i1 %cmp4.not17, label %if.end11, label %for.body for.body: ; preds = %if.else, %for.body %i.020 = phi i32 [ %inc10, %for.body ], [ 2, %if.else ] %a.019 = phi i32 [ %a.1, %for.body ], [ 1, %if.else ] %b.018 = phi i32 [ %b.1, %for.body ], [ 1, %if.else ] %rem = and i32 %i.020, 1 %3 = xor i32 %rem, 1 %b.1 = add i32 %3, %b.018 %a.1 = add i32 %rem, %a.019 %call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %a.1, i32 noundef %b.1) %inc10 = add nuw nsw i32 %i.020, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp4.not.not = icmp slt i32 %i.020, %4 br i1 %cmp4.not.not, label %for.body, label %if.end11, !llvm.loop !9 if.end11: ; preds = %for.body, %if.else, %if.then call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nofree nounwind } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #define 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(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("\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_102732/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102732/source.c" target datalayout = "e-m:e-p270: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 NIL -1 struct Node {int p, l, r;}; struct Node T[10000]; int n; void Preorder(int x) { if (x == NIL) { return; } printf(" %d", x); Preorder(T[x].l); Preorder(T[x].r); } void Inorder(int x) { if (x == NIL) { return; } Inorder(T[x].l); printf(" %d", x); Inorder(T[x].r); } void Postorder(int x) { if (x == NIL) { return; } Postorder(T[x].l); Postorder(T[x].r); printf(" %d", x); } int main() { int i, l, r, n, j, k; scanf("%d", &n); for (j = 0; j < n; j++) { T[j].p = NIL; } for (j = 0; j < n; j++) { scanf("%d %d %d", &i, &l, &r); T[i].l = l; T[i].r = r; if (l != NIL) { T[l].p = i; } if (r != NIL) { T[r].p = i; } } for (j = 0; j < n; j++) { if (T[j].p == NIL) { k = j; } } printf("Preorder\n"); Preorder(k); printf("\nInorder\n"); Inorder(k); printf("\nPostorder\n"); Postorder(k); printf("\n"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102783/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102783/source.c" target datalayout = "e-m:e-p270: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 @.str.2 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1 @n = dso_local local_unnamed_addr global i32 0, align 4 @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 @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, i32 noundef %x.tr7) %idxprom = sext i32 %x.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 @Preorder(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 @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 %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 @Inorder(i32 noundef %0) %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %x.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 @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 %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 @Postorder(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 @Postorder(i32 noundef %1) %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %x) br label %common.ret6 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %i = alloca i32, align 4 %l = alloca i32, align 4 %r = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !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 [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 %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 @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 %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 %j.156 = phi i32 [ %inc22, %for.inc21 ], [ 0, %for.cond1.preheader ] %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %i, ptr noundef nonnull %l, ptr noundef nonnull %r) %3 = load i32, ptr %l, align 4, !tbaa !11 %4 = load i32, ptr %i, 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 %j.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 ] %k.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 @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 %k.059 %indvars.iv.next64 = or i64 %indvars.iv63, 1 %arrayidx28.1 = getelementptr inbounds [10000 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 [10000 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 [10000 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 ] %k.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 ] %k.059.epil = phi i32 [ %spec.select.epil, %for.body26.epil ], [ %k.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 @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 %k.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 %k.0.lcssa = phi i32 [ undef, %for.cond24.preheader ], [ undef, %for.cond1.preheader ], [ undef, %entry ], [ %k.059.unr, %for.end35.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body26.epil ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) call void @Preorder(i32 noundef %k.0.lcssa) %puts51 = call i32 @puts(ptr nonnull dereferenceable(1) @str.7) call void @Inorder(i32 noundef %k.0.lcssa) %puts52 = call i32 @puts(ptr nonnull dereferenceable(1) @str.8) call void @Postorder(i32 noundef %k.0.lcssa) %putchar = call i32 @putchar(i32 10) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 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 %i) #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 #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_102833/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102833/source.c" target datalayout = "e-m:e-p270: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> int main(void) { int hani[21][21]; int n,m; int x,y; int i,j; int iti_x,iti_y; int ryou; int ok = 0; int ii,jj; char get[10]; char muki; while(1){ ok = 0; iti_x = iti_y = 10; for(i = 0;i < 21;i++){ for(j = 0;j < 21;j++){ hani[i][j] = 0; } } scanf("%d",&n); //printf("=1=\n"); if(n == 0)break; for(i = 0;i < n;i++){ scanf("%d %d",&x,&y); hani[20 - y][x] = 1; } //printf("=2=\n"); scanf("%d",&m); for(j = 0;j < m;j++){ scanf("%*c"); scanf("%c %d",&muki,&ryou); switch(muki){ case 'N': for(i = iti_y;i >= (iti_y - ryou);i--)hani[i][iti_x] += 2; iti_y = i + 1; break; case 'E': for(i = iti_x;i <= (iti_x + ryou);i++)hani[iti_y][i] += 2; iti_x = i - 1; break; case 'W': for(i = iti_x;i >= (iti_x - ryou);i--)hani[iti_y][i] += 2; iti_x = i + 1; break; case 'S': for(i = iti_y;i <= (iti_y + ryou);i++)hani[i][iti_x] += 2; iti_y = i - 1; break; } } for(i = 0;i < 21;i++){ for(j = 0;j < 21;j++){ if(hani[i][j] == 1 && ok != 1){ printf("No\n"); ok = 1; } } } if(ok == 0)printf("Yes\n"); }//WhileLoop return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102891/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102891/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%*c\00", align 1 @.str.3 = private unnamed_addr constant [6 x i8] c"%c %d\00", align 1 @str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @str.6 = 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: %hani = alloca [21 x [21 x i32]], align 16 %n = alloca i32, align 4 %m = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 %ryou = alloca i32, align 4 %muki = alloca i8, align 1 call void @llvm.lifetime.start.p0(i64 1764, ptr nonnull %hani) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ryou) #6 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %muki) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %hani, i8 0, i64 1764, i1 false), !tbaa !5 %call305 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp9306 = icmp eq i32 %0, 0 br i1 %cmp9306, label %while.end, label %for.cond10.preheader for.cond10.preheader: ; preds = %entry, %if.end116 %1 = phi i32 [ %70, %if.end116 ], [ %0, %entry ] %cmp11161 = icmp sgt i32 %1, 0 br i1 %cmp11161, label %for.body12, label %for.end20 for.body12: ; preds = %for.cond10.preheader, %for.body12 %i.1162 = phi i32 [ %inc19, %for.body12 ], [ 0, %for.cond10.preheader ] %call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %2 = load i32, ptr %y, align 4, !tbaa !5 %sub = sub nsw i32 20, %2 %idxprom14 = sext i32 %sub to i64 %3 = load i32, ptr %x, align 4, !tbaa !5 %idxprom16 = sext i32 %3 to i64 %arrayidx17 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %idxprom14, i64 %idxprom16 store i32 1, ptr %arrayidx17, align 4, !tbaa !5 %inc19 = add nuw nsw i32 %i.1162, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp11 = icmp slt i32 %inc19, %4 br i1 %cmp11, label %for.body12, label %for.end20, !llvm.loop !9 for.end20: ; preds = %for.body12, %for.cond10.preheader %call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) %5 = load i32, ptr %m, align 4, !tbaa !5 %cmp23174 = icmp sgt i32 %5, 0 br i1 %cmp23174, label %for.body24, label %for.cond91.preheader.preheader for.body24: ; preds = %for.end20, %for.inc84 %j.1177 = phi i32 [ %inc85, %for.inc84 ], [ 0, %for.end20 ] %iti_x.0176 = phi i32 [ %iti_x.1, %for.inc84 ], [ 10, %for.end20 ] %iti_y.0175 = phi i32 [ %iti_y.1, %for.inc84 ], [ 10, %for.end20 ] %call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2) %call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %muki, ptr noundef nonnull %ryou) %6 = load i8, ptr %muki, align 1, !tbaa !11 %conv = sext i8 %6 to i32 switch i32 %conv, label %for.inc84 [ i32 78, label %for.cond27.preheader i32 69, label %for.cond40.preheader i32 87, label %for.cond55.preheader i32 83, label %for.cond70.preheader ] for.cond70.preheader: ; preds = %for.body24 %7 = load i32, ptr %ryou, align 4, !tbaa !5 %cmp72.not163 = icmp slt i32 %7, 0 br i1 %cmp72.not163, label %for.end82, label %for.body74.lr.ph for.body74.lr.ph: ; preds = %for.cond70.preheader %add71 = add i32 %7, %iti_y.0175 %idxprom77 = sext i32 %iti_x.0176 to i64 %8 = sext i32 %iti_y.0175 to i64 %smax = call i32 @llvm.smax.i32(i32 %iti_y.0175, i32 %add71) %9 = add i32 %smax, 1 %10 = sub i32 %9, %iti_y.0175 %11 = sub i32 %smax, %iti_y.0175 %xtraiter = and i32 %10, 3 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body74.prol.loopexit, label %for.body74.prol for.body74.prol: ; preds = %for.body74.lr.ph, %for.body74.prol %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body74.prol ], [ %8, %for.body74.lr.ph ] %prol.iter = phi i32 [ %prol.iter.next, %for.body74.prol ], [ 0, %for.body74.lr.ph ] %arrayidx78.prol = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv.prol, i64 %idxprom77 %12 = load i32, ptr %arrayidx78.prol, align 4, !tbaa !5 %add79.prol = add nsw i32 %12, 2 store i32 %add79.prol, ptr %arrayidx78.prol, align 4, !tbaa !5 %indvars.iv.next.prol = add nsw i64 %indvars.iv.prol, 1 %prol.iter.next = add i32 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body74.prol.loopexit, label %for.body74.prol, !llvm.loop !12 for.body74.prol.loopexit: ; preds = %for.body74.prol, %for.body74.lr.ph %indvars.iv.unr = phi i64 [ %8, %for.body74.lr.ph ], [ %indvars.iv.next.prol, %for.body74.prol ] %13 = icmp ult i32 %11, 3 br i1 %13, label %for.end82, label %for.body74 for.cond55.preheader: ; preds = %for.body24 %14 = load i32, ptr %ryou, align 4, !tbaa !5 %cmp57.not165 = icmp slt i32 %14, 0 br i1 %cmp57.not165, label %for.end67, label %for.body59.lr.ph for.body59.lr.ph: ; preds = %for.cond55.preheader %sub56 = sub nsw i32 %iti_x.0176, %14 %idxprom60 = sext i32 %iti_y.0175 to i64 %15 = sext i32 %iti_x.0176 to i64 %16 = sext i32 %sub56 to i64 %17 = add nsw i64 %15, 1 %smin = call i64 @llvm.smin.i64(i64 %16, i64 %15) %18 = sub i64 %17, %smin %min.iters.check310 = icmp ult i64 %18, 8 br i1 %min.iters.check310, label %for.body59.preheader, label %vector.ph311 vector.ph311: ; preds = %for.body59.lr.ph %n.vec313 = and i64 %18, -8 %ind.end314 = sub i64 %15, %n.vec313 br label %vector.body317 vector.body317: ; preds = %vector.body317, %vector.ph311 %index318 = phi i64 [ 0, %vector.ph311 ], [ %index.next325, %vector.body317 ] %offset.idx319 = sub i64 %15, %index318 %19 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %idxprom60, i64 %offset.idx319 %20 = getelementptr inbounds i32, ptr %19, i64 -3 %wide.load320 = load <4 x i32>, ptr %20, align 4, !tbaa !5 %21 = getelementptr inbounds i32, ptr %19, i64 -7 %wide.load321 = load <4 x i32>, ptr %21, align 4, !tbaa !5 %22 = add nsw <4 x i32> %wide.load320, <i32 2, i32 2, i32 2, i32 2> %23 = add nsw <4 x i32> %wide.load321, <i32 2, i32 2, i32 2, i32 2> store <4 x i32> %22, ptr %20, align 4, !tbaa !5 store <4 x i32> %23, ptr %21, align 4, !tbaa !5 %index.next325 = add nuw i64 %index318, 8 %24 = icmp eq i64 %index.next325, %n.vec313 br i1 %24, label %middle.block308, label %vector.body317, !llvm.loop !14 middle.block308: ; preds = %vector.body317 %cmp.n316 = icmp eq i64 %18, %n.vec313 br i1 %cmp.n316, label %for.end67.loopexit, label %for.body59.preheader for.body59.preheader: ; preds = %for.body59.lr.ph, %middle.block308 %indvars.iv185.ph = phi i64 [ %15, %for.body59.lr.ph ], [ %ind.end314, %middle.block308 ] br label %for.body59 for.cond40.preheader: ; preds = %for.body24 %25 = load i32, ptr %ryou, align 4, !tbaa !5 %cmp42.not168 = icmp slt i32 %25, 0 br i1 %cmp42.not168, label %for.end52, label %for.body44.lr.ph for.body44.lr.ph: ; preds = %for.cond40.preheader %add41 = add i32 %25, %iti_x.0176 %idxprom45 = sext i32 %iti_y.0175 to i64 %26 = sext i32 %iti_x.0176 to i64 %smax191 = call i32 @llvm.smax.i32(i32 %iti_x.0176, i32 %add41) %27 = add i32 %smax191, 1 %28 = sub i32 %smax191, %iti_x.0176 %29 = zext i32 %28 to i64 %30 = add nuw nsw i64 %29, 1 %min.iters.check = icmp ult i32 %28, 7 br i1 %min.iters.check, label %for.body44.preheader, label %vector.ph vector.ph: ; preds = %for.body44.lr.ph %n.vec = and i64 %30, 8589934584 %ind.end = add nsw i64 %n.vec, %26 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %offset.idx = add i64 %index, %26 %31 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %idxprom45, i64 %offset.idx %wide.load = load <4 x i32>, ptr %31, align 4, !tbaa !5 %32 = getelementptr inbounds i32, ptr %31, i64 4 %wide.load307 = load <4 x i32>, ptr %32, align 4, !tbaa !5 %33 = add nsw <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2> %34 = add nsw <4 x i32> %wide.load307, <i32 2, i32 2, i32 2, i32 2> store <4 x i32> %33, ptr %31, align 4, !tbaa !5 store <4 x i32> %34, ptr %32, align 4, !tbaa !5 %index.next = add nuw i64 %index, 8 %35 = icmp eq i64 %index.next, %n.vec br i1 %35, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %30, %n.vec br i1 %cmp.n, label %for.end52, label %for.body44.preheader for.body44.preheader: ; preds = %for.body44.lr.ph, %middle.block %indvars.iv188.ph = phi i64 [ %26, %for.body44.lr.ph ], [ %ind.end, %middle.block ] br label %for.body44 for.cond27.preheader: ; preds = %for.body24 %36 = load i32, ptr %ryou, align 4, !tbaa !5 %cmp29.not171 = icmp slt i32 %36, 0 br i1 %cmp29.not171, label %for.end37, label %for.body31.lr.ph for.body31.lr.ph: ; preds = %for.cond27.preheader %sub28 = sub nsw i32 %iti_y.0175, %36 %idxprom34 = sext i32 %iti_x.0176 to i64 %37 = sext i32 %iti_y.0175 to i64 %38 = sext i32 %sub28 to i64 br label %for.body31 for.body31: ; preds = %for.body31.lr.ph, %for.body31 %indvars.iv194 = phi i64 [ %37, %for.body31.lr.ph ], [ %indvars.iv.next195, %for.body31 ] %arrayidx35 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv194, i64 %idxprom34 %39 = load i32, ptr %arrayidx35, align 4, !tbaa !5 %add = add nsw i32 %39, 2 store i32 %add, ptr %arrayidx35, align 4, !tbaa !5 %indvars.iv.next195 = add nsw i64 %indvars.iv194, -1 %cmp29.not.not = icmp sgt i64 %indvars.iv194, %38 br i1 %cmp29.not.not, label %for.body31, label %for.end37.loopexit, !llvm.loop !18 for.end37.loopexit: ; preds = %for.body31 %40 = trunc i64 %indvars.iv.next195 to i32 br label %for.end37 for.end37: ; preds = %for.end37.loopexit, %for.cond27.preheader %i.2.lcssa = phi i32 [ %iti_y.0175, %for.cond27.preheader ], [ %40, %for.end37.loopexit ] %add38 = add nsw i32 %i.2.lcssa, 1 br label %for.inc84 for.body44: ; preds = %for.body44.preheader, %for.body44 %indvars.iv188 = phi i64 [ %indvars.iv.next189, %for.body44 ], [ %indvars.iv188.ph, %for.body44.preheader ] %arrayidx48 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %idxprom45, i64 %indvars.iv188 %41 = load i32, ptr %arrayidx48, align 4, !tbaa !5 %add49 = add nsw i32 %41, 2 store i32 %add49, ptr %arrayidx48, align 4, !tbaa !5 %indvars.iv.next189 = add nsw i64 %indvars.iv188, 1 %lftr.wideiv192 = trunc i64 %indvars.iv.next189 to i32 %exitcond193.not = icmp eq i32 %27, %lftr.wideiv192 br i1 %exitcond193.not, label %for.end52, label %for.body44, !llvm.loop !19 for.end52: ; preds = %for.body44, %middle.block, %for.cond40.preheader %i.3.lcssa = phi i32 [ %iti_x.0176, %for.cond40.preheader ], [ %27, %middle.block ], [ %27, %for.body44 ] %sub53 = add nsw i32 %i.3.lcssa, -1 br label %for.inc84 for.body59: ; preds = %for.body59.preheader, %for.body59 %indvars.iv185 = phi i64 [ %indvars.iv.next186, %for.body59 ], [ %indvars.iv185.ph, %for.body59.preheader ] %arrayidx63 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %idxprom60, i64 %indvars.iv185 %42 = load i32, ptr %arrayidx63, align 4, !tbaa !5 %add64 = add nsw i32 %42, 2 store i32 %add64, ptr %arrayidx63, align 4, !tbaa !5 %indvars.iv.next186 = add nsw i64 %indvars.iv185, -1 %cmp57.not.not = icmp sgt i64 %indvars.iv185, %16 br i1 %cmp57.not.not, label %for.body59, label %for.end67.loopexit, !llvm.loop !20 for.end67.loopexit: ; preds = %for.body59, %middle.block308 %indvars.iv.next186.lcssa = phi i64 [ %ind.end314, %middle.block308 ], [ %indvars.iv.next186, %for.body59 ] %43 = trunc i64 %indvars.iv.next186.lcssa to i32 br label %for.end67 for.end67: ; preds = %for.end67.loopexit, %for.cond55.preheader %i.4.lcssa = phi i32 [ %iti_x.0176, %for.cond55.preheader ], [ %43, %for.end67.loopexit ] %add68 = add nsw i32 %i.4.lcssa, 1 br label %for.inc84 for.body74: ; preds = %for.body74.prol.loopexit, %for.body74 %indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body74 ], [ %indvars.iv.unr, %for.body74.prol.loopexit ] %arrayidx78 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv, i64 %idxprom77 %44 = load i32, ptr %arrayidx78, align 4, !tbaa !5 %add79 = add nsw i32 %44, 2 store i32 %add79, ptr %arrayidx78, align 4, !tbaa !5 %indvars.iv.next = add nsw i64 %indvars.iv, 1 %arrayidx78.1 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv.next, i64 %idxprom77 %45 = load i32, ptr %arrayidx78.1, align 4, !tbaa !5 %add79.1 = add nsw i32 %45, 2 store i32 %add79.1, ptr %arrayidx78.1, align 4, !tbaa !5 %indvars.iv.next.1 = add nsw i64 %indvars.iv, 2 %arrayidx78.2 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv.next.1, i64 %idxprom77 %46 = load i32, ptr %arrayidx78.2, align 4, !tbaa !5 %add79.2 = add nsw i32 %46, 2 store i32 %add79.2, ptr %arrayidx78.2, align 4, !tbaa !5 %indvars.iv.next.2 = add nsw i64 %indvars.iv, 3 %arrayidx78.3 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv.next.2, i64 %idxprom77 %47 = load i32, ptr %arrayidx78.3, align 4, !tbaa !5 %add79.3 = add nsw i32 %47, 2 store i32 %add79.3, ptr %arrayidx78.3, align 4, !tbaa !5 %indvars.iv.next.3 = add nsw i64 %indvars.iv, 4 %lftr.wideiv.3 = trunc i64 %indvars.iv.next.3 to i32 %exitcond.not.3 = icmp eq i32 %9, %lftr.wideiv.3 br i1 %exitcond.not.3, label %for.end82, label %for.body74, !llvm.loop !21 for.end82: ; preds = %for.body74.prol.loopexit, %for.body74, %for.cond70.preheader %i.5.lcssa = phi i32 [ %iti_y.0175, %for.cond70.preheader ], [ %9, %for.body74 ], [ %9, %for.body74.prol.loopexit ] %sub83 = add nsw i32 %i.5.lcssa, -1 br label %for.inc84 for.inc84: ; preds = %for.end37, %for.end52, %for.end67, %for.end82, %for.body24 %iti_y.1 = phi i32 [ %iti_y.0175, %for.body24 ], [ %sub83, %for.end82 ], [ %iti_y.0175, %for.end67 ], [ %iti_y.0175, %for.end52 ], [ %add38, %for.end37 ] %iti_x.1 = phi i32 [ %iti_x.0176, %for.body24 ], [ %iti_x.0176, %for.end82 ], [ %add68, %for.end67 ], [ %sub53, %for.end52 ], [ %iti_x.0176, %for.end37 ] %inc85 = add nuw nsw i32 %j.1177, 1 %48 = load i32, ptr %m, align 4, !tbaa !5 %cmp23 = icmp slt i32 %inc85, %48 br i1 %cmp23, label %for.body24, label %for.cond91.preheader.preheader, !llvm.loop !22 for.cond91.preheader.preheader: ; preds = %for.inc84, %for.end20 br label %for.cond91.preheader for.cond91.preheader: ; preds = %for.cond91.preheader.preheader, %for.inc106.20 %indvars.iv201 = phi i64 [ %indvars.iv.next202, %for.inc106.20 ], [ 0, %for.cond91.preheader.preheader ] %ok.0180 = phi i32 [ %ok.2.20, %for.inc106.20 ], [ 0, %for.cond91.preheader.preheader ] %arrayidx98 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 0 %49 = load i32, ptr %arrayidx98, align 4, !tbaa !5 %cmp99 = icmp eq i32 %49, 1 %cmp101 = icmp ne i32 %ok.0180, 1 %or.cond = select i1 %cmp99, i1 %cmp101, i1 false br i1 %or.cond, label %for.inc106.20.sink.split, label %for.inc106 for.inc106: ; preds = %for.cond91.preheader %arrayidx98.1 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 1 %50 = load i32, ptr %arrayidx98.1, align 4, !tbaa !5 %cmp99.1 = icmp eq i32 %50, 1 %cmp101.1 = icmp ne i32 %ok.0180, 1 %or.cond.1 = select i1 %cmp99.1, i1 %cmp101.1, i1 false br i1 %or.cond.1, label %for.inc106.20.sink.split, label %for.inc106.1 for.inc106.1: ; preds = %for.inc106 %arrayidx98.2 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 2 %51 = load i32, ptr %arrayidx98.2, align 4, !tbaa !5 %cmp99.2 = icmp eq i32 %51, 1 %cmp101.2 = icmp ne i32 %ok.0180, 1 %or.cond.2 = select i1 %cmp99.2, i1 %cmp101.2, i1 false br i1 %or.cond.2, label %for.inc106.20.sink.split, label %for.inc106.2 for.inc106.2: ; preds = %for.inc106.1 %arrayidx98.3 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 3 %52 = load i32, ptr %arrayidx98.3, align 4, !tbaa !5 %cmp99.3 = icmp eq i32 %52, 1 %cmp101.3 = icmp ne i32 %ok.0180, 1 %or.cond.3 = select i1 %cmp99.3, i1 %cmp101.3, i1 false br i1 %or.cond.3, label %for.inc106.20.sink.split, label %for.inc106.3 for.inc106.3: ; preds = %for.inc106.2 %arrayidx98.4 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 4 %53 = load i32, ptr %arrayidx98.4, align 4, !tbaa !5 %cmp99.4 = icmp eq i32 %53, 1 %cmp101.4 = icmp ne i32 %ok.0180, 1 %or.cond.4 = select i1 %cmp99.4, i1 %cmp101.4, i1 false br i1 %or.cond.4, label %for.inc106.20.sink.split, label %for.inc106.4 for.inc106.4: ; preds = %for.inc106.3 %arrayidx98.5 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 5 %54 = load i32, ptr %arrayidx98.5, align 4, !tbaa !5 %cmp99.5 = icmp eq i32 %54, 1 %cmp101.5 = icmp ne i32 %ok.0180, 1 %or.cond.5 = select i1 %cmp99.5, i1 %cmp101.5, i1 false br i1 %or.cond.5, label %for.inc106.20.sink.split, label %for.inc106.5 for.inc106.5: ; preds = %for.inc106.4 %arrayidx98.6 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 6 %55 = load i32, ptr %arrayidx98.6, align 4, !tbaa !5 %cmp99.6 = icmp eq i32 %55, 1 %cmp101.6 = icmp ne i32 %ok.0180, 1 %or.cond.6 = select i1 %cmp99.6, i1 %cmp101.6, i1 false br i1 %or.cond.6, label %for.inc106.20.sink.split, label %for.inc106.6 for.inc106.6: ; preds = %for.inc106.5 %arrayidx98.7 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 7 %56 = load i32, ptr %arrayidx98.7, align 4, !tbaa !5 %cmp99.7 = icmp eq i32 %56, 1 %cmp101.7 = icmp ne i32 %ok.0180, 1 %or.cond.7 = select i1 %cmp99.7, i1 %cmp101.7, i1 false br i1 %or.cond.7, label %for.inc106.20.sink.split, label %for.inc106.7 for.inc106.7: ; preds = %for.inc106.6 %arrayidx98.8 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 8 %57 = load i32, ptr %arrayidx98.8, align 4, !tbaa !5 %cmp99.8 = icmp eq i32 %57, 1 %cmp101.8 = icmp ne i32 %ok.0180, 1 %or.cond.8 = select i1 %cmp99.8, i1 %cmp101.8, i1 false br i1 %or.cond.8, label %for.inc106.20.sink.split, label %for.inc106.8 for.inc106.8: ; preds = %for.inc106.7 %arrayidx98.9 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 9 %58 = load i32, ptr %arrayidx98.9, align 4, !tbaa !5 %cmp99.9 = icmp eq i32 %58, 1 %cmp101.9 = icmp ne i32 %ok.0180, 1 %or.cond.9 = select i1 %cmp99.9, i1 %cmp101.9, i1 false br i1 %or.cond.9, label %for.inc106.20.sink.split, label %for.inc106.9 for.inc106.9: ; preds = %for.inc106.8 %arrayidx98.10 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 10 %59 = load i32, ptr %arrayidx98.10, align 4, !tbaa !5 %cmp99.10 = icmp eq i32 %59, 1 %cmp101.10 = icmp ne i32 %ok.0180, 1 %or.cond.10 = select i1 %cmp99.10, i1 %cmp101.10, i1 false br i1 %or.cond.10, label %for.inc106.20.sink.split, label %for.inc106.10 for.inc106.10: ; preds = %for.inc106.9 %arrayidx98.11 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 11 %60 = load i32, ptr %arrayidx98.11, align 4, !tbaa !5 %cmp99.11 = icmp eq i32 %60, 1 %cmp101.11 = icmp ne i32 %ok.0180, 1 %or.cond.11 = select i1 %cmp99.11, i1 %cmp101.11, i1 false br i1 %or.cond.11, label %for.inc106.20.sink.split, label %for.inc106.11 for.inc106.11: ; preds = %for.inc106.10 %arrayidx98.12 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 12 %61 = load i32, ptr %arrayidx98.12, align 4, !tbaa !5 %cmp99.12 = icmp eq i32 %61, 1 %cmp101.12 = icmp ne i32 %ok.0180, 1 %or.cond.12 = select i1 %cmp99.12, i1 %cmp101.12, i1 false br i1 %or.cond.12, label %for.inc106.20.sink.split, label %for.inc106.12 for.inc106.12: ; preds = %for.inc106.11 %arrayidx98.13 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 13 %62 = load i32, ptr %arrayidx98.13, align 4, !tbaa !5 %cmp99.13 = icmp eq i32 %62, 1 %cmp101.13 = icmp ne i32 %ok.0180, 1 %or.cond.13 = select i1 %cmp99.13, i1 %cmp101.13, i1 false br i1 %or.cond.13, label %for.inc106.20.sink.split, label %for.inc106.13 for.inc106.13: ; preds = %for.inc106.12 %arrayidx98.14 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 14 %63 = load i32, ptr %arrayidx98.14, align 4, !tbaa !5 %cmp99.14 = icmp eq i32 %63, 1 %cmp101.14 = icmp ne i32 %ok.0180, 1 %or.cond.14 = select i1 %cmp99.14, i1 %cmp101.14, i1 false br i1 %or.cond.14, label %for.inc106.20.sink.split, label %for.inc106.14 for.inc106.14: ; preds = %for.inc106.13 %arrayidx98.15 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 15 %64 = load i32, ptr %arrayidx98.15, align 4, !tbaa !5 %cmp99.15 = icmp eq i32 %64, 1 %cmp101.15 = icmp ne i32 %ok.0180, 1 %or.cond.15 = select i1 %cmp99.15, i1 %cmp101.15, i1 false br i1 %or.cond.15, label %for.inc106.20.sink.split, label %for.inc106.15 for.inc106.15: ; preds = %for.inc106.14 %arrayidx98.16 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 16 %65 = load i32, ptr %arrayidx98.16, align 4, !tbaa !5 %cmp99.16 = icmp eq i32 %65, 1 %cmp101.16 = icmp ne i32 %ok.0180, 1 %or.cond.16 = select i1 %cmp99.16, i1 %cmp101.16, i1 false br i1 %or.cond.16, label %for.inc106.20.sink.split, label %for.inc106.16 for.inc106.16: ; preds = %for.inc106.15 %arrayidx98.17 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 17 %66 = load i32, ptr %arrayidx98.17, align 4, !tbaa !5 %cmp99.17 = icmp eq i32 %66, 1 %cmp101.17 = icmp ne i32 %ok.0180, 1 %or.cond.17 = select i1 %cmp99.17, i1 %cmp101.17, i1 false br i1 %or.cond.17, label %for.inc106.20.sink.split, label %for.inc106.17 for.inc106.17: ; preds = %for.inc106.16 %arrayidx98.18 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 18 %67 = load i32, ptr %arrayidx98.18, align 4, !tbaa !5 %cmp99.18 = icmp eq i32 %67, 1 %cmp101.18 = icmp ne i32 %ok.0180, 1 %or.cond.18 = select i1 %cmp99.18, i1 %cmp101.18, i1 false br i1 %or.cond.18, label %for.inc106.20.sink.split, label %for.inc106.18 for.inc106.18: ; preds = %for.inc106.17 %arrayidx98.19 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 19 %68 = load i32, ptr %arrayidx98.19, align 4, !tbaa !5 %cmp99.19 = icmp eq i32 %68, 1 %cmp101.19 = icmp ne i32 %ok.0180, 1 %or.cond.19 = select i1 %cmp99.19, i1 %cmp101.19, i1 false br i1 %or.cond.19, label %for.inc106.20.sink.split, label %for.inc106.19 for.inc106.19: ; preds = %for.inc106.18 %arrayidx98.20 = getelementptr inbounds [21 x [21 x i32]], ptr %hani, i64 0, i64 %indvars.iv201, i64 20 %69 = load i32, ptr %arrayidx98.20, align 4, !tbaa !5 %cmp99.20 = icmp eq i32 %69, 1 %cmp101.20 = icmp ne i32 %ok.0180, 1 %or.cond.20 = select i1 %cmp99.20, i1 %cmp101.20, i1 false br i1 %or.cond.20, label %for.inc106.20.sink.split, label %for.inc106.20 for.inc106.20.sink.split: ; preds = %for.inc106.19, %for.inc106.18, %for.inc106.17, %for.inc106.16, %for.inc106.15, %for.inc106.14, %for.inc106.13, %for.inc106.12, %for.inc106.11, %for.inc106.10, %for.inc106.9, %for.inc106.8, %for.inc106.7, %for.inc106.6, %for.inc106.5, %for.inc106.4, %for.inc106.3, %for.inc106.2, %for.inc106.1, %for.inc106, %for.cond91.preheader %puts158 = call i32 @puts(ptr nonnull dereferenceable(1) @str.6) br label %for.inc106.20 for.inc106.20: ; preds = %for.inc106.20.sink.split, %for.inc106.19 %ok.2.20 = phi i32 [ %ok.0180, %for.inc106.19 ], [ 1, %for.inc106.20.sink.split ] %indvars.iv.next202 = add nuw nsw i64 %indvars.iv201, 1 %exitcond204.not = icmp eq i64 %indvars.iv.next202, 21 br i1 %exitcond204.not, label %for.end111, label %for.cond91.preheader, !llvm.loop !23 for.end111: ; preds = %for.inc106.20 %cmp112 = icmp eq i32 %ok.2.20, 0 br i1 %cmp112, label %if.then114, label %if.end116 if.then114: ; preds = %for.end111 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %if.end116 if.end116: ; preds = %if.then114, %for.end111 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1764) %hani, i8 0, i64 1764, i1 false), !tbaa !5 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %70 = load i32, ptr %n, align 4, !tbaa !5 %cmp9 = icmp eq i32 %70, 0 br i1 %cmp9, label %while.end, label %for.cond10.preheader while.end: ; preds = %if.end116, %entry call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %muki) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ryou) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 1764, ptr nonnull %hani) #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: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, 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 nounwind willreturn memory(argmem: write) } attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #6 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = !{!7, !7, i64 0} !12 = distinct !{!12, !13} !13 = !{!"llvm.loop.unroll.disable"} !14 = distinct !{!14, !10, !15, !16} !15 = !{!"llvm.loop.isvectorized", i32 1} !16 = !{!"llvm.loop.unroll.runtime.disable"} !17 = distinct !{!17, !10, !15, !16} !18 = distinct !{!18, !10} !19 = distinct !{!19, !10, !16, !15} !20 = distinct !{!20, !10, !16, !15} !21 = distinct !{!21, !10} !22 = distinct !{!22, !10} !23 = distinct !{!23, !10}
// Aizu Vol-20 2000 Misterious Gems // 2017.8.12 bal4u@uu #include <stdio.h> #include <string.h> char a[22][22]; int main() { int n, x, y, m, s; int i; char d[3]; while (1) { scanf("%d", &n); if (!n) break; memset(a, 0, sizeof(a)); for (i = 0; i < n; i++) scanf("%d%d", &x, &y), a[x][y] = 1; scanf("%d", &m); x = 10, y = 10; while (m-- > 0) { scanf("%s%d", d, &s); while (s-- > 0) { if (d[0] == 'E') x++; else if (d[0] == 'S') y--; else if (d[0] == 'W') x--; else if (d[0] == 'N') y++; if (a[x][y]) n--, a[x][y] = 0; } } puts(!n ? "Yes" : "No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102934/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102934/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 local_unnamed_addr global [22 x [22 x i8]] zeroinitializer, align 16 @.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"%s%d\00", align 1 @.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %x = alloca i32, align 4 %y = alloca i32, align 4 %m = alloca i32, align 4 %s = alloca i32, align 4 %d = alloca [3 x i8], align 1 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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 %m) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4 call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %d) #4 %call70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not71 = icmp eq i32 %0, 0 br i1 %tobool.not71, label %while.end57, label %if.end if.end: ; preds = %entry, %while.end54 %1 = phi i32 [ %14, %while.end54 ], [ %0, %entry ] call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(484) @a, i8 0, i64 484, i1 false) %cmp59 = icmp sgt i32 %1, 0 br i1 %cmp59, label %for.body, label %for.end for.body: ; preds = %if.end, %for.body %i.060 = phi i32 [ %inc, %for.body ], [ 0, %if.end ] %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y) %2 = load i32, ptr %x, align 4, !tbaa !5 %idxprom = sext i32 %2 to i64 %3 = load i32, ptr %y, align 4, !tbaa !5 %idxprom2 = sext i32 %3 to i64 %arrayidx3 = getelementptr inbounds [22 x [22 x i8]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom2 store i8 1, ptr %arrayidx3, align 1, !tbaa !9 %inc = add nuw nsw i32 %i.060, 1 %4 = load i32, ptr %n, align 4, !tbaa !5 %cmp = icmp slt i32 %inc, %4 br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.body, %if.end %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m) store i32 10, ptr %x, align 4, !tbaa !5 store i32 10, ptr %y, align 4, !tbaa !5 %5 = load i32, ptr %m, align 4, !tbaa !5 %dec68 = add nsw i32 %5, -1 store i32 %dec68, ptr %m, align 4, !tbaa !5 %cmp669 = icmp sgt i32 %5, 0 br i1 %cmp669, label %while.body7, label %while.end54 while.cond5.loopexit: ; preds = %if.end53, %while.body7 %dec10.lcssa = phi i32 [ %dec1064, %while.body7 ], [ -1, %if.end53 ] store i32 %dec10.lcssa, ptr %s, align 4, !tbaa !5 %6 = load i32, ptr %m, align 4, !tbaa !5 %dec = add nsw i32 %6, -1 store i32 %dec, ptr %m, align 4, !tbaa !5 %cmp6 = icmp sgt i32 %6, 0 br i1 %cmp6, label %while.body7, label %while.end54, !llvm.loop !12 while.body7: ; preds = %for.end, %while.cond5.loopexit %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %d, ptr noundef nonnull %s) %s.promoted = load i32, ptr %s, align 4, !tbaa !5 %dec1064 = add nsw i32 %s.promoted, -1 %cmp1165 = icmp sgt i32 %s.promoted, 0 br i1 %cmp1165, label %while.body12.lr.ph, label %while.cond5.loopexit while.body12.lr.ph: ; preds = %while.body7 %n.promoted = load i32, ptr %n, align 4, !tbaa !5 %x.promoted = load i32, ptr %x, align 4, !tbaa !5 %y.promoted = load i32, ptr %y, align 4, !tbaa !5 %7 = load i8, ptr %d, align 1, !tbaa !9 br label %while.body12 while.body12: ; preds = %while.body12.lr.ph, %if.end53 %dec1067 = phi i32 [ %dec1064, %while.body12.lr.ph ], [ %dec10, %if.end53 ] %8 = phi i32 [ %y.promoted, %while.body12.lr.ph ], [ %11, %if.end53 ] %9 = phi i32 [ %x.promoted, %while.body12.lr.ph ], [ %10, %if.end53 ] %dec486366 = phi i32 [ %n.promoted, %while.body12.lr.ph ], [ %dec4862, %if.end53 ] switch i8 %7, label %if.end41 [ i8 69, label %if.then16 i8 83, label %if.then22 i8 87, label %if.then29 i8 78, label %if.then36 ] if.then16: ; preds = %while.body12 %inc17 = add nsw i32 %9, 1 store i32 %inc17, ptr %x, align 4, !tbaa !5 br label %if.end41 if.then22: ; preds = %while.body12 %dec23 = add nsw i32 %8, -1 store i32 %dec23, ptr %y, align 4, !tbaa !5 br label %if.end41 if.then29: ; preds = %while.body12 %dec30 = add nsw i32 %9, -1 store i32 %dec30, ptr %x, align 4, !tbaa !5 br label %if.end41 if.then36: ; preds = %while.body12 %inc37 = add nsw i32 %8, 1 store i32 %inc37, ptr %y, align 4, !tbaa !5 br label %if.end41 if.end41: ; preds = %while.body12, %if.then22, %if.then36, %if.then29, %if.then16 %10 = phi i32 [ %9, %while.body12 ], [ %9, %if.then22 ], [ %9, %if.then36 ], [ %dec30, %if.then29 ], [ %inc17, %if.then16 ] %11 = phi i32 [ %8, %while.body12 ], [ %dec23, %if.then22 ], [ %inc37, %if.then36 ], [ %8, %if.then29 ], [ %8, %if.then16 ] %idxprom42 = sext i32 %10 to i64 %idxprom44 = sext i32 %11 to i64 %arrayidx45 = getelementptr inbounds [22 x [22 x i8]], ptr @a, i64 0, i64 %idxprom42, i64 %idxprom44 %12 = load i8, ptr %arrayidx45, align 1, !tbaa !9 %tobool46.not = icmp eq i8 %12, 0 br i1 %tobool46.not, label %if.end53, label %if.then47 if.then47: ; preds = %if.end41 %dec48 = add nsw i32 %dec486366, -1 store i32 %dec48, ptr %n, align 4, !tbaa !5 store i8 0, ptr %arrayidx45, align 1, !tbaa !9 br label %if.end53 if.end53: ; preds = %if.then47, %if.end41 %dec4862 = phi i32 [ %dec48, %if.then47 ], [ %dec486366, %if.end41 ] %dec10 = add nsw i32 %dec1067, -1 %cmp11 = icmp sgt i32 %dec1067, 0 br i1 %cmp11, label %while.body12, label %while.cond5.loopexit, !llvm.loop !13 while.end54: ; preds = %while.cond5.loopexit, %for.end %13 = load i32, ptr %n, align 4, !tbaa !5 %tobool55.not = icmp eq i32 %13, 0 %cond = select i1 %tobool55.not, ptr @.str.3, ptr @.str.4 %call56 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %cond) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %14 = load i32, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %14, 0 br i1 %tobool.not, label %while.end57, label %if.end while.end57: ; preds = %while.end54, %entry call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %d) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 ; Function Attrs: 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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11}
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #include <limits.h> int main(void){ int n; scanf("%d",&n); int m=0,head[n*2],next[n*2],to[n*2],a,b,post[n],count; bool visited[n]; for (int i=0; i<n; i++){ head[i]=-1; } for (int i=0; i<n-1; i++){ scanf("%d%d",&a,&b); a--; b--; next[m]=head[a]; head[a]=m; to[m]=b; m++; next[m]=head[b]; head[b]=m; to[m]=a; m++; } for (int i=0; i<n; i++){ visited[i]=false; } int costf[n]; costf[0]=0; visited[0]=true; count=0; post[0]=0; for (int i=0; i<count+1; i++){ for (int e=head[post[i]]; e!=-1; e=next[e]){ if (visited[to[e]]==false){ visited[to[e]]=true; costf[to[e]]=costf[post[i]]+1; count++; post[count]=to[e]; } } } for (int i=0; i<n; i++){ visited[i]=false; } int costs[n]; costs[n-1]=0; visited[n-1]=true; count=0; post[0]=n-1; for (int i=i=0; i<count+1; i++){ for (int e=head[post[i]]; e!=-1; e=next[e]){ if (visited[to[e]]==false){ visited[to[e]]=true; costs[to[e]]=costs[post[i]]+1; count++; post[count]=to[e]; } } } int Fennec=0,Snuke=0; for (int i=0; i<n; i++){ if (costf[i]<=costs[i]){ Fennec++; } else { Snuke++; } } if (Fennec>Snuke){ printf("Fennec\n"); } else { printf("Snuke\n"); } return 0 ; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_102992/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_102992/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1 @str = private unnamed_addr constant [6 x i8] c"Snuke\00", align 1 @str.4 = private unnamed_addr constant [7 x i8] c"Fennec\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca i32, align 4 %b = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %mul = shl nsw i32 %0, 1 %1 = zext i32 %mul to i64 %2 = call ptr @llvm.stacksave.p0() %vla = alloca i32, i64 %1, align 16 %3 = load i32, ptr %n, align 4, !tbaa !5 %mul1 = shl nsw i32 %3, 1 %4 = zext i32 %mul1 to i64 %vla2 = alloca i32, i64 %4, align 16 %vla4 = alloca i32, i64 %4, align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7 %5 = zext i32 %3 to i64 %vla5 = alloca i32, i64 %5, align 16 %vla6 = alloca i8, i64 %5, align 16 %cmp233 = icmp sgt i32 %3, 0 br i1 %cmp233, label %for.cond8.preheader, label %for.cond36.preheader.thread294 for.cond36.preheader.thread294: ; preds = %entry %sub235284 = add nsw i32 %3, -1 br label %for.cond36.preheader.for.cond.cleanup38_crit_edge for.cond8.preheader: ; preds = %entry %6 = shl nuw nsw i64 %5, 2 call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 -1, i64 %6, i1 false), !tbaa !5 %cmp9236.not = icmp eq i32 %3, 1 br i1 %cmp9236.not, label %for.body39.preheader, label %for.body11 for.cond36.preheader: ; preds = %for.body11 %cmp37240 = icmp sgt i32 %15, 0 br i1 %cmp37240, label %for.body39.preheader, label %for.cond36.preheader.for.cond.cleanup38_crit_edge for.cond36.preheader.for.cond.cleanup38_crit_edge: ; preds = %for.cond36.preheader.thread294, %for.cond36.preheader %sub.lcssa299 = phi i32 [ %sub235284, %for.cond36.preheader.thread294 ], [ %sub, %for.cond36.preheader ] %.lcssa298 = phi i32 [ %3, %for.cond36.preheader.thread294 ], [ %15, %for.cond36.preheader ] %.pre = zext i32 %.lcssa298 to i64 br label %for.cond.cleanup38 for.body39.preheader: ; preds = %for.cond8.preheader, %for.cond36.preheader %sub.lcssa291 = phi i32 [ %sub, %for.cond36.preheader ], [ 0, %for.cond8.preheader ] %.lcssa289 = phi i32 [ %15, %for.cond36.preheader ], [ 1, %for.cond8.preheader ] %7 = zext i32 %.lcssa289 to i64 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %vla6, i8 0, i64 %7, i1 false), !tbaa !9 br label %for.cond.cleanup38 for.body11: ; preds = %for.cond8.preheader, %for.body11 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body11 ], [ 0, %for.cond8.preheader ] %i7.0237 = phi i32 [ %inc33, %for.body11 ], [ 0, %for.cond8.preheader ] %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b) %8 = load i32, ptr %a, align 4, !tbaa !5 %dec = add nsw i32 %8, -1 store i32 %dec, ptr %a, align 4, !tbaa !5 %9 = load i32, ptr %b, align 4, !tbaa !5 %dec13 = add nsw i32 %9, -1 store i32 %dec13, ptr %b, align 4, !tbaa !5 %idxprom14 = sext i32 %dec to i64 %arrayidx15 = getelementptr inbounds i32, ptr %vla, i64 %idxprom14 %10 = load i32, ptr %arrayidx15, align 4, !tbaa !5 %arrayidx17 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv store i32 %10, ptr %arrayidx17, align 8, !tbaa !5 %11 = trunc i64 %indvars.iv to i32 store i32 %11, ptr %arrayidx15, align 4, !tbaa !5 %arrayidx21 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv store i32 %dec13, ptr %arrayidx21, align 8, !tbaa !5 %12 = or i64 %indvars.iv, 1 %idxprom23 = sext i32 %dec13 to i64 %arrayidx24 = getelementptr inbounds i32, ptr %vla, i64 %idxprom23 %13 = load i32, ptr %arrayidx24, align 4, !tbaa !5 %arrayidx26 = getelementptr inbounds i32, ptr %vla2, i64 %12 store i32 %13, ptr %arrayidx26, align 4, !tbaa !5 %14 = trunc i64 %12 to i32 store i32 %14, ptr %arrayidx24, align 4, !tbaa !5 %arrayidx30 = getelementptr inbounds i32, ptr %vla4, i64 %12 store i32 %dec, ptr %arrayidx30, align 4, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2 %inc33 = add nuw nsw i32 %i7.0237, 1 %15 = load i32, ptr %n, align 4, !tbaa !5 %sub = add nsw i32 %15, -1 %cmp9 = icmp slt i32 %inc33, %sub br i1 %cmp9, label %for.body11, label %for.cond36.preheader, !llvm.loop !11 for.cond.cleanup38: ; preds = %for.cond36.preheader.for.cond.cleanup38_crit_edge, %for.body39.preheader %cmp37240292 = phi i1 [ false, %for.cond36.preheader.for.cond.cleanup38_crit_edge ], [ true, %for.body39.preheader ] %sub.lcssa290 = phi i32 [ %sub.lcssa299, %for.cond36.preheader.for.cond.cleanup38_crit_edge ], [ %sub.lcssa291, %for.body39.preheader ] %.pre-phi = phi i64 [ %.pre, %for.cond36.preheader.for.cond.cleanup38_crit_edge ], [ %7, %for.body39.preheader ] %vla45 = alloca i32, i64 %.pre-phi, align 16 store i32 0, ptr %vla45, align 16, !tbaa !5 store i8 1, ptr %vla6, align 16, !tbaa !9 store i32 0, ptr %vla5, align 16, !tbaa !5 br label %for.body53 for.cond94.preheader: ; preds = %for.cond.cleanup60 br i1 %cmp37240292, label %for.body98.preheader, label %for.cond.cleanup97 for.body98.preheader: ; preds = %for.cond94.preheader call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla6, i8 0, i64 %.pre-phi, i1 false), !tbaa !9 br label %for.cond.cleanup97 for.body53: ; preds = %for.cond.cleanup38, %for.cond.cleanup60 %indvars.iv272 = phi i64 [ 0, %for.cond.cleanup38 ], [ %indvars.iv.next273, %for.cond.cleanup60 ] %count.0247 = phi i32 [ 0, %for.cond.cleanup38 ], [ %count.1.lcssa, %for.cond.cleanup60 ] %arrayidx55 = getelementptr inbounds i32, ptr %vla5, i64 %indvars.iv272 %16 = load i32, ptr %arrayidx55, align 4, !tbaa !5 %idxprom56 = sext i32 %16 to i64 %arrayidx57 = getelementptr inbounds i32, ptr %vla, i64 %idxprom56 %e.0242 = load i32, ptr %arrayidx57, align 4, !tbaa !5 %cmp59.not243 = icmp eq i32 %e.0242, -1 br i1 %cmp59.not243, label %for.cond.cleanup60, label %for.body61 for.cond.cleanup60: ; preds = %for.inc86, %for.body53 %count.1.lcssa = phi i32 [ %count.0247, %for.body53 ], [ %count.2, %for.inc86 ] %indvars.iv.next273 = add nuw nsw i64 %indvars.iv272, 1 %17 = sext i32 %count.1.lcssa to i64 %cmp51.not.not = icmp slt i64 %indvars.iv272, %17 br i1 %cmp51.not.not, label %for.body53, label %for.cond94.preheader, !llvm.loop !13 for.body61: ; preds = %for.body53, %for.inc86 %e.0245 = phi i32 [ %e.0, %for.inc86 ], [ %e.0242, %for.body53 ] %count.1244 = phi i32 [ %count.2, %for.inc86 ], [ %count.0247, %for.body53 ] %idxprom62 = sext i32 %e.0245 to i64 %arrayidx63 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom62 %18 = load i32, ptr %arrayidx63, align 4, !tbaa !5 %idxprom64 = sext i32 %18 to i64 %arrayidx65 = getelementptr inbounds i8, ptr %vla6, i64 %idxprom64 %19 = load i8, ptr %arrayidx65, align 1, !tbaa !9, !range !14, !noundef !15 %cmp66 = icmp eq i8 %19, 0 br i1 %cmp66, label %if.then, label %for.inc86 if.then: ; preds = %for.body61 store i8 1, ptr %arrayidx65, align 1, !tbaa !9 %20 = load i32, ptr %arrayidx55, align 4, !tbaa !5 %idxprom74 = sext i32 %20 to i64 %arrayidx75 = getelementptr inbounds i32, ptr %vla45, i64 %idxprom74 %21 = load i32, ptr %arrayidx75, align 4, !tbaa !5 %add76 = add nsw i32 %21, 1 %arrayidx80 = getelementptr inbounds i32, ptr %vla45, i64 %idxprom64 store i32 %add76, ptr %arrayidx80, align 4, !tbaa !5 %inc81 = add nsw i32 %count.1244, 1 %idxprom84 = sext i32 %inc81 to i64 %arrayidx85 = getelementptr inbounds i32, ptr %vla5, i64 %idxprom84 store i32 %18, ptr %arrayidx85, align 4, !tbaa !5 br label %for.inc86 for.inc86: ; preds = %for.body61, %if.then %count.2 = phi i32 [ %inc81, %if.then ], [ %count.1244, %for.body61 ] %arrayidx88 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom62 %e.0 = load i32, ptr %arrayidx88, align 4, !tbaa !5 %cmp59.not = icmp eq i32 %e.0, -1 br i1 %cmp59.not, label %for.cond.cleanup60, label %for.body61, !llvm.loop !16 for.cond.cleanup97: ; preds = %for.body98.preheader, %for.cond94.preheader %vla104 = alloca i32, i64 %.pre-phi, align 16 %idxprom106 = sext i32 %sub.lcssa290 to i64 %arrayidx107 = getelementptr inbounds i32, ptr %vla104, i64 %idxprom106 store i32 0, ptr %arrayidx107, align 4, !tbaa !5 %arrayidx110 = getelementptr inbounds i8, ptr %vla6, i64 %idxprom106 store i8 1, ptr %arrayidx110, align 1, !tbaa !9 store i32 %sub.lcssa290, ptr %vla5, align 16, !tbaa !5 br label %for.body119 for.cond166.preheader: ; preds = %for.cond.cleanup128 br i1 %cmp37240292, label %for.body170.preheader, label %if.else188 for.body170.preheader: ; preds = %for.cond166.preheader %min.iters.check = icmp ult i64 %.pre-phi, 8 br i1 %min.iters.check, label %for.body170.preheader312, label %vector.ph vector.ph: ; preds = %for.body170.preheader %n.vec = and i64 %.pre-phi, 4294967288 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %36, %vector.body ] %vec.phi304 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %37, %vector.body ] %vec.phi305 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %30, %vector.body ] %vec.phi306 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %31, %vector.body ] %22 = getelementptr inbounds i32, ptr %vla45, i64 %index %wide.load = load <4 x i32>, ptr %22, align 16, !tbaa !5 %23 = getelementptr inbounds i32, ptr %22, i64 4 %wide.load307 = load <4 x i32>, ptr %23, align 16, !tbaa !5 %24 = getelementptr inbounds i32, ptr %vla104, i64 %index %wide.load308 = load <4 x i32>, ptr %24, align 16, !tbaa !5 %25 = getelementptr inbounds i32, ptr %24, i64 4 %wide.load309 = load <4 x i32>, ptr %25, align 16, !tbaa !5 %26 = icmp sle <4 x i32> %wide.load, %wide.load308 %27 = icmp sle <4 x i32> %wide.load307, %wide.load309 %28 = zext <4 x i1> %26 to <4 x i32> %29 = zext <4 x i1> %27 to <4 x i32> %30 = add <4 x i32> %vec.phi305, %28 %31 = add <4 x i32> %vec.phi306, %29 %32 = xor <4 x i1> %26, <i1 true, i1 true, i1 true, i1 true> %33 = xor <4 x i1> %27, <i1 true, i1 true, i1 true, i1 true> %34 = zext <4 x i1> %32 to <4 x i32> %35 = zext <4 x i1> %33 to <4 x i32> %36 = add <4 x i32> %vec.phi, %34 %37 = add <4 x i32> %vec.phi304, %35 %index.next = add nuw i64 %index, 8 %38 = icmp eq i64 %index.next, %n.vec br i1 %38, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %bin.rdx310 = add <4 x i32> %31, %30 %39 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx310) %bin.rdx = add <4 x i32> %37, %36 %40 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %.pre-phi, %n.vec br i1 %cmp.n, label %for.cond.cleanup169, label %for.body170.preheader312 for.body170.preheader312: ; preds = %for.body170.preheader, %middle.block %indvars.iv281.ph = phi i64 [ 0, %for.body170.preheader ], [ %n.vec, %middle.block ] %Snuke.0260.ph = phi i32 [ 0, %for.body170.preheader ], [ %40, %middle.block ] %Fennec.0259.ph = phi i32 [ 0, %for.body170.preheader ], [ %39, %middle.block ] br label %for.body170 for.body119: ; preds = %for.cond.cleanup97, %for.cond.cleanup128 %indvars.iv278 = phi i64 [ 0, %for.cond.cleanup97 ], [ %indvars.iv.next279, %for.cond.cleanup128 ] %count.3256 = phi i32 [ 0, %for.cond.cleanup97 ], [ %count.4.lcssa, %for.cond.cleanup128 ] %arrayidx122 = getelementptr inbounds i32, ptr %vla5, i64 %indvars.iv278 %41 = load i32, ptr %arrayidx122, align 4, !tbaa !5 %idxprom123 = sext i32 %41 to i64 %arrayidx124 = getelementptr inbounds i32, ptr %vla, i64 %idxprom123 %e120.0251 = load i32, ptr %arrayidx124, align 4, !tbaa !5 %cmp126.not252 = icmp eq i32 %e120.0251, -1 br i1 %cmp126.not252, label %for.cond.cleanup128, label %for.body129 for.cond.cleanup128: ; preds = %for.inc158, %for.body119 %count.4.lcssa = phi i32 [ %count.3256, %for.body119 ], [ %count.5, %for.inc158 ] %indvars.iv.next279 = add nuw nsw i64 %indvars.iv278, 1 %42 = sext i32 %count.4.lcssa to i64 %cmp116.not.not = icmp slt i64 %indvars.iv278, %42 br i1 %cmp116.not.not, label %for.body119, label %for.cond166.preheader, !llvm.loop !20 for.body129: ; preds = %for.body119, %for.inc158 %e120.0254 = phi i32 [ %e120.0, %for.inc158 ], [ %e120.0251, %for.body119 ] %count.4253 = phi i32 [ %count.5, %for.inc158 ], [ %count.3256, %for.body119 ] %idxprom130 = sext i32 %e120.0254 to i64 %arrayidx131 = getelementptr inbounds i32, ptr %vla4, i64 %idxprom130 %43 = load i32, ptr %arrayidx131, align 4, !tbaa !5 %idxprom132 = sext i32 %43 to i64 %arrayidx133 = getelementptr inbounds i8, ptr %vla6, i64 %idxprom132 %44 = load i8, ptr %arrayidx133, align 1, !tbaa !9, !range !14, !noundef !15 %cmp136 = icmp eq i8 %44, 0 br i1 %cmp136, label %if.then138, label %for.inc158 if.then138: ; preds = %for.body129 store i8 1, ptr %arrayidx133, align 1, !tbaa !9 %45 = load i32, ptr %arrayidx122, align 4, !tbaa !5 %idxprom145 = sext i32 %45 to i64 %arrayidx146 = getelementptr inbounds i32, ptr %vla104, i64 %idxprom145 %46 = load i32, ptr %arrayidx146, align 4, !tbaa !5 %add147 = add nsw i32 %46, 1 %arrayidx151 = getelementptr inbounds i32, ptr %vla104, i64 %idxprom132 store i32 %add147, ptr %arrayidx151, align 4, !tbaa !5 %inc152 = add nsw i32 %count.4253, 1 %idxprom155 = sext i32 %inc152 to i64 %arrayidx156 = getelementptr inbounds i32, ptr %vla5, i64 %idxprom155 store i32 %43, ptr %arrayidx156, align 4, !tbaa !5 br label %for.inc158 for.inc158: ; preds = %for.body129, %if.then138 %count.5 = phi i32 [ %inc152, %if.then138 ], [ %count.4253, %for.body129 ] %arrayidx160 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom130 %e120.0 = load i32, ptr %arrayidx160, align 4, !tbaa !5 %cmp126.not = icmp eq i32 %e120.0, -1 br i1 %cmp126.not, label %for.cond.cleanup128, label %for.body129, !llvm.loop !21 for.cond.cleanup169: ; preds = %for.body170, %middle.block %Fennec.1.lcssa = phi i32 [ %39, %middle.block ], [ %Fennec.1, %for.body170 ] %Snuke.1.lcssa = phi i32 [ %40, %middle.block ], [ %Snuke.1, %for.body170 ] %cmp184 = icmp ugt i32 %Fennec.1.lcssa, %Snuke.1.lcssa br i1 %cmp184, label %if.end190, label %if.else188 for.body170: ; preds = %for.body170.preheader312, %for.body170 %indvars.iv281 = phi i64 [ %indvars.iv.next282, %for.body170 ], [ %indvars.iv281.ph, %for.body170.preheader312 ] %Snuke.0260 = phi i32 [ %Snuke.1, %for.body170 ], [ %Snuke.0260.ph, %for.body170.preheader312 ] %Fennec.0259 = phi i32 [ %Fennec.1, %for.body170 ], [ %Fennec.0259.ph, %for.body170.preheader312 ] %arrayidx172 = getelementptr inbounds i32, ptr %vla45, i64 %indvars.iv281 %47 = load i32, ptr %arrayidx172, align 4, !tbaa !5 %arrayidx174 = getelementptr inbounds i32, ptr %vla104, i64 %indvars.iv281 %48 = load i32, ptr %arrayidx174, align 4, !tbaa !5 %cmp175.not = icmp sle i32 %47, %48 %inc178 = zext i1 %cmp175.not to i32 %Fennec.1 = add nuw nsw i32 %Fennec.0259, %inc178 %not.cmp175.not = xor i1 %cmp175.not, true %inc179 = zext i1 %not.cmp175.not to i32 %Snuke.1 = add nuw nsw i32 %Snuke.0260, %inc179 %indvars.iv.next282 = add nuw nsw i64 %indvars.iv281, 1 %exitcond.not = icmp eq i64 %indvars.iv.next282, %.pre-phi br i1 %exitcond.not, label %for.cond.cleanup169, label %for.body170, !llvm.loop !22 if.else188: ; preds = %for.cond166.preheader, %for.cond.cleanup169 br label %if.end190 if.end190: ; preds = %for.cond.cleanup169, %if.else188 %str.sink = phi ptr [ @str, %if.else188 ], [ @str.4, %for.cond.cleanup169 ] %puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7 call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nofree nounwind } attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #7 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"_Bool", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = !{i8 0, i8 2} !15 = !{} !16 = distinct !{!16, !12} !17 = distinct !{!17, !12, !18, !19} !18 = !{!"llvm.loop.isvectorized", i32 1} !19 = !{!"llvm.loop.unroll.runtime.disable"} !20 = distinct !{!20, !12} !21 = distinct !{!21, !12} !22 = distinct !{!22, !12, !19, !18}
/* cat <<EOF >mistaken-paste */ #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #define BIG 2000000007 #define VERYBIG 200000000000007LL #define MOD 1000000007 typedef uint64_t ull; typedef int64_t sll; #define N_MAX 5000 #define M_MAX 400 #ifdef __cplusplus #include <queue> #include <stack> // #include <tuple> using namespace std; // I'm NOT gonna use C++ without compro. shit typedef priority_queue<ull, vector<ull>, greater<ull> > upque123; typedef priority_queue<ull, vector<ull> > upque321; typedef priority_queue<sll, vector<sll>, greater<sll> > spque123; typedef priority_queue<sll, vector<sll> > spque321; #endif typedef struct { int32_t a; int32_t b; } hw; typedef struct { sll a; sll b; } hwll; typedef struct { hwll a; hwll b; } linell; typedef struct { ull s; ull t; int32_t c; } struct_a; typedef struct { int32_t from; int32_t to; sll cost; } struct_b; const hw vector8[8] = { {-1, -1}, {-1, 0}, {-1, +1}, { 0, -1}, { 0, +1}, {+1, -1}, {+1, 0}, {+1, +1} }; ull n, m; ull h, w; ull k; ull q; ull vua, vub, vuc, vud, vue, vuf; sll vsa, vsb, vsc, vsd, vse, vsf; long double vra, vrb, vrc; double vda, vdb, vdc; size_t slen; size_t tlen; char ch, dh; void swap_adj (ull *a, ull *b) { if (*a != *b) { ull tmp = *b; *b = *a; *a = tmp; } return; } ull divide (ull a, ull b) { ull x = MOD - 2; ull ans = 1; while (x) { if (x & 1) ans = (ans * b) % MOD; b = (b * b) % MOD; x /= 2; } return (a * ans) % MOD; } int32_t digits (ull x) { int32_t i = 1; while (x >= 10) { x /= 10; i++; } return i; } ull umin (ull x, ull y) { return (x < y) ? x : y; } ull umax (ull x, ull y) { return (x > y) ? x : y; } sll smin (sll x, sll y) { return (x < y) ? x : y; } sll smax (sll x, sll y) { return (x > y) ? x : y; } ull gcd (ull x, ull y) { if (x < y) { return gcd(y, x); } else if (y == 0) { return x; } else { return gcd(y, x % y); } } ull bitpow (ull a, ull x, ull modulo) { ull result = 1; while (x) { if (x & 1) { result *= a; result %= modulo; } x /= 2; a = (a * a) % modulo; } return result; } int32_t targetdig (ull x, int32_t index /* 1-indexed */) { // static...? int32_t posmax = digits(x); if (posmax < index) return -1; while (posmax > index) { posmax--; x /= 10; } return x % 10; } int32_t charcomp (const char left, const char right) { if (left < right) { return -1; } else if (left > right) { return +1; } else { return 0; } } int32_t pcharcomp (const void *left, const void *right) { char lval = *(char*)left; char rval = *(char*)right; return charcomp(lval, rval); } int32_t intcomp (const int32_t left, const int32_t right) { if (left < right) { return -1; } else if (left > right) { return +1; } else { return 0; } } int32_t pintcomp (const void *left, const void *right) { int lval = *(int*)left; int rval = *(int*)right; return intcomp(lval, rval); } int32_t ullcomp (const ull left, const ull right) { if (left < right) { return -1; } else if (left > right) { return +1; } else { return 0; } } int32_t pullcomp (const void *left, const void *right) { ull lval = *(ull*)left; ull rval = *(ull*)right; return ullcomp(lval, rval); } int32_t pullrevcomp (const void *left, const void *right) { ull lval = *(ull*)left; ull rval = *(ull*)right; return -ullcomp(lval, rval); } int32_t sllcomp (const sll left, const sll right) { if (left < right) { return -1; } else if (left > right) { return +1; } else { return 0; } } int32_t psllcomp (const void *left, const void *right) { sll lval = *(sll*)left, rval = *(sll*)right; return ullcomp(lval, rval); } int32_t hwllfraccomp (const hwll left, const hwll right) { return ullcomp(left.a * right.b, left.b * right.a); } int32_t phwAcomp (const hw *left, const hw *right) { return intcomp(left->a, right->a); } int32_t phwBcomp (const hw *left, const hw *right) { return intcomp(left->b, right->b); } int32_t phwABcomp (const hw *left, const hw *right) { int32_t x = phwAcomp(left, right); if (x) return x; return phwBcomp(left, right); } int32_t phwllAcomp (const hwll *left, const hwll *right) { return sllcomp(left->a, right->a); } int32_t phwllBcomp (const hwll *left, const hwll *right) { return sllcomp(left->b, right->b); } int32_t phwllABcomp (const void *left, const void *right) { hwll lval = *(hwll*)left, rval = *(hwll*)right; int32_t x = sllcomp(lval.a, rval.a); if (x) return x; return sllcomp(lval.b, rval.b); } int32_t phwllrAcBcomp (const hwll *left, const hwll *right) { int32_t x = -phwllAcomp(left, right); if (x) return x; return phwllBcomp(left, right); } int32_t phwllBAcomp (const hwll *left, const hwll *right) { int32_t x = phwllBcomp(left, right); if (x) return x; return phwllAcomp(left, right); } int32_t pstrAcomp (const struct_a *left, const struct_a *right) { int32_t x; if (x = ullcomp(left->t, right->t)) return x; if (x = ullcomp(left->s, right->s)) return x; if (x = intcomp(left->c, right->c)) return x; return 0; } int32_t bitlet (char c) { return (1 << (c - 'a')); } ull ullabs (ull a, ull b) { if (a >= b) { return a - b; } else { return b - a; } } sll sllabs (sll a, sll b) { if (a >= b) { return a - b; } else { return b - a; } } sll nibutanlobo (bool (*func)(sll arg), sll ok, sll ng) { while (sllabs(ok, ng) > 1) { sll med = (ok + ng) / 2; if (func(med)) { ok = med; } else { ng = med; } // printf("debug: [%lld %lld)\n", ok, ng); } if (!func(ok)) return ok * 2 - ng; return ok; } bool nextrouteint (int32_t arr[], int32_t n) { int32_t i = n - 1; int32_t j, x; while (i > 0 && arr[i - 1] > arr[i]) i--; if (i == 0) return false; x = n; for (j = i; j < n; j++) { if (arr[j] < arr[i - 1]) continue; if (x == n || arr[x] > arr[j]) x = j; } arr[i - 1] ^= arr[x]; arr[x] ^= arr[i - 1]; arr[i - 1] ^= arr[x]; qsort(&arr[i], n - i, sizeof(int32_t), pintcomp); return true; } bool nextrouteull (ull arr[], int32_t n) { int32_t i = n - 1; int32_t j, x; while (i > 0 && arr[i - 1] > arr[i]) i--; if (i == 0) return false; x = n; for (j = i; j < n; j++) { if (arr[j] < arr[i - 1]) continue; if (x == n || arr[x] > arr[j]) x = j; } arr[i - 1] ^= arr[x]; arr[x] ^= arr[i - 1]; arr[i - 1] ^= arr[x]; qsort(&arr[i], n - i, sizeof(ull), pintcomp); return true; } void printUquotient (ull left, ull right) { const int32_t digits = 20; printf("%llu.", left / right); left %= right; for (int32_t i = 0; i < digits; i++) { left *= 10; printf("%1d", left / right); left %= right; } puts(""); return; } void printSquotient (sll left, sll right) { if (left * right < 0) putchar('-'); printUquotient(sllabs(left, 0), sllabs(right, 0)); return; } int bitcount (ull n) { int result = 0; while (n) { if (n & 1) result++; n /= 2; } return result; } #ifdef __cplusplus typedef struct { int32_t to; sll cost; } edge; typedef pair<sll, int32_t> P; std::vector<edge> g[N_MAX]; void dijk_init (ull n, struct_b arr[]) { edge x; for (int32_t i = 0; i < n; i++) { x.to = arr[i].to; x.cost = arr[i].cost; g[arr[i].from].push_back(x); } } void dijk_distinit (int s, sll distance[], ull n) { for (int32_t i = 0; i < n; i++) { distance[i] = VERYBIG; } distance[s] = 0; return; } bool dijkstra (int s, sll distance[]) { priority_queue<P, std::vector<P>, greater<P> > que; // (最短距離, 頂点番号) que.push(P(distance[s], s)); bool ischanged = false; while (!que.empty()) { P p = que.top(); que.pop(); sll v = p.second; if (distance[v] < p.first) continue; int32_t maxsize = g[v].size(); for (int32_t i = 0; i < maxsize; i++) { edge e = g[v][i]; if (distance[e.to] > distance[v] + e.cost) { distance[e.to] = distance[v] + e.cost; ischanged = true; que.push(P(distance[e.to], e.to)); } } } return ischanged; } #endif sll dist[N_MAX]; struct_b path[N_MAX * 2]; ull a[N_MAX]; // sll a[N_MAX]; // ull a[N_MAX][N_MAX]; // sll a[N_MAX][N_MAX]; ull b[N_MAX]; // sll b[N_MAX]; ull c[N_MAX]; // char c[N_MAX]; // char s[N_MAX + 1]; // char s[N_MAX + 1][N_MAX + 1]; // char s[N_MAX + 1][M_MAX + 1]; // char t[N_MAX + 1]; // ull alphabets[26]; // char alphabets[26]; // ull dp[N_MAX + 1]; // ull dp[N_MAX + 1][N_MAX + 1]; // bool dp[N_MAX + 1]; // bool dp[N_MAX + 1][N_MAX + 1]; hwll arr[N_MAX]; // typedef tuple<sll, int32_t, int32_t> P2d; ull dp[N_MAX + 1][N_MAX + 1]; double distance (sll x1, sll y1, sll x2, sll y2) { double xdist2, ydist2, origindist, dist; xdist2 = (x1 - x2) * (x1 - x2); ydist2 = (y1 - y2) * (y1 - y2); return sqrt(xdist2 + ydist2); } ull solve () { sll i, j, ki, l; ull result = 0; // sll result = 0; // double result = 0; ull maybe = 0; // sll maybe = 0; ull sum = 0; // sll sum = 0; ull item; ull *dpcell; // qsortの際には"p"ullcompを使う for (i = 0; i < n; i++) { arr[i].a = a[i] + b[i]; arr[i].b = i; } qsort(arr, n, sizeof(hwll), phwllABcomp); for (i = 0; i <= n; i++) { dp[0][i] = BIG; } dp[0][0] = 0; for (i = 1; i <= n; i++) { ull oindex = arr[i - 1].b; // printf("[%llu]: %llu / %llu\n", i, arr[i - 1].a, oindex); for (j = 0; j <= n; j++) { dp[i][j] = dp[i - 1][j]; if (j > 0 && dp[i - 1][j - 1] <= a[oindex]) { dp[i][j] = umin(dp[i][j], dp[i - 1][j - 1] + b[oindex]); } // printf("[%llu][%llu] %llu\n", i, j, dp[i][j]); } } result = n; while (dp[n][result] == BIG) result--; printf("%llu\n", result); // printf("%.12lf\n", (double)result); // puts(s); return 0; success: puts("YES"); // puts("Yes"); // printf("%llu\n", result); // puts("0"); // puts("Alice"); return 0; fail: puts("NO"); // puts("No"); // puts("0"); // puts("-1"); // puts("-1 -1 -1"); // puts("Eel"); return 1; } int32_t main (void) { int32_t i, j; int32_t x, y; // scanf("%lf%lf", &vda, &vdb); // scanf("%lld%lld%lld%lld", &vsa, &vsb, &vsc, &vsd); // scanf("%llu%llu", &vua, &vub, &vuc, &vud); // scanf("%llu%llu", &h, &w); scanf("%llu", &n, &m); // scanf("%*llu"); // scanf("%llu", &k, &m, &n); // scanf("%llu%llu", &vua, &vub, &vuc, &vud, &vue, &vuf); // scanf("%lld", &vsa, &vsb, &vsc); // scanf("%s", s); // scanf("%s", t); // scanf("%llu", &k); // for (i = 0; i < n; i++) { // scanf("%llu", &a[i]); // // a[i]--; // } // for (i = 0; i < h; i++) { // scanf("%llu", &a[i]); // } // for (i = 0; i < w; i++) { // scanf("%llu", &b[i]); // } // for (i = 0; i < m; i++) { // scanf("%llu", &b[i]); // } // for (i = 0; i < h; i++) { // scanf("%s", s[i]); // } // scanf("%s", t); for (i = 0; i < n; i++) { scanf("%llu", &a[i]); scanf("%llu", &b[i]); // scanf("%llu", &c[i]); // arr[i].a--; // arr[i].b--; } // for (i = 0; i < n; i++) { // for (j = 0; j < n; j++) { // scanf("%llu", &a[i][j]); // } // } // for (i = 0; i < n; i++) { // scanf("%llu%llu%llu", &a[i], &b[i], &c[i]); // } // scanf("%llu", &q); // scanf("%llu", &k); // k--; // for (i = 0; i < q; i++) { // scanf("%llu%llu", &a[i], &b[i]); // a[i]--; // b[i]--; // // solve(); // } // for (i = 0; i < m; i++) { // scanf("%llu%llu", &arr[i].a, &arr[i].b); // arr[i].a--; // arr[i].b--; // } // for (i = 0; i < n; i++) { // for (j = 0; j < m; j++) { // scanf("%llu", &a[i][j]); // a[i][j]--; // } // } solve(); // for (i = 0; i < m; i++) { // scanf("%llu%llu%llu", &vua, &vub, &vuc); // // scanf("%s%s", s, t); // // scanf("%f%f%f", &vda, &vdb, &vdc); // // scanf("%s", s); // solve(); // } // while (scanf("%llu%llu", &n, &k), n + k) { // for (i = 0; i < n; i++) { // scanf("%llu", &a[i]); // } // solve(); // } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103034/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103034/source.c" target datalayout = "e-m:e-p270: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.hw = type { i32, i32 } %struct.hwll = type { i64, i64 } %struct.struct_b = type { i32, i32, i64 } %struct.struct_a = type { i64, i64, i32 } @vector8 = dso_local local_unnamed_addr constant [8 x %struct.hw] [%struct.hw { i32 -1, i32 -1 }, %struct.hw { i32 -1, i32 0 }, %struct.hw { i32 -1, i32 1 }, %struct.hw { i32 0, i32 -1 }, %struct.hw { i32 0, i32 1 }, %struct.hw { i32 1, i32 -1 }, %struct.hw { i32 1, i32 0 }, %struct.hw { i32 1, i32 1 }], align 16 @.str = private unnamed_addr constant [6 x i8] c"%llu.\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%1d\00", align 1 @n = dso_local global i64 0, align 8 @a = dso_local global [5000 x i64] zeroinitializer, align 16 @b = dso_local global [5000 x i64] zeroinitializer, align 16 @arr = dso_local global [5000 x %struct.hwll] zeroinitializer, align 16 @dp = dso_local local_unnamed_addr global [5001 x [5001 x i64]] zeroinitializer, align 16 @.str.3 = private unnamed_addr constant [6 x i8] c"%llu\0A\00", align 1 @.str.6 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1 @m = dso_local global i64 0, align 8 @h = dso_local local_unnamed_addr global i64 0, align 8 @w = dso_local local_unnamed_addr global i64 0, align 8 @k = dso_local local_unnamed_addr global i64 0, align 8 @q = dso_local local_unnamed_addr global i64 0, align 8 @vua = dso_local local_unnamed_addr global i64 0, align 8 @vub = dso_local local_unnamed_addr global i64 0, align 8 @vuc = dso_local local_unnamed_addr global i64 0, align 8 @vud = dso_local local_unnamed_addr global i64 0, align 8 @vue = dso_local local_unnamed_addr global i64 0, align 8 @vuf = dso_local local_unnamed_addr global i64 0, align 8 @vsa = dso_local local_unnamed_addr global i64 0, align 8 @vsb = dso_local local_unnamed_addr global i64 0, align 8 @vsc = dso_local local_unnamed_addr global i64 0, align 8 @vsd = dso_local local_unnamed_addr global i64 0, align 8 @vse = dso_local local_unnamed_addr global i64 0, align 8 @vsf = dso_local local_unnamed_addr global i64 0, align 8 @vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16 @vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8 @slen = dso_local local_unnamed_addr global i64 0, align 8 @tlen = dso_local local_unnamed_addr global i64 0, align 8 @ch = dso_local local_unnamed_addr global i8 0, align 1 @dh = dso_local local_unnamed_addr global i8 0, align 1 @dist = dso_local local_unnamed_addr global [5000 x i64] zeroinitializer, align 16 @path = dso_local local_unnamed_addr global [10000 x %struct.struct_b] zeroinitializer, align 16 @c = dso_local local_unnamed_addr global [5000 x i64] zeroinitializer, align 16 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap_adj(ptr nocapture noundef %a, ptr nocapture noundef %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.not = icmp eq i64 %0, %1 br i1 %cmp.not, label %if.end, label %if.then if.then: ; preds = %entry store i64 %0, ptr %b, align 8, !tbaa !5 store i64 %1, ptr %a, align 8, !tbaa !5 br label %if.end if.end: ; preds = %if.then, %entry ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @divide(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 { entry: br label %while.body while.body: ; preds = %entry, %if.end %ans.014 = phi i64 [ 1, %entry ], [ %ans.1, %if.end ] %x.013 = phi i64 [ 1000000005, %entry ], [ %div11, %if.end ] %b.addr.012 = phi i64 [ %b, %entry ], [ %rem3, %if.end ] %and = and i64 %x.013, 1 %tobool1.not = icmp eq i64 %and, 0 br i1 %tobool1.not, label %if.end, label %if.then if.then: ; preds = %while.body %mul = mul i64 %ans.014, %b.addr.012 %rem = urem i64 %mul, 1000000007 br label %if.end if.end: ; preds = %if.then, %while.body %ans.1 = phi i64 [ %rem, %if.then ], [ %ans.014, %while.body ] %mul2 = mul i64 %b.addr.012, %b.addr.012 %rem3 = urem i64 %mul2, 1000000007 %div11 = lshr i64 %x.013, 1 %tobool.not = icmp ult i64 %x.013, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9 while.end: ; preds = %if.end %mul4 = mul i64 %ans.1, %a %rem5 = urem i64 %mul4, 1000000007 ret i64 %rem5 } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @digits(i64 noundef %x) local_unnamed_addr #1 { entry: %cmp3 = icmp ugt i64 %x, 9 br i1 %cmp3, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %i.05 = phi i32 [ %inc, %while.body ], [ 1, %entry ] %x.addr.04 = phi i64 [ %div, %while.body ], [ %x, %entry ] %div = udiv i64 %x.addr.04, 10 %inc = add nuw nsw i32 %i.05, 1 %cmp = icmp ugt i64 %x.addr.04, 99 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11 while.end: ; preds = %while.body, %entry %i.0.lcssa = phi i32 [ 1, %entry ], [ %inc, %while.body ] ret i32 %i.0.lcssa } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 { entry: %cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y) ret i64 %cond } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 { entry: br label %tailrecurse tailrecurse: ; preds = %tailrecurse.backedge, %entry %x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ] %y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ] %cmp = icmp ult i64 %x.tr, %y.tr br i1 %cmp, label %tailrecurse.backedge, label %if.else if.else: ; preds = %tailrecurse %cmp1 = icmp eq i64 %y.tr, 0 br i1 %cmp1, label %return, label %if.else3 if.else3: ; preds = %if.else %rem = urem i64 %x.tr, %y.tr br label %tailrecurse.backedge tailrecurse.backedge: ; preds = %if.else3, %tailrecurse %y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ] br label %tailrecurse return: ; preds = %if.else ret i64 %x.tr } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 { entry: %tobool.not12 = icmp eq i64 %x, 0 br i1 %tobool.not12, label %while.end, label %while.body while.body: ; preds = %entry, %if.end %result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ] %a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ] %x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ] %and = and i64 %x.addr.013, 1 %tobool1.not = icmp eq i64 %and, 0 br i1 %tobool1.not, label %if.end, label %if.then if.then: ; preds = %while.body %mul = mul i64 %result.015, %a.addr.014 %rem = urem i64 %mul, %modulo br label %if.end if.end: ; preds = %if.then, %while.body %result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ] %div11 = lshr i64 %x.addr.013, 1 %mul2 = mul i64 %a.addr.014, %a.addr.014 %rem3 = urem i64 %mul2, %modulo %tobool.not = icmp ult i64 %x.addr.013, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12 while.end: ; preds = %if.end, %entry %result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ] ret i64 %result.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @targetdig(i64 noundef %x, i32 noundef %index) local_unnamed_addr #1 { entry: %cmp3.i = icmp ugt i64 %x, 9 br i1 %cmp3.i, label %while.body.i, label %digits.exit while.body.i: ; preds = %entry, %while.body.i %i.05.i = phi i32 [ %inc.i, %while.body.i ], [ 1, %entry ] %x.addr.04.i = phi i64 [ %div.i, %while.body.i ], [ %x, %entry ] %div.i = udiv i64 %x.addr.04.i, 10 %inc.i = add nuw nsw i32 %i.05.i, 1 %cmp.i = icmp ugt i64 %x.addr.04.i, 99 br i1 %cmp.i, label %while.body.i, label %digits.exit, !llvm.loop !11 digits.exit: ; preds = %while.body.i, %entry %i.0.lcssa.i = phi i32 [ 1, %entry ], [ %inc.i, %while.body.i ] %cmp = icmp slt i32 %i.0.lcssa.i, %index br i1 %cmp, label %cleanup, label %while.cond.preheader while.cond.preheader: ; preds = %digits.exit %cmp17 = icmp sgt i32 %i.0.lcssa.i, %index br i1 %cmp17, label %while.body.preheader, label %while.end while.body.preheader: ; preds = %while.cond.preheader %0 = sub i32 %i.0.lcssa.i, %index %1 = xor i32 %index, -1 %2 = add i32 %i.0.lcssa.i, %1 %xtraiter = and i32 %0, 3 %lcmp.mod.not = icmp eq i32 %xtraiter, 0 br i1 %lcmp.mod.not, label %while.body.prol.loopexit, label %while.body.prol while.body.prol: ; preds = %while.body.preheader, %while.body.prol %posmax.09.prol = phi i32 [ %dec.prol, %while.body.prol ], [ %i.0.lcssa.i, %while.body.preheader ] %x.addr.08.prol = phi i64 [ %div.prol, %while.body.prol ], [ %x, %while.body.preheader ] %prol.iter = phi i32 [ %prol.iter.next, %while.body.prol ], [ 0, %while.body.preheader ] %dec.prol = add nsw i32 %posmax.09.prol, -1 %div.prol = udiv i64 %x.addr.08.prol, 10 %prol.iter.next = add i32 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %while.body.prol.loopexit, label %while.body.prol, !llvm.loop !13 while.body.prol.loopexit: ; preds = %while.body.prol, %while.body.preheader %posmax.09.unr = phi i32 [ %i.0.lcssa.i, %while.body.preheader ], [ %dec.prol, %while.body.prol ] %x.addr.08.unr = phi i64 [ %x, %while.body.preheader ], [ %div.prol, %while.body.prol ] %div.lcssa.unr = phi i64 [ undef, %while.body.preheader ], [ %div.prol, %while.body.prol ] %3 = icmp ult i32 %2, 3 br i1 %3, label %while.end, label %while.body while.body: ; preds = %while.body.prol.loopexit, %while.body %posmax.09 = phi i32 [ %dec.3, %while.body ], [ %posmax.09.unr, %while.body.prol.loopexit ] %x.addr.08 = phi i64 [ %div.3, %while.body ], [ %x.addr.08.unr, %while.body.prol.loopexit ] %dec.3 = add nsw i32 %posmax.09, -4 %div.3 = udiv i64 %x.addr.08, 10000 %cmp1.3 = icmp sgt i32 %dec.3, %index br i1 %cmp1.3, label %while.body, label %while.end, !llvm.loop !15 while.end: ; preds = %while.body.prol.loopexit, %while.body, %while.cond.preheader %x.addr.0.lcssa = phi i64 [ %x, %while.cond.preheader ], [ %div.lcssa.unr, %while.body.prol.loopexit ], [ %div.3, %while.body ] %rem = urem i64 %x.addr.0.lcssa, 10 %conv = trunc i64 %rem to i32 br label %cleanup cleanup: ; preds = %digits.exit, %while.end %retval.0 = phi i32 [ %conv, %while.end ], [ -1, %digits.exit ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @charcomp(i8 noundef signext %left, i8 noundef signext %right) local_unnamed_addr #3 { entry: %cmp = icmp slt i8 %left, %right %cmp5 = icmp sgt i8 %left, %right %. = zext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i8, ptr %left, align 1, !tbaa !16 %1 = load i8, ptr %right, align 1, !tbaa !16 %cmp.i = icmp slt i8 %0, %1 %cmp5.i = icmp sgt i8 %0, %1 %..i = zext i1 %cmp5.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @intcomp(i32 noundef %left, i32 noundef %right) local_unnamed_addr #3 { entry: %cmp = icmp slt i32 %left, %right %cmp1 = icmp sgt i32 %left, %right %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pintcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) #4 { entry: %0 = load i32, ptr %left, align 4, !tbaa !17 %1 = load i32, ptr %right, align 4, !tbaa !17 %cmp.i = icmp slt i32 %0, %1 %cmp1.i = icmp sgt i32 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @ullcomp(i64 noundef %left, i64 noundef %right) local_unnamed_addr #3 { entry: %cmp = icmp ult i64 %left, %right %cmp1 = icmp ugt i64 %left, %right %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !5 %1 = load i64, ptr %right, align 8, !tbaa !5 %cmp.i = icmp ult i64 %0, %1 %cmp1.i = icmp ugt i64 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pullrevcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !5 %1 = load i64, ptr %right, align 8, !tbaa !5 %cmp.i = icmp ult i64 %0, %1 %cmp1.i = icmp ugt i64 %0, %1 %..i.neg = sext i1 %cmp1.i to i32 %retval.0.i.neg = select i1 %cmp.i, i32 1, i32 %..i.neg ret i32 %retval.0.i.neg } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @sllcomp(i64 noundef %left, i64 noundef %right) local_unnamed_addr #3 { entry: %cmp = icmp slt i64 %left, %right %cmp1 = icmp sgt i64 %left, %right %. = zext i1 %cmp1 to i32 %retval.0 = select i1 %cmp, i32 -1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !5 %1 = load i64, ptr %right, align 8, !tbaa !5 %cmp.i = icmp ult i64 %0, %1 %cmp1.i = icmp ugt i64 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @hwllfraccomp(i64 %left.coerce0, i64 %left.coerce1, i64 %right.coerce0, i64 %right.coerce1) local_unnamed_addr #3 { entry: %mul = mul nsw i64 %right.coerce1, %left.coerce0 %mul3 = mul nsw i64 %right.coerce0, %left.coerce1 %cmp.i = icmp ult i64 %mul, %mul3 %cmp1.i = icmp ugt i64 %mul, %mul3 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwAcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i32, ptr %left, align 4, !tbaa !19 %1 = load i32, ptr %right, align 4, !tbaa !19 %cmp.i = icmp slt i32 %0, %1 %cmp1.i = icmp sgt i32 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwBcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %b = getelementptr inbounds %struct.hw, ptr %left, i64 0, i32 1 %0 = load i32, ptr %b, align 4, !tbaa !21 %b1 = getelementptr inbounds %struct.hw, ptr %right, i64 0, i32 1 %1 = load i32, ptr %b1, align 4, !tbaa !21 %cmp.i = icmp slt i32 %0, %1 %cmp1.i = icmp sgt i32 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i32, ptr %left, align 4, !tbaa !19 %1 = load i32, ptr %right, align 4, !tbaa !19 %cmp.i.i = icmp slt i32 %0, %1 %cmp1.i.i = icmp sgt i32 %0, %1 %..i.i = zext i1 %cmp1.i.i to i32 %retval.0.i.i = select i1 %cmp.i.i, i32 -1, i32 %..i.i %tobool.not = icmp eq i32 %retval.0.i.i, 0 br i1 %tobool.not, label %if.end, label %cleanup if.end: ; preds = %entry %b.i = getelementptr inbounds %struct.hw, ptr %left, i64 0, i32 1 %2 = load i32, ptr %b.i, align 4, !tbaa !21 %b1.i = getelementptr inbounds %struct.hw, ptr %right, i64 0, i32 1 %3 = load i32, ptr %b1.i, align 4, !tbaa !21 %cmp.i.i5 = icmp slt i32 %2, %3 %cmp1.i.i6 = icmp sgt i32 %2, %3 %..i.i7 = zext i1 %cmp1.i.i6 to i32 %retval.0.i.i8 = select i1 %cmp.i.i5, i32 -1, i32 %..i.i7 br label %cleanup cleanup: ; preds = %entry, %if.end %retval.0 = phi i32 [ %retval.0.i.i8, %if.end ], [ %retval.0.i.i, %entry ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllAcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !22 %1 = load i64, ptr %right, align 8, !tbaa !22 %cmp.i = icmp slt i64 %0, %1 %cmp1.i = icmp sgt i64 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllBcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %b = getelementptr inbounds %struct.hwll, ptr %left, i64 0, i32 1 %0 = load i64, ptr %b, align 8, !tbaa !24 %b1 = getelementptr inbounds %struct.hwll, ptr %right, i64 0, i32 1 %1 = load i64, ptr %b1, align 8, !tbaa !24 %cmp.i = icmp slt i64 %0, %1 %cmp1.i = icmp sgt i64 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i ret i32 %retval.0.i } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) #4 { entry: %lval.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !25 %lval.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8 %lval.sroa.4.0.copyload = load i64, ptr %lval.sroa.4.0..sroa_idx, align 8, !tbaa.struct !26 %rval.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !25 %rval.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8 %rval.sroa.4.0.copyload = load i64, ptr %rval.sroa.4.0..sroa_idx, align 8, !tbaa.struct !26 %cmp.i = icmp slt i64 %lval.sroa.0.0.copyload, %rval.sroa.0.0.copyload %cmp1.i = icmp sgt i64 %lval.sroa.0.0.copyload, %rval.sroa.0.0.copyload %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i %tobool.not = icmp eq i32 %retval.0.i, 0 %cmp.i7 = icmp slt i64 %lval.sroa.4.0.copyload, %rval.sroa.4.0.copyload %cmp1.i8 = icmp sgt i64 %lval.sroa.4.0.copyload, %rval.sroa.4.0.copyload %..i9 = zext i1 %cmp1.i8 to i32 %retval.0.i10 = select i1 %cmp.i7, i32 -1, i32 %..i9 %retval.0 = select i1 %tobool.not, i32 %retval.0.i10, i32 %retval.0.i ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllrAcBcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %0 = load i64, ptr %left, align 8, !tbaa !22 %1 = load i64, ptr %right, align 8, !tbaa !22 %cmp.i.i = icmp slt i64 %0, %1 %cmp1.i.i = icmp sgt i64 %0, %1 %..i.i = zext i1 %cmp1.i.i to i32 %retval.0.i.i = select i1 %cmp.i.i, i32 -1, i32 %..i.i %tobool.not = icmp eq i32 %retval.0.i.i, 0 br i1 %tobool.not, label %if.end, label %if.then if.then: ; preds = %entry %sub = sub nsw i32 0, %retval.0.i.i br label %cleanup if.end: ; preds = %entry %b.i = getelementptr inbounds %struct.hwll, ptr %left, i64 0, i32 1 %2 = load i64, ptr %b.i, align 8, !tbaa !24 %b1.i = getelementptr inbounds %struct.hwll, ptr %right, i64 0, i32 1 %3 = load i64, ptr %b1.i, align 8, !tbaa !24 %cmp.i.i5 = icmp slt i64 %2, %3 %cmp1.i.i6 = icmp sgt i64 %2, %3 %..i.i7 = zext i1 %cmp1.i.i6 to i32 %retval.0.i.i8 = select i1 %cmp.i.i5, i32 -1, i32 %..i.i7 br label %cleanup cleanup: ; preds = %if.end, %if.then %retval.0 = phi i32 [ %sub, %if.then ], [ %retval.0.i.i8, %if.end ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @phwllBAcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %b.i = getelementptr inbounds %struct.hwll, ptr %left, i64 0, i32 1 %0 = load i64, ptr %b.i, align 8, !tbaa !24 %b1.i = getelementptr inbounds %struct.hwll, ptr %right, i64 0, i32 1 %1 = load i64, ptr %b1.i, align 8, !tbaa !24 %cmp.i.i = icmp slt i64 %0, %1 %cmp1.i.i = icmp sgt i64 %0, %1 %..i.i = zext i1 %cmp1.i.i to i32 %retval.0.i.i = select i1 %cmp.i.i, i32 -1, i32 %..i.i %tobool.not = icmp eq i32 %retval.0.i.i, 0 br i1 %tobool.not, label %if.end, label %cleanup if.end: ; preds = %entry %2 = load i64, ptr %left, align 8, !tbaa !22 %3 = load i64, ptr %right, align 8, !tbaa !22 %cmp.i.i5 = icmp slt i64 %2, %3 %cmp1.i.i6 = icmp sgt i64 %2, %3 %..i.i7 = zext i1 %cmp1.i.i6 to i32 %retval.0.i.i8 = select i1 %cmp.i.i5, i32 -1, i32 %..i.i7 br label %cleanup cleanup: ; preds = %entry, %if.end %retval.0 = phi i32 [ %retval.0.i.i8, %if.end ], [ %retval.0.i.i, %entry ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @pstrAcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 { entry: %t = getelementptr inbounds %struct.struct_a, ptr %left, i64 0, i32 1 %0 = load i64, ptr %t, align 8, !tbaa !27 %t1 = getelementptr inbounds %struct.struct_a, ptr %right, i64 0, i32 1 %1 = load i64, ptr %t1, align 8, !tbaa !27 %cmp.i = icmp ult i64 %0, %1 %cmp1.i = icmp ugt i64 %0, %1 %..i = zext i1 %cmp1.i to i32 %retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i %tobool.not = icmp eq i32 %retval.0.i, 0 br i1 %tobool.not, label %if.end, label %cleanup if.end: ; preds = %entry %2 = load i64, ptr %left, align 8, !tbaa !29 %3 = load i64, ptr %right, align 8, !tbaa !29 %cmp.i18 = icmp ult i64 %2, %3 %cmp1.i19 = icmp ugt i64 %2, %3 %..i20 = zext i1 %cmp1.i19 to i32 %retval.0.i21 = select i1 %cmp.i18, i32 -1, i32 %..i20 %tobool4.not = icmp eq i32 %retval.0.i21, 0 br i1 %tobool4.not, label %if.end6, label %cleanup if.end6: ; preds = %if.end %c = getelementptr inbounds %struct.struct_a, ptr %left, i64 0, i32 2 %4 = load i32, ptr %c, align 8, !tbaa !30 %c7 = getelementptr inbounds %struct.struct_a, ptr %right, i64 0, i32 2 %5 = load i32, ptr %c7, align 8, !tbaa !30 %cmp.i22 = icmp slt i32 %4, %5 %cmp1.i23 = icmp sgt i32 %4, %5 %..i24 = zext i1 %cmp1.i23 to i32 %retval.0.i25 = select i1 %cmp.i22, i32 -1, i32 %..i24 br label %cleanup cleanup: ; preds = %if.end6, %if.end, %entry %retval.0 = phi i32 [ %retval.0.i, %entry ], [ %retval.0.i21, %if.end ], [ %retval.0.i25, %if.end6 ] ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i32 @bitlet(i8 noundef signext %c) local_unnamed_addr #3 { entry: %conv = sext i8 %c to i32 %sub = add nsw i32 %conv, -97 %shl = shl nuw nsw i32 1, %sub ret i32 %shl } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable define dso_local i64 @ullabs(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 { entry: %cmp.not = icmp ult i64 %a, %b %sub = sub i64 %a, %b %sub1 = sub i64 %b, %a %retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub ret i64 %retval.0 } ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable define dso_local i64 @sllabs(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %sub = sub nsw i64 %a, %b %retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true) ret i64 %retval.0 } ; Function Attrs: nounwind uwtable define dso_local i64 @nibutanlobo(ptr nocapture noundef readonly %func, i64 noundef %ok, i64 noundef %ng) local_unnamed_addr #5 { entry: %sub.i14 = sub nsw i64 %ok, %ng %retval.0.i15 = tail call i64 @llvm.abs.i64(i64 %sub.i14, i1 true) %cmp16 = icmp ugt i64 %retval.0.i15, 1 br i1 %cmp16, label %while.body, label %while.end while.body: ; preds = %entry, %while.body %ng.addr.018 = phi i64 [ %ng.addr.0.div, %while.body ], [ %ng, %entry ] %ok.addr.017 = phi i64 [ %div.ok.addr.0, %while.body ], [ %ok, %entry ] %add = add nsw i64 %ng.addr.018, %ok.addr.017 %div = sdiv i64 %add, 2 %call1 = tail call zeroext i1 %func(i64 noundef %div) #12 %div.ok.addr.0 = select i1 %call1, i64 %div, i64 %ok.addr.017 %ng.addr.0.div = select i1 %call1, i64 %ng.addr.018, i64 %div %sub.i = sub nsw i64 %div.ok.addr.0, %ng.addr.0.div %retval.0.i = tail call i64 @llvm.abs.i64(i64 %sub.i, i1 true) %cmp = icmp ugt i64 %retval.0.i, 1 br i1 %cmp, label %while.body, label %while.end, !llvm.loop !31 while.end: ; preds = %while.body, %entry %ok.addr.0.lcssa = phi i64 [ %ok, %entry ], [ %div.ok.addr.0, %while.body ] %ng.addr.0.lcssa = phi i64 [ %ng, %entry ], [ %ng.addr.0.div, %while.body ] %call2 = tail call zeroext i1 %func(i64 noundef %ok.addr.0.lcssa) #12 %mul = shl nsw i64 %ok.addr.0.lcssa, 1 %sub = sub nsw i64 %mul, %ng.addr.0.lcssa %retval.0 = select i1 %call2, i64 %ok.addr.0.lcssa, i64 %sub ret i64 %retval.0 } ; Function Attrs: nofree nounwind uwtable define dso_local zeroext i1 @nextrouteint(ptr noundef %arr, i32 noundef %n) local_unnamed_addr #6 { entry: %0 = zext i32 %n to i64 %smin = tail call i32 @llvm.smin.i32(i32 %n, i32 1) %1 = add i32 %smin, -1 br label %while.cond while.cond: ; preds = %land.rhs, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %land.rhs ], [ %0, %entry ] %2 = trunc i64 %indvars.iv to i32 %cmp = icmp sgt i32 %2, 1 br i1 %cmp, label %land.rhs, label %while.end land.rhs: ; preds = %while.cond %indvars.iv.next = add nsw i64 %indvars.iv, -1 %sub1 = add i64 %indvars.iv, 4294967294 %idxprom = and i64 %sub1, 4294967295 %arrayidx = getelementptr inbounds i32, ptr %arr, i64 %idxprom %3 = load i32, ptr %arrayidx, align 4, !tbaa !17 %idxprom2 = and i64 %indvars.iv.next, 4294967295 %arrayidx3 = getelementptr inbounds i32, ptr %arr, i64 %idxprom2 %4 = load i32, ptr %arrayidx3, align 4, !tbaa !17 %cmp4 = icmp sgt i32 %3, %4 br i1 %cmp4, label %while.cond, label %while.end.split.loop.exit90, !llvm.loop !32 while.end.split.loop.exit90: ; preds = %land.rhs %indvars.le = trunc i64 %indvars.iv.next to i32 br label %while.end while.end: ; preds = %while.cond, %while.end.split.loop.exit90 %i.0.in.lcssa = phi i32 [ %2, %while.end.split.loop.exit90 ], [ %smin, %while.cond ] %i.0.lcssa = phi i32 [ %indvars.le, %while.end.split.loop.exit90 ], [ %1, %while.cond ] %cmp5 = icmp ne i32 %i.0.lcssa, 0 br i1 %cmp5, label %for.cond.preheader, label %cleanup for.cond.preheader: ; preds = %while.end %cmp680.not = icmp sgt i32 %i.0.in.lcssa, %n %.pre = add nsw i32 %i.0.in.lcssa, -2 %.pre88 = sext i32 %.pre to i64 br i1 %cmp680.not, label %for.cond.preheader.for.end_crit_edge, label %for.body.lr.ph for.cond.preheader.for.end_crit_edge: ; preds = %for.cond.preheader %.pre89 = sext i32 %i.0.lcssa to i64 br label %for.end for.body.lr.ph: ; preds = %for.cond.preheader %arrayidx11 = getelementptr inbounds i32, ptr %arr, i64 %.pre88 %5 = load i32, ptr %arrayidx11, align 4, !tbaa !17 %6 = sext i32 %i.0.lcssa to i64 %7 = sext i32 %n to i64 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.inc %indvars.iv84 = phi i64 [ %6, %for.body.lr.ph ], [ %indvars.iv.next85, %for.inc ] %x.082 = phi i32 [ %n, %for.body.lr.ph ], [ %x.1, %for.inc ] %arrayidx8 = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv84 %8 = load i32, ptr %arrayidx8, align 4, !tbaa !17 %cmp12 = icmp slt i32 %8, %5 br i1 %cmp12, label %for.inc, label %if.end14 if.end14: ; preds = %for.body %cmp15 = icmp eq i32 %x.082, %n br i1 %cmp15, label %if.then21, label %lor.lhs.false lor.lhs.false: ; preds = %if.end14 %idxprom16 = sext i32 %x.082 to i64 %arrayidx17 = getelementptr inbounds i32, ptr %arr, i64 %idxprom16 %9 = load i32, ptr %arrayidx17, align 4, !tbaa !17 %cmp20 = icmp sgt i32 %9, %8 br i1 %cmp20, label %if.then21, label %for.inc if.then21: ; preds = %lor.lhs.false, %if.end14 %10 = trunc i64 %indvars.iv84 to i32 br label %for.inc for.inc: ; preds = %lor.lhs.false, %if.then21, %for.body %x.1 = phi i32 [ %x.082, %for.body ], [ %10, %if.then21 ], [ %x.082, %lor.lhs.false ] %indvars.iv.next85 = add nsw i64 %indvars.iv84, 1 %cmp6 = icmp slt i64 %indvars.iv.next85, %7 br i1 %cmp6, label %for.body, label %for.end, !llvm.loop !33 for.end: ; preds = %for.inc, %for.cond.preheader.for.end_crit_edge %idxprom40.pre-phi = phi i64 [ %.pre89, %for.cond.preheader.for.end_crit_edge ], [ %6, %for.inc ] %x.0.lcssa = phi i32 [ %n, %for.cond.preheader.for.end_crit_edge ], [ %x.1, %for.inc ] %idxprom23 = sext i32 %x.0.lcssa to i64 %arrayidx24 = getelementptr inbounds i32, ptr %arr, i64 %idxprom23 %11 = load i32, ptr %arrayidx24, align 4, !tbaa !17 %arrayidx27 = getelementptr inbounds i32, ptr %arr, i64 %.pre88 %12 = load i32, ptr %arrayidx27, align 4, !tbaa !17 %xor = xor i32 %12, %11 store i32 %xor, ptr %arrayidx27, align 4, !tbaa !17 %13 = load i32, ptr %arrayidx24, align 4, !tbaa !17 %xor33 = xor i32 %13, %xor store i32 %xor33, ptr %arrayidx24, align 4, !tbaa !17 %14 = load i32, ptr %arrayidx27, align 4, !tbaa !17 %xor39 = xor i32 %14, %xor33 store i32 %xor39, ptr %arrayidx27, align 4, !tbaa !17 %arrayidx41 = getelementptr inbounds i32, ptr %arr, i64 %idxprom40.pre-phi %sub42 = sub nsw i32 %n, %i.0.lcssa %conv = sext i32 %sub42 to i64 tail call void @qsort(ptr noundef nonnull %arrayidx41, i64 noundef %conv, i64 noundef 4, ptr noundef nonnull @pintcomp) #12 br label %cleanup cleanup: ; preds = %while.end, %for.end ret i1 %cmp5 } ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #7 ; Function Attrs: nofree nounwind uwtable define dso_local zeroext i1 @nextrouteull(ptr noundef %arr, i32 noundef %n) local_unnamed_addr #6 { entry: %0 = zext i32 %n to i64 %smin = tail call i32 @llvm.smin.i32(i32 %n, i32 1) %1 = add i32 %smin, -1 br label %while.cond while.cond: ; preds = %land.rhs, %entry %indvars.iv = phi i64 [ %indvars.iv.next, %land.rhs ], [ %0, %entry ] %2 = trunc i64 %indvars.iv to i32 %cmp = icmp sgt i32 %2, 1 br i1 %cmp, label %land.rhs, label %while.end land.rhs: ; preds = %while.cond %indvars.iv.next = add nsw i64 %indvars.iv, -1 %sub1 = add i64 %indvars.iv, 4294967294 %idxprom = and i64 %sub1, 4294967295 %arrayidx = getelementptr inbounds i64, ptr %arr, i64 %idxprom %3 = load i64, ptr %arrayidx, align 8, !tbaa !5 %idxprom2 = and i64 %indvars.iv.next, 4294967295 %arrayidx3 = getelementptr inbounds i64, ptr %arr, i64 %idxprom2 %4 = load i64, ptr %arrayidx3, align 8, !tbaa !5 %cmp4 = icmp ugt i64 %3, %4 br i1 %cmp4, label %while.cond, label %while.end.split.loop.exit90, !llvm.loop !34 while.end.split.loop.exit90: ; preds = %land.rhs %indvars.le = trunc i64 %indvars.iv.next to i32 br label %while.end while.end: ; preds = %while.cond, %while.end.split.loop.exit90 %i.0.in.lcssa = phi i32 [ %2, %while.end.split.loop.exit90 ], [ %smin, %while.cond ] %i.0.lcssa = phi i32 [ %indvars.le, %while.end.split.loop.exit90 ], [ %1, %while.cond ] %cmp5 = icmp ne i32 %i.0.lcssa, 0 br i1 %cmp5, label %for.cond.preheader, label %cleanup for.cond.preheader: ; preds = %while.end %cmp680.not = icmp sgt i32 %i.0.in.lcssa, %n %.pre = add nsw i32 %i.0.in.lcssa, -2 %.pre88 = sext i32 %.pre to i64 br i1 %cmp680.not, label %for.cond.preheader.for.end_crit_edge, label %for.body.lr.ph for.cond.preheader.for.end_crit_edge: ; preds = %for.cond.preheader %.pre89 = sext i32 %i.0.lcssa to i64 br label %for.end for.body.lr.ph: ; preds = %for.cond.preheader %arrayidx11 = getelementptr inbounds i64, ptr %arr, i64 %.pre88 %5 = load i64, ptr %arrayidx11, align 8, !tbaa !5 %6 = sext i32 %i.0.lcssa to i64 %7 = sext i32 %n to i64 br label %for.body for.body: ; preds = %for.body.lr.ph, %for.inc %indvars.iv84 = phi i64 [ %6, %for.body.lr.ph ], [ %indvars.iv.next85, %for.inc ] %x.082 = phi i32 [ %n, %for.body.lr.ph ], [ %x.1, %for.inc ] %arrayidx8 = getelementptr inbounds i64, ptr %arr, i64 %indvars.iv84 %8 = load i64, ptr %arrayidx8, align 8, !tbaa !5 %cmp12 = icmp ult i64 %8, %5 br i1 %cmp12, label %for.inc, label %if.end14 if.end14: ; preds = %for.body %cmp15 = icmp eq i32 %x.082, %n br i1 %cmp15, label %if.then21, label %lor.lhs.false lor.lhs.false: ; preds = %if.end14 %idxprom16 = sext i32 %x.082 to i64 %arrayidx17 = getelementptr inbounds i64, ptr %arr, i64 %idxprom16 %9 = load i64, ptr %arrayidx17, align 8, !tbaa !5 %cmp20 = icmp ugt i64 %9, %8 br i1 %cmp20, label %if.then21, label %for.inc if.then21: ; preds = %lor.lhs.false, %if.end14 %10 = trunc i64 %indvars.iv84 to i32 br label %for.inc for.inc: ; preds = %lor.lhs.false, %if.then21, %for.body %x.1 = phi i32 [ %x.082, %for.body ], [ %10, %if.then21 ], [ %x.082, %lor.lhs.false ] %indvars.iv.next85 = add nsw i64 %indvars.iv84, 1 %cmp6 = icmp slt i64 %indvars.iv.next85, %7 br i1 %cmp6, label %for.body, label %for.end, !llvm.loop !35 for.end: ; preds = %for.inc, %for.cond.preheader.for.end_crit_edge %idxprom40.pre-phi = phi i64 [ %.pre89, %for.cond.preheader.for.end_crit_edge ], [ %6, %for.inc ] %x.0.lcssa = phi i32 [ %n, %for.cond.preheader.for.end_crit_edge ], [ %x.1, %for.inc ] %idxprom23 = sext i32 %x.0.lcssa to i64 %arrayidx24 = getelementptr inbounds i64, ptr %arr, i64 %idxprom23 %11 = load i64, ptr %arrayidx24, align 8, !tbaa !5 %arrayidx27 = getelementptr inbounds i64, ptr %arr, i64 %.pre88 %12 = load i64, ptr %arrayidx27, align 8, !tbaa !5 %xor = xor i64 %12, %11 store i64 %xor, ptr %arrayidx27, align 8, !tbaa !5 %13 = load i64, ptr %arrayidx24, align 8, !tbaa !5 %xor33 = xor i64 %13, %xor store i64 %xor33, ptr %arrayidx24, align 8, !tbaa !5 %14 = load i64, ptr %arrayidx27, align 8, !tbaa !5 %xor39 = xor i64 %14, %xor33 store i64 %xor39, ptr %arrayidx27, align 8, !tbaa !5 %arrayidx41 = getelementptr inbounds i64, ptr %arr, i64 %idxprom40.pre-phi %sub42 = sub nsw i32 %n, %i.0.lcssa %conv = sext i32 %sub42 to i64 tail call void @qsort(ptr noundef nonnull %arrayidx41, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @pintcomp) #12 br label %cleanup cleanup: ; preds = %while.end, %for.end ret i1 %cmp5 } ; Function Attrs: nofree nounwind uwtable define dso_local void @printUquotient(i64 noundef %left, i64 noundef %right) local_unnamed_addr #6 { entry: %div = udiv i64 %left, %right %call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %div) %left.addr.0 = urem i64 %left, %right %mul = mul i64 %left.addr.0, 10 %div1 = udiv i64 %mul, %right %call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1) %left.addr.0.1 = urem i64 %mul, %right %mul.1 = mul i64 %left.addr.0.1, 10 %div1.1 = udiv i64 %mul.1, %right %call2.1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.1) %left.addr.0.2 = urem i64 %mul.1, %right %mul.2 = mul i64 %left.addr.0.2, 10 %div1.2 = udiv i64 %mul.2, %right %call2.2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.2) %left.addr.0.3 = urem i64 %mul.2, %right %mul.3 = mul i64 %left.addr.0.3, 10 %div1.3 = udiv i64 %mul.3, %right %call2.3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.3) %left.addr.0.4 = urem i64 %mul.3, %right %mul.4 = mul i64 %left.addr.0.4, 10 %div1.4 = udiv i64 %mul.4, %right %call2.4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.4) %left.addr.0.5 = urem i64 %mul.4, %right %mul.5 = mul i64 %left.addr.0.5, 10 %div1.5 = udiv i64 %mul.5, %right %call2.5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.5) %left.addr.0.6 = urem i64 %mul.5, %right %mul.6 = mul i64 %left.addr.0.6, 10 %div1.6 = udiv i64 %mul.6, %right %call2.6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.6) %left.addr.0.7 = urem i64 %mul.6, %right %mul.7 = mul i64 %left.addr.0.7, 10 %div1.7 = udiv i64 %mul.7, %right %call2.7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.7) %left.addr.0.8 = urem i64 %mul.7, %right %mul.8 = mul i64 %left.addr.0.8, 10 %div1.8 = udiv i64 %mul.8, %right %call2.8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.8) %left.addr.0.9 = urem i64 %mul.8, %right %mul.9 = mul i64 %left.addr.0.9, 10 %div1.9 = udiv i64 %mul.9, %right %call2.9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.9) %left.addr.0.10 = urem i64 %mul.9, %right %mul.10 = mul i64 %left.addr.0.10, 10 %div1.10 = udiv i64 %mul.10, %right %call2.10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.10) %left.addr.0.11 = urem i64 %mul.10, %right %mul.11 = mul i64 %left.addr.0.11, 10 %div1.11 = udiv i64 %mul.11, %right %call2.11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.11) %left.addr.0.12 = urem i64 %mul.11, %right %mul.12 = mul i64 %left.addr.0.12, 10 %div1.12 = udiv i64 %mul.12, %right %call2.12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.12) %left.addr.0.13 = urem i64 %mul.12, %right %mul.13 = mul i64 %left.addr.0.13, 10 %div1.13 = udiv i64 %mul.13, %right %call2.13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.13) %left.addr.0.14 = urem i64 %mul.13, %right %mul.14 = mul i64 %left.addr.0.14, 10 %div1.14 = udiv i64 %mul.14, %right %call2.14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.14) %left.addr.0.15 = urem i64 %mul.14, %right %mul.15 = mul i64 %left.addr.0.15, 10 %div1.15 = udiv i64 %mul.15, %right %call2.15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.15) %left.addr.0.16 = urem i64 %mul.15, %right %mul.16 = mul i64 %left.addr.0.16, 10 %div1.16 = udiv i64 %mul.16, %right %call2.16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.16) %left.addr.0.17 = urem i64 %mul.16, %right %mul.17 = mul i64 %left.addr.0.17, 10 %div1.17 = udiv i64 %mul.17, %right %call2.17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.17) %left.addr.0.18 = urem i64 %mul.17, %right %mul.18 = mul i64 %left.addr.0.18, 10 %div1.18 = udiv i64 %mul.18, %right %call2.18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.18) %left.addr.0.19 = urem i64 %mul.18, %right %mul.19 = mul i64 %left.addr.0.19, 10 %div1.19 = udiv i64 %mul.19, %right %call2.19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %div1.19) %0 = load ptr, ptr @stdout, align 8, !tbaa !36 %call.i = tail call noundef i32 @putc(i32 noundef 10, ptr noundef %0) ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8 ; Function Attrs: nofree nounwind uwtable define dso_local void @printSquotient(i64 noundef %left, i64 noundef %right) local_unnamed_addr #6 { entry: %mul = mul nsw i64 %right, %left %cmp = icmp slt i64 %mul, 0 br i1 %cmp, label %if.then, label %if.end if.then: ; preds = %entry %0 = load ptr, ptr @stdout, align 8, !tbaa !36 %call.i = tail call noundef i32 @putc(i32 noundef 45, ptr noundef %0) br label %if.end if.end: ; preds = %if.then, %entry %retval.0.i = tail call i64 @llvm.abs.i64(i64 %left, i1 true) %retval.0.i5 = tail call i64 @llvm.abs.i64(i64 %right, i1 true) tail call void @printUquotient(i64 noundef %retval.0.i, i64 noundef %retval.0.i5) ret void } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 { entry: %tobool.not6 = icmp eq i64 %n, 0 br i1 %tobool.not6, label %while.end, label %while.body while.body: ; preds = %entry, %while.body %result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ] %n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ] %0 = trunc i64 %n.addr.07 to i32 %1 = and i32 %0, 1 %spec.select = add i32 %1, %result.08 %div5 = lshr i64 %n.addr.07, 1 %tobool.not = icmp ult i64 %n.addr.07, 2 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !38 while.end: ; preds = %while.body, %entry %result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ] ret i32 %result.0.lcssa } ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable define dso_local double @distance(i64 noundef %x1, i64 noundef %y1, i64 noundef %x2, i64 noundef %y2) local_unnamed_addr #9 { entry: %sub = sub nsw i64 %x1, %x2 %mul = mul nsw i64 %sub, %sub %conv = sitofp i64 %mul to double %sub2 = sub nsw i64 %y1, %y2 %mul4 = mul nsw i64 %sub2, %sub2 %conv5 = sitofp i64 %mul4 to double %add = fadd double %conv, %conv5 %call = tail call double @sqrt(double noundef %add) #12 ret double %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(write) declare double @sqrt(double noundef) local_unnamed_addr #10 ; Function Attrs: nofree nounwind uwtable define dso_local i64 @solve() local_unnamed_addr #6 { entry: %0 = load i64, ptr @n, align 8, !tbaa !5 %cmp93.not = icmp eq i64 %0, 0 br i1 %cmp93.not, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %xtraiter = and i64 %0, 1 %1 = icmp eq i64 %0, 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 = and i64 %0, -2 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %i.094 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %arrayidx = getelementptr inbounds [5000 x i64], ptr @a, i64 0, i64 %i.094 %2 = load i64, ptr %arrayidx, align 16, !tbaa !5 %arrayidx1 = getelementptr inbounds [5000 x i64], ptr @b, i64 0, i64 %i.094 %3 = load i64, ptr %arrayidx1, align 16, !tbaa !5 %add = add i64 %3, %2 %arrayidx2 = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %i.094 store i64 %add, ptr %arrayidx2, align 16, !tbaa !22 %b = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %i.094, i32 1 store i64 %i.094, ptr %b, align 8, !tbaa !24 %inc = or i64 %i.094, 1 %arrayidx.1 = getelementptr inbounds [5000 x i64], ptr @a, i64 0, i64 %inc %4 = load i64, ptr %arrayidx.1, align 8, !tbaa !5 %arrayidx1.1 = getelementptr inbounds [5000 x i64], ptr @b, i64 0, i64 %inc %5 = load i64, ptr %arrayidx1.1, align 8, !tbaa !5 %add.1 = add i64 %5, %4 %arrayidx2.1 = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %inc store i64 %add.1, ptr %arrayidx2.1, align 16, !tbaa !22 %b.1 = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %inc, i32 1 store i64 %inc, ptr %b.1, align 8, !tbaa !24 %inc.1 = add nuw nsw i64 %i.094, 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 !39 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %i.094.unr = phi i64 [ 0, %for.body.preheader ], [ %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 %arrayidx.epil = getelementptr inbounds [5000 x i64], ptr @a, i64 0, i64 %i.094.unr %6 = load i64, ptr %arrayidx.epil, align 8, !tbaa !5 %arrayidx1.epil = getelementptr inbounds [5000 x i64], ptr @b, i64 0, i64 %i.094.unr %7 = load i64, ptr %arrayidx1.epil, align 8, !tbaa !5 %add.epil = add i64 %7, %6 %arrayidx2.epil = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %i.094.unr store i64 %add.epil, ptr %arrayidx2.epil, align 16, !tbaa !22 %b.epil = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %i.094.unr, i32 1 store i64 %i.094.unr, ptr %b.epil, align 8, !tbaa !24 br label %for.end for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry tail call void @qsort(ptr noundef nonnull @arr, i64 noundef %0, i64 noundef 16, ptr noundef nonnull @phwllABcomp) #12 %8 = load i64, ptr @n, align 8, !tbaa !5 %9 = add i64 %8, 1 %min.iters.check = icmp ult i64 %9, 4 br i1 %min.iters.check, label %for.body6.preheader, label %vector.ph vector.ph: ; preds = %for.end %n.vec = and i64 %9, -4 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %10 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %index store <2 x i64> <i64 2000000007, i64 2000000007>, ptr %10, align 16, !tbaa !5 %11 = getelementptr inbounds i64, ptr %10, i64 2 store <2 x i64> <i64 2000000007, i64 2000000007>, ptr %11, align 16, !tbaa !5 %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 !40 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %9, %n.vec br i1 %cmp.n, label %for.end10, label %for.body6.preheader for.body6.preheader: ; preds = %for.end, %middle.block %i.195.ph = phi i64 [ 0, %for.end ], [ %n.vec, %middle.block ] br label %for.body6 for.body6: ; preds = %for.body6.preheader, %for.body6 %i.195 = phi i64 [ %inc9, %for.body6 ], [ %i.195.ph, %for.body6.preheader ] %arrayidx7 = getelementptr inbounds [5001 x i64], ptr @dp, i64 0, i64 %i.195 store i64 2000000007, ptr %arrayidx7, align 8, !tbaa !5 %inc9 = add nuw i64 %i.195, 1 %exitcond99.not = icmp eq i64 %i.195, %8 br i1 %exitcond99.not, label %for.end10, label %for.body6, !llvm.loop !43 for.end10: ; preds = %for.body6, %middle.block store i64 0, ptr @dp, align 16, !tbaa !5 %cmp12.not97 = icmp eq i64 %8, 0 br i1 %cmp12.not97, label %while.cond.preheader, label %for.body18.peel.next for.body18.peel.next: ; preds = %for.end10, %for.end43 %i.298 = phi i64 [ %inc45, %for.end43 ], [ 1, %for.end10 ] %sub = add nsw i64 %i.298, -1 %b15 = getelementptr inbounds [5000 x %struct.hwll], ptr @arr, i64 0, i64 %sub, i32 1 %13 = load i64, ptr %b15, align 8, !tbaa !24 %arrayidx29 = getelementptr inbounds [5000 x i64], ptr @a, i64 0, i64 %13 %arrayidx37 = getelementptr inbounds [5000 x i64], ptr @b, i64 0, i64 %13 %arrayidx23.peel = getelementptr inbounds [5001 x [5001 x i64]], ptr @dp, i64 0, i64 %i.298, i64 0 store i64 0, ptr %arrayidx23.peel, align 8, !tbaa !5 %14 = load i64, ptr %arrayidx29, align 8, !tbaa !5 br label %land.lhs.true land.lhs.true: ; preds = %for.inc41, %for.body18.peel.next %j.096 = phi i64 [ 1, %for.body18.peel.next ], [ %inc42, %for.inc41 ] %arrayidx21 = getelementptr inbounds [5001 x [5001 x i64]], ptr @dp, i64 0, i64 %sub, i64 %j.096 %15 = load i64, ptr %arrayidx21, align 8, !tbaa !5 %arrayidx23 = getelementptr inbounds [5001 x [5001 x i64]], ptr @dp, i64 0, i64 %i.298, i64 %j.096 store i64 %15, ptr %arrayidx23, align 8, !tbaa !5 %sub27 = add nsw i64 %j.096, -1 %arrayidx28 = getelementptr inbounds [5001 x [5001 x i64]], ptr @dp, i64 0, i64 %sub, i64 %sub27 %16 = load i64, ptr %arrayidx28, align 8, !tbaa !5 %cmp30.not = icmp ugt i64 %16, %14 br i1 %cmp30.not, label %for.inc41, label %if.then if.then: ; preds = %land.lhs.true %17 = load i64, ptr %arrayidx37, align 8, !tbaa !5 %add38 = add i64 %17, %16 %cond.i = tail call i64 @llvm.umin.i64(i64 %15, i64 %add38) store i64 %cond.i, ptr %arrayidx23, align 8, !tbaa !5 br label %for.inc41 for.inc41: ; preds = %land.lhs.true, %if.then %inc42 = add nuw i64 %j.096, 1 %exitcond100.not = icmp eq i64 %j.096, %8 br i1 %exitcond100.not, label %for.end43, label %land.lhs.true, !llvm.loop !44 for.end43: ; preds = %for.inc41 %inc45 = add nuw i64 %i.298, 1 %exitcond102.not = icmp eq i64 %i.298, %8 br i1 %exitcond102.not, label %while.cond.preheader, label %for.body18.peel.next, !llvm.loop !46 while.cond.preheader: ; preds = %for.end43, %for.end10 br label %while.cond while.cond: ; preds = %while.cond.preheader, %while.cond %result.0 = phi i64 [ %dec, %while.cond ], [ %8, %while.cond.preheader ] %arrayidx48 = getelementptr inbounds [5001 x [5001 x i64]], ptr @dp, i64 0, i64 %8, i64 %result.0 %18 = load i64, ptr %arrayidx48, align 8, !tbaa !5 %cmp49 = icmp eq i64 %18, 2000000007 %dec = add i64 %result.0, -1 br i1 %cmp49, label %while.cond, label %while.end, !llvm.loop !47 while.end: ; preds = %while.cond %call50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %result.0) ret i64 0 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #6 { entry: %call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @n, ptr noundef nonnull @m) %0 = load i64, ptr @n, align 8, !tbaa !5 %cmp10.not = icmp eq i64 %0, 0 br i1 %cmp10.not, label %for.end, label %for.body for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [5000 x i64], ptr @a, i64 0, i64 %indvars.iv %call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %arrayidx) %arrayidx4 = getelementptr inbounds [5000 x i64], ptr @b, i64 0, i64 %indvars.iv %call5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %arrayidx4) %indvars.iv.next = add nuw i64 %indvars.iv, 1 %1 = load i64, ptr @n, align 8, !tbaa !5 %cmp = icmp ugt i64 %1, %indvars.iv.next br i1 %cmp, label %for.body, label %for.end, !llvm.loop !48 for.end: ; preds = %for.body, %entry %call6 = tail call i64 @solve() ret i32 0 } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8 ; Function Attrs: nofree nounwind declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #8 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umin.i64(i64, i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.umax.i64(i64, i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #11 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #11 attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #5 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #9 = { mustprogress nofree nounwind willreturn memory(write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #10 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 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 = !{!6, !6, i64 0} !6 = !{!"long", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10} !12 = distinct !{!12, !10} !13 = distinct !{!13, !14} !14 = !{!"llvm.loop.unroll.disable"} !15 = distinct !{!15, !10} !16 = !{!7, !7, i64 0} !17 = !{!18, !18, i64 0} !18 = !{!"int", !7, i64 0} !19 = !{!20, !18, i64 0} !20 = !{!"", !18, i64 0, !18, i64 4} !21 = !{!20, !18, i64 4} !22 = !{!23, !6, i64 0} !23 = !{!"", !6, i64 0, !6, i64 8} !24 = !{!23, !6, i64 8} !25 = !{i64 0, i64 8, !5, i64 8, i64 8, !5} !26 = !{i64 0, i64 8, !5} !27 = !{!28, !6, i64 8} !28 = !{!"", !6, i64 0, !6, i64 8, !18, i64 16} !29 = !{!28, !6, i64 0} !30 = !{!28, !18, i64 16} !31 = distinct !{!31, !10} !32 = distinct !{!32, !10} !33 = distinct !{!33, !10} !34 = distinct !{!34, !10} !35 = distinct !{!35, !10} !36 = !{!37, !37, i64 0} !37 = !{!"any pointer", !7, i64 0} !38 = distinct !{!38, !10} !39 = distinct !{!39, !10} !40 = distinct !{!40, !10, !41, !42} !41 = !{!"llvm.loop.isvectorized", i32 1} !42 = !{!"llvm.loop.unroll.runtime.disable"} !43 = distinct !{!43, !10, !42, !41} !44 = distinct !{!44, !10, !45} !45 = !{!"llvm.loop.peeled.count", i32 1} !46 = distinct !{!46, !10} !47 = distinct !{!47, !10} !48 = distinct !{!48, !10}
#include<stdio.h> int main(void) { int i,a,b; char s[12]; scanf("%d%d%s",&a,&b,s); if(s[a]!='-'){ printf("No"); return 0; } for(i=0;i<a;i++){ if(s[i]<'0' || s[i] >'9'){ printf("No"); return 0; } } for(i=a+1;i<a+b+1;i++){ if(s[i]<'0' || s[i] >'9'){ printf("No"); return 0; } } printf("Yes"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103092/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103092/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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%s\00", align 1 @.str.1 = private unnamed_addr constant [3 x i8] c"No\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca 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) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %s) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %s) %0 = load i32, ptr %a, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !9 %cmp.not = icmp eq i8 %1, 45 br i1 %cmp.not, label %for.cond.preheader, label %cleanup for.cond.preheader: ; preds = %entry %cmp353 = icmp sgt i32 %0, 0 br i1 %cmp353, label %for.body.preheader, label %for.cond18.preheader for.body.preheader: ; preds = %for.cond.preheader %wide.trip.count = zext i32 %0 to i64 br label %for.body for.cond: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond18.preheader, label %for.body, !llvm.loop !10 for.cond18.preheader: ; preds = %for.cond, %for.cond.preheader %2 = load i32, ptr %b, align 4, !tbaa !5 %add19 = add nsw i32 %2, %0 %smax = call i32 @llvm.smax.i32(i32 %0, i32 %add19) %wide.trip.count59 = sext i32 %smax to i64 br label %for.cond18 for.body: ; preds = %for.body.preheader, %for.cond %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] %arrayidx6 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv %3 = load i8, ptr %arrayidx6, align 1, !tbaa !9 %4 = add i8 %3, -58 %or.cond = icmp ult i8 %4, -10 br i1 %or.cond, label %cleanup, label %for.cond for.cond18: ; preds = %for.cond18.preheader, %for.body23 %indvars.iv56 = phi i64 [ %idxprom, %for.cond18.preheader ], [ %indvars.iv.next57, %for.body23 ] %exitcond60.not = icmp eq i64 %indvars.iv56, %wide.trip.count59 br i1 %exitcond60.not, label %cleanup, label %for.body23 for.body23: ; preds = %for.cond18 %indvars.iv.next57 = add nsw i64 %indvars.iv56, 1 %arrayidx25 = getelementptr inbounds [12 x i8], ptr %s, i64 0, i64 %indvars.iv.next57 %5 = load i8, ptr %arrayidx25, align 1, !tbaa !9 %6 = add i8 %5, -58 %or.cond52 = icmp ult i8 %6, -10 br i1 %or.cond52, label %cleanup, label %for.cond18, !llvm.loop !12 cleanup: ; preds = %for.body, %for.cond18, %for.body23, %entry %.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.body23 ], [ @.str.2, %for.cond18 ], [ @.str.1, %for.body ] %call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %s) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11}
#include <stdio.h> int main (){ int i=0,k=0,a,b; char s[20]; scanf ("%d%d%s",&a,&b,s); for (i=0;s[i]!=0;i++){ if (i!=a && s[i]<'9'+1 && s[i]>'0'-1){ ; } else if (i==a && s[i]=='-'){ ; } else { k++; break; } } if (k==0){ printf ("Yes"); } else { printf ("No"); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103135/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103135/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %s = alloca [20 x i8], align 16 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 20, ptr nonnull %s) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %s) %0 = load i8, ptr %s, align 16, !tbaa !5 %cmp.not43 = icmp eq i8 %0, 0 br i1 %cmp.not43, label %if.end33, label %for.body.lr.ph for.body.lr.ph: ; preds = %entry %1 = load i32, ptr %a, align 4, !tbaa !8 %2 = zext i32 %1 to i64 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 ] %3 = phi i8 [ %0, %for.body.lr.ph ], [ %6, %for.inc ] %cmp2.not = icmp ne i64 %indvars.iv, %2 %4 = add i8 %3, -48 %5 = icmp ult i8 %4, 10 %or.cond41 = and i1 %5, %cmp2.not br i1 %or.cond41, label %for.inc, label %if.else if.else: ; preds = %for.body %cmp15 = icmp eq i64 %indvars.iv, %2 %cmp21 = icmp eq i8 %3, 45 %or.cond42 = and i1 %cmp21, %cmp15 br i1 %or.cond42, label %for.inc, label %if.end33 for.inc: ; preds = %if.else, %for.body %indvars.iv.next = add nuw i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv.next %6 = load i8, ptr %arrayidx, align 1, !tbaa !5 %cmp.not = icmp eq i8 %6, 0 br i1 %cmp.not, label %if.end33, label %for.body, !llvm.loop !10 if.end33: ; preds = %if.else, %for.inc, %entry %.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.1, %for.inc ], [ @.str.2, %if.else ] %call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 20, 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> int main() { int a, b; char s[16] = {}; scanf("%d %d %s", &a, &b, s); if (s[a] == '-') { int c = 0; for (int i=0; i<a; i++) if (s[i] >= '0' && s[i] <= '9') c++; for (int i=a+1; i<=a+b; i++) if (s[i] >= '0' && s[i] <= '9') c++; if (c == a+b) { puts("Yes"); return 0; } } puts("No"); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103179/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103179/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [9 x i8] c"%d %d %s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %s = alloca [16 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %s) #5 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %s, i8 0, i64 16, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %s) %0 = load i32, ptr %a, align 4, !tbaa !5 %idxprom = sext i32 %0 to i64 %arrayidx = getelementptr inbounds [16 x i8], ptr %s, i64 0, i64 %idxprom %1 = load i8, ptr %arrayidx, align 1, !tbaa !9 %cmp = icmp eq i8 %1, 45 br i1 %cmp, label %for.cond.preheader, label %if.end46 for.cond.preheader: ; preds = %entry %cmp262 = icmp sgt i32 %0, 0 br i1 %cmp262, label %for.body.preheader, label %for.cond17.preheader for.body.preheader: ; preds = %for.cond.preheader %wide.trip.count = zext i32 %0 to i64 %min.iters.check = icmp ult i32 %0, 8 br i1 %min.iters.check, label %for.body.preheader95, 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.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ] %vec.phi74 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ] %2 = getelementptr inbounds [16 x i8], ptr %s, i64 0, i64 %index %wide.load = load <4 x i8>, ptr %2, align 8, !tbaa !9 %3 = getelementptr inbounds i8, ptr %2, i64 4 %wide.load75 = load <4 x i8>, ptr %3, align 4, !tbaa !9 %4 = add <4 x i8> %wide.load, <i8 -48, i8 -48, i8 -48, i8 -48> %5 = add <4 x i8> %wide.load75, <i8 -48, i8 -48, i8 -48, i8 -48> %6 = icmp ult <4 x i8> %4, <i8 10, i8 10, i8 10, i8 10> %7 = icmp ult <4 x i8> %5, <i8 10, i8 10, i8 10, i8 10> %8 = zext <4 x i1> %6 to <4 x i32> %9 = zext <4 x i1> %7 to <4 x i32> %10 = add <4 x i32> %vec.phi, %8 %11 = add <4 x i32> %vec.phi74, %9 %index.next = add nuw i64 %index, 8 %12 = icmp eq i64 %index.next, %n.vec br i1 %12, label %middle.block, label %vector.body, !llvm.loop !10 middle.block: ; preds = %vector.body %bin.rdx = add <4 x i32> %11, %10 %13 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx) %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond17.preheader, label %for.body.preheader95 for.body.preheader95: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] %c.063.ph = phi i32 [ 0, %for.body.preheader ], [ %13, %middle.block ] br label %for.body for.cond17.preheader: ; preds = %for.body, %middle.block, %for.cond.preheader %c.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %13, %middle.block ], [ %c.1, %for.body ] %14 = load i32, ptr %b, align 4, !tbaa !5 %add18 = add nsw i32 %14, %0 %cmp19.not.not65 = icmp sgt i32 %14, 0 br i1 %cmp19.not.not65, label %for.body22.preheader, label %for.cond.cleanup21 for.body22.preheader: ; preds = %for.cond17.preheader %15 = sext i32 %add18 to i64 %16 = add nsw i64 %idxprom, 1 %smax = call i64 @llvm.smax.i64(i64 %16, i64 %15) %17 = sub i64 %smax, %idxprom %min.iters.check78 = icmp ult i64 %17, 8 br i1 %min.iters.check78, label %for.body22.preheader93, label %vector.ph79 vector.ph79: ; preds = %for.body22.preheader %n.vec81 = and i64 %17, -8 %ind.end = add i64 %n.vec81, %idxprom %18 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.0.lcssa, i64 0 br label %vector.body84 vector.body84: ; preds = %vector.body84, %vector.ph79 %index85 = phi i64 [ 0, %vector.ph79 ], [ %index.next90, %vector.body84 ] %vec.phi86 = phi <4 x i32> [ %18, %vector.ph79 ], [ %28, %vector.body84 ] %vec.phi87 = phi <4 x i32> [ zeroinitializer, %vector.ph79 ], [ %29, %vector.body84 ] %offset.idx = add i64 %index85, %idxprom %19 = add nsw i64 %offset.idx, 1 %20 = getelementptr inbounds [16 x i8], ptr %s, i64 0, i64 %19 %wide.load88 = load <4 x i8>, ptr %20, align 1, !tbaa !9 %21 = getelementptr inbounds i8, ptr %20, i64 4 %wide.load89 = load <4 x i8>, ptr %21, align 1, !tbaa !9 %22 = add <4 x i8> %wide.load88, <i8 -48, i8 -48, i8 -48, i8 -48> %23 = add <4 x i8> %wide.load89, <i8 -48, i8 -48, i8 -48, i8 -48> %24 = icmp ult <4 x i8> %22, <i8 10, i8 10, i8 10, i8 10> %25 = icmp ult <4 x i8> %23, <i8 10, i8 10, i8 10, i8 10> %26 = zext <4 x i1> %24 to <4 x i32> %27 = zext <4 x i1> %25 to <4 x i32> %28 = add <4 x i32> %vec.phi86, %26 %29 = add <4 x i32> %vec.phi87, %27 %index.next90 = add nuw i64 %index85, 8 %30 = icmp eq i64 %index.next90, %n.vec81 br i1 %30, label %middle.block76, label %vector.body84, !llvm.loop !14 middle.block76: ; preds = %vector.body84 %bin.rdx91 = add <4 x i32> %29, %28 %31 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx91) %cmp.n83 = icmp eq i64 %17, %n.vec81 br i1 %cmp.n83, label %for.cond.cleanup21, label %for.body22.preheader93 for.body22.preheader93: ; preds = %for.body22.preheader, %middle.block76 %indvars.iv71.ph = phi i64 [ %idxprom, %for.body22.preheader ], [ %ind.end, %middle.block76 ] %c.266.ph = phi i32 [ %c.0.lcssa, %for.body22.preheader ], [ %31, %middle.block76 ] br label %for.body22 for.body: ; preds = %for.body.preheader95, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader95 ] %c.063 = phi i32 [ %c.1, %for.body ], [ %c.063.ph, %for.body.preheader95 ] %arrayidx5 = getelementptr inbounds [16 x i8], ptr %s, i64 0, i64 %indvars.iv %32 = load i8, ptr %arrayidx5, align 1, !tbaa !9 %33 = add i8 %32, -48 %or.cond = icmp ult i8 %33, 10 %inc = zext i1 %or.cond to i32 %c.1 = add nuw nsw i32 %c.063, %inc %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.body, !llvm.loop !15 for.cond.cleanup21: ; preds = %for.body22, %middle.block76, %for.cond17.preheader %c.2.lcssa = phi i32 [ %c.0.lcssa, %for.cond17.preheader ], [ %31, %middle.block76 ], [ %c.3, %for.body22 ] %cmp41.not = icmp eq i32 %c.2.lcssa, %add18 br i1 %cmp41.not, label %cleanup48, label %if.end46 for.body22: ; preds = %for.body22.preheader93, %for.body22 %indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body22 ], [ %indvars.iv71.ph, %for.body22.preheader93 ] %c.266 = phi i32 [ %c.3, %for.body22 ], [ %c.266.ph, %for.body22.preheader93 ] %indvars.iv.next72 = add nsw i64 %indvars.iv71, 1 %arrayidx24 = getelementptr inbounds [16 x i8], ptr %s, i64 0, i64 %indvars.iv.next72 %34 = load i8, ptr %arrayidx24, align 1, !tbaa !9 %35 = add i8 %34, -48 %or.cond61 = icmp ult i8 %35, 10 %inc35 = zext i1 %or.cond61 to i32 %c.3 = add nsw i32 %c.266, %inc35 %cmp19.not.not = icmp slt i64 %indvars.iv.next72, %15 br i1 %cmp19.not.not, label %for.body22, label %for.cond.cleanup21, !llvm.loop !16 if.end46: ; preds = %for.cond.cleanup21, %entry br label %cleanup48 cleanup48: ; preds = %for.cond.cleanup21, %if.end46 %.str.1.sink = phi ptr [ @.str.2, %if.end46 ], [ @.str.1, %for.cond.cleanup21 ] %call44 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.1.sink) call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %s) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 @puts(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 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { 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 = !{!7, !7, i64 0} !10 = distinct !{!10, !11, !12, !13} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !11, !12, !13} !15 = distinct !{!15, !11, !13, !12} !16 = distinct !{!16, !11, !13, !12}
#include <stdio.h> #include <stdlib.h> int main() { int a,b; char s[20]; scanf("%d%d%s",&a,&b,s); int i,l,k,m; k=0;l=0;m=0; for(i=0;i<(a+b+1);i++) { k++; if(s[i]=='-') { l=l+10; m++; } if(l<10) { l++; } } l=l-10; if(l==a&&(k-l-1)==b&&m==1) printf("Yes"); else printf("No"); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103221/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103221/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1 @.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %s = alloca [20 x i8], align 16 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 20, ptr nonnull %s) #3 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %s) %0 = load i32, ptr %a, align 4, !tbaa !5 %1 = load i32, ptr %b, align 4, !tbaa !5 %add = add i32 %1, %0 %cmp.not35 = icmp slt i32 %add, 0 br i1 %cmp.not35, label %for.end, label %for.body.preheader for.body.preheader: ; preds = %entry %2 = add nuw i32 %add, 1 %wide.trip.count = zext i32 %2 to i64 %xtraiter = and i64 %wide.trip.count, 1 %3 = icmp eq i32 %add, 0 br i1 %3, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new for.body.preheader.new: ; preds = %for.body.preheader %unroll_iter = and i64 %wide.trip.count, 4294967294 br label %for.body for.body: ; preds = %for.body, %for.body.preheader.new %indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %for.body ] %m.039 = phi i32 [ 0, %for.body.preheader.new ], [ %m.1.1, %for.body ] %l.037 = phi i32 [ 0, %for.body.preheader.new ], [ %l.2.1, %for.body ] %niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %for.body ] %indvars.iv.next = or i64 %indvars.iv, 1 %arrayidx = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv %4 = load i8, ptr %arrayidx, align 2, !tbaa !9 %cmp2 = icmp eq i8 %4, 45 %add4 = add nsw i32 %l.037, 10 %l.1 = select i1 %cmp2, i32 %add4, i32 %l.037 %inc5 = zext i1 %cmp2 to i32 %m.1 = add nuw nsw i32 %m.039, %inc5 %cmp6 = icmp slt i32 %l.1, 10 %inc9 = zext i1 %cmp6 to i32 %l.2 = add nsw i32 %l.1, %inc9 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %arrayidx.1 = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv.next %5 = load i8, ptr %arrayidx.1, align 1, !tbaa !9 %cmp2.1 = icmp eq i8 %5, 45 %add4.1 = add nsw i32 %l.2, 10 %l.1.1 = select i1 %cmp2.1, i32 %add4.1, i32 %l.2 %inc5.1 = zext i1 %cmp2.1 to i32 %m.1.1 = add nuw nsw i32 %m.1, %inc5.1 %cmp6.1 = icmp slt i32 %l.1.1, 10 %inc9.1 = zext i1 %cmp6.1 to i32 %l.2.1 = add nsw i32 %l.1.1, %inc9.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 !10 for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader %m.1.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %m.1.1, %for.body ] %l.2.lcssa.ph = phi i32 [ undef, %for.body.preheader ], [ %l.2.1, %for.body ] %indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %for.body ] %m.039.unr = phi i32 [ 0, %for.body.preheader ], [ %m.1.1, %for.body ] %l.037.unr = phi i32 [ 0, %for.body.preheader ], [ %l.2.1, %for.body ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end.loopexit, label %for.body.epil for.body.epil: ; preds = %for.end.loopexit.unr-lcssa %arrayidx.epil = getelementptr inbounds [20 x i8], ptr %s, i64 0, i64 %indvars.iv.unr %6 = load i8, ptr %arrayidx.epil, align 1, !tbaa !9 %cmp2.epil = icmp eq i8 %6, 45 %add4.epil = add nsw i32 %l.037.unr, 10 %l.1.epil = select i1 %cmp2.epil, i32 %add4.epil, i32 %l.037.unr %inc5.epil = zext i1 %cmp2.epil to i32 %m.1.epil = add nuw nsw i32 %m.039.unr, %inc5.epil %cmp6.epil = icmp slt i32 %l.1.epil, 10 %inc9.epil = zext i1 %cmp6.epil to i32 %l.2.epil = add nsw i32 %l.1.epil, %inc9.epil br label %for.end.loopexit for.end.loopexit: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil %m.1.lcssa = phi i32 [ %m.1.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %m.1.epil, %for.body.epil ] %l.2.lcssa = phi i32 [ %l.2.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %l.2.epil, %for.body.epil ] %7 = icmp eq i32 %m.1.lcssa, 1 br label %for.end for.end: ; preds = %for.end.loopexit, %entry %l.0.lcssa = phi i32 [ 0, %entry ], [ %l.2.lcssa, %for.end.loopexit ] %k.0.lcssa = phi i32 [ 0, %entry ], [ %2, %for.end.loopexit ] %m.0.lcssa = phi i1 [ false, %entry ], [ %7, %for.end.loopexit ] %sub = add nsw i32 %l.0.lcssa, -10 %cmp12 = icmp eq i32 %sub, %0 br i1 %cmp12, label %land.lhs.true, label %if.else land.lhs.true: ; preds = %for.end %reass.sub44 = sub i32 %k.0.lcssa, %l.0.lcssa %sub15 = add i32 %reass.sub44, 9 %cmp16 = icmp eq i32 %sub15, %1 %or.cond = select i1 %cmp16, i1 %m.0.lcssa, i1 false br i1 %or.cond, label %if.end24, label %if.else if.else: ; preds = %land.lhs.true, %for.end br label %if.end24 if.end24: ; preds = %land.lhs.true, %if.else %.str.2.sink = phi ptr [ @.str.2, %if.else ], [ @.str.1, %land.lhs.true ] %call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink) call void @llvm.lifetime.end.p0(i64 20, 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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!7, !7, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"}
#include <stdio.h> #include <string.h> #define MAX 200 int main(void) { char First[MAX]; char Copy1[MAX]; char Copy2[MAX]; int m, h, length; char str; while(1) { scanf("%s", First); if(strcmp(First, "-") == 0) { break; } scanf("%d", &m); length = strlen(First); for(int i=0; i<m; ++i) { scanf("%d", &h); strncpy(Copy1, First, h); strncpy(Copy2, &First[h], length-h); strncpy(First, Copy2, length-h); strncpy(&First[length-h], Copy1, h); } printf("%s\n", First); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103265/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103265/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %First = alloca [200 x i8], align 16 %Copy1 = alloca [200 x i8], align 16 %Copy2 = 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 %First) #6 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %Copy1) #6 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %Copy2) #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 %call35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %First) %lhsv36 = load i16, ptr %First, align 16 %.not37 = icmp eq i16 %lhsv36, 45 br i1 %.not37, label %while.end, label %if.end if.end: ; preds = %entry, %for.cond.cleanup %call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m) %call5 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %First) #7 %conv = trunc i64 %call5 to i32 %0 = load i32, ptr %m, align 4, !tbaa !5 %cmp633 = icmp sgt i32 %0, 0 br i1 %cmp633, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %if.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) %First) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %First) %lhsv = load i16, ptr %First, align 16 %.not = icmp eq i16 %lhsv, 45 br i1 %.not, label %while.end, label %if.end for.body: ; preds = %if.end, %for.body %i.034 = phi i32 [ %inc, %for.body ], [ 0, %if.end ] %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h) %1 = load i32, ptr %h, align 4, !tbaa !5 %conv11 = sext i32 %1 to i64 %call12 = call ptr @strncpy(ptr noundef nonnull %Copy1, ptr noundef nonnull %First, i64 noundef %conv11) #6 %arrayidx = getelementptr inbounds [200 x i8], ptr %First, i64 0, i64 %conv11 %sub = sub nsw i32 %conv, %1 %conv14 = sext i32 %sub to i64 %call15 = call ptr @strncpy(ptr noundef nonnull %Copy2, ptr noundef nonnull %arrayidx, i64 noundef %conv14) #6 %call20 = call ptr @strncpy(ptr noundef nonnull %First, ptr noundef nonnull %Copy2, i64 noundef %conv14) #6 %arrayidx23 = getelementptr inbounds [200 x i8], ptr %First, i64 0, i64 %conv14 %call26 = call ptr @strncpy(ptr noundef nonnull %arrayidx23, ptr noundef nonnull %Copy1, i64 noundef %conv11) #6 %inc = add nuw nsw i32 %i.034, 1 %2 = load i32, ptr %m, align 4, !tbaa !5 %cmp6 = icmp slt i32 %inc, %2 br i1 %cmp6, label %for.body, label %for.cond.cleanup, !llvm.loop !9 while.end: ; preds = %for.cond.cleanup, %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 %Copy2) #6 call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %Copy1) #6 call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %First) #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 @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 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"}
#include<stdio.h> #include<string.h> void shuffle(char a[], int b); int main(){ int t,b,i; char ini[201]; while(1){ scanf("%s",ini); if(ini[0]=='-') return 0; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d",&b); shuffle(ini,b); } printf("%s\n",ini); } return 0; } void shuffle (char a[],int b){ int i,len; char temp[200]; len=strlen(a); for(i=0;i<b;i++) temp[i]=a[i]; for(i=0;i<len-b;i++) a[i]=a[i+b]; for(i=0;i<b;i++) a[len-b+i]=temp[i]; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103308/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103308/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %temp.i = alloca [200 x i8], align 16 %t = alloca i32, align 4 %b = alloca i32, align 4 %ini = alloca [201 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #7 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %ini) #7 %call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ini) %0 = load i8, ptr %ini, align 16, !tbaa !5 %cmp13 = icmp eq i8 %0, 45 br i1 %cmp13, label %if.then, label %if.end if.then: ; preds = %for.end, %entry call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %ini) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #7 ret i32 0 if.end: ; preds = %entry, %for.end %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t) %1 = load i32, ptr %t, align 4, !tbaa !8 %cmp310 = icmp sgt i32 %1, 0 br i1 %cmp310, label %for.body, label %for.end for.body: ; preds = %if.end, %shuffle.exit %i.011 = phi i32 [ %inc, %shuffle.exit ], [ 0, %if.end ] %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b) %2 = load i32, ptr %b, align 4, !tbaa !8 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %temp.i) #7 %call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ini) #8 %conv.i = trunc i64 %call.i to i32 %cmp48.i = icmp sgt i32 %2, 0 br i1 %cmp48.i, label %for.body.preheader.i, label %for.cond4.preheader.i for.body.preheader.i: ; preds = %for.body %3 = zext i32 %2 to i64 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %temp.i, ptr nonnull align 16 %ini, i64 %3, i1 false), !tbaa !5 br label %for.cond4.preheader.i for.cond4.preheader.i: ; preds = %for.body.preheader.i, %for.body %sub.i = sub nsw i32 %conv.i, %2 %cmp550.i = icmp sgt i32 %sub.i, 0 br i1 %cmp550.i, label %iter.check26, label %for.cond15.preheader.i iter.check26: ; preds = %for.cond4.preheader.i %4 = sext i32 %2 to i64 %wide.trip.count.i = zext i32 %sub.i to i64 %invariant.gep.i = getelementptr i8, ptr %ini, i64 %4 %min.iters.check24 = icmp ult i32 %sub.i, 8 %5 = add nsw i64 %4, 31 %diff.check = icmp ult i64 %5, 32 %or.cond = select i1 %min.iters.check24, i1 true, i1 %diff.check br i1 %or.cond, label %for.body7.i.preheader, label %vector.main.loop.iter.check28 vector.main.loop.iter.check28: ; preds = %iter.check26 %min.iters.check27 = icmp ult i32 %sub.i, 32 br i1 %min.iters.check27, label %vec.epilog.ph40, label %vector.ph29 vector.ph29: ; preds = %vector.main.loop.iter.check28 %n.vec31 = and i64 %wide.trip.count.i, 4294967264 br label %vector.body33 vector.body33: ; preds = %vector.body33, %vector.ph29 %index = phi i64 [ 0, %vector.ph29 ], [ %index.next36, %vector.body33 ] %6 = getelementptr i8, ptr %invariant.gep.i, i64 %index %wide.load34 = load <16 x i8>, ptr %6, align 1, !tbaa !5 %7 = getelementptr i8, ptr %6, i64 16 %wide.load35 = load <16 x i8>, ptr %7, align 1, !tbaa !5 %8 = getelementptr inbounds i8, ptr %ini, i64 %index store <16 x i8> %wide.load34, ptr %8, align 16, !tbaa !5 %9 = getelementptr inbounds i8, ptr %8, i64 16 store <16 x i8> %wide.load35, ptr %9, align 16, !tbaa !5 %index.next36 = add nuw i64 %index, 32 %10 = icmp eq i64 %index.next36, %n.vec31 br i1 %10, label %middle.block23, label %vector.body33, !llvm.loop !10 middle.block23: ; preds = %vector.body33 %cmp.n32 = icmp eq i64 %n.vec31, %wide.trip.count.i br i1 %cmp.n32, label %for.cond15.preheader.i, label %vec.epilog.iter.check39 vec.epilog.iter.check39: ; preds = %middle.block23 %n.vec.remaining41 = and i64 %wide.trip.count.i, 24 %min.epilog.iters.check42 = icmp eq i64 %n.vec.remaining41, 0 br i1 %min.epilog.iters.check42, label %for.body7.i.preheader, label %vec.epilog.ph40 vec.epilog.ph40: ; preds = %vector.main.loop.iter.check28, %vec.epilog.iter.check39 %vec.epilog.resume.val43 = phi i64 [ %n.vec31, %vec.epilog.iter.check39 ], [ 0, %vector.main.loop.iter.check28 ] %n.vec45 = and i64 %wide.trip.count.i, 4294967288 br label %vec.epilog.vector.body48 vec.epilog.vector.body48: ; preds = %vec.epilog.vector.body48, %vec.epilog.ph40 %index49 = phi i64 [ %vec.epilog.resume.val43, %vec.epilog.ph40 ], [ %index.next51, %vec.epilog.vector.body48 ] %11 = getelementptr i8, ptr %invariant.gep.i, i64 %index49 %wide.load50 = load <8 x i8>, ptr %11, align 1, !tbaa !5 %12 = getelementptr inbounds i8, ptr %ini, i64 %index49 store <8 x i8> %wide.load50, ptr %12, align 8, !tbaa !5 %index.next51 = add nuw i64 %index49, 8 %13 = icmp eq i64 %index.next51, %n.vec45 br i1 %13, label %vec.epilog.middle.block37, label %vec.epilog.vector.body48, !llvm.loop !14 vec.epilog.middle.block37: ; preds = %vec.epilog.vector.body48 %cmp.n47 = icmp eq i64 %n.vec45, %wide.trip.count.i br i1 %cmp.n47, label %for.cond15.preheader.i, label %for.body7.i.preheader for.body7.i.preheader: ; preds = %iter.check26, %vec.epilog.iter.check39, %vec.epilog.middle.block37 %indvars.iv.i.ph = phi i64 [ 0, %iter.check26 ], [ %n.vec31, %vec.epilog.iter.check39 ], [ %n.vec45, %vec.epilog.middle.block37 ] %14 = xor i64 %indvars.iv.i.ph, -1 %15 = add nsw i64 %14, %wide.trip.count.i %xtraiter = and i64 %wide.trip.count.i, 3 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body7.i.prol.loopexit, label %for.body7.i.prol for.body7.i.prol: ; preds = %for.body7.i.preheader, %for.body7.i.prol %indvars.iv.i.prol = phi i64 [ %indvars.iv.next.i.prol, %for.body7.i.prol ], [ %indvars.iv.i.ph, %for.body7.i.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body7.i.prol ], [ 0, %for.body7.i.preheader ] %gep.i.prol = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.i.prol %16 = load i8, ptr %gep.i.prol, align 1, !tbaa !5 %arrayidx11.i.prol = getelementptr inbounds i8, ptr %ini, i64 %indvars.iv.i.prol store i8 %16, ptr %arrayidx11.i.prol, align 1, !tbaa !5 %indvars.iv.next.i.prol = add nuw nsw i64 %indvars.iv.i.prol, 1 %prol.iter.next = add i64 %prol.iter, 1 %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter br i1 %prol.iter.cmp.not, label %for.body7.i.prol.loopexit, label %for.body7.i.prol, !llvm.loop !15 for.body7.i.prol.loopexit: ; preds = %for.body7.i.prol, %for.body7.i.preheader %indvars.iv.i.unr = phi i64 [ %indvars.iv.i.ph, %for.body7.i.preheader ], [ %indvars.iv.next.i.prol, %for.body7.i.prol ] %17 = icmp ult i64 %15, 3 br i1 %17, label %for.cond15.preheader.i, label %for.body7.i for.cond15.preheader.i: ; preds = %for.body7.i.prol.loopexit, %for.body7.i, %middle.block23, %vec.epilog.middle.block37, %for.cond4.preheader.i br i1 %cmp48.i, label %iter.check, label %shuffle.exit iter.check: ; preds = %for.cond15.preheader.i %wide.trip.count61.i = zext i32 %2 to i64 %min.iters.check = icmp ult i32 %2, 8 br i1 %min.iters.check, label %for.body18.i.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %iter.check %18 = add nsw i64 %wide.trip.count61.i, -1 %19 = trunc i64 %18 to i32 %20 = add i32 %sub.i, %19 %21 = icmp slt i32 %20, %sub.i %22 = icmp ugt i64 %18, 4294967295 %23 = or i1 %21, %22 br i1 %23, label %for.body18.i.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.scevcheck %min.iters.check14 = icmp ult i32 %2, 32 br i1 %min.iters.check14, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %wide.trip.count61.i, 4294967264 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %24 = trunc i64 %offset.idx to i32 %25 = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %offset.idx %wide.load = load <16 x i8>, ptr %25, align 16, !tbaa !5 %26 = getelementptr inbounds i8, ptr %25, i64 16 %wide.load15 = load <16 x i8>, ptr %26, align 16, !tbaa !5 %27 = add nsw i32 %sub.i, %24 %28 = sext i32 %27 to i64 %29 = getelementptr inbounds i8, ptr %ini, i64 %28 store <16 x i8> %wide.load, ptr %29, align 1, !tbaa !5 %30 = getelementptr inbounds i8, ptr %29, i64 16 store <16 x i8> %wide.load15, ptr %30, align 1, !tbaa !5 %index.next = add nuw i64 %offset.idx, 32 %31 = icmp eq i64 %index.next, %n.vec br i1 %31, label %middle.block, label %vector.body, !llvm.loop !17 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count61.i br i1 %cmp.n, label %shuffle.exit, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %n.vec.remaining = and i64 %wide.trip.count61.i, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body18.i.preheader, label %vec.epilog.ph vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ] %n.vec17 = and i64 %wide.trip.count61.i, 4294967288 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %offset.idx19 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next21, %vec.epilog.vector.body ] %32 = trunc i64 %offset.idx19 to i32 %33 = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %offset.idx19 %wide.load20 = load <8 x i8>, ptr %33, align 8, !tbaa !5 %34 = add nsw i32 %sub.i, %32 %35 = sext i32 %34 to i64 %36 = getelementptr inbounds i8, ptr %ini, i64 %35 store <8 x i8> %wide.load20, ptr %36, align 1, !tbaa !5 %index.next21 = add nuw i64 %offset.idx19, 8 %37 = icmp eq i64 %index.next21, %n.vec17 br i1 %37, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !18 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n18 = icmp eq i64 %n.vec17, %wide.trip.count61.i br i1 %cmp.n18, label %shuffle.exit, label %for.body18.i.preheader for.body18.i.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv57.i.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec17, %vec.epilog.middle.block ] %38 = xor i64 %indvars.iv57.i.ph, -1 %39 = add nsw i64 %38, %wide.trip.count61.i %xtraiter52 = and i64 %wide.trip.count61.i, 3 %lcmp.mod53.not = icmp eq i64 %xtraiter52, 0 br i1 %lcmp.mod53.not, label %for.body18.i.prol.loopexit, label %for.body18.i.prol for.body18.i.prol: ; preds = %for.body18.i.preheader, %for.body18.i.prol %indvars.iv57.i.prol = phi i64 [ %indvars.iv.next58.i.prol, %for.body18.i.prol ], [ %indvars.iv57.i.ph, %for.body18.i.preheader ] %prol.iter54 = phi i64 [ %prol.iter54.next, %for.body18.i.prol ], [ 0, %for.body18.i.preheader ] %indvars60.i.prol = trunc i64 %indvars.iv57.i.prol to i32 %arrayidx20.i.prol = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %indvars.iv57.i.prol %40 = load i8, ptr %arrayidx20.i.prol, align 1, !tbaa !5 %add22.i.prol = add nsw i32 %sub.i, %indvars60.i.prol %idxprom23.i.prol = sext i32 %add22.i.prol to i64 %arrayidx24.i.prol = getelementptr inbounds i8, ptr %ini, i64 %idxprom23.i.prol store i8 %40, ptr %arrayidx24.i.prol, align 1, !tbaa !5 %indvars.iv.next58.i.prol = add nuw nsw i64 %indvars.iv57.i.prol, 1 %prol.iter54.next = add i64 %prol.iter54, 1 %prol.iter54.cmp.not = icmp eq i64 %prol.iter54.next, %xtraiter52 br i1 %prol.iter54.cmp.not, label %for.body18.i.prol.loopexit, label %for.body18.i.prol, !llvm.loop !19 for.body18.i.prol.loopexit: ; preds = %for.body18.i.prol, %for.body18.i.preheader %indvars.iv57.i.unr = phi i64 [ %indvars.iv57.i.ph, %for.body18.i.preheader ], [ %indvars.iv.next58.i.prol, %for.body18.i.prol ] %41 = icmp ult i64 %39, 3 br i1 %41, label %shuffle.exit, label %for.body18.i for.body7.i: ; preds = %for.body7.i.prol.loopexit, %for.body7.i %indvars.iv.i = phi i64 [ %indvars.iv.next.i.3, %for.body7.i ], [ %indvars.iv.i.unr, %for.body7.i.prol.loopexit ] %gep.i = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.i %42 = load i8, ptr %gep.i, align 1, !tbaa !5 %arrayidx11.i = getelementptr inbounds i8, ptr %ini, i64 %indvars.iv.i store i8 %42, ptr %arrayidx11.i, align 1, !tbaa !5 %indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1 %gep.i.1 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i %43 = load i8, ptr %gep.i.1, align 1, !tbaa !5 %arrayidx11.i.1 = getelementptr inbounds i8, ptr %ini, i64 %indvars.iv.next.i store i8 %43, ptr %arrayidx11.i.1, align 1, !tbaa !5 %indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2 %gep.i.2 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i.1 %44 = load i8, ptr %gep.i.2, align 1, !tbaa !5 %arrayidx11.i.2 = getelementptr inbounds i8, ptr %ini, i64 %indvars.iv.next.i.1 store i8 %44, ptr %arrayidx11.i.2, align 1, !tbaa !5 %indvars.iv.next.i.2 = add nuw nsw i64 %indvars.iv.i, 3 %gep.i.3 = getelementptr i8, ptr %invariant.gep.i, i64 %indvars.iv.next.i.2 %45 = load i8, ptr %gep.i.3, align 1, !tbaa !5 %arrayidx11.i.3 = getelementptr inbounds i8, ptr %ini, i64 %indvars.iv.next.i.2 store i8 %45, ptr %arrayidx11.i.3, align 1, !tbaa !5 %indvars.iv.next.i.3 = add nuw nsw i64 %indvars.iv.i, 4 %exitcond.not.i.3 = icmp eq i64 %indvars.iv.next.i.3, %wide.trip.count.i br i1 %exitcond.not.i.3, label %for.cond15.preheader.i, label %for.body7.i, !llvm.loop !20 for.body18.i: ; preds = %for.body18.i.prol.loopexit, %for.body18.i %indvars.iv57.i = phi i64 [ %indvars.iv.next58.i.3, %for.body18.i ], [ %indvars.iv57.i.unr, %for.body18.i.prol.loopexit ] %indvars60.i = trunc i64 %indvars.iv57.i to i32 %arrayidx20.i = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %indvars.iv57.i %46 = load i8, ptr %arrayidx20.i, align 1, !tbaa !5 %add22.i = add nsw i32 %sub.i, %indvars60.i %idxprom23.i = sext i32 %add22.i to i64 %arrayidx24.i = getelementptr inbounds i8, ptr %ini, i64 %idxprom23.i store i8 %46, ptr %arrayidx24.i, align 1, !tbaa !5 %indvars.iv.next58.i = add nuw nsw i64 %indvars.iv57.i, 1 %indvars60.i.1 = trunc i64 %indvars.iv.next58.i to i32 %arrayidx20.i.1 = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %indvars.iv.next58.i %47 = load i8, ptr %arrayidx20.i.1, align 1, !tbaa !5 %add22.i.1 = add nsw i32 %sub.i, %indvars60.i.1 %idxprom23.i.1 = sext i32 %add22.i.1 to i64 %arrayidx24.i.1 = getelementptr inbounds i8, ptr %ini, i64 %idxprom23.i.1 store i8 %47, ptr %arrayidx24.i.1, align 1, !tbaa !5 %indvars.iv.next58.i.1 = add nuw nsw i64 %indvars.iv57.i, 2 %indvars60.i.2 = trunc i64 %indvars.iv.next58.i.1 to i32 %arrayidx20.i.2 = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %indvars.iv.next58.i.1 %48 = load i8, ptr %arrayidx20.i.2, align 1, !tbaa !5 %add22.i.2 = add nsw i32 %sub.i, %indvars60.i.2 %idxprom23.i.2 = sext i32 %add22.i.2 to i64 %arrayidx24.i.2 = getelementptr inbounds i8, ptr %ini, i64 %idxprom23.i.2 store i8 %48, ptr %arrayidx24.i.2, align 1, !tbaa !5 %indvars.iv.next58.i.2 = add nuw nsw i64 %indvars.iv57.i, 3 %indvars60.i.3 = trunc i64 %indvars.iv.next58.i.2 to i32 %arrayidx20.i.3 = getelementptr inbounds [200 x i8], ptr %temp.i, i64 0, i64 %indvars.iv.next58.i.2 %49 = load i8, ptr %arrayidx20.i.3, align 1, !tbaa !5 %add22.i.3 = add nsw i32 %sub.i, %indvars60.i.3 %idxprom23.i.3 = sext i32 %add22.i.3 to i64 %arrayidx24.i.3 = getelementptr inbounds i8, ptr %ini, i64 %idxprom23.i.3 store i8 %49, ptr %arrayidx24.i.3, align 1, !tbaa !5 %indvars.iv.next58.i.3 = add nuw nsw i64 %indvars.iv57.i, 4 %exitcond62.not.i.3 = icmp eq i64 %indvars.iv.next58.i.3, %wide.trip.count61.i br i1 %exitcond62.not.i.3, label %shuffle.exit, label %for.body18.i, !llvm.loop !21 shuffle.exit: ; preds = %for.body18.i.prol.loopexit, %for.body18.i, %middle.block, %vec.epilog.middle.block, %for.cond15.preheader.i call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %temp.i) #7 %inc = add nuw nsw i32 %i.011, 1 %50 = load i32, ptr %t, align 4, !tbaa !8 %cmp3 = icmp slt i32 %inc, %50 br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !22 for.end: ; preds = %shuffle.exit, %if.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) %ini) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ini) %51 = load i8, ptr %ini, align 16, !tbaa !5 %cmp = icmp eq i8 %51, 45 br i1 %cmp, label %if.then, label %if.end } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind memory(argmem: readwrite) uwtable define dso_local void @shuffle(ptr nocapture noundef %a, i32 noundef %b) local_unnamed_addr #3 { entry: %temp = alloca [200 x i8], align 16 call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %temp) #7 %call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %a) #8 %conv = trunc i64 %call to i32 %cmp48 = icmp sgt i32 %b, 0 br i1 %cmp48, label %for.body.preheader, label %for.cond4.preheader for.body.preheader: ; preds = %entry %0 = zext i32 %b to i64 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %temp, ptr align 1 %a, i64 %0, i1 false), !tbaa !5 br label %for.cond4.preheader for.cond4.preheader: ; preds = %for.body.preheader, %entry %sub = sub nsw i32 %conv, %b %cmp550 = icmp sgt i32 %sub, 0 br i1 %cmp550, label %iter.check, label %for.cond15.preheader iter.check: ; preds = %for.cond4.preheader %1 = sext i32 %b to i64 %wide.trip.count = zext i32 %sub to i64 %invariant.gep = getelementptr i8, ptr %a, i64 %1 %min.iters.check = icmp ult i32 %sub, 8 %2 = add nsw i64 %1, 31 %diff.check = icmp ult i64 %2, 32 %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check br i1 %or.cond, label %for.body7.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %iter.check %min.iters.check64 = icmp ult i32 %sub, 32 br i1 %min.iters.check64, 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 ] %3 = getelementptr i8, ptr %invariant.gep, i64 %index %wide.load = load <16 x i8>, ptr %3, align 1, !tbaa !5 %4 = getelementptr i8, ptr %3, i64 16 %wide.load65 = load <16 x i8>, ptr %4, align 1, !tbaa !5 %5 = getelementptr inbounds i8, ptr %a, i64 %index store <16 x i8> %wide.load, ptr %5, align 1, !tbaa !5 %6 = getelementptr inbounds i8, ptr %5, i64 16 store <16 x i8> %wide.load65, ptr %6, align 1, !tbaa !5 %index.next = add nuw i64 %index, 32 %7 = icmp eq i64 %index.next, %n.vec br i1 %7, label %middle.block, label %vector.body, !llvm.loop !23 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond15.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.body7.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.vec67 = and i64 %wide.trip.count, 4294967288 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index69 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next71, %vec.epilog.vector.body ] %8 = getelementptr i8, ptr %invariant.gep, i64 %index69 %wide.load70 = load <8 x i8>, ptr %8, align 1, !tbaa !5 %9 = getelementptr inbounds i8, ptr %a, i64 %index69 store <8 x i8> %wide.load70, ptr %9, align 1, !tbaa !5 %index.next71 = add nuw i64 %index69, 8 %10 = icmp eq i64 %index.next71, %n.vec67 br i1 %10, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !24 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n68 = icmp eq i64 %n.vec67, %wide.trip.count br i1 %cmp.n68, label %for.cond15.preheader, label %for.body7.preheader for.body7.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec67, %vec.epilog.middle.block ] %11 = xor i64 %indvars.iv.ph, -1 %12 = add nsw i64 %11, %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.body7.prol.loopexit, label %for.body7.prol for.body7.prol: ; preds = %for.body7.preheader, %for.body7.prol %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body7.prol ], [ %indvars.iv.ph, %for.body7.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body7.prol ], [ 0, %for.body7.preheader ] %gep.prol = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.prol %13 = load i8, ptr %gep.prol, align 1, !tbaa !5 %arrayidx11.prol = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.prol store i8 %13, ptr %arrayidx11.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.body7.prol.loopexit, label %for.body7.prol, !llvm.loop !25 for.body7.prol.loopexit: ; preds = %for.body7.prol, %for.body7.preheader %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body7.preheader ], [ %indvars.iv.next.prol, %for.body7.prol ] %14 = icmp ult i64 %12, 3 br i1 %14, label %for.cond15.preheader, label %for.body7 for.cond15.preheader: ; preds = %for.body7.prol.loopexit, %for.body7, %middle.block, %vec.epilog.middle.block, %for.cond4.preheader br i1 %cmp48, label %iter.check75, label %for.end27 iter.check75: ; preds = %for.cond15.preheader %wide.trip.count61 = zext i32 %b to i64 %min.iters.check73 = icmp ult i32 %b, 8 br i1 %min.iters.check73, label %for.body18.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %iter.check75 %15 = add nsw i64 %wide.trip.count61, -1 %16 = trunc i64 %15 to i32 %17 = add i32 %sub, %16 %18 = icmp slt i32 %17, %sub %19 = icmp ugt i64 %15, 4294967295 %20 = or i1 %18, %19 br i1 %20, label %for.body18.preheader, label %vector.main.loop.iter.check77 vector.main.loop.iter.check77: ; preds = %vector.scevcheck %min.iters.check76 = icmp ult i32 %b, 32 br i1 %min.iters.check76, label %vec.epilog.ph90, label %vector.ph78 vector.ph78: ; preds = %vector.main.loop.iter.check77 %n.vec80 = and i64 %wide.trip.count61, 4294967264 br label %vector.body82 vector.body82: ; preds = %vector.body82, %vector.ph78 %offset.idx = phi i64 [ 0, %vector.ph78 ], [ %index.next86, %vector.body82 ] %21 = trunc i64 %offset.idx to i32 %22 = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %offset.idx %wide.load84 = load <16 x i8>, ptr %22, align 16, !tbaa !5 %23 = getelementptr inbounds i8, ptr %22, i64 16 %wide.load85 = load <16 x i8>, ptr %23, align 16, !tbaa !5 %24 = add nsw i32 %sub, %21 %25 = sext i32 %24 to i64 %26 = getelementptr inbounds i8, ptr %a, i64 %25 store <16 x i8> %wide.load84, ptr %26, align 1, !tbaa !5 %27 = getelementptr inbounds i8, ptr %26, i64 16 store <16 x i8> %wide.load85, ptr %27, align 1, !tbaa !5 %index.next86 = add nuw i64 %offset.idx, 32 %28 = icmp eq i64 %index.next86, %n.vec80 br i1 %28, label %middle.block72, label %vector.body82, !llvm.loop !26 middle.block72: ; preds = %vector.body82 %cmp.n81 = icmp eq i64 %n.vec80, %wide.trip.count61 br i1 %cmp.n81, label %for.end27, label %vec.epilog.iter.check89 vec.epilog.iter.check89: ; preds = %middle.block72 %n.vec.remaining91 = and i64 %wide.trip.count61, 24 %min.epilog.iters.check92 = icmp eq i64 %n.vec.remaining91, 0 br i1 %min.epilog.iters.check92, label %for.body18.preheader, label %vec.epilog.ph90 vec.epilog.ph90: ; preds = %vector.main.loop.iter.check77, %vec.epilog.iter.check89 %vec.epilog.resume.val93 = phi i64 [ %n.vec80, %vec.epilog.iter.check89 ], [ 0, %vector.main.loop.iter.check77 ] %n.vec95 = and i64 %wide.trip.count61, 4294967288 br label %vec.epilog.vector.body98 vec.epilog.vector.body98: ; preds = %vec.epilog.vector.body98, %vec.epilog.ph90 %offset.idx100 = phi i64 [ %vec.epilog.resume.val93, %vec.epilog.ph90 ], [ %index.next102, %vec.epilog.vector.body98 ] %29 = trunc i64 %offset.idx100 to i32 %30 = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %offset.idx100 %wide.load101 = load <8 x i8>, ptr %30, align 8, !tbaa !5 %31 = add nsw i32 %sub, %29 %32 = sext i32 %31 to i64 %33 = getelementptr inbounds i8, ptr %a, i64 %32 store <8 x i8> %wide.load101, ptr %33, align 1, !tbaa !5 %index.next102 = add nuw i64 %offset.idx100, 8 %34 = icmp eq i64 %index.next102, %n.vec95 br i1 %34, label %vec.epilog.middle.block87, label %vec.epilog.vector.body98, !llvm.loop !27 vec.epilog.middle.block87: ; preds = %vec.epilog.vector.body98 %cmp.n97 = icmp eq i64 %n.vec95, %wide.trip.count61 br i1 %cmp.n97, label %for.end27, label %for.body18.preheader for.body18.preheader: ; preds = %vector.scevcheck, %iter.check75, %vec.epilog.iter.check89, %vec.epilog.middle.block87 %indvars.iv57.ph = phi i64 [ 0, %iter.check75 ], [ 0, %vector.scevcheck ], [ %n.vec80, %vec.epilog.iter.check89 ], [ %n.vec95, %vec.epilog.middle.block87 ] %35 = xor i64 %indvars.iv57.ph, -1 %36 = add nsw i64 %35, %wide.trip.count61 %xtraiter103 = and i64 %wide.trip.count61, 3 %lcmp.mod104.not = icmp eq i64 %xtraiter103, 0 br i1 %lcmp.mod104.not, label %for.body18.prol.loopexit, label %for.body18.prol for.body18.prol: ; preds = %for.body18.preheader, %for.body18.prol %indvars.iv57.prol = phi i64 [ %indvars.iv.next58.prol, %for.body18.prol ], [ %indvars.iv57.ph, %for.body18.preheader ] %prol.iter105 = phi i64 [ %prol.iter105.next, %for.body18.prol ], [ 0, %for.body18.preheader ] %indvars60.prol = trunc i64 %indvars.iv57.prol to i32 %arrayidx20.prol = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %indvars.iv57.prol %37 = load i8, ptr %arrayidx20.prol, align 1, !tbaa !5 %add22.prol = add nsw i32 %sub, %indvars60.prol %idxprom23.prol = sext i32 %add22.prol to i64 %arrayidx24.prol = getelementptr inbounds i8, ptr %a, i64 %idxprom23.prol store i8 %37, ptr %arrayidx24.prol, align 1, !tbaa !5 %indvars.iv.next58.prol = add nuw nsw i64 %indvars.iv57.prol, 1 %prol.iter105.next = add i64 %prol.iter105, 1 %prol.iter105.cmp.not = icmp eq i64 %prol.iter105.next, %xtraiter103 br i1 %prol.iter105.cmp.not, label %for.body18.prol.loopexit, label %for.body18.prol, !llvm.loop !28 for.body18.prol.loopexit: ; preds = %for.body18.prol, %for.body18.preheader %indvars.iv57.unr = phi i64 [ %indvars.iv57.ph, %for.body18.preheader ], [ %indvars.iv.next58.prol, %for.body18.prol ] %38 = icmp ult i64 %36, 3 br i1 %38, label %for.end27, label %for.body18 for.body7: ; preds = %for.body7.prol.loopexit, %for.body7 %indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body7 ], [ %indvars.iv.unr, %for.body7.prol.loopexit ] %gep = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv %39 = load i8, ptr %gep, align 1, !tbaa !5 %arrayidx11 = getelementptr inbounds i8, ptr %a, i64 %indvars.iv store i8 %39, ptr %arrayidx11, align 1, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %gep.1 = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.next %40 = load i8, ptr %gep.1, align 1, !tbaa !5 %arrayidx11.1 = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.next store i8 %40, ptr %arrayidx11.1, align 1, !tbaa !5 %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2 %gep.2 = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.next.1 %41 = load i8, ptr %gep.2, align 1, !tbaa !5 %arrayidx11.2 = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.next.1 store i8 %41, ptr %arrayidx11.2, align 1, !tbaa !5 %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3 %gep.3 = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.next.2 %42 = load i8, ptr %gep.3, align 1, !tbaa !5 %arrayidx11.3 = getelementptr inbounds i8, ptr %a, i64 %indvars.iv.next.2 store i8 %42, ptr %arrayidx11.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.cond15.preheader, label %for.body7, !llvm.loop !29 for.body18: ; preds = %for.body18.prol.loopexit, %for.body18 %indvars.iv57 = phi i64 [ %indvars.iv.next58.3, %for.body18 ], [ %indvars.iv57.unr, %for.body18.prol.loopexit ] %indvars60 = trunc i64 %indvars.iv57 to i32 %arrayidx20 = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %indvars.iv57 %43 = load i8, ptr %arrayidx20, align 1, !tbaa !5 %add22 = add nsw i32 %sub, %indvars60 %idxprom23 = sext i32 %add22 to i64 %arrayidx24 = getelementptr inbounds i8, ptr %a, i64 %idxprom23 store i8 %43, ptr %arrayidx24, align 1, !tbaa !5 %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1 %indvars60.1 = trunc i64 %indvars.iv.next58 to i32 %arrayidx20.1 = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %indvars.iv.next58 %44 = load i8, ptr %arrayidx20.1, align 1, !tbaa !5 %add22.1 = add nsw i32 %sub, %indvars60.1 %idxprom23.1 = sext i32 %add22.1 to i64 %arrayidx24.1 = getelementptr inbounds i8, ptr %a, i64 %idxprom23.1 store i8 %44, ptr %arrayidx24.1, align 1, !tbaa !5 %indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57, 2 %indvars60.2 = trunc i64 %indvars.iv.next58.1 to i32 %arrayidx20.2 = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %indvars.iv.next58.1 %45 = load i8, ptr %arrayidx20.2, align 1, !tbaa !5 %add22.2 = add nsw i32 %sub, %indvars60.2 %idxprom23.2 = sext i32 %add22.2 to i64 %arrayidx24.2 = getelementptr inbounds i8, ptr %a, i64 %idxprom23.2 store i8 %45, ptr %arrayidx24.2, align 1, !tbaa !5 %indvars.iv.next58.2 = add nuw nsw i64 %indvars.iv57, 3 %indvars60.3 = trunc i64 %indvars.iv.next58.2 to i32 %arrayidx20.3 = getelementptr inbounds [200 x i8], ptr %temp, i64 0, i64 %indvars.iv.next58.2 %46 = load i8, ptr %arrayidx20.3, align 1, !tbaa !5 %add22.3 = add nsw i32 %sub, %indvars60.3 %idxprom23.3 = sext i32 %add22.3 to i64 %arrayidx24.3 = getelementptr inbounds i8, ptr %a, i64 %idxprom23.3 store i8 %46, ptr %arrayidx24.3, align 1, !tbaa !5 %indvars.iv.next58.3 = add nuw nsw i64 %indvars.iv57, 4 %exitcond62.not.3 = icmp eq i64 %indvars.iv.next58.3, %wide.trip.count61 br i1 %exitcond62.not.3, label %for.end27, label %for.body18, !llvm.loop !30 for.end27: ; preds = %for.body18.prol.loopexit, %for.body18, %middle.block72, %vec.epilog.middle.block87, %for.cond15.preheader call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %temp) #7 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 ; 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 = { 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 = { 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, !16} !20 = distinct !{!20, !11, !12} !21 = distinct !{!21, !11, !12} !22 = distinct !{!22, !11} !23 = distinct !{!23, !11, !12, !13} !24 = distinct !{!24, !11, !12, !13} !25 = distinct !{!25, !16} !26 = distinct !{!26, !11, !12, !13} !27 = distinct !{!27, !11, !12, !13} !28 = distinct !{!28, !16} !29 = distinct !{!29, !11, !12} !30 = distinct !{!30, !11, !12}
#include <stdio.h> #include <string.h> int main() { char str1[205], str2[205]; char *f=str1, *b=str2, *p, i; int m, h, len; while(scanf(" %s", f)) { if(strcmp(f, "-")==0) break; for(len=0; f[len]; len++); scanf("%d", &m); for(i=0; i<m; i++) { scanf("%d", &h); p=f, f=b, b=p; memcpy(f, b+h, len-h); memcpy(f+len-h, b, h); f[len]='\0'; } puts(f); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103359/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103359/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c" %s\00", align 1 @.str.1 = private unnamed_addr constant [2 x i8] c"-\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: %str1 = alloca [205 x i8], align 16 %str2 = alloca [205 x i8], align 16 %m = alloca i32, align 4 %h = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 205, ptr nonnull %str1) #5 call void @llvm.lifetime.start.p0(i64 205, ptr nonnull %str2) #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 %call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str1) %tobool.not42 = icmp eq i32 %call41, 0 br i1 %tobool.not42, label %while.end, label %while.body while.body: ; preds = %entry, %for.end20 %f.044 = phi ptr [ %f.1.lcssa, %for.end20 ], [ %str1, %entry ] %b.043 = phi ptr [ %b.1.lcssa, %for.end20 ], [ %str2, %entry ] %call2 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %f.044, ptr noundef nonnull dereferenceable(2) @.str.1) #6 %cmp = icmp eq i32 %call2, 0 br i1 %cmp, label %while.end, label %for.cond for.cond: ; preds = %while.body, %for.cond %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %while.body ] %arrayidx = getelementptr inbounds i8, ptr %f.044, i64 %indvars.iv %0 = load i8, ptr %arrayidx, align 1, !tbaa !5 %tobool3.not = icmp eq i8 %0, 0 %indvars.iv.next = add nuw i64 %indvars.iv, 1 br i1 %tobool3.not, label %for.end, label %for.cond, !llvm.loop !8 for.end: ; preds = %for.cond %1 = trunc i64 %indvars.iv to i32 %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m) %2 = load i32, ptr %m, align 4, !tbaa !10 %cmp636 = icmp sgt i32 %2, 0 br i1 %cmp636, label %for.body8, label %for.end20 for.body8: ; preds = %for.end, %for.body8 %i.039 = phi i8 [ %inc19, %for.body8 ], [ 0, %for.end ] %f.138 = phi ptr [ %b.137, %for.body8 ], [ %f.044, %for.end ] %b.137 = phi ptr [ %f.138, %for.body8 ], [ %b.043, %for.end ] %call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h) %3 = load i32, ptr %h, align 4, !tbaa !10 %idx.ext = sext i32 %3 to i64 %add.ptr = getelementptr inbounds i8, ptr %f.138, i64 %idx.ext %sub = sub nsw i32 %1, %3 %conv10 = sext i32 %sub to i64 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %b.137, ptr align 1 %add.ptr, i64 %conv10, i1 false) %add.ptr12 = getelementptr inbounds i8, ptr %b.137, i64 %indvars.iv %4 = load i32, ptr %h, align 4, !tbaa !10 %idx.ext13 = sext i32 %4 to i64 %idx.neg = sub nsw i64 0, %idx.ext13 %add.ptr14 = getelementptr inbounds i8, ptr %add.ptr12, i64 %idx.neg call void @llvm.memcpy.p0.p0.i64(ptr align 1 %add.ptr14, ptr nonnull align 1 %f.138, i64 %idx.ext13, i1 false) store i8 0, ptr %add.ptr12, align 1, !tbaa !5 %inc19 = add i8 %i.039, 1 %conv = sext i8 %inc19 to i32 %5 = load i32, ptr %m, align 4, !tbaa !10 %cmp6 = icmp sgt i32 %5, %conv br i1 %cmp6, label %for.body8, label %for.end20, !llvm.loop !12 for.end20: ; preds = %for.body8, %for.end %b.1.lcssa = phi ptr [ %b.043, %for.end ], [ %f.138, %for.body8 ] %f.1.lcssa = phi ptr [ %f.044, %for.end ], [ %b.137, %for.body8 ] %call21 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %f.1.lcssa) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %f.1.lcssa) %tobool.not = icmp eq i32 %call, 0 br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !13 while.end: ; preds = %for.end20, %while.body, %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 205, ptr nonnull %str2) #5 call void @llvm.lifetime.end.p0(i64 205, ptr nonnull %str1) #5 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, 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: 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 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 = { nounwind } attributes #6 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = distinct !{!8, !9} !9 = !{!"llvm.loop.mustprogress"} !10 = !{!11, !11, i64 0} !11 = !{!"int", !6, i64 0} !12 = distinct !{!12, !9} !13 = distinct !{!13, !9}
/* ITP1_9_B */ #include <stdio.h> #include <string.h> #define MAX_CARD_CNT 201 /* ??????????????????????????¢??° */ void init_char_array(char array[], short length); /* ?????£?????????????????? */ void do_shuffle(char array[], short pos, short length); int main(void) { char cards[MAX_CARD_CNT]; short shuffle_cnt, shuffle_pos, length; short ii; while(1) { init_char_array(cards, MAX_CARD_CNT); shuffle_cnt = 0; shuffle_pos = 0; scanf("%s", cards); length = strlen(cards); if( '-' == cards[0] ) { break; } scanf("%hd", &shuffle_cnt); for( ii = 0; ii < shuffle_cnt; ii++ ) { scanf("%hd", &shuffle_pos); do_shuffle(cards, shuffle_pos, length); } printf("%s\n", cards); } return 0; } /* ??????????????????????????¢??° */ void init_char_array(char array[], short length) { short ii; for( ii = 0; ii < length; ii++ ) { array[ii] = '\0'; } } /* ?????£?????????????????? */ void do_shuffle(char array[], short pos, short length) { // ????????¨????????? char start_to_pos[pos]; char pos_to_end[length - pos]; init_char_array(start_to_pos, pos); init_char_array(pos_to_end, length - pos); // ??????????????? short ii; short idx_start_to_pos = 0; for( ii = 0; ii < pos; ii++ ) { start_to_pos[idx_start_to_pos++] = array[ii]; } short idx_pos_to_end = 0; for( ii = pos; ii < length; ii++ ) { pos_to_end[idx_pos_to_end++] = array[ii]; } // ???????????\???????????????????´? short idx_array = 0; for( ii = 0; ii < length - pos; ii++ ) { array[idx_array++] = pos_to_end[ii]; } for( ii = 0; ii < pos; ii++ ) { array[idx_array++] = start_to_pos[ii]; } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103401/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103401/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%hd\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %cards = alloca [201 x i8], align 16 %shuffle_cnt = alloca i16, align 2 %shuffle_pos = alloca i16, align 2 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %cards) #9 call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %shuffle_cnt) #9 call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %shuffle_pos) #9 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %cards, i8 0, i64 201, i1 false), !tbaa !5 store i16 0, ptr %shuffle_cnt, align 2, !tbaa !8 store i16 0, ptr %shuffle_pos, align 2, !tbaa !8 %call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards) %0 = load i8, ptr %cards, align 16, !tbaa !5 %cmp21 = icmp eq i8 %0, 45 br i1 %cmp21, label %while.end, label %if.end.preheader if.end.preheader: ; preds = %entry %call319 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %cards) #10 br label %if.end if.end: ; preds = %if.end.preheader, %for.end %conv22.in = phi i64 [ %call3, %for.end ], [ %call319, %if.end.preheader ] %conv22 = trunc i64 %conv22.in to i16 %call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %shuffle_cnt) %1 = load i16, ptr %shuffle_cnt, align 2, !tbaa !8 %cmp916 = icmp sgt i16 %1, 0 br i1 %cmp916, label %for.body, label %for.end for.body: ; preds = %if.end, %for.body %ii.017 = phi i16 [ %inc, %for.body ], [ 0, %if.end ] %call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %shuffle_pos) %2 = load i16, ptr %shuffle_pos, align 2, !tbaa !8 call void @do_shuffle(ptr noundef nonnull %cards, i16 noundef signext %2, i16 noundef signext %conv22) %inc = add nuw nsw i16 %ii.017, 1 %3 = load i16, ptr %shuffle_cnt, align 2, !tbaa !8 %cmp9 = icmp slt i16 %inc, %3 br i1 %cmp9, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.body, %if.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) %cards) call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %cards, i8 0, i64 201, i1 false), !tbaa !5 store i16 0, ptr %shuffle_cnt, align 2, !tbaa !8 store i16 0, ptr %shuffle_pos, align 2, !tbaa !8 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards) %call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %cards) #10 %4 = load i8, ptr %cards, 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 2, ptr nonnull %shuffle_pos) #9 call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %shuffle_cnt) #9 call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %cards) #9 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable define dso_local void @init_char_array(ptr nocapture noundef writeonly %array, i16 noundef signext %length) local_unnamed_addr #2 { entry: %cmp5 = icmp sgt i16 %length, 0 br i1 %cmp5, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %0 = zext i16 %length to i64 tail call void @llvm.memset.p0.i64(ptr align 1 %array, i8 0, i64 %0, i1 false), !tbaa !5 br label %for.end for.end: ; preds = %for.body.preheader, %entry ret void } ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3 ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4 ; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable define dso_local void @do_shuffle(ptr nocapture noundef %array, i16 noundef signext %pos, i16 noundef signext %length) local_unnamed_addr #5 { entry: %0 = zext i16 %pos to i64 %vla = alloca i8, i64 %0, align 16 %conv = sext i16 %length to i32 %conv1 = sext i16 %pos to i32 %sub = sub nsw i32 %conv, %conv1 %1 = zext i32 %sub to i64 %vla2 = alloca i8, i64 %1, align 16 %cmp5.i = icmp sgt i16 %pos, 0 br i1 %cmp5.i, label %for.body.preheader.i, label %init_char_array.exit for.body.preheader.i: ; preds = %entry call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %0, i1 false), !tbaa !5 br label %init_char_array.exit init_char_array.exit: ; preds = %entry, %for.body.preheader.i %conv6 = trunc i32 %sub to i16 %cmp5.i82 = icmp sgt i16 %conv6, 0 br i1 %cmp5.i82, label %for.body.preheader.i83, label %init_char_array.exit84 for.body.preheader.i83: ; preds = %init_char_array.exit %conv6.mask = and i32 %sub, 65535 %2 = zext i32 %conv6.mask to i64 call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla2, i8 0, i64 %2, i1 false), !tbaa !5 br label %init_char_array.exit84 init_char_array.exit84: ; preds = %init_char_array.exit, %for.body.preheader.i83 br i1 %cmp5.i, label %for.body.preheader, label %for.cond13.preheader for.body.preheader: ; preds = %init_char_array.exit84 call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %vla, ptr align 1 %array, i64 %0, i1 false), !tbaa !5 br label %for.cond13.preheader for.cond13.preheader: ; preds = %for.body.preheader, %init_char_array.exit84 %cmp1688 = icmp slt i16 %pos, %length br i1 %cmp1688, label %iter.check, label %for.cond27.preheader iter.check: ; preds = %for.cond13.preheader %3 = sext i16 %pos to i64 %4 = sub i16 %length, %pos %5 = xor i16 %pos, -1 %6 = add i16 %5, %length %7 = zext i16 %6 to i64 %8 = add nuw nsw i64 %7, 1 %min.iters.check = icmp ult i16 %6, 7 br i1 %min.iters.check, label %for.body18.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %iter.check %9 = xor i16 %pos, -1 %10 = add i16 %9, %length %11 = icmp slt i16 %10, 0 br i1 %11, label %for.body18.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.scevcheck %min.iters.check105 = icmp ult i16 %6, 31 br i1 %min.iters.check105, label %vec.epilog.ph, label %vector.ph vector.ph: ; preds = %vector.main.loop.iter.check %n.vec = and i64 %8, 131040 %invariant.gep = getelementptr i8, ptr %array, i64 %3 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %gep = getelementptr i8, ptr %invariant.gep, i64 %index %wide.load = load <16 x i8>, ptr %gep, align 1, !tbaa !5 %12 = getelementptr inbounds i8, ptr %gep, i64 16 %wide.load107 = load <16 x i8>, ptr %12, align 1, !tbaa !5 %sext = shl i64 %index, 48 %13 = ashr exact i64 %sext, 48 %14 = getelementptr inbounds i8, ptr %vla2, i64 %13 store <16 x i8> %wide.load, ptr %14, align 16, !tbaa !5 %15 = getelementptr inbounds i8, ptr %14, i64 16 store <16 x i8> %wide.load107, ptr %15, align 16, !tbaa !5 %index.next = add nuw i64 %index, 32 %16 = icmp eq i64 %index.next, %n.vec br i1 %16, label %middle.block, label %vector.body, !llvm.loop !12 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %8, %n.vec br i1 %cmp.n, label %for.cond27.preheader, label %vec.epilog.iter.check vec.epilog.iter.check: ; preds = %middle.block %ind.end112 = trunc i64 %n.vec to i16 %ind.end110 = add nsw i64 %n.vec, %3 %n.vec.remaining = and i64 %8, 24 %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0 br i1 %min.epilog.iters.check, label %for.body18.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.vec109 = and i64 %8, 131064 %ind.end = add nsw i64 %n.vec109, %3 %ind.end111 = trunc i64 %n.vec109 to i16 %invariant.gep178 = getelementptr i8, ptr %array, i64 %3 br label %vec.epilog.vector.body vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph %index115 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next119, %vec.epilog.vector.body ] %gep179 = getelementptr i8, ptr %invariant.gep178, i64 %index115 %wide.load118 = load <8 x i8>, ptr %gep179, align 1, !tbaa !5 %sext175 = shl i64 %index115, 48 %17 = ashr exact i64 %sext175, 48 %18 = getelementptr inbounds i8, ptr %vla2, i64 %17 store <8 x i8> %wide.load118, ptr %18, align 8, !tbaa !5 %index.next119 = add nuw i64 %index115, 8 %19 = icmp eq i64 %index.next119, %n.vec109 br i1 %19, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !15 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n114 = icmp eq i64 %8, %n.vec109 br i1 %cmp.n114, label %for.cond27.preheader, label %for.body18.preheader for.body18.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ %3, %iter.check ], [ %3, %vector.scevcheck ], [ %ind.end110, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ] %idx_pos_to_end.090.ph = phi i16 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %ind.end112, %vec.epilog.iter.check ], [ %ind.end111, %vec.epilog.middle.block ] br label %for.body18 for.cond27.preheader: ; preds = %for.body18, %middle.block, %vec.epilog.middle.block, %for.cond13.preheader %cmp3291 = icmp sgt i32 %sub, 0 br i1 %cmp3291, label %for.body34.preheader, label %for.cond43.preheader for.body34.preheader: ; preds = %for.cond27.preheader %min.iters.check122 = icmp ult i32 %sub, 32 br i1 %min.iters.check122, label %for.body34.preheader177, label %vector.scevcheck120 vector.scevcheck120: ; preds = %for.body34.preheader %20 = xor i32 %conv1, -1 %21 = add nsw i32 %20, %conv %22 = trunc i32 %21 to i16 %23 = icmp ugt i16 %22, 32766 %24 = icmp ugt i32 %21, 32767 %25 = or i1 %23, %24 br i1 %25, label %for.body34.preheader177, label %vector.ph123 vector.ph123: ; preds = %vector.scevcheck120 %n.vec125 = and i32 %sub, -32 %ind.end126 = trunc i32 %n.vec125 to i16 br label %vector.body129 vector.body129: ; preds = %vector.body129, %vector.ph123 %index130 = phi i32 [ 0, %vector.ph123 ], [ %index.next134, %vector.body129 ] %offset.idx131 = zext i32 %index130 to i64 %sext176 = shl i64 %offset.idx131, 48 %26 = ashr exact i64 %sext176, 48 %27 = getelementptr inbounds i8, ptr %vla2, i64 %26 %wide.load132 = load <16 x i8>, ptr %27, align 16, !tbaa !5 %28 = getelementptr inbounds i8, ptr %27, i64 16 %wide.load133 = load <16 x i8>, ptr %28, align 16, !tbaa !5 %29 = getelementptr inbounds i8, ptr %array, i64 %26 store <16 x i8> %wide.load132, ptr %29, align 1, !tbaa !5 %30 = getelementptr inbounds i8, ptr %29, i64 16 store <16 x i8> %wide.load133, ptr %30, align 1, !tbaa !5 %index.next134 = add nuw i32 %index130, 32 %31 = icmp eq i32 %index.next134, %n.vec125 br i1 %31, label %middle.block121, label %vector.body129, !llvm.loop !16 middle.block121: ; preds = %vector.body129 %cmp.n128 = icmp eq i32 %sub, %n.vec125 br i1 %cmp.n128, label %for.cond43.preheader, label %for.body34.preheader177 for.body34.preheader177: ; preds = %vector.scevcheck120, %for.body34.preheader, %middle.block121 %idx_array.093.ph = phi i16 [ 0, %vector.scevcheck120 ], [ 0, %for.body34.preheader ], [ %ind.end126, %middle.block121 ] br label %for.body34 for.body18: ; preds = %for.body18.preheader, %for.body18 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body18 ], [ %indvars.iv.ph, %for.body18.preheader ] %idx_pos_to_end.090 = phi i16 [ %inc21, %for.body18 ], [ %idx_pos_to_end.090.ph, %for.body18.preheader ] %arrayidx20 = getelementptr inbounds i8, ptr %array, i64 %indvars.iv %32 = load i8, ptr %arrayidx20, align 1, !tbaa !5 %inc21 = add i16 %idx_pos_to_end.090, 1 %idxprom22 = sext i16 %idx_pos_to_end.090 to i64 %arrayidx23 = getelementptr inbounds i8, ptr %vla2, i64 %idxprom22 store i8 %32, ptr %arrayidx23, align 1, !tbaa !5 %indvars.iv.next = add nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i16 %inc21, %4 br i1 %exitcond.not, label %for.cond27.preheader, label %for.body18, !llvm.loop !17 for.cond43.preheader: ; preds = %for.body34, %middle.block121, %for.cond27.preheader %idx_array.0.lcssa = phi i16 [ 0, %for.cond27.preheader ], [ %ind.end126, %middle.block121 ], [ %inc37, %for.body34 ] br i1 %cmp5.i, label %iter.check140, label %for.end56 iter.check140: ; preds = %for.cond43.preheader %min.iters.check138 = icmp ult i16 %pos, 8 br i1 %min.iters.check138, label %for.body48.preheader, label %vector.scevcheck135 vector.scevcheck135: ; preds = %iter.check140 %33 = add nsw i64 %0, -1 %34 = trunc i64 %33 to i16 %35 = add i16 %idx_array.0.lcssa, %34 %36 = icmp slt i16 %35, %idx_array.0.lcssa %37 = icmp ugt i64 %33, 65535 %38 = or i1 %36, %37 br i1 %38, label %for.body48.preheader, label %vector.main.loop.iter.check142 vector.main.loop.iter.check142: ; preds = %vector.scevcheck135 %min.iters.check141 = icmp ult i16 %pos, 32 br i1 %min.iters.check141, label %vec.epilog.ph156, label %vector.ph143 vector.ph143: ; preds = %vector.main.loop.iter.check142 %n.vec145 = and i64 %0, 65504 br label %vector.body147 vector.body147: ; preds = %vector.body147, %vector.ph143 %index148 = phi i64 [ 0, %vector.ph143 ], [ %index.next152, %vector.body147 ] %.cast = trunc i64 %index148 to i16 %offset.idx149 = add i16 %idx_array.0.lcssa, %.cast %39 = getelementptr inbounds i8, ptr %vla, i64 %index148 %wide.load150 = load <16 x i8>, ptr %39, align 16, !tbaa !5 %40 = getelementptr inbounds i8, ptr %39, i64 16 %wide.load151 = load <16 x i8>, ptr %40, align 16, !tbaa !5 %41 = sext i16 %offset.idx149 to i64 %42 = getelementptr inbounds i8, ptr %array, i64 %41 store <16 x i8> %wide.load150, ptr %42, align 1, !tbaa !5 %43 = getelementptr inbounds i8, ptr %42, i64 16 store <16 x i8> %wide.load151, ptr %43, align 1, !tbaa !5 %index.next152 = add nuw i64 %index148, 32 %44 = icmp eq i64 %index.next152, %n.vec145 br i1 %44, label %middle.block136, label %vector.body147, !llvm.loop !18 middle.block136: ; preds = %vector.body147 %cmp.n146 = icmp eq i64 %n.vec145, %0 br i1 %cmp.n146, label %for.end56, label %vec.epilog.iter.check155 vec.epilog.iter.check155: ; preds = %middle.block136 %.cast165 = trunc i64 %n.vec145 to i16 %ind.end166 = add i16 %idx_array.0.lcssa, %.cast165 %n.vec.remaining157 = and i64 %0, 24 %min.epilog.iters.check158 = icmp eq i64 %n.vec.remaining157, 0 br i1 %min.epilog.iters.check158, label %for.body48.preheader, label %vec.epilog.ph156 vec.epilog.ph156: ; preds = %vector.main.loop.iter.check142, %vec.epilog.iter.check155 %vec.epilog.resume.val159 = phi i64 [ %n.vec145, %vec.epilog.iter.check155 ], [ 0, %vector.main.loop.iter.check142 ] %n.vec161 = and i64 %0, 65528 %.cast163 = trunc i64 %n.vec161 to i16 %ind.end164 = add i16 %idx_array.0.lcssa, %.cast163 br label %vec.epilog.vector.body169 vec.epilog.vector.body169: ; preds = %vec.epilog.vector.body169, %vec.epilog.ph156 %index170 = phi i64 [ %vec.epilog.resume.val159, %vec.epilog.ph156 ], [ %index.next174, %vec.epilog.vector.body169 ] %.cast171 = trunc i64 %index170 to i16 %offset.idx172 = add i16 %idx_array.0.lcssa, %.cast171 %45 = getelementptr inbounds i8, ptr %vla, i64 %index170 %wide.load173 = load <8 x i8>, ptr %45, align 8, !tbaa !5 %46 = sext i16 %offset.idx172 to i64 %47 = getelementptr inbounds i8, ptr %array, i64 %46 store <8 x i8> %wide.load173, ptr %47, align 1, !tbaa !5 %index.next174 = add nuw i64 %index170, 8 %48 = icmp eq i64 %index.next174, %n.vec161 br i1 %48, label %vec.epilog.middle.block153, label %vec.epilog.vector.body169, !llvm.loop !19 vec.epilog.middle.block153: ; preds = %vec.epilog.vector.body169 %cmp.n168 = icmp eq i64 %n.vec161, %0 br i1 %cmp.n168, label %for.end56, label %for.body48.preheader for.body48.preheader: ; preds = %vector.scevcheck135, %iter.check140, %vec.epilog.iter.check155, %vec.epilog.middle.block153 %indvars.iv101.ph = phi i64 [ 0, %iter.check140 ], [ 0, %vector.scevcheck135 ], [ %n.vec145, %vec.epilog.iter.check155 ], [ %n.vec161, %vec.epilog.middle.block153 ] %idx_array.196.ph = phi i16 [ %idx_array.0.lcssa, %iter.check140 ], [ %idx_array.0.lcssa, %vector.scevcheck135 ], [ %ind.end166, %vec.epilog.iter.check155 ], [ %ind.end164, %vec.epilog.middle.block153 ] %49 = xor i64 %indvars.iv101.ph, -1 %50 = add nsw i64 %49, %0 %xtraiter = and i64 %0, 3 %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.body48.prol.loopexit, label %for.body48.prol for.body48.prol: ; preds = %for.body48.preheader, %for.body48.prol %indvars.iv101.prol = phi i64 [ %indvars.iv.next102.prol, %for.body48.prol ], [ %indvars.iv101.ph, %for.body48.preheader ] %idx_array.196.prol = phi i16 [ %inc51.prol, %for.body48.prol ], [ %idx_array.196.ph, %for.body48.preheader ] %prol.iter = phi i64 [ %prol.iter.next, %for.body48.prol ], [ 0, %for.body48.preheader ] %arrayidx50.prol = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv101.prol %51 = load i8, ptr %arrayidx50.prol, align 1, !tbaa !5 %inc51.prol = add i16 %idx_array.196.prol, 1 %idxprom52.prol = sext i16 %idx_array.196.prol to i64 %arrayidx53.prol = getelementptr inbounds i8, ptr %array, i64 %idxprom52.prol store i8 %51, ptr %arrayidx53.prol, align 1, !tbaa !5 %indvars.iv.next102.prol = add nuw nsw i64 %indvars.iv101.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.body48.prol.loopexit, label %for.body48.prol, !llvm.loop !20 for.body48.prol.loopexit: ; preds = %for.body48.prol, %for.body48.preheader %indvars.iv101.unr = phi i64 [ %indvars.iv101.ph, %for.body48.preheader ], [ %indvars.iv.next102.prol, %for.body48.prol ] %idx_array.196.unr = phi i16 [ %idx_array.196.ph, %for.body48.preheader ], [ %inc51.prol, %for.body48.prol ] %52 = icmp ult i64 %50, 3 br i1 %52, label %for.end56, label %for.body48.preheader.new for.body48.preheader.new: ; preds = %for.body48.prol.loopexit %invariant.gep180 = getelementptr i8, ptr %vla, i64 1 %invariant.gep182 = getelementptr i8, ptr %vla, i64 2 %invariant.gep184 = getelementptr i8, ptr %vla, i64 3 br label %for.body48 for.body34: ; preds = %for.body34.preheader177, %for.body34 %idx_array.093 = phi i16 [ %inc37, %for.body34 ], [ %idx_array.093.ph, %for.body34.preheader177 ] %idxprom35 = sext i16 %idx_array.093 to i64 %arrayidx36 = getelementptr inbounds i8, ptr %vla2, i64 %idxprom35 %53 = load i8, ptr %arrayidx36, align 1, !tbaa !5 %inc37 = add i16 %idx_array.093, 1 %arrayidx39 = getelementptr inbounds i8, ptr %array, i64 %idxprom35 store i8 %53, ptr %arrayidx39, align 1, !tbaa !5 %conv28 = sext i16 %inc37 to i32 %cmp32 = icmp sgt i32 %sub, %conv28 br i1 %cmp32, label %for.body34, label %for.cond43.preheader, !llvm.loop !22 for.body48: ; preds = %for.body48, %for.body48.preheader.new %indvars.iv101 = phi i64 [ %indvars.iv101.unr, %for.body48.preheader.new ], [ %indvars.iv.next102.3, %for.body48 ] %idx_array.196 = phi i16 [ %idx_array.196.unr, %for.body48.preheader.new ], [ %inc51.3, %for.body48 ] %arrayidx50 = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv101 %54 = load i8, ptr %arrayidx50, align 1, !tbaa !5 %inc51 = add i16 %idx_array.196, 1 %idxprom52 = sext i16 %idx_array.196 to i64 %arrayidx53 = getelementptr inbounds i8, ptr %array, i64 %idxprom52 store i8 %54, ptr %arrayidx53, align 1, !tbaa !5 %gep181 = getelementptr i8, ptr %invariant.gep180, i64 %indvars.iv101 %55 = load i8, ptr %gep181, align 1, !tbaa !5 %inc51.1 = add i16 %idx_array.196, 2 %idxprom52.1 = sext i16 %inc51 to i64 %arrayidx53.1 = getelementptr inbounds i8, ptr %array, i64 %idxprom52.1 store i8 %55, ptr %arrayidx53.1, align 1, !tbaa !5 %gep183 = getelementptr i8, ptr %invariant.gep182, i64 %indvars.iv101 %56 = load i8, ptr %gep183, align 1, !tbaa !5 %inc51.2 = add i16 %idx_array.196, 3 %idxprom52.2 = sext i16 %inc51.1 to i64 %arrayidx53.2 = getelementptr inbounds i8, ptr %array, i64 %idxprom52.2 store i8 %56, ptr %arrayidx53.2, align 1, !tbaa !5 %gep185 = getelementptr i8, ptr %invariant.gep184, i64 %indvars.iv101 %57 = load i8, ptr %gep185, align 1, !tbaa !5 %inc51.3 = add i16 %idx_array.196, 4 %idxprom52.3 = sext i16 %inc51.2 to i64 %arrayidx53.3 = getelementptr inbounds i8, ptr %array, i64 %idxprom52.3 store i8 %57, ptr %arrayidx53.3, align 1, !tbaa !5 %indvars.iv.next102.3 = add nuw nsw i64 %indvars.iv101, 4 %exitcond104.not.3 = icmp eq i64 %indvars.iv.next102.3, %0 br i1 %exitcond104.not.3, label %for.end56, label %for.body48, !llvm.loop !23 for.end56: ; preds = %for.body48.prol.loopexit, %for.body48, %middle.block136, %vec.epilog.middle.block153, %for.cond43.preheader 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 #6 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nofree nosync nounwind willreturn memory(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 #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 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 #6 = { nofree nounwind } attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) } attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #9 = { nounwind } attributes #10 = { 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 = !{!"short", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11, !13, !14} !13 = !{!"llvm.loop.isvectorized", i32 1} !14 = !{!"llvm.loop.unroll.runtime.disable"} !15 = distinct !{!15, !11, !13, !14} !16 = distinct !{!16, !11, !13, !14} !17 = distinct !{!17, !11, !13} !18 = distinct !{!18, !11, !13, !14} !19 = distinct !{!19, !11, !13, !14} !20 = distinct !{!20, !21} !21 = !{!"llvm.loop.unroll.disable"} !22 = distinct !{!22, !11, !13} !23 = distinct !{!23, !11, !13}
#include<stdio.h> #include<string.h> int main(){ int i, r, n, n2, z, x; char moji1[201] = {}, tmp1, tmp2; for(;scanf("%s",moji1),moji1[0] != '-';){ scanf("%d", &n); for( i = 0; i < n; i++ ){ scanf("%d", &n2); for( r = 0; r < n2; r++ ){ for( z = 0; z < strlen( moji1 ); z++ ){ if( z == 0 ){ tmp1 = moji1[z]; }else if( z == strlen(moji1) - 1 ){ moji1[z - 1] = moji1[z]; moji1[z] = tmp1; }else{ moji1[z - 1] = moji1[z]; tmp2 = moji1[z]; } } } } printf("%s\n", moji1); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103445/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103445/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 i32, align 4 %n2 = alloca i32, align 4 %moji1 = alloca [201 x i8], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n2) #6 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %moji1) #6 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(201) %moji1, i8 0, i64 201, i1 false) %call79 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %moji1) %0 = load i8, ptr %moji1, align 16, !tbaa !5 %cmp.not80 = icmp eq i8 %0, 45 br i1 %cmp.not80, label %for.end52, label %for.body for.body: ; preds = %entry, %for.end49 %call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !8 %cmp475 = icmp sgt i32 %1, 0 br i1 %cmp475, label %for.body6, label %for.end49 for.body6: ; preds = %for.body, %for.inc47 %i.077 = phi i32 [ %inc48, %for.inc47 ], [ 0, %for.body ] %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n2) %2 = load i32, ptr %n2, align 4, !tbaa !8 %cmp971 = icmp sgt i32 %2, 0 br i1 %cmp971, label %for.cond12.preheader, label %for.inc47 for.cond12.preheader: ; preds = %for.body6, %for.inc44 %r.072 = phi i32 [ %inc45, %for.inc44 ], [ 0, %for.body6 ] %char0 = load i8, ptr %moji1, align 16 %cmp1666.not = icmp eq i8 %char0, 0 br i1 %cmp1666.not, label %for.inc44, label %for.inc.peel for.inc.peel: ; preds = %for.cond12.preheader %3 = load i8, ptr %moji1, align 16, !tbaa !5 %call15.peel = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %moji1) #7 %cmp16.peel = icmp ugt i64 %call15.peel, 1 br i1 %cmp16.peel, label %if.else, label %for.inc44 if.else: ; preds = %for.inc.peel, %for.inc %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.inc.peel ] %call1570 = phi i64 [ %call15, %for.inc ], [ %call15.peel, %for.inc.peel ] %sub = add i64 %call1570, -1 %cmp25 = icmp eq i64 %sub, %indvars.iv %arrayidx29 = getelementptr inbounds [201 x i8], ptr %moji1, i64 0, i64 %indvars.iv %4 = load i8, ptr %arrayidx29, align 1, !tbaa !5 %5 = add nsw i64 %indvars.iv, -1 %arrayidx32 = getelementptr inbounds [201 x i8], ptr %moji1, i64 0, i64 %5 store i8 %4, ptr %arrayidx32, align 1, !tbaa !5 br i1 %cmp25, label %if.then27, label %for.inc if.then27: ; preds = %if.else store i8 %3, ptr %arrayidx29, align 1, !tbaa !5 br label %for.inc for.inc: ; preds = %if.else, %if.then27 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %call15 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %moji1) #7 %cmp16 = icmp ugt i64 %call15, %indvars.iv.next br i1 %cmp16, label %if.else, label %for.inc44, !llvm.loop !10 for.inc44: ; preds = %for.inc, %for.inc.peel, %for.cond12.preheader %inc45 = add nuw nsw i32 %r.072, 1 %exitcond.not = icmp eq i32 %inc45, %2 br i1 %exitcond.not, label %for.inc47, label %for.cond12.preheader, !llvm.loop !13 for.inc47: ; preds = %for.inc44, %for.body6 %inc48 = add nuw nsw i32 %i.077, 1 %6 = load i32, ptr %n, align 4, !tbaa !8 %cmp4 = icmp slt i32 %inc48, %6 br i1 %cmp4, label %for.body6, label %for.end49, !llvm.loop !14 for.end49: ; preds = %for.inc47, %for.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) %moji1) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %moji1) %7 = load i8, ptr %moji1, align 16, !tbaa !5 %cmp.not = icmp eq i8 %7, 45 br i1 %cmp.not, label %for.end52, label %for.body, !llvm.loop !15 for.end52: ; preds = %for.end49, %entry call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %moji1) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n2) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: 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 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-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 = { 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} !11 = !{!"llvm.loop.mustprogress"} !12 = !{!"llvm.loop.peeled.count", i32 1} !13 = distinct !{!13, !11} !14 = distinct !{!14, !11} !15 = distinct !{!15, !11}
#include <stdio.h> #include <string.h> int main(void) { char ch[201]; char tmp[201]; int n, i, s, len; while(1) { scanf("%s", &ch); if (ch[0] == '-') break; len = strlen(ch); scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &s); strcpy(tmp, ch); strcpy(ch, tmp + s); strcpy(ch + (len - s), tmp); ch[len] = '\0'; } printf("%s\n", ch); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103496/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103496/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %ch = alloca [201 x i8], align 16 %tmp = alloca [201 x i8], align 16 %n = alloca i32, align 4 %s = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %ch) #6 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %tmp) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #6 %call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch) %0 = load i8, ptr %ch, align 16, !tbaa !5 %cmp27 = icmp eq i8 %0, 45 br i1 %cmp27, label %while.end, label %if.end if.end: ; preds = %entry, %for.end %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %ch) #7 %conv3 = trunc i64 %call2 to i32 %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %1 = load i32, ptr %n, align 4, !tbaa !8 %cmp524 = icmp sgt i32 %1, 0 br i1 %cmp524, label %for.body.lr.ph, label %for.end for.body.lr.ph: ; preds = %if.end %sext = shl i64 %call2, 32 %idxprom = ashr exact i64 %sext, 32 %arrayidx19 = getelementptr inbounds [201 x i8], ptr %ch, i64 0, i64 %idxprom br label %for.body for.body: ; preds = %for.body.lr.ph, %for.body %i.025 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ] %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %s) %call10 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %ch) #6 %2 = load i32, ptr %s, align 4, !tbaa !8 %idx.ext = sext i32 %2 to i64 %add.ptr = getelementptr inbounds i8, ptr %tmp, i64 %idx.ext %call13 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %ch, ptr noundef nonnull dereferenceable(1) %add.ptr) #6 %sub = sub nsw i32 %conv3, %2 %idx.ext15 = sext i32 %sub to i64 %add.ptr16 = getelementptr inbounds i8, ptr %ch, i64 %idx.ext15 %call18 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %add.ptr16, ptr noundef nonnull dereferenceable(1) %tmp) #6 store i8 0, ptr %arrayidx19, align 1, !tbaa !5 %inc = add nuw nsw i32 %i.025, 1 %3 = load i32, ptr %n, align 4, !tbaa !8 %cmp5 = icmp slt i32 %inc, %3 br i1 %cmp5, label %for.body, label %for.end, !llvm.loop !10 for.end: ; preds = %for.body, %if.end %puts = call i32 @puts(ptr nonnull dereferenceable(1) %ch) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ch) %4 = load i8, ptr %ch, 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 4, ptr nonnull %s) #6 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6 call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %tmp) #6 call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %ch) #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 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> int main(){ int m, h; char cards[256], temp[256], result[256]; int i, j=0, len; while(1){ scanf("%s", cards); len=strlen(cards); if(strcmp(cards, "-")==0&&len==1)break; scanf("%d", &m); for(;m>0;m--){ scanf("%d", &h); strcpy(temp, cards); for(i=0;i<h;i++){ cards[len-h+i]=temp[i]; } for(i=0;i<len-h;i++){ cards[i]=temp[i+h]; } } for(i=0;i<len;i++){ result[j++]=cards[i]; } result[j++]='\n'; } result[j]='\0'; printf("%s", result); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103546/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103546/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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: %m = alloca i32, align 4 %h = alloca i32, align 4 %cards = alloca [256 x i8], align 16 %temp = alloca [256 x i8], align 16 %result = alloca [256 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 256, ptr nonnull %cards) #6 call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %temp) #6 call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %result) #6 %call79 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards) %call280 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %cards) #7 %conv81 = trunc i64 %call280 to i32 %lhsv82 = load i16, ptr %cards, align 16 %.not83 = icmp eq i16 %lhsv82, 45 %cmp684 = icmp eq i32 %conv81, 1 %or.cond85 = select i1 %.not83, i1 %cmp684, i1 false br i1 %or.cond85, label %while.end, label %if.end if.end: ; preds = %entry, %for.end47 %conv87 = phi i32 [ %conv, %for.end47 ], [ %conv81, %entry ] %j.086 = phi i32 [ %inc48, %for.end47 ], [ 0, %entry ] %call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %m) %.pr = load i32, ptr %m, align 4, !tbaa !5 %cmp975 = icmp sgt i32 %.pr, 0 br i1 %cmp975, label %for.body, label %for.cond36.preheader for.cond36.preheader: ; preds = %for.inc34, %if.end %cmp3776 = icmp sgt i32 %conv87, 0 br i1 %cmp3776, label %for.body39.preheader, label %for.end47 for.body39.preheader: ; preds = %for.cond36.preheader %0 = sext i32 %j.086 to i64 %scevgep94 = getelementptr i8, ptr %result, i64 %0 %1 = zext i32 %conv87 to i64 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %scevgep94, ptr nonnull align 16 %cards, i64 %1, i1 false), !tbaa !9 %2 = add i32 %j.086, %conv87 br label %for.end47 for.body: ; preds = %if.end, %for.inc34 %call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %h) %call14 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %temp, ptr noundef nonnull dereferenceable(1) %cards) #6 %3 = load i32, ptr %h, align 4, !tbaa !5 %cmp1671 = icmp sgt i32 %3, 0 br i1 %cmp1671, label %iter.check, label %for.cond21.preheader iter.check: ; preds = %for.body %wide.trip.count = zext i32 %3 to i64 %min.iters.check = icmp ult i32 %3, 8 br i1 %min.iters.check, label %for.body18.preheader, label %vector.scevcheck vector.scevcheck: ; preds = %iter.check %4 = add nsw i64 %wide.trip.count, -1 %5 = sub i32 %conv87, %3 %6 = trunc i64 %4 to i32 %7 = add i32 %5, %6 %8 = icmp slt i32 %7, %5 %9 = icmp ugt i64 %4, 4294967295 %10 = or i1 %8, %9 br i1 %10, label %for.body18.preheader, label %vector.main.loop.iter.check vector.main.loop.iter.check: ; preds = %vector.scevcheck %min.iters.check104 = icmp ult i32 %3, 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.count, 4294967264 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %offset.idx = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %11 = trunc i64 %offset.idx to i32 %12 = getelementptr inbounds [256 x i8], ptr %temp, i64 0, i64 %offset.idx %wide.load = load <16 x i8>, ptr %12, align 16, !tbaa !9 %13 = getelementptr inbounds i8, ptr %12, i64 16 %wide.load105 = load <16 x i8>, ptr %13, align 16, !tbaa !9 %14 = add i32 %conv87, %11 %15 = sub i32 %14, %3 %16 = sext i32 %15 to i64 %17 = getelementptr inbounds [256 x i8], ptr %cards, i64 0, i64 %16 store <16 x i8> %wide.load, ptr %17, align 1, !tbaa !9 %18 = getelementptr inbounds i8, ptr %17, i64 16 store <16 x i8> %wide.load105, ptr %18, align 1, !tbaa !9 %index.next = add nuw i64 %offset.idx, 32 %19 = icmp eq i64 %index.next, %n.vec br i1 %19, 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.cond21.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.body18.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.count, 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 ] %20 = trunc i64 %offset.idx109 to i32 %21 = getelementptr inbounds [256 x i8], ptr %temp, i64 0, i64 %offset.idx109 %wide.load110 = load <8 x i8>, ptr %21, align 8, !tbaa !9 %22 = add i32 %conv87, %20 %23 = sub i32 %22, %3 %24 = sext i32 %23 to i64 %25 = getelementptr inbounds [256 x i8], ptr %cards, i64 0, i64 %24 store <8 x i8> %wide.load110, ptr %25, align 1, !tbaa !9 %index.next111 = add nuw i64 %offset.idx109, 8 %26 = icmp eq i64 %index.next111, %n.vec107 br i1 %26, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !14 vec.epilog.middle.block: ; preds = %vec.epilog.vector.body %cmp.n108 = icmp eq i64 %n.vec107, %wide.trip.count br i1 %cmp.n108, label %for.cond21.preheader, label %for.body18.preheader for.body18.preheader: ; preds = %vector.scevcheck, %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block %indvars.iv.ph = phi i64 [ 0, %iter.check ], [ 0, %vector.scevcheck ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec107, %vec.epilog.middle.block ] %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 %arrayidx.prol = getelementptr inbounds [256 x i8], ptr %temp, i64 0, i64 %indvars.iv.ph %27 = load i8, ptr %arrayidx.prol, align 8, !tbaa !9 %28 = trunc i64 %indvars.iv.ph to i32 %sub.prol = add i32 %conv87, %28 %add.prol = sub i32 %sub.prol, %3 %idxprom19.prol = sext i32 %add.prol to i64 %arrayidx20.prol = getelementptr inbounds [256 x i8], ptr %cards, i64 0, i64 %idxprom19.prol store i8 %27, ptr %arrayidx20.prol, align 1, !tbaa !9 %indvars.iv.next.prol = or i64 %indvars.iv.ph, 1 br label %for.body18.prol.loopexit for.body18.prol.loopexit: ; preds = %for.body18.prol, %for.body18.preheader %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %for.body18.preheader ], [ %indvars.iv.next.prol, %for.body18.prol ] %29 = sub nsw i64 0, %wide.trip.count %30 = xor i64 %indvars.iv.ph, %29 %31 = icmp eq i64 %30, -1 br i1 %31, label %for.cond21.preheader, label %for.body18 for.cond21.preheader: ; preds = %for.body18.prol.loopexit, %for.body18, %middle.block, %vec.epilog.middle.block, %for.body %cmp2373 = icmp sgt i32 %conv87, %3 br i1 %cmp2373, label %for.body25.preheader, label %for.inc34 for.body25.preheader: ; preds = %for.cond21.preheader %32 = sext i32 %3 to i64 %scevgep = getelementptr i8, ptr %temp, i64 %32 %33 = xor i32 %3, -1 %34 = add i32 %conv87, %33 %35 = zext i32 %34 to i64 %36 = add nuw nsw i64 %35, 1 call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) %cards, ptr noundef nonnull align 1 dereferenceable(1) %scevgep, i64 %36, i1 false), !tbaa !9 br label %for.inc34 for.body18: ; preds = %for.body18.prol.loopexit, %for.body18 %indvars.iv = phi i64 [ %indvars.iv.next.1, %for.body18 ], [ %indvars.iv.unr, %for.body18.prol.loopexit ] %arrayidx = getelementptr inbounds [256 x i8], ptr %temp, i64 0, i64 %indvars.iv %37 = load i8, ptr %arrayidx, align 1, !tbaa !9 %38 = trunc i64 %indvars.iv to i32 %sub = add i32 %conv87, %38 %add = sub i32 %sub, %3 %idxprom19 = sext i32 %add to i64 %arrayidx20 = getelementptr inbounds [256 x i8], ptr %cards, i64 0, i64 %idxprom19 store i8 %37, ptr %arrayidx20, align 1, !tbaa !9 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %arrayidx.1 = getelementptr inbounds [256 x i8], ptr %temp, i64 0, i64 %indvars.iv.next %39 = load i8, ptr %arrayidx.1, align 1, !tbaa !9 %40 = trunc i64 %indvars.iv.next to i32 %sub.1 = add i32 %conv87, %40 %add.1 = sub i32 %sub.1, %3 %idxprom19.1 = sext i32 %add.1 to i64 %arrayidx20.1 = getelementptr inbounds [256 x i8], ptr %cards, i64 0, i64 %idxprom19.1 store i8 %39, ptr %arrayidx20.1, align 1, !tbaa !9 %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.cond21.preheader, label %for.body18, !llvm.loop !15 for.inc34: ; preds = %for.body25.preheader, %for.cond21.preheader %41 = load i32, ptr %m, align 4, !tbaa !5 %dec = add nsw i32 %41, -1 store i32 %dec, ptr %m, align 4, !tbaa !5 %cmp9 = icmp sgt i32 %41, 1 br i1 %cmp9, label %for.body, label %for.cond36.preheader, !llvm.loop !16 for.end47: ; preds = %for.body39.preheader, %for.cond36.preheader %j.1.lcssa = phi i32 [ %j.086, %for.cond36.preheader ], [ %2, %for.body39.preheader ] %inc48 = add nsw i32 %j.1.lcssa, 1 %idxprom49 = sext i32 %j.1.lcssa to i64 %arrayidx50 = getelementptr inbounds [256 x i8], ptr %result, i64 0, i64 %idxprom49 store i8 10, ptr %arrayidx50, align 1, !tbaa !9 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cards) %call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %cards) #7 %conv = trunc i64 %call2 to i32 %lhsv = load i16, ptr %cards, align 16 %.not = icmp eq i16 %lhsv, 45 %cmp6 = icmp eq i32 %conv, 1 %or.cond = select i1 %.not, i1 %cmp6, i1 false br i1 %or.cond, label %while.end.loopexit, label %if.end while.end.loopexit: ; preds = %for.end47 %42 = sext i32 %inc48 to i64 br label %while.end while.end: ; preds = %while.end.loopexit, %entry %j.0.lcssa = phi i64 [ 0, %entry ], [ %42, %while.end.loopexit ] %arrayidx52 = getelementptr inbounds [256 x i8], ptr %result, i64 0, i64 %j.0.lcssa store i8 0, ptr %arrayidx52, align 1, !tbaa !9 %call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %result) call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %result) #6 call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %temp) #6 call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %cards) #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: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: 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 = { 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 = { 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 = !{!"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, !12} !16 = distinct !{!16, !11}
#include <stdio.h> #include <stdlib.h> int main(void) { int n, k; scanf("%d %d", &n, &k); printf("%d\n", 2*n + 1 + (((n-k) < k-1) ? (n-k) : k - 1) + n - 1); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10359/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10359/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 %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, ptr noundef nonnull %k) %0 = load i32, ptr %n, align 4, !tbaa !5 %1 = load i32, ptr %k, align 4, !tbaa !5 %sub = sub nsw i32 %0, %1 %sub1 = add nsw i32 %1, -1 %sub.sub1 = call i32 @llvm.smin.i32(i32 %sub, i32 %sub1) %add5 = mul i32 %0, 3 %sub6 = add i32 %add5, %sub.sub1 %call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub6) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"}
#include <stdio.h> #include <string.h> int main() { char s[205]; char nd[] = "-"; int n, t1, cnt; while (1) { scanf("%s", s); if (strcmp(s, nd) == 0) break; scanf("%d", &n); cnt = 0; while (n--) { scanf("%d", &t1); cnt += t1; } // printf("%d\n", cnt); cnt %= strlen(s); // printf("%d\n", cnt); printf("%s", s + cnt); s[cnt] = '\0'; printf("%s\n", s); } }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103632/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103632/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [205 x i8], align 16 %n = alloca i32, align 4 %t1 = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 205, ptr nonnull %s) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t1) #5 %call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s) %lhsv24 = load i16, ptr %s, align 16 %.not25 = icmp eq i16 %lhsv24, 45 br i1 %.not25, label %while.end15, label %if.end if.end: ; preds = %entry, %while.end %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %dec20 = add nsw i32 %0, -1 store i32 %dec20, ptr %n, align 4, !tbaa !5 %tobool.not21 = icmp eq i32 %0, 0 br i1 %tobool.not21, label %while.end, label %while.body6 while.body6: ; preds = %if.end, %while.body6 %cnt.022 = phi i32 [ %add, %while.body6 ], [ 0, %if.end ] %call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %t1) %1 = load i32, ptr %t1, align 4, !tbaa !5 %add = add nsw i32 %1, %cnt.022 %2 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %2, 0 br i1 %tobool.not, label %while.end, label %while.body6, !llvm.loop !9 while.end: ; preds = %while.body6, %if.end %cnt.0.lcssa = phi i32 [ 0, %if.end ], [ %add, %while.body6 ] %call9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6 %conv = sext i32 %cnt.0.lcssa to i64 %rem = urem i64 %conv, %call9 %sext = shl i64 %rem, 32 %idx.ext = ashr exact i64 %sext, 32 %add.ptr = getelementptr inbounds i8, ptr %s, i64 %idx.ext %call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %add.ptr) store i8 0, ptr %add.ptr, align 1, !tbaa !11 %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.end15, label %if.end while.end15: ; preds = %while.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t1) #5 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5 call void @llvm.lifetime.end.p0(i64 205, 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: read) declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nofree nounwind } attributes #5 = { nounwind } attributes #6 = { nounwind willreturn memory(read) } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"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}
#include<stdio.h> #include<string.h> int main(void){ 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_103683/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103683/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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> int main(void) { char in[201], tmp[201]; int m, n, i, j; while (1) { scanf("%200s ", in); if (in[0] == '-') break; scanf("%d ", &m); while (m--) { scanf("%d ", &n); for (i = 0; in[i+n] != '\0'; i++) { tmp[i] = in[i+n]; } for (j = 0; j < n; j++) { tmp[i+j] = in[j]; } tmp[i+j] = '\0'; for (i = 0; tmp[i] != '\0'; i++) { in[i] = tmp[i]; } } puts(in); } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103726/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103726/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%200s \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: %in = alloca [201 x i8], align 16 %tmp = alloca [201 x i8], align 16 %m = alloca i32, align 4 %n = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %in) #4 call void @llvm.lifetime.start.p0(i64 201, ptr nonnull %tmp) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in) %0 = load i8, ptr %in, align 16, !tbaa !5 %cmp74 = icmp eq i8 %0, 45 br i1 %cmp74, label %while.end46, label %if.end if.end: ; preds = %entry, %while.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 %dec71 = add nsw i32 %1, -1 store i32 %dec71, ptr %m, align 4, !tbaa !8 %tobool.not72 = icmp eq i32 %1, 0 br i1 %tobool.not72, label %while.end, label %while.body4 while.cond3.loopexit: ; preds = %for.body36, %for.end26 %2 = load i32, ptr %m, align 4, !tbaa !8 %dec = add nsw i32 %2, -1 store i32 %dec, ptr %m, align 4, !tbaa !8 %tobool.not = icmp eq i32 %2, 0 br i1 %tobool.not, label %while.end, label %while.body4, !llvm.loop !10 while.body4: ; preds = %if.end, %while.cond3.loopexit %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n) %3 = load i32, ptr %n, align 4, !tbaa !8 %idxprom60 = sext i32 %3 to i64 %arrayidx661 = getelementptr inbounds [201 x i8], ptr %in, i64 0, i64 %idxprom60 %4 = load i8, ptr %arrayidx661, align 1, !tbaa !5 %cmp8.not62 = icmp eq i8 %4, 0 br i1 %cmp8.not62, label %for.cond15.preheader, label %for.body for.cond15.preheader.loopexit: ; preds = %for.body %5 = trunc i64 %indvars.iv.next to i32 br label %for.cond15.preheader for.cond15.preheader: ; preds = %for.cond15.preheader.loopexit, %while.body4 %i.0.lcssa = phi i32 [ 0, %while.body4 ], [ %5, %for.cond15.preheader.loopexit ] %cmp1665 = icmp sgt i32 %3, 0 br i1 %cmp1665, label %for.body18.preheader, label %for.end26 for.body18.preheader: ; preds = %for.cond15.preheader %6 = zext i32 %i.0.lcssa to i64 %scevgep = getelementptr i8, ptr %tmp, i64 %6 %7 = zext i32 %3 to i64 call void @llvm.memcpy.p0.p0.i64(ptr align 1 %scevgep, ptr nonnull align 16 %in, i64 %7, i1 false), !tbaa !5 br label %for.end26 for.body: ; preds = %while.body4, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body4 ] %8 = phi i8 [ %10, %for.body ], [ %4, %while.body4 ] %arrayidx14 = getelementptr inbounds [201 x i8], ptr %tmp, i64 0, i64 %indvars.iv store i8 %8, ptr %arrayidx14, align 1, !tbaa !5 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %9 = add nsw i64 %indvars.iv.next, %idxprom60 %arrayidx6 = getelementptr inbounds [201 x i8], ptr %in, i64 0, i64 %9 %10 = load i8, ptr %arrayidx6, align 1, !tbaa !5 %cmp8.not = icmp eq i8 %10, 0 br i1 %cmp8.not, label %for.cond15.preheader.loopexit, label %for.body, !llvm.loop !12 for.end26: ; preds = %for.body18.preheader, %for.cond15.preheader %j.0.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ %3, %for.body18.preheader ] %add27 = add nuw nsw i32 %j.0.lcssa, %i.0.lcssa %idxprom28 = zext i32 %add27 to i64 %arrayidx29 = getelementptr inbounds [201 x i8], ptr %tmp, i64 0, i64 %idxprom28 store i8 0, ptr %arrayidx29, align 1, !tbaa !5 %11 = load i8, ptr %tmp, align 16, !tbaa !5 %cmp34.not68 = icmp eq i8 %11, 0 br i1 %cmp34.not68, label %while.cond3.loopexit, label %for.body36 for.body36: ; preds = %for.end26, %for.body36 %indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body36 ], [ 0, %for.end26 ] %12 = phi i8 [ %13, %for.body36 ], [ %11, %for.end26 ] %arrayidx40 = getelementptr inbounds [201 x i8], ptr %in, i64 0, i64 %indvars.iv80 store i8 %12, ptr %arrayidx40, align 1, !tbaa !5 %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1 %arrayidx32 = getelementptr inbounds [201 x i8], ptr %tmp, i64 0, i64 %indvars.iv.next81 %13 = load i8, ptr %arrayidx32, align 1, !tbaa !5 %cmp34.not = icmp eq i8 %13, 0 br i1 %cmp34.not, label %while.cond3.loopexit, label %for.body36, !llvm.loop !13 while.end: ; preds = %while.cond3.loopexit, %if.end %call45 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %in) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in) %14 = load i8, ptr %in, align 16, !tbaa !5 %cmp = icmp eq i8 %14, 45 br i1 %cmp, label %while.end46, label %if.end while.end46: ; preds = %while.end, %entry call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4 call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %tmp) #4 call void @llvm.lifetime.end.p0(i64 201, ptr nonnull %in) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"omnipotent char", !7, i64 0} !7 = !{!"Simple C/C++ TBAA"} !8 = !{!9, !9, i64 0} !9 = !{!"int", !6, i64 0} !10 = distinct !{!10, !11} !11 = !{!"llvm.loop.mustprogress"} !12 = distinct !{!12, !11} !13 = distinct !{!13, !11}
#include <stdio.h> int main() { int n; scanf("%d\n",&n); int l[n]; int r[n]; for(int i=0;i<n;i++) { scanf("%d %d\n",&l[i],&r[i]); } int k; scanf("%d",&k); int flag=0; for(int i=0;i<n;i++) { if(k>r[i]) flag++; else break; } printf("%d",n-flag); }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_10377/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_10377/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\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 %k = 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 %4 = zext i32 %3 to i64 %vla1 = alloca i32, i64 %4, align 16 %cmp25 = icmp sgt i32 %3, 0 br i1 %cmp25, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4 %call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %k) %5 = load i32, ptr %n, align 4, !tbaa !5 %cmp827 = icmp sgt i32 %5, 0 br i1 %cmp827, label %for.body10.lr.ph, label %cleanup for.body10.lr.ph: ; preds = %for.cond.cleanup %6 = load i32, ptr %k, align 4, !tbaa !5 %wide.trip.count = zext i32 %5 to i64 br label %for.body10 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 %arrayidx3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv %call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx3) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %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.body10: ; preds = %for.body10.lr.ph, %if.then %indvars.iv34 = phi i64 [ 0, %for.body10.lr.ph ], [ %indvars.iv.next35, %if.then ] %arrayidx12 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv34 %9 = load i32, ptr %arrayidx12, align 4, !tbaa !5 %cmp13 = icmp sgt i32 %6, %9 br i1 %cmp13, label %if.then, label %cleanup.loopexit.split.loop.exit if.then: ; preds = %for.body10 %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 %cleanup, label %for.body10, !llvm.loop !11 cleanup.loopexit.split.loop.exit: ; preds = %for.body10 %indvars38.le = trunc i64 %indvars.iv34 to i32 br label %cleanup cleanup: ; preds = %if.then, %cleanup.loopexit.split.loop.exit, %for.cond.cleanup %flag.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %indvars38.le, %cleanup.loopexit.split.loop.exit ], [ %5, %if.then ] %sub = sub nsw i32 %5, %flag.0.lcssa %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4 call void @llvm.stackrestore.p0(ptr %2) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare ptr @llvm.stacksave.p0() #3 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn declare void @llvm.stackrestore.p0(ptr) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
//set many funcs template //Ver.20190820 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<time.h> #include<assert.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;} void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;} 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;} void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;} 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);} void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;} void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;} int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;} int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;} int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;} int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);} int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);} int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;} void shuffledget(int x[],int n){ int i,b[524288],p,c; for(i=0;i<n;i++){ b[i]=i; } for(i=n;i>=1;i--){ p=rand()%i; c=b[i-1];b[i-1]=b[p];b[p]=c; } for(i=0;i<n;i++){ scanf("%d",&x[b[i]]); } } int dx4[4]={1,-1,0,0}; int dy4[4]={0,0,1,-1}; int dx8[8]={-1,-1,-1,0,0,1,1,1}; int dy8[8]={-1,0,1,-1,1,-1,0,1}; int search(int x,int a[],int n){ int st=0,fi=n-1,te; while(st<=fi){ te=(st+fi)/2; if(a[te]<x){st=te+1;}else{fi=te-1;} } return st; } void prarr(int arr[],int n){ int i; for(i=0;i<n;i++){ if(i){printf(" ");} printf("%d",arr[i]); } printf("\n"); return; } void getperm(int a[],int n){ int i,p; for(i=0;i<n;i++){ a[i]=i; } for(i=n-1;i>=1;i--){ p=rand()%(i+1); swap(&a[p],&a[i]); } } 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; } void coordinate_comp(int a[],int n){ int i,c=0; sd dat[524288]; for(i=0;i<n;i++){ dat[i].val=a[i]; dat[i].node=i; } qsort(dat,n,sizeof(dat[0]),sdsortfnc); a[dat[0].node]=c; for(i=1;i<n;i++){ if(dat[i-1].val!=dat[i].val){c++;} a[dat[i].node]=c; } } long long power(long long a,long long b){ long long x=1,y=a; while(b>0){ if(b&1ll){ x=(x*y)%mod; } y=(y*y)%mod; b>>=1; } return x%mod; } long long modular_inverse(long long n){ return power(n,mod-2); } long long factorial[524288]; long long invfact[524288]; void cfact(){ long long i; factorial[0]=1; factorial[1]=1; for(i=2;i<524288;i++){ factorial[i]=factorial[i-1]*i; factorial[i]%=mod; } invfact[524287]=modular_inverse(factorial[524287]); for(i=524286;i>=0;i--){ invfact[i]=invfact[i+1]*(i+1); invfact[i]%=mod; } } long long calcnCr(long long n,long long k){ return (factorial[n]*((invfact[k]*invfact[n-k])%mod))%mod; } int main(void){ cfact(); long long i,j,n,m,k,a[524288],b,c,h,w,r=0,l,t; long long rw[524288]={0}; scanf("%lld%lld",&n,&k); for(i=1;i<=n;i++){ scanf("%lld",&a[i]); } qsort(&a[1],n,sizeof(long long),llsortfncsj); for(i=1;i<=n;i++){ rw[i]=rw[i-1]+a[i]; } if(k==1){printf("0\n");return 0;} for(i=k;i<=n;i++){ w=n-i+1; t=(mod*3ll); t+=(rw[n]-rw[n-w])-rw[w]; t%=mod; t*=calcnCr(i-2,k-2);t%=mod; r+=t;r%=mod; } printf("%lld\n",r); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103834/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103834/source.c" target datalayout = "e-m:e-p270: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.sd = type { i32, i32 } @.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 @factorial = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @invfact = dso_local local_unnamed_addr global [524288 x i64] zeroinitializer, align 16 @.str.3 = private unnamed_addr constant [9 x i8] c"%lld%lld\00", align 1 @.str.4 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1 @.str.6 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: mustprogress nofree 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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 store i32 %1, ptr %a, align 4, !tbaa !16 store i32 %0, ptr %b, align 4, !tbaa !16 ret void } ; 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 !20 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 !20 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 !21 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 !21 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 !22 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 !23 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 !25 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 !26 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 !27 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 !28 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(argmem: readwrite) uwtable define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i64, ptr %a, align 8, !tbaa !29 %1 = load i64, ptr %b, align 8, !tbaa !29 store i64 %1, ptr %a, align 8, !tbaa !29 store i64 %0, ptr %b, align 8, !tbaa !29 ret void } ; 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: readwrite) uwtable define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load double, ptr %a, align 8, !tbaa !31 %1 = load double, ptr %b, align 8, !tbaa !31 store double %1, ptr %a, align 8, !tbaa !31 store double %0, ptr %b, align 8, !tbaa !31 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 store i8 %1, ptr %a, align 1, !tbaa !33 store i8 %0, ptr %b, align 1, !tbaa !33 ret void } ; 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 #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 %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 #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !16 %1 = load i32, ptr %b, align 4, !tbaa !16 %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) #5 { 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 #5 { 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 #5 { 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 #5 { 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 #6 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #19 ret i32 %call } ; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7 ; 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 #6 { entry: %call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #19 ret i32 %call } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 %cmp = icmp sgt i8 %0, %1 %cmp5 = icmp ne i8 %0, %1 %. = sext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable define dso_local i32 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 { entry: %0 = load i8, ptr %a, align 1, !tbaa !33 %1 = load i8, ptr %b, align 1, !tbaa !33 %cmp = icmp slt i8 %0, %1 %cmp5 = icmp ne i8 %0, %1 %. = sext i1 %cmp5 to i32 %retval.0 = select i1 %cmp, i32 1, i32 %. ret i32 %retval.0 } ; Function Attrs: nounwind uwtable define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 { entry: %b = alloca [524288 x i32], align 16 call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #20 %cmp40 = icmp sgt i32 %n, 0 br i1 %cmp40, label %for.body.preheader, label %for.end25 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.preheader57, 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 !16 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16 %index.next = add nuw i64 %index, 8 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8> %2 = icmp eq i64 %index.next, %n.vec br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57 for.body.preheader57: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block br i1 %cmp40, label %for.body3.preheader, label %for.end25 for.body3.preheader: ; preds = %for.cond1.preheader %3 = zext i32 %n to i64 br label %for.body3 for.body: ; preds = %for.body.preheader57, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ] %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 !16 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !35 for.cond15.preheader: ; preds = %for.body3 br i1 %cmp40, label %for.body17.preheader, label %for.end25 for.body17.preheader: ; preds = %for.cond15.preheader %wide.trip.count54 = zext i32 %n to i64 br label %for.body17 for.body3: ; preds = %for.body3.preheader, %for.body3 %indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ] %call = tail call i32 @rand() #20 %5 = trunc i64 %indvars.iv47 to i32 %rem = srem i32 %call, %5 %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1 %idxprom4 = and i64 %indvars.iv.next48, 4294967295 %arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4 %6 = load i32, ptr %arrayidx5, align 4, !tbaa !16 %idxprom6 = sext i32 %rem to i64 %arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6 %7 = load i32, ptr %arrayidx7, align 4, !tbaa !16 store i32 %7, ptr %arrayidx5, align 4, !tbaa !16 store i32 %6, ptr %arrayidx7, align 4, !tbaa !16 %cmp2 = icmp ugt i64 %indvars.iv47, 1 br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36 for.body17: ; preds = %for.body17.preheader, %for.body17 %indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ] %arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50 %8 = load i32, ptr %arrayidx19, align 4, !tbaa !16 %idxprom20 = sext i32 %8 to i64 %arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20 %call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21) %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1 %exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54 br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37 for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #20 ret void } ; Function Attrs: nounwind declare i32 @rand() local_unnamed_addr #9 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10 ; 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 #11 { 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 !16 %cmp1 = icmp slt i32 %0, %x %add2 = add nsw i32 %div, 1 %sub3 = add nsw i32 %div, -1 %fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3 %st.1 = select i1 %cmp1, i32 %add2, i32 %st.011 %cmp.not = icmp sgt i32 %st.1, %fi.1 br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38 while.end: ; preds = %while.body, %entry %st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ] ret i32 %st.0.lcssa } ; Function Attrs: nofree nounwind uwtable define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 { entry: %cmp7 = icmp sgt i32 %n, 0 br i1 %cmp7, label %if.end.peel, label %for.end if.end.peel: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %.pre = load i32, ptr %arr, align 4, !tbaa !16 %call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre) %exitcond.peel.not = icmp eq i32 %n, 1 br i1 %exitcond.peel.not, label %for.end, label %if.end if.end: ; preds = %if.end.peel, %if.end %indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ] %putchar6 = tail call i32 @putchar(i32 32) %arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv %0 = load i32, ptr %arrayidx, align 4, !tbaa !16 %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0) %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !39 for.end: ; preds = %if.end, %if.end.peel, %entry %putchar = tail call i32 @putchar(i32 10) ret void } ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10 ; Function Attrs: nounwind uwtable define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 { entry: %cmp20 = icmp sgt i32 %n, 0 br i1 %cmp20, label %for.body.preheader, label %for.end9 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.preheader30, 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 i32, ptr %a, i64 %index store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16 %1 = getelementptr inbounds i32, ptr %0, i64 4 store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16 %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 !41 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader30 for.body.preheader30: ; preds = %for.body.preheader, %middle.block %indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ] br label %for.body for.cond1.preheader: ; preds = %for.body, %middle.block %cmp222 = icmp sgt i32 %n, 1 br i1 %cmp222, label %for.body3.preheader, label %for.end9 for.body3.preheader: ; preds = %for.cond1.preheader %3 = zext i32 %n to i64 br label %for.body3 for.body: ; preds = %for.body.preheader30, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ] %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv %4 = trunc i64 %indvars.iv to i32 store i32 %4, ptr %arrayidx, align 4, !tbaa !16 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !42 for.body3: ; preds = %for.body3.preheader, %for.body3 %indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ] %indvars.iv.next26 = add nsw i64 %indvars.iv25, -1 %call = tail call i32 @rand() #20 %5 = trunc i64 %indvars.iv25 to i32 %rem = srem i32 %call, %5 %idxprom4 = sext i32 %rem to i64 %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4 %idxprom6 = and i64 %indvars.iv.next26, 4294967295 %arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6 %6 = load i32, ptr %arrayidx5, align 4, !tbaa !16 %7 = load i32, ptr %arrayidx7, align 4, !tbaa !16 store i32 %7, ptr %arrayidx5, align 4, !tbaa !16 store i32 %6, ptr %arrayidx7, align 4, !tbaa !16 %cmp2 = icmp ugt i64 %indvars.iv25, 2 br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43 for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader ret void } ; 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) #5 { entry: %0 = load i32, ptr %a, align 4, !tbaa !44 %1 = load i32, ptr %b, align 4, !tbaa !44 %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 void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 { entry: %dat = alloca [524288 x %struct.sd], align 16 call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #20 %cmp46 = icmp sgt i32 %n, 0 br i1 %cmp46, label %for.body.preheader, label %for.end for.body.preheader: ; preds = %entry %wide.trip.count = zext i32 %n to i64 %min.iters.check = icmp ult i32 %n, 4 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, 4294967292 br label %vector.body vector.body: ; preds = %vector.body, %vector.ph %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] %vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ] %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2> %0 = or i64 %index, 2 %1 = getelementptr inbounds i32, ptr %a, i64 %index %wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16 %2 = getelementptr inbounds i32, ptr %1, i64 2 %wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16 %3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index %4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0 %interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16 %interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3> store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16 %index.next = add nuw i64 %index, 4 %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4> %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46 middle.block: ; preds = %vector.body %cmp.n = icmp eq i64 %n.vec, %wide.trip.count br i1 %cmp.n, label %for.end, 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.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 i32, ptr %a, i64 %indvars.iv %6 = load i32, ptr %arrayidx, align 4, !tbaa !16 %arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv store i32 %6, ptr %arrayidx2, align 8, !tbaa !44 %node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1 %7 = trunc i64 %indvars.iv to i32 store i32 %7, ptr %node, align 4, !tbaa !47 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !48 for.end: ; preds = %for.body, %middle.block, %entry %conv = sext i32 %n to i64 call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #20 %node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1 %8 = load i32, ptr %node6, align 4, !tbaa !47 %idxprom7 = sext i32 %8 to i64 %arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7 store i32 0, ptr %arrayidx8, align 4, !tbaa !16 %cmp1048 = icmp sgt i32 %n, 1 br i1 %cmp1048, label %for.body12.preheader, label %for.end29 for.body12.preheader: ; preds = %for.end %wide.trip.count56 = zext i32 %n to i64 %.pre = load i32, ptr %dat, align 16, !tbaa !44 %9 = add nsw i64 %wide.trip.count56, -1 %xtraiter = and i64 %9, 1 %10 = icmp eq i32 %n, 2 br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new for.body12.preheader.new: ; preds = %for.body12.preheader %unroll_iter = and i64 %9, -2 br label %for.body12 for.body12: ; preds = %for.body12, %for.body12.preheader.new %11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ] %indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ] %c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ] %niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ] %arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52 %12 = load i32, ptr %arrayidx17, align 8, !tbaa !44 %cmp19.not = icmp ne i32 %11, %12 %inc21 = zext i1 %cmp19.not to i32 %spec.select = add nuw nsw i32 %c.050, %inc21 %node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1 %13 = load i32, ptr %node24, align 4, !tbaa !47 %idxprom25 = sext i32 %13 to i64 %arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25 store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16 %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1 %arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53 %14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44 %cmp19.not.1 = icmp ne i32 %12, %14 %inc21.1 = zext i1 %cmp19.not.1 to i32 %spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1 %node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1 %15 = load i32, ptr %node24.1, align 4, !tbaa !47 %idxprom25.1 = sext i32 %15 to i64 %arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1 store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16 %indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 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.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49 for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader %.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ] %indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ] %c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa %arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr %16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44 %cmp19.not.epil = icmp ne i32 %.unr, %16 %inc21.epil = zext i1 %cmp19.not.epil to i32 %spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil %node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1 %17 = load i32, ptr %node24.epil, align 4, !tbaa !47 %idxprom25.epil = sext i32 %17 to i64 %arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16 br label %for.end29 for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #20 ret void } ; Function Attrs: nofree declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13 ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @power(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 { entry: %cmp9 = icmp sgt i64 %b, 0 br i1 %cmp9, label %while.body, label %while.end while.body: ; preds = %entry, %if.end %y.012 = phi i64 [ %rem2, %if.end ], [ %a, %entry ] %x.011 = phi i64 [ %x.1, %if.end ], [ 1, %entry ] %b.addr.010 = phi i64 [ %shr, %if.end ], [ %b, %entry ] %and = and i64 %b.addr.010, 1 %tobool.not = icmp eq i64 %and, 0 br i1 %tobool.not, label %if.end, label %if.then if.then: ; preds = %while.body %mul = mul nsw i64 %y.012, %x.011 %rem = srem i64 %mul, 1000000007 br label %if.end if.end: ; preds = %if.then, %while.body %x.1 = phi i64 [ %rem, %if.then ], [ %x.011, %while.body ] %mul1 = mul nsw i64 %y.012, %y.012 %rem2 = urem i64 %mul1, 1000000007 %shr = lshr i64 %b.addr.010, 1 %cmp.not = icmp ult i64 %b.addr.010, 2 br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !50 while.end.loopexit: ; preds = %if.end %0 = srem i64 %x.1, 1000000007 br label %while.end while.end: ; preds = %while.end.loopexit, %entry %x.0.lcssa = phi i64 [ 1, %entry ], [ %0, %while.end.loopexit ] ret i64 %x.0.lcssa } ; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable define dso_local i64 @modular_inverse(i64 noundef %n) local_unnamed_addr #2 { entry: br label %while.body.i while.body.i: ; preds = %if.end.i, %entry %y.012.i = phi i64 [ %rem2.i, %if.end.i ], [ %n, %entry ] %x.011.i = phi i64 [ %x.1.i, %if.end.i ], [ 1, %entry ] %b.addr.010.i = phi i64 [ %shr.i, %if.end.i ], [ 1000000005, %entry ] %and.i = and i64 %b.addr.010.i, 1 %tobool.not.i = icmp eq i64 %and.i, 0 br i1 %tobool.not.i, label %if.end.i, label %if.then.i if.then.i: ; preds = %while.body.i %mul.i = mul nsw i64 %x.011.i, %y.012.i %rem.i = srem i64 %mul.i, 1000000007 br label %if.end.i if.end.i: ; preds = %if.then.i, %while.body.i %x.1.i = phi i64 [ %rem.i, %if.then.i ], [ %x.011.i, %while.body.i ] %mul1.i = mul nsw i64 %y.012.i, %y.012.i %rem2.i = urem i64 %mul1.i, 1000000007 %shr.i = lshr i64 %b.addr.010.i, 1 %cmp.not.i = icmp ult i64 %b.addr.010.i, 2 br i1 %cmp.not.i, label %power.exit, label %while.body.i, !llvm.loop !50 power.exit: ; preds = %if.end.i %0 = srem i64 %x.1.i, 1000000007 ret i64 %0 } ; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable define dso_local void @cfact() local_unnamed_addr #14 { entry: store i64 1, ptr @factorial, align 16, !tbaa !29 store i64 1, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 1), align 8, !tbaa !29 br label %for.body for.body: ; preds = %for.body, %entry %0 = phi i64 [ 1, %entry ], [ %rem.1, %for.body ] %i.025 = phi i64 [ 2, %entry ], [ %inc.1, %for.body ] %mul = mul nsw i64 %0, %i.025 %arrayidx1 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %i.025 %rem = srem i64 %mul, 1000000007 store i64 %rem, ptr %arrayidx1, align 16, !tbaa !29 %inc = or i64 %i.025, 1 %mul.1 = mul nsw i64 %rem, %inc %arrayidx1.1 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %inc %rem.1 = srem i64 %mul.1, 1000000007 store i64 %rem.1, ptr %arrayidx1.1, align 8, !tbaa !29 %inc.1 = add nuw nsw i64 %i.025, 2 %exitcond.not.1 = icmp eq i64 %inc.1, 524288 br i1 %exitcond.not.1, label %for.end, label %for.body, !llvm.loop !51 for.end: ; preds = %for.body %1 = load i64, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 524287), align 8, !tbaa !29 br label %while.body.i.i while.body.i.i: ; preds = %if.end.i.i, %for.end %y.012.i.i = phi i64 [ %rem2.i.i, %if.end.i.i ], [ %1, %for.end ] %x.011.i.i = phi i64 [ %x.1.i.i, %if.end.i.i ], [ 1, %for.end ] %b.addr.010.i.i = phi i64 [ %shr.i.i, %if.end.i.i ], [ 1000000005, %for.end ] %and.i.i = and i64 %b.addr.010.i.i, 1 %tobool.not.i.i = icmp eq i64 %and.i.i, 0 br i1 %tobool.not.i.i, label %if.end.i.i, label %if.then.i.i if.then.i.i: ; preds = %while.body.i.i %mul.i.i = mul nsw i64 %x.011.i.i, %y.012.i.i %rem.i.i = srem i64 %mul.i.i, 1000000007 br label %if.end.i.i if.end.i.i: ; preds = %if.then.i.i, %while.body.i.i %x.1.i.i = phi i64 [ %rem.i.i, %if.then.i.i ], [ %x.011.i.i, %while.body.i.i ] %mul1.i.i = mul nsw i64 %y.012.i.i, %y.012.i.i %rem2.i.i = urem i64 %mul1.i.i, 1000000007 %shr.i.i = lshr i64 %b.addr.010.i.i, 1 %cmp.not.i.i = icmp ult i64 %b.addr.010.i.i, 2 br i1 %cmp.not.i.i, label %modular_inverse.exit, label %while.body.i.i, !llvm.loop !50 modular_inverse.exit: ; preds = %if.end.i.i %2 = srem i64 %x.1.i.i, 1000000007 store i64 %2, ptr getelementptr inbounds ([524288 x i64], ptr @invfact, i64 0, i64 524287), align 8, !tbaa !29 br label %for.body5 for.body5: ; preds = %for.body5.1, %modular_inverse.exit %3 = phi i64 [ %2, %modular_inverse.exit ], [ %rem11.1, %for.body5.1 ] %i.126 = phi i64 [ 524286, %modular_inverse.exit ], [ %dec.1, %for.body5.1 ] %add = or i64 %i.126, 1 %mul8 = mul nsw i64 %3, %add %arrayidx9 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %i.126 %rem11 = srem i64 %mul8, 1000000007 store i64 %rem11, ptr %arrayidx9, align 16, !tbaa !29 %cmp4.not = icmp eq i64 %i.126, 0 br i1 %cmp4.not, label %for.end13, label %for.body5.1, !llvm.loop !52 for.body5.1: ; preds = %for.body5 %dec = add nsw i64 %i.126, -1 %mul8.1 = mul nsw i64 %rem11, %i.126 %arrayidx9.1 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %dec %rem11.1 = srem i64 %mul8.1, 1000000007 store i64 %rem11.1, ptr %arrayidx9.1, align 8, !tbaa !29 %dec.1 = add nsw i64 %i.126, -2 br label %for.body5 for.end13: ; preds = %for.body5 ret void } ; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable define dso_local i64 @calcnCr(i64 noundef %n, i64 noundef %k) local_unnamed_addr #15 { entry: %arrayidx = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %n %0 = load i64, ptr %arrayidx, align 8, !tbaa !29 %arrayidx1 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %k %1 = load i64, ptr %arrayidx1, align 8, !tbaa !29 %sub = sub nsw i64 %n, %k %arrayidx2 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %sub %2 = load i64, ptr %arrayidx2, align 8, !tbaa !29 %mul = mul nsw i64 %2, %1 %rem = srem i64 %mul, 1000000007 %mul3 = mul nsw i64 %rem, %0 %rem4 = srem i64 %mul3, 1000000007 ret i64 %rem4 } ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #12 { entry: %n = alloca i64, align 8 %k = alloca i64, align 8 %a = alloca [524288 x i64], align 16 %rw = alloca [524288 x i64], align 16 store i64 1, ptr @factorial, align 16, !tbaa !29 store i64 1, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 1), align 8, !tbaa !29 br label %for.body.i for.body.i: ; preds = %for.body.i, %entry %0 = phi i64 [ 1, %entry ], [ %rem.i.1, %for.body.i ] %i.025.i = phi i64 [ 2, %entry ], [ %inc.i.1, %for.body.i ] %mul.i = mul nsw i64 %i.025.i, %0 %arrayidx1.i = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %i.025.i %rem.i = srem i64 %mul.i, 1000000007 store i64 %rem.i, ptr %arrayidx1.i, align 16, !tbaa !29 %inc.i = or i64 %i.025.i, 1 %mul.i.1 = mul nsw i64 %inc.i, %rem.i %arrayidx1.i.1 = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %inc.i %rem.i.1 = srem i64 %mul.i.1, 1000000007 store i64 %rem.i.1, ptr %arrayidx1.i.1, align 8, !tbaa !29 %inc.i.1 = add nuw nsw i64 %i.025.i, 2 %exitcond.not.i.1 = icmp eq i64 %inc.i.1, 524288 br i1 %exitcond.not.i.1, label %for.end.i, label %for.body.i, !llvm.loop !51 for.end.i: ; preds = %for.body.i %1 = load i64, ptr getelementptr inbounds ([524288 x i64], ptr @factorial, i64 0, i64 524287), align 8, !tbaa !29 br label %while.body.i.i.i while.body.i.i.i: ; preds = %if.end.i.i.i, %for.end.i %y.012.i.i.i = phi i64 [ %rem2.i.i.i, %if.end.i.i.i ], [ %1, %for.end.i ] %x.011.i.i.i = phi i64 [ %x.1.i.i.i, %if.end.i.i.i ], [ 1, %for.end.i ] %b.addr.010.i.i.i = phi i64 [ %shr.i.i.i, %if.end.i.i.i ], [ 1000000005, %for.end.i ] %and.i.i.i = and i64 %b.addr.010.i.i.i, 1 %tobool.not.i.i.i = icmp eq i64 %and.i.i.i, 0 br i1 %tobool.not.i.i.i, label %if.end.i.i.i, label %if.then.i.i.i if.then.i.i.i: ; preds = %while.body.i.i.i %mul.i.i.i = mul nsw i64 %x.011.i.i.i, %y.012.i.i.i %rem.i.i.i = srem i64 %mul.i.i.i, 1000000007 br label %if.end.i.i.i if.end.i.i.i: ; preds = %if.then.i.i.i, %while.body.i.i.i %x.1.i.i.i = phi i64 [ %rem.i.i.i, %if.then.i.i.i ], [ %x.011.i.i.i, %while.body.i.i.i ] %mul1.i.i.i = mul nsw i64 %y.012.i.i.i, %y.012.i.i.i %rem2.i.i.i = urem i64 %mul1.i.i.i, 1000000007 %shr.i.i.i = lshr i64 %b.addr.010.i.i.i, 1 %cmp.not.i.i.i = icmp ult i64 %b.addr.010.i.i.i, 2 br i1 %cmp.not.i.i.i, label %modular_inverse.exit.i, label %while.body.i.i.i, !llvm.loop !50 modular_inverse.exit.i: ; preds = %if.end.i.i.i %2 = srem i64 %x.1.i.i.i, 1000000007 store i64 %2, ptr getelementptr inbounds ([524288 x i64], ptr @invfact, i64 0, i64 524287), align 8, !tbaa !29 br label %for.body5.i for.body5.i: ; preds = %for.body5.i.1, %modular_inverse.exit.i %3 = phi i64 [ %2, %modular_inverse.exit.i ], [ %rem11.i.1, %for.body5.i.1 ] %i.126.i = phi i64 [ 524286, %modular_inverse.exit.i ], [ %dec.i.1, %for.body5.i.1 ] %add.i = or i64 %i.126.i, 1 %mul8.i = mul nsw i64 %add.i, %3 %arrayidx9.i = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %i.126.i %rem11.i = srem i64 %mul8.i, 1000000007 store i64 %rem11.i, ptr %arrayidx9.i, align 16, !tbaa !29 %cmp4.not.i = icmp eq i64 %i.126.i, 0 br i1 %cmp4.not.i, label %cfact.exit, label %for.body5.i.1, !llvm.loop !52 for.body5.i.1: ; preds = %for.body5.i %dec.i = add nsw i64 %i.126.i, -1 %mul8.i.1 = mul nsw i64 %i.126.i, %rem11.i %arrayidx9.i.1 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %dec.i %rem11.i.1 = srem i64 %mul8.i.1, 1000000007 store i64 %rem11.i.1, ptr %arrayidx9.i.1, align 8, !tbaa !29 %dec.i.1 = add nsw i64 %i.126.i, -2 br label %for.body5.i cfact.exit: ; preds = %for.body5.i call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #20 call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #20 call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %a) #20 call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %rw) #20 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4194304) %rw, i8 0, i64 4194304, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n, ptr noundef nonnull %k) %4 = load i64, ptr %n, align 8, !tbaa !29 %cmp.not75 = icmp slt i64 %4, 1 br i1 %cmp.not75, label %for.end, label %for.body for.body: ; preds = %cfact.exit, %for.body %i.076 = phi i64 [ %inc, %for.body ], [ 1, %cfact.exit ] %arrayidx = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.076 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %arrayidx) %inc = add nuw nsw i64 %i.076, 1 %5 = load i64, ptr %n, align 8, !tbaa !29 %cmp.not.not = icmp slt i64 %i.076, %5 br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !53 for.end: ; preds = %for.body, %cfact.exit %.lcssa74 = phi i64 [ %4, %cfact.exit ], [ %5, %for.body ] %arrayidx2 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 1 call void @qsort(ptr noundef nonnull %arrayidx2, i64 noundef %.lcssa74, i64 noundef 8, ptr noundef nonnull @llsortfncsj) #20 %6 = load i64, ptr %n, align 8, !tbaa !29 %cmp4.not77 = icmp slt i64 %6, 1 br i1 %cmp4.not77, label %for.end11, label %for.body5.preheader for.body5.preheader: ; preds = %for.end %xtraiter = and i64 %6, 3 %7 = icmp ult i64 %6, 4 br i1 %7, label %for.end11.loopexit.unr-lcssa, label %for.body5.preheader.new for.body5.preheader.new: ; preds = %for.body5.preheader %unroll_iter = and i64 %6, -4 br label %for.body5 for.body5: ; preds = %for.body5, %for.body5.preheader.new %8 = phi i64 [ 0, %for.body5.preheader.new ], [ %add.3, %for.body5 ] %i.178 = phi i64 [ 1, %for.body5.preheader.new ], [ %inc10.3, %for.body5 ] %niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.3, %for.body5 ] %arrayidx7 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.178 %9 = load i64, ptr %arrayidx7, align 8, !tbaa !29 %add = add nsw i64 %9, %8 %arrayidx8 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %i.178 store i64 %add, ptr %arrayidx8, align 8, !tbaa !29 %inc10 = add nuw nsw i64 %i.178, 1 %arrayidx7.1 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %inc10 %10 = load i64, ptr %arrayidx7.1, align 8, !tbaa !29 %add.1 = add nsw i64 %10, %add %arrayidx8.1 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %inc10 store i64 %add.1, ptr %arrayidx8.1, align 8, !tbaa !29 %inc10.1 = add nuw nsw i64 %i.178, 2 %arrayidx7.2 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %inc10.1 %11 = load i64, ptr %arrayidx7.2, align 8, !tbaa !29 %add.2 = add nsw i64 %11, %add.1 %arrayidx8.2 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %inc10.1 store i64 %add.2, ptr %arrayidx8.2, align 8, !tbaa !29 %inc10.2 = add nuw i64 %i.178, 3 %arrayidx7.3 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %inc10.2 %12 = load i64, ptr %arrayidx7.3, align 8, !tbaa !29 %add.3 = add nsw i64 %12, %add.2 %arrayidx8.3 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %inc10.2 store i64 %add.3, ptr %arrayidx8.3, align 8, !tbaa !29 %inc10.3 = add nuw i64 %i.178, 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.end11.loopexit.unr-lcssa, label %for.body5, !llvm.loop !54 for.end11.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader %.unr = phi i64 [ 0, %for.body5.preheader ], [ %add.3, %for.body5 ] %i.178.unr = phi i64 [ 1, %for.body5.preheader ], [ %inc10.3, %for.body5 ] %lcmp.mod.not = icmp eq i64 %xtraiter, 0 br i1 %lcmp.mod.not, label %for.end11, label %for.body5.epil for.body5.epil: ; preds = %for.end11.loopexit.unr-lcssa, %for.body5.epil %13 = phi i64 [ %add.epil, %for.body5.epil ], [ %.unr, %for.end11.loopexit.unr-lcssa ] %i.178.epil = phi i64 [ %inc10.epil, %for.body5.epil ], [ %i.178.unr, %for.end11.loopexit.unr-lcssa ] %epil.iter = phi i64 [ %epil.iter.next, %for.body5.epil ], [ 0, %for.end11.loopexit.unr-lcssa ] %arrayidx7.epil = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.178.epil %14 = load i64, ptr %arrayidx7.epil, align 8, !tbaa !29 %add.epil = add nsw i64 %14, %13 %arrayidx8.epil = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %i.178.epil store i64 %add.epil, ptr %arrayidx8.epil, align 8, !tbaa !29 %inc10.epil = add nuw i64 %i.178.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.end11, label %for.body5.epil, !llvm.loop !55 for.end11: ; preds = %for.end11.loopexit.unr-lcssa, %for.body5.epil, %for.end %15 = load i64, ptr %k, align 8, !tbaa !29 %cmp12 = icmp eq i64 %15, 1 br i1 %cmp12, label %if.then, label %for.cond14.preheader for.cond14.preheader: ; preds = %for.end11 %cmp15.not80 = icmp sgt i64 %15, %6 br i1 %cmp15.not80, label %for.end34, label %for.body16.lr.ph for.body16.lr.ph: ; preds = %for.cond14.preheader %arrayidx19 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %6 %16 = load i64, ptr %arrayidx19, align 8, !tbaa !29 %.neg73 = add i64 %16, 3000000021 %sub27 = add nsw i64 %15, -2 %arrayidx1.i69 = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %sub27 %17 = load i64, ptr %arrayidx1.i69, align 8, !tbaa !29 br label %for.body16 if.then: ; preds = %for.end11 %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup for.body16: ; preds = %for.body16.lr.ph, %for.body16 %i.282 = phi i64 [ %15, %for.body16.lr.ph ], [ %inc33, %for.body16 ] %r.081 = phi i64 [ 0, %for.body16.lr.ph ], [ %rem31, %for.body16 ] %sub17 = sub nsw i64 %6, %i.282 %add18 = add nsw i64 %sub17, 1 %sub20 = sub nsw i64 %6, %add18 %arrayidx21 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %sub20 %18 = load i64, ptr %arrayidx21, align 8, !tbaa !29 %arrayidx23 = getelementptr inbounds [524288 x i64], ptr %rw, i64 0, i64 %add18 %19 = load i64, ptr %arrayidx23, align 8, !tbaa !29 %20 = add i64 %18, %19 %add25 = sub i64 %.neg73, %20 %rem = srem i64 %add25, 1000000007 %sub26 = add nsw i64 %i.282, -2 %arrayidx.i = getelementptr inbounds [524288 x i64], ptr @factorial, i64 0, i64 %sub26 %21 = load i64, ptr %arrayidx.i, align 8, !tbaa !29 %sub.i = sub nsw i64 %sub26, %sub27 %arrayidx2.i = getelementptr inbounds [524288 x i64], ptr @invfact, i64 0, i64 %sub.i %22 = load i64, ptr %arrayidx2.i, align 8, !tbaa !29 %mul.i70 = mul nsw i64 %22, %17 %rem.i71 = srem i64 %mul.i70, 1000000007 %mul3.i = mul nsw i64 %rem.i71, %21 %rem4.i = srem i64 %mul3.i, 1000000007 %mul = mul nsw i64 %rem4.i, %rem %rem29 = srem i64 %mul, 1000000007 %add30 = add nsw i64 %rem29, %r.081 %rem31 = srem i64 %add30, 1000000007 %inc33 = add i64 %i.282, 1 %exitcond84.not = icmp eq i64 %i.282, %6 br i1 %exitcond84.not, label %for.end34, label %for.body16, !llvm.loop !56 for.end34: ; preds = %for.body16, %for.cond14.preheader %r.0.lcssa = phi i64 [ 0, %for.cond14.preheader ], [ %rem31, %for.body16 ] %call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %r.0.lcssa) br label %cleanup cleanup: ; preds = %for.end34, %if.then call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %rw) #20 call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %a) #20 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #20 call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #20 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) #16 ; Function Attrs: nofree nounwind declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #17 ; Function Attrs: nofree nounwind declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #17 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smax.i32(i32, i32) #18 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #18 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.abs.i32(i32, i1 immarg) #18 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smax.i64(i64, i64) #18 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.smin.i64(i64, i64) #18 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i64 @llvm.abs.i64(i64, i1 immarg) #18 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #18 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: 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 #5 = { 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 #6 = { 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 #7 = { 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 #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #9 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #11 = { nofree 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 #12 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #14 = { nofree 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 #15 = { 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 #16 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #17 = { nofree nounwind } attributes #18 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #19 = { nounwind willreturn memory(read) } attributes #20 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"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 = !{!17, !17, i64 0} !17 = !{!"int", !18, i64 0} !18 = !{!"omnipotent char", !19, i64 0} !19 = !{!"Simple C/C++ TBAA"} !20 = distinct !{!20, !6} !21 = distinct !{!21, !6} !22 = distinct !{!22, !6} !23 = distinct !{!23, !24} !24 = !{!"llvm.loop.unroll.disable"} !25 = distinct !{!25, !6} !26 = distinct !{!26, !24} !27 = distinct !{!27, !6} !28 = distinct !{!28, !6} !29 = !{!30, !30, i64 0} !30 = !{!"long long", !18, i64 0} !31 = !{!32, !32, i64 0} !32 = !{!"double", !18, i64 0} !33 = !{!18, !18, i64 0} !34 = distinct !{!34, !6, !9, !10} !35 = distinct !{!35, !6, !10, !9} !36 = distinct !{!36, !6} !37 = distinct !{!37, !6} !38 = distinct !{!38, !6} !39 = distinct !{!39, !6, !40} !40 = !{!"llvm.loop.peeled.count", i32 1} !41 = distinct !{!41, !6, !9, !10} !42 = distinct !{!42, !6, !10, !9} !43 = distinct !{!43, !6} !44 = !{!45, !17, i64 0} !45 = !{!"", !17, i64 0, !17, i64 4} !46 = distinct !{!46, !6, !9, !10} !47 = !{!45, !17, i64 4} !48 = distinct !{!48, !6, !10, !9} !49 = distinct !{!49, !6} !50 = distinct !{!50, !6} !51 = distinct !{!51, !6} !52 = distinct !{!52, !6} !53 = distinct !{!53, !6} !54 = distinct !{!54, !6} !55 = distinct !{!55, !24} !56 = distinct !{!56, !6}
#include <stdio.h> #define min(x, y) ((x)<(y) ? (x) : (y)) int main(){ int n; scanf("%d", &n); int ans = 1<<30; while(n--){ int a; scanf("%d", &a); int count = 0; while(a % 2 == 0){ count++; a >>= 1; } ans = min(ans, count); } printf("%d\n", ans); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103878/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103878/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca i32, align 4 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %dec15 = add nsw i32 %0, -1 store i32 %dec15, ptr %n, align 4, !tbaa !5 %tobool.not16 = icmp eq i32 %0, 0 br i1 %tobool.not16, label %while.end5, label %while.body while.body: ; preds = %entry, %while.end %ans.017 = phi i32 [ %cond, %while.end ], [ 1073741824, %entry ] call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4 %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a) %a.promoted = load i32, ptr %a, align 4, !tbaa !5 %1 = and i32 %a.promoted, 1 %cmp12 = icmp eq i32 %1, 0 br i1 %cmp12, label %while.body3, label %while.end while.body3: ; preds = %while.body, %while.body3 %count.014 = phi i32 [ %inc, %while.body3 ], [ 0, %while.body ] %shr1113 = phi i32 [ %shr, %while.body3 ], [ %a.promoted, %while.body ] %inc = add nuw nsw i32 %count.014, 1 %shr = ashr i32 %shr1113, 1 %2 = and i32 %shr1113, 2 %cmp = icmp eq i32 %2, 0 br i1 %cmp, label %while.body3, label %while.end, !llvm.loop !9 while.end: ; preds = %while.body3, %while.body %count.0.lcssa = phi i32 [ 0, %while.body ], [ %inc, %while.body3 ] %cond = call i32 @llvm.smin.i32(i32 %ans.017, i32 %count.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4 %3 = load i32, ptr %n, align 4, !tbaa !5 %dec = add nsw i32 %3, -1 store i32 %dec, ptr %n, align 4, !tbaa !5 %tobool.not = icmp eq i32 %3, 0 br i1 %tobool.not, label %while.end5, label %while.body, !llvm.loop !11 while.end5: ; preds = %while.end, %entry %ans.0.lcssa = phi i32 [ 1073741824, %entry ], [ %cond, %while.end ] %call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa) call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) declare i32 @llvm.smin.i32(i32, i32) #3 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = distinct !{!9, !10} !10 = !{!"llvm.loop.mustprogress"} !11 = distinct !{!11, !10}
#include <stdio.h> int main() { int i, count, N, A[200]; scanf("%d", &N); for (i = 0; i < N; i++) scanf("%d", &(A[i])); for (count = 0; ; count++) { for (i = 0; i < N; i++) { if (A[i] % 2 == 1) break; } if (i < N) break; else { for (i = 0; i < N; i++) A[i] /= 2; } } printf("%d\n", count); fflush(stdout); return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103920/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103920/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @stdout = external local_unnamed_addr global ptr, align 8 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %N = alloca i32, align 4 %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 %cmp38 = icmp sgt i32 %0, 0 br i1 %cmp38, label %for.body, label %for.cond2.preheader for.cond2.preheader: ; preds = %for.body, %entry %.lcssa = phi i32 [ %0, %entry ], [ %9, %for.body ] %.lcssa.fr = freeze i32 %.lcssa %cmp440 = icmp sgt i32 %.lcssa.fr, 0 br i1 %cmp440, label %for.cond2.us.us.preheader, label %for.cond2 for.cond2.us.us.preheader: ; preds = %for.cond2.preheader %wide.trip.count76 = zext i32 %.lcssa.fr to i64 %min.iters.check = icmp ult i32 %.lcssa.fr, 8 %n.vec = and i64 %wide.trip.count76, 4294967288 %cmp.n = icmp eq i64 %n.vec, %wide.trip.count76 br label %for.cond2.us.us for.cond2.us.us: ; preds = %for.cond2.us.us.preheader, %for.cond14.for.inc23_crit_edge.us.us %count.0.us.us = phi i32 [ %inc24.us.us, %for.cond14.for.inc23_crit_edge.us.us ], [ 0, %for.cond2.us.us.preheader ] br label %for.body5.us.us for.cond3.us.us: ; preds = %for.body5.us.us %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1 %exitcond77.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count76 br i1 %exitcond77.not, label %for.body16.us.us.preheader, label %for.body5.us.us, !llvm.loop !9 for.body16.us.us.preheader: ; preds = %for.cond3.us.us br i1 %min.iters.check, label %for.body16.us.us.preheader87, label %vector.body vector.body: ; preds = %for.body16.us.us.preheader, %vector.body %index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body16.us.us.preheader ] %1 = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %index %wide.load = load <4 x i32>, ptr %1, align 16, !tbaa !5 %2 = getelementptr inbounds i32, ptr %1, i64 4 %wide.load86 = load <4 x i32>, ptr %2, align 16, !tbaa !5 %3 = sdiv <4 x i32> %wide.load, <i32 2, i32 2, i32 2, i32 2> %4 = sdiv <4 x i32> %wide.load86, <i32 2, i32 2, i32 2, i32 2> store <4 x i32> %3, ptr %1, align 16, !tbaa !5 store <4 x i32> %4, ptr %2, align 16, !tbaa !5 %index.next = add nuw i64 %index, 8 %5 = icmp eq i64 %index.next, %n.vec br i1 %5, label %middle.block, label %vector.body, !llvm.loop !11 middle.block: ; preds = %vector.body br i1 %cmp.n, label %for.cond14.for.inc23_crit_edge.us.us, label %for.body16.us.us.preheader87 for.body16.us.us.preheader87: ; preds = %for.body16.us.us.preheader, %middle.block %indvars.iv78.ph = phi i64 [ 0, %for.body16.us.us.preheader ], [ %n.vec, %middle.block ] br label %for.body16.us.us for.body16.us.us: ; preds = %for.body16.us.us.preheader87, %for.body16.us.us %indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body16.us.us ], [ %indvars.iv78.ph, %for.body16.us.us.preheader87 ] %arrayidx18.us.us = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv78 %6 = load i32, ptr %arrayidx18.us.us, align 4, !tbaa !5 %div.us.us = sdiv i32 %6, 2 store i32 %div.us.us, ptr %arrayidx18.us.us, align 4, !tbaa !5 %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1 %exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count76 br i1 %exitcond82.not, label %for.cond14.for.inc23_crit_edge.us.us, label %for.body16.us.us, !llvm.loop !14 for.body5.us.us: ; preds = %for.cond2.us.us, %for.cond3.us.us %indvars.iv73 = phi i64 [ 0, %for.cond2.us.us ], [ %indvars.iv.next74, %for.cond3.us.us ] %arrayidx7.us.us = getelementptr inbounds [200 x i32], ptr %A, i64 0, i64 %indvars.iv73 %7 = load i32, ptr %arrayidx7.us.us, align 4, !tbaa !5 %8 = and i32 %7, -2147483647 %cmp8.us.us = icmp eq i32 %8, 1 br i1 %cmp8.us.us, label %for.end25, label %for.cond3.us.us for.cond14.for.inc23_crit_edge.us.us: ; preds = %for.body16.us.us, %middle.block %inc24.us.us = add nuw nsw i32 %count.0.us.us, 1 br label %for.cond2.us.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 %9 = load i32, ptr %N, align 4, !tbaa !5 %10 = sext i32 %9 to i64 %cmp = icmp slt i64 %indvars.iv.next, %10 br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !15 for.cond2: ; preds = %for.cond2.preheader, %for.cond2 br label %for.cond2 for.end25: ; preds = %for.body5.us.us %call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.us.us) %11 = load ptr, ptr @stdout, align 8, !tbaa !16 %call27 = call i32 @fflush(ptr noundef %11) 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: nofree nounwind declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { nofree nounwind "no-trapping-math"="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, !13} !12 = !{!"llvm.loop.isvectorized", i32 1} !13 = !{!"llvm.loop.unroll.runtime.disable"} !14 = distinct !{!14, !10, !13, !12} !15 = distinct !{!15, !10} !16 = !{!17, !17, i64 0} !17 = !{!"any pointer", !7, i64 0}
#include <stdlib.h> #include <stdio.h> int main(void) { int i,n,k=0; long seisuu[210]={0}; int hantei = 0; scanf("%d", &i ); for (n = 0 ; n < i ; n++) scanf("%ld",&seisuu[n]); while (hantei == 0) { for (n = 0 ; n < i ; n++) { if (seisuu[n] % 2 != 0) {hantei = 1; break;} else seisuu[n] /= 2 ; } if (hantei == 0) k++; } printf("%d",k); return 0; } /*配列の中の数字を全部2で割った後入れなおす*/
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_103964/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_103964/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-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 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %i = alloca i32, align 4 %seisuu = alloca [210 x i64], align 16 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #4 call void @llvm.lifetime.start.p0(i64 1680, ptr nonnull %seisuu) #4 call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1680) %seisuu, i8 0, i64 1680, i1 false) %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i) %0 = load i32, ptr %i, align 4, !tbaa !5 %cmp27 = icmp sgt i32 %0, 0 br i1 %cmp27, label %for.body, label %for.cond3.preheader.us.preheader while.cond.preheader: ; preds = %for.body %cmp4.not29 = icmp slt i32 %4, 1 br i1 %cmp4.not29, label %for.cond3.preheader.us.preheader, label %for.cond3.preheader.preheader for.cond3.preheader.us.preheader: ; preds = %entry, %while.cond.preheader br label %for.cond3.preheader.us for.cond3.preheader.preheader: ; preds = %while.cond.preheader %1 = zext i32 %4 to i64 %wide.trip.count = zext i32 %4 to i64 %2 = load i64, ptr %seisuu, align 16, !tbaa !9 %3 = and i64 %2, 1 %cmp8.not4955 = icmp eq i64 %3, 0 br i1 %cmp8.not4955, label %if.else.lr.ph, label %while.end for.cond3.preheader.us: ; preds = %for.cond3.preheader.us.preheader, %for.cond3.preheader.us br label %for.cond3.preheader.us for.body: ; preds = %entry, %for.body %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] %arrayidx = getelementptr inbounds [210 x i64], ptr %seisuu, 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 %4 = load i32, ptr %i, align 4, !tbaa !5 %5 = sext i32 %4 to i64 %cmp = icmp slt i64 %indvars.iv.next, %5 br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11 if.else.lr.ph: ; preds = %for.cond3.preheader.preheader, %for.end13 %6 = phi i64 [ %10, %for.end13 ], [ %2, %for.cond3.preheader.preheader ] %k.03656 = phi i32 [ %spec.select, %for.end13 ], [ 0, %for.cond3.preheader.preheader ] br label %if.else for.body5: ; preds = %if.else %arrayidx7 = getelementptr inbounds [210 x i64], ptr %seisuu, i64 0, i64 %indvars.iv.next40 %7 = load i64, ptr %arrayidx7, align 8, !tbaa !9 %8 = and i64 %7, 1 %cmp8.not = icmp eq i64 %8, 0 br i1 %cmp8.not, label %if.else, label %for.body5.while.end_crit_edge, !llvm.loop !13 if.else: ; preds = %if.else.lr.ph, %for.body5 %9 = phi i64 [ %6, %if.else.lr.ph ], [ %7, %for.body5 ] %arrayidx751 = phi ptr [ %seisuu, %if.else.lr.ph ], [ %arrayidx7, %for.body5 ] %indvars.iv3950 = phi i64 [ 0, %if.else.lr.ph ], [ %indvars.iv.next40, %for.body5 ] %div = sdiv i64 %9, 2 store i64 %div, ptr %arrayidx751, align 8, !tbaa !9 %indvars.iv.next40 = add nuw nsw i64 %indvars.iv3950, 1 %exitcond = icmp eq i64 %indvars.iv.next40, %wide.trip.count br i1 %exitcond, label %for.end13, label %for.body5, !llvm.loop !13 for.end13: ; preds = %if.else %cmp4.not.le63 = icmp uge i64 %indvars.iv.next40, %1 %inc16 = zext i1 %cmp4.not.le63 to i32 %spec.select = add nuw nsw i32 %k.03656, %inc16 %10 = load i64, ptr %seisuu, align 16, !tbaa !9 %11 = and i64 %10, 1 %cmp8.not49 = icmp eq i64 %11, 0 br i1 %cmp8.not49, label %if.else.lr.ph, label %while.end, !llvm.loop !14 for.body5.while.end_crit_edge: ; preds = %for.body5 %cmp4.not.le = icmp uge i64 %indvars.iv.next40, %1 %12 = zext i1 %cmp4.not.le to i32 br label %while.end while.end: ; preds = %for.end13, %for.cond3.preheader.preheader, %for.body5.while.end_crit_edge %k.036.lcssa = phi i32 [ %k.03656, %for.body5.while.end_crit_edge ], [ 0, %for.cond3.preheader.preheader ], [ %spec.select, %for.end13 ] %cmp4.not31.lcssa = phi i32 [ %12, %for.body5.while.end_crit_edge ], [ 0, %for.cond3.preheader.preheader ], [ 0, %for.end13 ] %spec.select45 = add nuw nsw i32 %k.036.lcssa, %cmp4.not31.lcssa %call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select45) call void @llvm.lifetime.end.p0(i64 1680, ptr nonnull %seisuu) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #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 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 attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) } attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } attributes #4 = { nounwind } !llvm.module.flags = !{!0, !1, !2, !3} !llvm.ident = !{!4} !0 = !{i32 1, !"wchar_size", i32 4} !1 = !{i32 8, !"PIC Level", i32 2} !2 = !{i32 7, !"PIE Level", i32 2} !3 = !{i32 7, !"uwtable", i32 2} !4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"} !5 = !{!6, !6, i64 0} !6 = !{!"int", !7, i64 0} !7 = !{!"omnipotent char", !8, i64 0} !8 = !{!"Simple C/C++ TBAA"} !9 = !{!10, !10, i64 0} !10 = !{!"long", !7, i64 0} !11 = distinct !{!11, !12} !12 = !{!"llvm.loop.mustprogress"} !13 = distinct !{!13, !12} !14 = distinct !{!14, !12}
#include <stdio.h> // 15min int main(void){ int n = 0; int a[201]; int ans = 0; scanf("%d", &n); for(int i = 0; i < n; i++){ scanf("%d", &a[i]); if(a[i] % 2 != 0){ printf("0\n"); return 0; } } while(1){ for(int i = 0; i < n; i++){ if(a[i] % 2 != 0){ printf("%d\n", ans); return 0; }else{ a[i] = a[i] / 2; } } ans++; } return 0; }
; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_104013/source.c' source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_104013/source.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-pc-linux-gnu" @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @str = private unnamed_addr constant [2 x i8] c"0\00", align 1 ; Function Attrs: nofree nounwind uwtable define dso_local i32 @main() local_unnamed_addr #0 { entry: %n = alloca i32, align 4 %a = alloca [201 x i32], align 16 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 804, ptr nonnull %a) #4 %call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n) %0 = load i32, ptr %n, align 4, !tbaa !5 %cmp.not41 = icmp sgt i32 %0, 0 br i1 %cmp.not41, label %for.body, label %while.cond.preheader51 for.cond: ; preds = %for.body %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 %1 = load i32, ptr %n, align 4, !tbaa !5 %2 = sext i32 %1 to i64 %cmp.not = icmp slt i64 %indvars.iv.next, %2 br i1 %cmp.not, label %for.body, label %while.cond.preheader, !llvm.loop !9 while.cond.preheader: ; preds = %for.cond %cmp8.not43 = icmp sgt i32 %1, 0 br i1 %cmp8.not43, label %while.cond.us.preheader, label %while.cond.preheader51 while.cond.preheader51: ; preds = %entry, %while.cond.preheader br label %while.cond while.cond.us.preheader: ; preds = %while.cond.preheader %wide.trip.count = zext i32 %1 to i64 br label %while.cond.us while.cond.us: ; preds = %while.cond.us.preheader, %for.cond7.for.end26_crit_edge.us %ans.0.us = phi i32 [ %inc27.us, %for.cond7.for.end26_crit_edge.us ], [ 0, %while.cond.us.preheader ] br label %for.body10.us for.body10.us: ; preds = %while.cond.us, %if.else.us %indvars.iv47 = phi i64 [ 0, %while.cond.us ], [ %indvars.iv.next48, %if.else.us ] %arrayidx12.us = getelementptr inbounds [201 x i32], ptr %a, i64 0, i64 %indvars.iv47 %3 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5 %4 = and i32 %3, 1 %cmp14.not.us = icmp eq i32 %4, 0 br i1 %cmp14.not.us, label %if.else.us, label %if.then15 if.else.us: ; preds = %for.body10.us %div.us = sdiv i32 %3, 2 store i32 %div.us, ptr %arrayidx12.us, align 4, !tbaa !5 %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1 %exitcond.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count br i1 %exitcond.not, label %for.cond7.for.end26_crit_edge.us, label %for.body10.us, !llvm.loop !11 for.cond7.for.end26_crit_edge.us: ; preds = %if.else.us %inc27.us = add nuw nsw i32 %ans.0.us, 1 br label %while.cond.us for.body: ; preds = %entry, %for.cond %indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %entry ] %arrayidx = getelementptr inbounds [201 x i32], ptr %a, i64 0, i64 %indvars.iv %call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx) %5 = load i32, ptr %arrayidx, align 4, !tbaa !5 %6 = and i32 %5, 1 %cmp4.not = icmp eq i32 %6, 0 br i1 %cmp4.not, label %for.cond, label %if.then if.then: ; preds = %for.body %puts = call i32 @puts(ptr nonnull dereferenceable(1) @str) br label %cleanup28 while.cond: ; preds = %while.cond.preheader51, %while.cond br label %while.cond if.then15: ; preds = %for.body10.us %call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.us) br label %cleanup28 cleanup28: ; preds = %if.then15, %if.then call void @llvm.lifetime.end.p0(i64 804, ptr nonnull %a) #4 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4 ret i32 0 } ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: nofree nounwind declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2 ; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1 ; Function Attrs: nofree nounwind declare noundef i32 @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}