Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
int main(int argc, char *argv[])
{
int n, m, c;
int a[20][20];
int b[20];
int i, j;
int ans;
int count;
scanf("%d %d %d", &n, &m, &c);
for (i = 0; i < m; i++) {
scanf("%d", &b[i]);
}
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
scanf("%d", &a[i][j]);
}
}
count = 0;
for (i = 0; i < n; i++) {
ans = c;
for (j = 0; j < m; j++) {
ans += a[i][j] * b[j];
}
if (ans > 0) {count++;}
}
printf("%d\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254077/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254077/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%c = alloca i32, align 4
%a = alloca [20 x [20 x i32]], align 16
%b = alloca [20 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %c)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp56 = icmp sgt i32 %0, 0
br i1 %cmp56, label %for.body, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp360 = icmp sgt i32 %2, 0
br i1 %cmp360, label %for.cond5.preheader.lr.ph, label %for.end38
for.cond5.preheader.lr.ph: ; preds = %for.cond2.preheader
%3 = icmp sgt i32 %1, 0
br i1 %3, label %for.cond5.preheader, label %for.body21.lr.ph.thread
for.body21.lr.ph.thread: ; preds = %for.cond5.preheader.lr.ph
%4 = load i32, ptr %c, align 4, !tbaa !5
br label %for.body21.lr.ph.split
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr %b, 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 %m, 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.cond5.preheader: ; preds = %for.cond5.preheader.lr.ph, %for.inc16
%7 = phi i32 [ %27, %for.inc16 ], [ %2, %for.cond5.preheader.lr.ph ]
%8 = phi i32 [ %28, %for.inc16 ], [ %1, %for.cond5.preheader.lr.ph ]
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.inc16 ], [ 0, %for.cond5.preheader.lr.ph ]
%cmp658 = icmp sgt i32 %8, 0
br i1 %cmp658, label %for.body7, label %for.inc16
for.cond19.preheader: ; preds = %for.inc16
%cmp2066 = icmp sgt i32 %27, 0
br i1 %cmp2066, label %for.body21.lr.ph, label %for.end38
for.body21.lr.ph: ; preds = %for.cond19.preheader
%9 = load i32, ptr %c, align 4, !tbaa !5
%cmp2362 = icmp sgt i32 %28, 0
br i1 %cmp2362, label %for.body21.us.preheader, label %for.body21.lr.ph.split
for.body21.us.preheader: ; preds = %for.body21.lr.ph
%wide.trip.count87 = zext i32 %27 to i64
%wide.trip.count = zext i32 %28 to i64
%min.iters.check = icmp ult i32 %28, 8
%n.vec = and i64 %wide.trip.count, 4294967288
%10 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %9, i64 0
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br label %for.body21.us
for.body21.us: ; preds = %for.body21.us.preheader, %for.cond22.for.end33_crit_edge.us
%indvars.iv84 = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next85, %for.cond22.for.end33_crit_edge.us ]
%count.068.us = phi i32 [ 0, %for.body21.us.preheader ], [ %spec.select.us, %for.cond22.for.end33_crit_edge.us ]
br i1 %min.iters.check, label %for.body24.us.preheader, label %vector.body
vector.body: ; preds = %for.body21.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body21.us ]
%vec.phi = phi <4 x i32> [ %17, %vector.body ], [ %10, %for.body21.us ]
%vec.phi104 = phi <4 x i32> [ %18, %vector.body ], [ zeroinitializer, %for.body21.us ]
%11 = getelementptr inbounds [20 x [20 x i32]], ptr %a, i64 0, i64 %indvars.iv84, i64 %index
%wide.load = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
%wide.load105 = load <4 x i32>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %index
%wide.load106 = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load107 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = mul nsw <4 x i32> %wide.load106, %wide.load
%16 = mul nsw <4 x i32> %wide.load107, %wide.load105
%17 = add <4 x i32> %15, %vec.phi
%18 = add <4 x i32> %16, %vec.phi104
%index.next = add nuw i64 %index, 8
%19 = icmp eq i64 %index.next, %n.vec
br i1 %19, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %18, %17
%20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond22.for.end33_crit_edge.us, label %for.body24.us.preheader
for.body24.us.preheader: ; preds = %for.body21.us, %middle.block
%indvars.iv81.ph = phi i64 [ 0, %for.body21.us ], [ %n.vec, %middle.block ]
%ans.064.us.ph = phi i32 [ %9, %for.body21.us ], [ %20, %middle.block ]
br label %for.body24.us
for.body24.us: ; preds = %for.body24.us.preheader, %for.body24.us
%indvars.iv81 = phi i64 [ %indvars.iv.next82, %for.body24.us ], [ %indvars.iv81.ph, %for.body24.us.preheader ]
%ans.064.us = phi i32 [ %add.us, %for.body24.us ], [ %ans.064.us.ph, %for.body24.us.preheader ]
%arrayidx28.us = getelementptr inbounds [20 x [20 x i32]], ptr %a, i64 0, i64 %indvars.iv84, i64 %indvars.iv81
%21 = load i32, ptr %arrayidx28.us, align 4, !tbaa !5
%arrayidx30.us = getelementptr inbounds [20 x i32], ptr %b, i64 0, i64 %indvars.iv81
%22 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%mul.us = mul nsw i32 %22, %21
%add.us = add nsw i32 %mul.us, %ans.064.us
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count
br i1 %exitcond.not, label %for.cond22.for.end33_crit_edge.us, label %for.body24.us, !llvm.loop !14
for.cond22.for.end33_crit_edge.us: ; preds = %for.body24.us, %middle.block
%add.us.lcssa = phi i32 [ %20, %middle.block ], [ %add.us, %for.body24.us ]
%cmp34.us = icmp sgt i32 %add.us.lcssa, 0
%inc35.us = zext i1 %cmp34.us to i32
%spec.select.us = add nuw nsw i32 %count.068.us, %inc35.us
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
br i1 %exitcond88.not, label %for.end38, label %for.body21.us, !llvm.loop !15
for.body21.lr.ph.split: ; preds = %for.body21.lr.ph.thread, %for.body21.lr.ph
%23 = phi i32 [ %4, %for.body21.lr.ph.thread ], [ %9, %for.body21.lr.ph ]
%.lcssa9197 = phi i32 [ %2, %for.body21.lr.ph.thread ], [ %27, %for.body21.lr.ph ]
%cmp34 = icmp sgt i32 %23, 0
%24 = select i1 %cmp34, i32 %.lcssa9197, i32 0
br label %for.end38
for.body7: ; preds = %for.cond5.preheader, %for.body7
%indvars.iv75 = phi i64 [ %indvars.iv.next76, %for.body7 ], [ 0, %for.cond5.preheader ]
%arrayidx11 = getelementptr inbounds [20 x [20 x i32]], ptr %a, i64 0, i64 %indvars.iv78, i64 %indvars.iv75
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx11)
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%25 = load i32, ptr %m, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp6 = icmp slt i64 %indvars.iv.next76, %26
br i1 %cmp6, label %for.body7, label %for.inc16.loopexit, !llvm.loop !16
for.inc16.loopexit: ; preds = %for.body7
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc16
for.inc16: ; preds = %for.inc16.loopexit, %for.cond5.preheader
%27 = phi i32 [ %.pre, %for.inc16.loopexit ], [ %7, %for.cond5.preheader ]
%28 = phi i32 [ %25, %for.inc16.loopexit ], [ %8, %for.cond5.preheader ]
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%29 = sext i32 %27 to i64
%cmp3 = icmp slt i64 %indvars.iv.next79, %29
br i1 %cmp3, label %for.cond5.preheader, label %for.cond19.preheader, !llvm.loop !17
for.end38: ; preds = %for.cond22.for.end33_crit_edge.us, %for.cond2.preheader, %for.body21.lr.ph.split, %for.cond19.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond19.preheader ], [ %24, %for.body21.lr.ph.split ], [ 0, %for.cond2.preheader ], [ %spec.select.us, %for.cond22.for.end33_crit_edge.us ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
|
#include<stdio.h>
#include<string.h>
#define MAX 300001
int temp[MAX];
void mergesort(int Array[],int first,int last)
{
if(first==last) return;
int middle=(first+last)/2;
mergesort(Array,first,middle);
mergesort(Array,middle+1,last);
int i,j,k;
for(i=first,j=first,k=middle+1;i<=last;i++)
{
if(j==middle+1) temp[i]=Array[k++];
else if(k==last+1) temp[i]=Array[j++];
else if(Array[k]>Array[j]) temp[i]=Array[k++];
else temp[i]=Array[j++];
}
for(i=first;i<=last;i++)
{
Array[i]=temp[i];
}
}
int main()
{
int n,i,m;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
mergesort(a,0,n-1);
long long int costs[n];
costs[0]=a[0];
//printf("%d ",a[0]);
for(i=1;i<n;i++)
{
//printf("%d ",a[i]);
costs[i]=costs[i-1]+a[i];
}
//printf("\n");
scanf("%d",&m);
int q;
for(i=0;i<m;i++)
{
scanf("%d",&q);
q--;
printf("%I64d\n",costs[n-1]-a[q]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25412/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25412/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@temp = dso_local local_unnamed_addr global [300001 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%I64d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @mergesort(ptr noundef %Array, i32 noundef %first, i32 noundef %last) local_unnamed_addr #0 {
entry:
%Array99 = ptrtoint ptr %Array to i64
%cmp = icmp eq i32 %first, %last
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%add = add nsw i32 %last, %first
%div = sdiv i32 %add, 2
tail call void @mergesort(ptr noundef %Array, i32 noundef %first, i32 noundef %div)
%add1 = add nsw i32 %div, 1
tail call void @mergesort(ptr noundef %Array, i32 noundef %add1, i32 noundef %last)
%cmp3.not86 = icmp sgt i32 %first, %last
br i1 %cmp3.not86, label %return, label %for.body.lr.ph
for.body.lr.ph: ; preds = %if.end
%add9 = add i32 %last, 1
%0 = sext i32 %first to i64
br label %for.body
for.cond39.preheader: ; preds = %for.inc
br i1 %cmp3.not86, label %return, label %for.body41.preheader
for.body41.preheader: ; preds = %for.cond39.preheader
%1 = sext i32 %first to i64
%2 = add i32 %last, 1
%3 = sub i32 %last, %first
%4 = zext i32 %3 to i64
%5 = add nuw nsw i64 %4, 1
%min.iters.check = icmp ult i32 %3, 15
br i1 %min.iters.check, label %for.body41.preheader101, label %vector.memcheck
vector.memcheck: ; preds = %for.body41.preheader
%6 = shl nsw i64 %0, 2
%7 = add i64 %6, %Array99
%8 = add i64 %6, ptrtoint (ptr @temp to i64)
%9 = sub i64 %7, %8
%diff.check = icmp ult i64 %9, 32
br i1 %diff.check, label %for.body41.preheader101, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%n.vec = and i64 %5, 8589934584
%ind.end = add nsw i64 %n.vec, %1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %index, %1
%10 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load100 = load <4 x i32>, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %Array, i64 %offset.idx
store <4 x i32> %wide.load, ptr %12, align 4, !tbaa !5
%13 = getelementptr inbounds i32, ptr %12, i64 4
store <4 x i32> %wide.load100, ptr %13, align 4, !tbaa !5
%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 !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %return, label %for.body41.preheader101
for.body41.preheader101: ; preds = %vector.memcheck, %for.body41.preheader, %middle.block
%indvars.iv94.ph = phi i64 [ %1, %vector.memcheck ], [ %1, %for.body41.preheader ], [ %ind.end, %middle.block ]
%15 = add i32 %last, 1
%16 = trunc i64 %indvars.iv94.ph to i32
%17 = sub i32 %15, %16
%18 = sub i32 %last, %16
%xtraiter = and i32 %17, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body41.prol.loopexit, label %for.body41.prol
for.body41.prol: ; preds = %for.body41.preheader101, %for.body41.prol
%indvars.iv94.prol = phi i64 [ %indvars.iv.next95.prol, %for.body41.prol ], [ %indvars.iv94.ph, %for.body41.preheader101 ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body41.prol ], [ 0, %for.body41.preheader101 ]
%arrayidx43.prol = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv94.prol
%19 = load i32, ptr %arrayidx43.prol, align 4, !tbaa !5
%arrayidx45.prol = getelementptr inbounds i32, ptr %Array, i64 %indvars.iv94.prol
store i32 %19, ptr %arrayidx45.prol, align 4, !tbaa !5
%indvars.iv.next95.prol = add nsw i64 %indvars.iv94.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.body41.prol.loopexit, label %for.body41.prol, !llvm.loop !13
for.body41.prol.loopexit: ; preds = %for.body41.prol, %for.body41.preheader101
%indvars.iv94.unr = phi i64 [ %indvars.iv94.ph, %for.body41.preheader101 ], [ %indvars.iv.next95.prol, %for.body41.prol ]
%20 = icmp ult i32 %18, 3
br i1 %20, label %return, label %for.body41
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ %0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%k.089 = phi i32 [ %add1, %for.body.lr.ph ], [ %k.1, %for.inc ]
%j.088 = phi i32 [ %first, %for.body.lr.ph ], [ %j.1, %for.inc ]
%cmp5 = icmp eq i32 %j.088, %add1
br i1 %cmp5, label %if.then6, label %if.else
if.then6: ; preds = %for.body
%inc = add nsw i32 %k.089, 1
%idxprom = sext i32 %k.089 to i64
%arrayidx = getelementptr inbounds i32, ptr %Array, i64 %idxprom
%21 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx8 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv
store i32 %21, ptr %arrayidx8, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%cmp10 = icmp eq i32 %k.089, %add9
br i1 %cmp10, label %if.then11, label %if.else17
if.then11: ; preds = %if.else
%inc12 = add nsw i32 %j.088, 1
%idxprom13 = sext i32 %j.088 to i64
%arrayidx14 = getelementptr inbounds i32, ptr %Array, i64 %idxprom13
%22 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv
store i32 %22, ptr %arrayidx16, align 4, !tbaa !5
br label %for.inc
if.else17: ; preds = %if.else
%idxprom18 = sext i32 %k.089 to i64
%arrayidx19 = getelementptr inbounds i32, ptr %Array, i64 %idxprom18
%23 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%idxprom20 = sext i32 %j.088 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %Array, i64 %idxprom20
%24 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %23, %24
%arrayidx28 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv
br i1 %cmp22, label %if.then23, label %if.else29
if.then23: ; preds = %if.else17
%inc24 = add nsw i32 %k.089, 1
store i32 %23, ptr %arrayidx28, align 4, !tbaa !5
br label %for.inc
if.else29: ; preds = %if.else17
%inc30 = add nsw i32 %j.088, 1
store i32 %24, ptr %arrayidx28, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then6, %if.then23, %if.else29, %if.then11
%j.1 = phi i32 [ %add1, %if.then6 ], [ %inc12, %if.then11 ], [ %j.088, %if.then23 ], [ %inc30, %if.else29 ]
%k.1 = phi i32 [ %inc, %if.then6 ], [ %add9, %if.then11 ], [ %inc24, %if.then23 ], [ %k.089, %if.else29 ]
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
%exitcond.not = icmp eq i32 %add9, %lftr.wideiv
br i1 %exitcond.not, label %for.cond39.preheader, label %for.body, !llvm.loop !15
for.body41: ; preds = %for.body41.prol.loopexit, %for.body41
%indvars.iv94 = phi i64 [ %indvars.iv.next95.3, %for.body41 ], [ %indvars.iv94.unr, %for.body41.prol.loopexit ]
%arrayidx43 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv94
%25 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%arrayidx45 = getelementptr inbounds i32, ptr %Array, i64 %indvars.iv94
store i32 %25, ptr %arrayidx45, align 4, !tbaa !5
%indvars.iv.next95 = add nsw i64 %indvars.iv94, 1
%arrayidx43.1 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv.next95
%26 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5
%arrayidx45.1 = getelementptr inbounds i32, ptr %Array, i64 %indvars.iv.next95
store i32 %26, ptr %arrayidx45.1, align 4, !tbaa !5
%indvars.iv.next95.1 = add nsw i64 %indvars.iv94, 2
%arrayidx43.2 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv.next95.1
%27 = load i32, ptr %arrayidx43.2, align 4, !tbaa !5
%arrayidx45.2 = getelementptr inbounds i32, ptr %Array, i64 %indvars.iv.next95.1
store i32 %27, ptr %arrayidx45.2, align 4, !tbaa !5
%indvars.iv.next95.2 = add nsw i64 %indvars.iv94, 3
%arrayidx43.3 = getelementptr inbounds [300001 x i32], ptr @temp, i64 0, i64 %indvars.iv.next95.2
%28 = load i32, ptr %arrayidx43.3, align 4, !tbaa !5
%arrayidx45.3 = getelementptr inbounds i32, ptr %Array, i64 %indvars.iv.next95.2
store i32 %28, ptr %arrayidx45.3, align 4, !tbaa !5
%indvars.iv.next95.3 = add nsw i64 %indvars.iv94, 4
%lftr.wideiv97.3 = trunc i64 %indvars.iv.next95.3 to i32
%exitcond98.not.3 = icmp eq i32 %2, %lftr.wideiv97.3
br i1 %exitcond98.not.3, label %return, label %for.body41, !llvm.loop !16
return: ; preds = %for.body41.prol.loopexit, %for.body41, %middle.block, %if.end, %for.cond39.preheader, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%q = 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 %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp46 = icmp sgt i32 %3, 0
br i1 %cmp46, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%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 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !17
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %3, %entry ], [ %4, %for.body ]
%sub = add nsw i32 %.lcssa, -1
call void @mergesort(ptr noundef nonnull %vla, i32 noundef 0, i32 noundef %sub)
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = zext i32 %6 to i64
%vla2 = alloca i64, i64 %7, align 16
%8 = load i32, ptr %vla, align 16, !tbaa !5
%conv = sext i32 %8 to i64
store i64 %conv, ptr %vla2, align 16, !tbaa !18
%cmp648 = icmp sgt i32 %6, 1
br i1 %cmp648, label %for.body8.preheader, label %for.end19
for.body8.preheader: ; preds = %for.end
%9 = add nsw i64 %7, -1
%10 = add nsw i64 %7, -2
%xtraiter = and i64 %9, 3
%11 = icmp ult i64 %10, 3
br i1 %11, label %for.end19.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i64 %9, -4
br label %for.body8
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%12 = phi i64 [ %conv, %for.body8.preheader.new ], [ %add.3, %for.body8 ]
%indvars.iv54 = phi i64 [ 1, %for.body8.preheader.new ], [ %indvars.iv.next55.3, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%arrayidx13 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv54
%13 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%conv14 = sext i32 %13 to i64
%add = add nsw i64 %12, %conv14
%arrayidx16 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv54
store i64 %add, ptr %arrayidx16, align 8, !tbaa !18
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%arrayidx13.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next55
%14 = load i32, ptr %arrayidx13.1, align 4, !tbaa !5
%conv14.1 = sext i32 %14 to i64
%add.1 = add nsw i64 %add, %conv14.1
%arrayidx16.1 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv.next55
store i64 %add.1, ptr %arrayidx16.1, align 8, !tbaa !18
%indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 2
%arrayidx13.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next55.1
%15 = load i32, ptr %arrayidx13.2, align 4, !tbaa !5
%conv14.2 = sext i32 %15 to i64
%add.2 = add nsw i64 %add.1, %conv14.2
%arrayidx16.2 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv.next55.1
store i64 %add.2, ptr %arrayidx16.2, align 8, !tbaa !18
%indvars.iv.next55.2 = add nuw nsw i64 %indvars.iv54, 3
%arrayidx13.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next55.2
%16 = load i32, ptr %arrayidx13.3, align 4, !tbaa !5
%conv14.3 = sext i32 %16 to i64
%add.3 = add nsw i64 %add.2, %conv14.3
%arrayidx16.3 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv.next55.2
store i64 %add.3, ptr %arrayidx16.3, align 8, !tbaa !18
%indvars.iv.next55.3 = add nuw nsw i64 %indvars.iv54, 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.end19.loopexit.unr-lcssa, label %for.body8, !llvm.loop !20
for.end19.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%.unr = phi i64 [ %conv, %for.body8.preheader ], [ %add.3, %for.body8 ]
%indvars.iv54.unr = phi i64 [ 1, %for.body8.preheader ], [ %indvars.iv.next55.3, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end19, label %for.body8.epil
for.body8.epil: ; preds = %for.end19.loopexit.unr-lcssa, %for.body8.epil
%17 = phi i64 [ %add.epil, %for.body8.epil ], [ %.unr, %for.end19.loopexit.unr-lcssa ]
%indvars.iv54.epil = phi i64 [ %indvars.iv.next55.epil, %for.body8.epil ], [ %indvars.iv54.unr, %for.end19.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.end19.loopexit.unr-lcssa ]
%arrayidx13.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv54.epil
%18 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
%conv14.epil = sext i32 %18 to i64
%add.epil = add nsw i64 %17, %conv14.epil
%arrayidx16.epil = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv54.epil
store i64 %add.epil, ptr %arrayidx16.epil, align 8, !tbaa !18
%indvars.iv.next55.epil = add nuw nsw i64 %indvars.iv54.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.end19, label %for.body8.epil, !llvm.loop !21
for.end19: ; preds = %for.end19.loopexit.unr-lcssa, %for.body8.epil, %for.end
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
%19 = load i32, ptr %m, align 4, !tbaa !5
%cmp2250 = icmp sgt i32 %19, 0
br i1 %cmp2250, label %for.body24, label %for.end36
for.body24: ; preds = %for.end19, %for.body24
%i.251 = phi i32 [ %inc35, %for.body24 ], [ 0, %for.end19 ]
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%20 = load i32, ptr %q, align 4, !tbaa !5
%dec = add nsw i32 %20, -1
store i32 %dec, ptr %q, align 4, !tbaa !5
%21 = load i32, ptr %n, align 4, !tbaa !5
%sub26 = add nsw i32 %21, -1
%idxprom27 = sext i32 %sub26 to i64
%arrayidx28 = getelementptr inbounds i64, ptr %vla2, i64 %idxprom27
%22 = load i64, ptr %arrayidx28, align 8, !tbaa !18
%idxprom29 = sext i32 %dec to i64
%arrayidx30 = getelementptr inbounds i32, ptr %vla, i64 %idxprom29
%23 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%conv31 = sext i32 %23 to i64
%sub32 = sub nsw i64 %22, %conv31
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sub32)
%inc35 = add nuw nsw i32 %i.251, 1
%24 = load i32, ptr %m, align 4, !tbaa !5
%cmp22 = icmp slt i32 %inc35, %24
br i1 %cmp22, label %for.body24, label %for.end36, !llvm.loop !22
for.end36: ; preds = %for.body24, %for.end19
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.stackrestore.p0(ptr %2)
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: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
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, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !10}
|
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int id, solved, penalty;
} Team;
int compare(const void *a, const void *b) {
int t;
const Team ta = *(Team *)a, tb = *(Team *)b;
t = tb.solved - ta.solved;
if (t)
return t;
else {
t = ta.penalty - tb.penalty;
if (t)
return t;
else
return ta.id - tb.id;
}
}
int main(void) {
int i;
int t, p, r;
while (scanf("%d %d %d", &t, &p, &r), t) {
Team team[50] = {0};
int wrong[50][10] = {0};
for (i = 0; i < t; i++)
team[i].id = i + 1;
for (i = 0; i < r; i++) {
int tid, pid, t;
char mes[10];
scanf("%d %d %d %s", &tid, &pid, &t, mes);
tid--;
pid--;
if (mes[0] == 'C') {
team[tid].solved++;
team[tid].penalty += wrong[tid][pid] * 1200 + t;
} else
wrong[tid][pid]++;
}
qsort(team, t, sizeof(Team), &compare);
for (i = 0; i < t; i++)
printf("%d %d %d\n", team[i].id, team[i].solved, team[i].penalty);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254178/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254178/source.c"
target datalayout = "e-m:e-p270: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.Team = type { i32, i32, i32 }
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"%d %d %d %s\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%ta.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %a, i64 4
%ta.sroa.4.0.copyload = load i32, ptr %ta.sroa.4.0..sroa_idx, align 4, !tbaa.struct !5
%tb.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %b, i64 4
%tb.sroa.4.0.copyload = load i32, ptr %tb.sroa.4.0..sroa_idx, align 4, !tbaa.struct !5
%sub = sub nsw i32 %tb.sroa.4.0.copyload, %ta.sroa.4.0.copyload
%tobool.not = icmp eq i32 %sub, 0
br i1 %tobool.not, label %if.else, label %cleanup
if.else: ; preds = %entry
%tb.sroa.0.0.copyload = load i32, ptr %b, align 4, !tbaa.struct !10
%ta.sroa.0.0.copyload = load i32, ptr %a, align 4, !tbaa.struct !10
%tb.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %b, i64 8
%tb.sroa.5.0.copyload = load i32, ptr %tb.sroa.5.0..sroa_idx, align 4, !tbaa.struct !11
%ta.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %a, i64 8
%ta.sroa.5.0.copyload = load i32, ptr %ta.sroa.5.0..sroa_idx, align 4, !tbaa.struct !11
%sub3 = sub nsw i32 %ta.sroa.5.0.copyload, %tb.sroa.5.0.copyload
%tobool4.not = icmp eq i32 %ta.sroa.5.0.copyload, %tb.sroa.5.0.copyload
%sub8 = sub nsw i32 %ta.sroa.0.0.copyload, %tb.sroa.0.0.copyload
%spec.select = select i1 %tobool4.not, i32 %sub8, i32 %sub3
br label %cleanup
cleanup: ; preds = %if.else, %entry
%retval.0 = phi i32 [ %sub, %entry ], [ %spec.select, %if.else ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%t = alloca i32, align 4
%p = alloca i32, align 4
%r = alloca i32, align 4
%team = alloca [50 x %struct.Team], align 16
%wrong = alloca [50 x [10 x i32]], align 16
%tid = alloca i32, align 4
%pid = alloca i32, align 4
%t4 = alloca i32, align 4
%mes = alloca [10 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %p) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #6
%call64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %p, ptr noundef nonnull %r)
%0 = load i32, ptr %t, align 4, !tbaa !6
%tobool.not65 = icmp eq i32 %0, 0
br i1 %tobool.not65, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end47
%1 = phi i32 [ %25, %for.end47 ], [ %0, %entry ]
call void @llvm.lifetime.start.p0(i64 600, ptr nonnull %team) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(600) %team, i8 0, i64 600, i1 false)
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %wrong) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2000) %wrong, i8 0, i64 2000, i1 false)
%cmp58 = icmp sgt i32 %1, 0
br i1 %cmp58, label %for.body.preheader, label %for.cond1.preheader
for.body.preheader: ; preds = %while.body
%wide.trip.count = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count, 3
%2 = icmp ult i32 %1, 4
br i1 %2, label %for.cond1.preheader.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body
for.cond1.preheader.loopexit.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.loopexit.unr-lcssa, %for.body.epil
%indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %for.body.epil ], [ %indvars.iv.unr, %for.cond1.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.cond1.preheader.loopexit.unr-lcssa ]
%indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
%arrayidx.epil = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv.epil
%3 = trunc i64 %indvars.iv.next.epil to i32
store i32 %3, ptr %arrayidx.epil, align 4, !tbaa !12
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond1.preheader, label %for.body.epil, !llvm.loop !14
for.cond1.preheader: ; preds = %for.cond1.preheader.loopexit.unr-lcssa, %for.body.epil, %while.body
%4 = load i32, ptr %r, align 4, !tbaa !6
%cmp260 = icmp sgt i32 %4, 0
br i1 %cmp260, label %for.body3, label %for.end28
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 ]
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv
%5 = trunc i64 %indvars.iv.next to i32
store i32 %5, ptr %arrayidx, align 16, !tbaa !12
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%arrayidx.1 = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv.next
%6 = trunc i64 %indvars.iv.next.1 to i32
store i32 %6, ptr %arrayidx.1, align 4, !tbaa !12
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%arrayidx.2 = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv.next.1
%7 = trunc i64 %indvars.iv.next.2 to i32
store i32 %7, ptr %arrayidx.2, align 8, !tbaa !12
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%arrayidx.3 = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv.next.2
%8 = trunc i64 %indvars.iv.next.3 to i32
store i32 %8, ptr %arrayidx.3, align 4, !tbaa !12
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond1.preheader.loopexit.unr-lcssa, label %for.body, !llvm.loop !16
for.body3: ; preds = %for.cond1.preheader, %if.end
%i.161 = phi i32 [ %inc27, %if.end ], [ 0, %for.cond1.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tid) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %pid) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t4) #6
call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %mes) #6
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tid, ptr noundef nonnull %pid, ptr noundef nonnull %t4, ptr noundef nonnull %mes)
%9 = load i32, ptr %tid, align 4, !tbaa !6
%dec = add nsw i32 %9, -1
%10 = load i32, ptr %pid, align 4, !tbaa !6
%dec6 = add nsw i32 %10, -1
%11 = load i8, ptr %mes, align 1, !tbaa !18
%cmp8 = icmp eq i8 %11, 67
%idxprom10 = sext i32 %dec to i64
br i1 %cmp8, label %if.then, label %if.else
if.then: ; preds = %for.body3
%solved = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %idxprom10, i32 1
%12 = load i32, ptr %solved, align 4, !tbaa !19
%inc12 = add nsw i32 %12, 1
store i32 %inc12, ptr %solved, align 4, !tbaa !19
%idxprom15 = sext i32 %dec6 to i64
%arrayidx16 = getelementptr inbounds [50 x [10 x i32]], ptr %wrong, i64 0, i64 %idxprom10, i64 %idxprom15
%13 = load i32, ptr %arrayidx16, align 4, !tbaa !6
%mul = mul nsw i32 %13, 1200
%14 = load i32, ptr %t4, align 4, !tbaa !6
%add17 = add nsw i32 %mul, %14
%penalty = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %idxprom10, i32 2
%15 = load i32, ptr %penalty, align 4, !tbaa !20
br label %if.end
if.else: ; preds = %for.body3
%idxprom23 = sext i32 %dec6 to i64
%arrayidx24 = getelementptr inbounds [50 x [10 x i32]], ptr %wrong, i64 0, i64 %idxprom10, i64 %idxprom23
%16 = load i32, ptr %arrayidx24, align 4, !tbaa !6
br label %if.end
if.end: ; preds = %if.else, %if.then
%.sink70 = phi i32 [ 1, %if.else ], [ %15, %if.then ]
%.sink = phi i32 [ %16, %if.else ], [ %add17, %if.then ]
%arrayidx24.sink = phi ptr [ %arrayidx24, %if.else ], [ %penalty, %if.then ]
%inc25 = add nsw i32 %.sink, %.sink70
store i32 %inc25, ptr %arrayidx24.sink, align 4, !tbaa !6
call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %mes) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t4) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %pid) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tid) #6
%inc27 = add nuw nsw i32 %i.161, 1
%17 = load i32, ptr %r, align 4, !tbaa !6
%cmp2 = icmp slt i32 %inc27, %17
br i1 %cmp2, label %for.body3, label %for.end28.loopexit, !llvm.loop !21
for.end28.loopexit: ; preds = %if.end
%.pre = load i32, ptr %t, align 4, !tbaa !6
br label %for.end28
for.end28: ; preds = %for.end28.loopexit, %for.cond1.preheader
%18 = phi i32 [ %.pre, %for.end28.loopexit ], [ %1, %for.cond1.preheader ]
%conv30 = sext i32 %18 to i64
call void @qsort(ptr noundef nonnull %team, i64 noundef %conv30, i64 noundef 12, ptr noundef nonnull @compare) #6
%19 = load i32, ptr %t, align 4, !tbaa !6
%cmp3262 = icmp sgt i32 %19, 0
br i1 %cmp3262, label %for.body34, label %for.end47
for.body34: ; preds = %for.end28, %for.body34
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.body34 ], [ 0, %for.end28 ]
%arrayidx36 = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv67
%20 = load i32, ptr %arrayidx36, align 4, !tbaa !12
%solved40 = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv67, i32 1
%21 = load i32, ptr %solved40, align 4, !tbaa !19
%penalty43 = getelementptr inbounds [50 x %struct.Team], ptr %team, i64 0, i64 %indvars.iv67, i32 2
%22 = load i32, ptr %penalty43, align 4, !tbaa !20
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20, i32 noundef %21, i32 noundef %22)
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%23 = load i32, ptr %t, align 4, !tbaa !6
%24 = sext i32 %23 to i64
%cmp32 = icmp slt i64 %indvars.iv.next68, %24
br i1 %cmp32, label %for.body34, label %for.end47, !llvm.loop !22
for.end47: ; preds = %for.body34, %for.end28
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %wrong) #6
call void @llvm.lifetime.end.p0(i64 600, ptr nonnull %team) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t, ptr noundef nonnull %p, ptr noundef nonnull %r)
%25 = load i32, ptr %t, align 4, !tbaa !6
%tobool.not = icmp eq i32 %25, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !23
while.end: ; preds = %for.end47, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %p) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: 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
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{i64 0, i64 4, !6, i64 4, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6}
!11 = !{i64 0, i64 4, !6}
!12 = !{!13, !7, i64 0}
!13 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!8, !8, i64 0}
!19 = !{!13, !7, i64 4}
!20 = !{!13, !7, i64 8}
!21 = distinct !{!21, !17}
!22 = distinct !{!22, !17}
!23 = distinct !{!23, !17}
|
#include<stdio.h>
int main()
{
long x;
scanf("%ld",&x);
long long i,j;
for( i=-120;i<121;i++){
for( j=-120;j<121;j++){
if(i*i*i*i*i-j*j*j*j*j==x){
printf("%lld %lld",i,j);
return 0;}
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254220/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254220/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i64, ptr %x, align 8, !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc13
%i.035 = phi i64 [ -120, %entry ], [ %inc14, %for.inc13 ]
%1 = mul i64 %i.035, %i.035
%2 = mul i64 %1, %i.035
%mul6 = mul i64 %2, %1
br label %for.body3
for.body3: ; preds = %for.inc.1, %for.cond1.preheader
%j.034 = phi i64 [ -120, %for.cond1.preheader ], [ %inc.1, %for.inc.1 ]
%3 = mul i64 %j.034, %j.034
%4 = mul i64 %3, %j.034
%mul10 = mul i64 %4, %3
%sub = sub nsw i64 %mul6, %mul10
%cmp11 = icmp eq i64 %sub, %0
br i1 %cmp11, label %if.then, label %for.inc
if.then: ; preds = %for.body3.1, %for.body3
%j.034.lcssa = phi i64 [ %j.034, %for.body3 ], [ %inc, %for.body3.1 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %i.035, i64 noundef %j.034.lcssa)
br label %cleanup
for.inc: ; preds = %for.body3
%inc = or i64 %j.034, 1
%exitcond.not = icmp eq i64 %inc, 121
br i1 %exitcond.not, label %for.inc13, label %for.body3.1, !llvm.loop !9
for.body3.1: ; preds = %for.inc
%5 = mul i64 %inc, %inc
%6 = mul i64 %5, %inc
%mul10.1 = mul i64 %6, %5
%sub.1 = sub nsw i64 %mul6, %mul10.1
%cmp11.1 = icmp eq i64 %sub.1, %0
br i1 %cmp11.1, label %if.then, label %for.inc.1
for.inc.1: ; preds = %for.body3.1
%inc.1 = add nsw i64 %j.034, 2
br label %for.body3
for.inc13: ; preds = %for.inc
%inc14 = add nsw i64 %i.035, 1
%exitcond38.not = icmp eq i64 %inc14, 121
br i1 %exitcond38.not, label %cleanup, label %for.cond1.preheader, !llvm.loop !11
cleanup: ; preds = %for.inc13, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !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 <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
int i, j, k;
long X;
long A, B;
long a, b;
long ans = 0;
scanf("%ld", &X);
for (j = 0; j < 1000; j++) {
A = j * j * j * j * j;
for (i = 0; i < 1000; i++) {
B = i * i * i * i * i;
if ((A - B) == X) {
printf("%d %d", j ,i);
return 0;
}
B *= (-1);
if ((A - B) == X) {
printf("%d %d", j, i * (-1));
return 0;
}
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254279/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254279/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %X) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i64, ptr %X, align 8, !tbaa !5
br label %for.body
for.body: ; preds = %entry, %for.inc24
%indvars.iv65 = phi i64 [ 0, %entry ], [ %indvars.iv.next66, %for.inc24 ]
%1 = trunc i64 %indvars.iv65 to i32
%2 = mul i32 %1, %1
%3 = mul i32 %2, %1
%mul3 = mul i32 %3, %2
%conv = zext i32 %mul3 to i64
br label %for.body7
for.body7: ; preds = %for.inc.1, %for.body
%indvars.iv = phi i64 [ 0, %for.body ], [ %indvars.iv.next.1, %for.inc.1 ]
%4 = trunc i64 %indvars.iv to i32
%5 = mul i32 %4, %4
%6 = mul i32 %5, %4
%mul11 = mul i32 %6, %5
%conv12 = zext i32 %mul11 to i64
%sub = sub nsw i64 %conv, %conv12
%cmp13 = icmp eq i64 %sub, %0
br i1 %cmp13, label %cleanup.sink.split, label %if.end
if.end: ; preds = %for.body7
%sub17 = add nuw nsw i64 %conv12, %conv
%cmp18 = icmp eq i64 %sub17, %0
br i1 %cmp18, label %if.then20, label %for.inc
if.then20: ; preds = %if.end.1, %if.end
%.lcssa79 = phi i32 [ %4, %if.end ], [ %8, %if.end.1 ]
%mul21 = sub nsw i32 0, %.lcssa79
br label %cleanup.sink.split
for.inc: ; preds = %if.end
%7 = trunc i64 %indvars.iv to i32
%8 = or i32 %7, 1
%9 = mul i32 %8, %8
%10 = mul i32 %9, %8
%mul11.1 = mul i32 %10, %9
%conv12.1 = zext i32 %mul11.1 to i64
%sub.1 = sub nsw i64 %conv, %conv12.1
%cmp13.1 = icmp eq i64 %sub.1, %0
br i1 %cmp13.1, label %cleanup.sink.split, label %if.end.1
if.end.1: ; preds = %for.inc
%sub17.1 = add nuw nsw i64 %conv12.1, %conv
%cmp18.1 = icmp eq i64 %sub17.1, %0
br i1 %cmp18.1, label %if.then20, label %for.inc.1
for.inc.1: ; preds = %if.end.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 1000
br i1 %exitcond.not.1, label %for.inc24, label %for.body7, !llvm.loop !9
for.inc24: ; preds = %for.inc.1
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%exitcond68.not = icmp eq i64 %indvars.iv.next66, 1000
br i1 %exitcond68.not, label %cleanup, label %for.body, !llvm.loop !11
cleanup.sink.split: ; preds = %for.body7, %for.inc, %if.then20
%mul21.sink = phi i32 [ %mul21, %if.then20 ], [ %4, %for.body7 ], [ %8, %for.inc ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1, i32 noundef %mul21.sink)
br label %cleanup
cleanup: ; preds = %for.inc24, %cleanup.sink.split
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %X) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define INDEX 1001
int main(void) {
long long int x;
scanf("%lld", &x);
long long int num[INDEX];
for (int i = 0; i < INDEX; i++) {
num[i] = (long long int ) i * (long long int ) i * (long long int ) i * (long long int ) i * (long long int ) i;
// printf("%lld\n", num[i]);
}
int flag = 0;
for (int i = 0; i < INDEX; i++) {
for (int j = 0; j < INDEX; j++) {
// printf("i, j: %d %d\n", i, j);
if ((num[i] - num[j]) == x) {
printf("%d %d\n", i, j);
flag = 1;
break;
} else if ((num[i] + num[j]) == x) {
printf("%d %d\n", i, (-1) * j);
flag = 1;
break;
}
}
if (flag) break;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254321/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254321/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [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:
%x = alloca i64, align 8
%num = alloca [1001 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
call void @llvm.lifetime.start.p0(i64 8008, ptr nonnull %num) #3
br label %for.body
for.cond9.preheader: ; preds = %for.body
%0 = load i64, ptr %x, align 8, !tbaa !5
br label %for.cond14.preheader
for.body: ; preds = %for.body.1, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.3, %for.body.1 ]
%1 = mul nuw nsw i64 %indvars.iv, %indvars.iv
%2 = mul i64 %1, %indvars.iv
%mul7 = mul i64 %2, %1
%arrayidx = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv
store i64 %mul7, ptr %arrayidx, align 16, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1001
br i1 %exitcond.not, label %for.cond9.preheader, label %for.body.1, !llvm.loop !9
for.body.1: ; preds = %for.body
%3 = mul nuw nsw i64 %indvars.iv.next, %indvars.iv.next
%4 = mul i64 %3, %indvars.iv.next
%mul7.1 = mul i64 %4, %3
%arrayidx.1 = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv.next
store i64 %mul7.1, ptr %arrayidx.1, align 8, !tbaa !5
%indvars.iv.next.1 = or i64 %indvars.iv, 2
%5 = mul nuw nsw i64 %indvars.iv.next.1, %indvars.iv.next.1
%6 = mul i64 %5, %indvars.iv.next.1
%mul7.2 = mul i64 %6, %5
%arrayidx.2 = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv.next.1
store i64 %mul7.2, ptr %arrayidx.2, align 16, !tbaa !5
%indvars.iv.next.2 = or i64 %indvars.iv, 3
%7 = mul nuw nsw i64 %indvars.iv.next.2, %indvars.iv.next.2
%8 = mul i64 %7, %indvars.iv.next.2
%mul7.3 = mul i64 %8, %7
%arrayidx.3 = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv.next.2
store i64 %mul7.3, ptr %arrayidx.3, align 8, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
br label %for.body
for.cond14.preheader: ; preds = %for.cond9.preheader, %for.inc41
%indvars.iv81 = phi i64 [ 0, %for.cond9.preheader ], [ %indvars.iv.next82, %for.inc41 ]
%arrayidx20 = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv81
%9 = load i64, ptr %arrayidx20, align 8, !tbaa !5
br label %for.body18
for.body18: ; preds = %for.inc36.1, %for.cond14.preheader
%indvars.iv77 = phi i64 [ 0, %for.cond14.preheader ], [ %indvars.iv.next78.1, %for.inc36.1 ]
%arrayidx22 = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv77
%10 = load i64, ptr %arrayidx22, align 16, !tbaa !5
%sub = sub nsw i64 %9, %10
%cmp23 = icmp eq i64 %sub, %0
br i1 %cmp23, label %if.then, label %if.else
if.then: ; preds = %for.body18.1, %for.body18
%indvars.iv77.lcssa = phi i64 [ %indvars.iv77, %for.body18 ], [ %indvars.iv.next78, %for.body18.1 ]
%11 = trunc i64 %indvars.iv81 to i32
%12 = trunc i64 %indvars.iv77.lcssa to i32
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11, i32 noundef %12)
br label %cleanup43
if.else: ; preds = %for.body18
%add = add nsw i64 %10, %9
%cmp30 = icmp eq i64 %add, %0
br i1 %cmp30, label %if.then32, label %for.inc36
if.then32: ; preds = %if.else.1, %if.else
%indvars.iv77.lcssa93 = phi i64 [ %indvars.iv77, %if.else ], [ %indvars.iv.next78, %if.else.1 ]
%13 = trunc i64 %indvars.iv81 to i32
%14 = trunc i64 %indvars.iv77.lcssa93 to i32
%mul33 = sub nsw i32 0, %14
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13, i32 noundef %mul33)
br label %cleanup43
for.inc36: ; preds = %if.else
%indvars.iv.next78 = or i64 %indvars.iv77, 1
%exitcond80 = icmp eq i64 %indvars.iv.next78, 1001
br i1 %exitcond80, label %for.inc41, label %for.body18.1, !llvm.loop !11
for.body18.1: ; preds = %for.inc36
%arrayidx22.1 = getelementptr inbounds [1001 x i64], ptr %num, i64 0, i64 %indvars.iv.next78
%15 = load i64, ptr %arrayidx22.1, align 8, !tbaa !5
%sub.1 = sub nsw i64 %9, %15
%cmp23.1 = icmp eq i64 %sub.1, %0
br i1 %cmp23.1, label %if.then, label %if.else.1
if.else.1: ; preds = %for.body18.1
%add.1 = add nsw i64 %15, %9
%cmp30.1 = icmp eq i64 %add.1, %0
br i1 %cmp30.1, label %if.then32, label %for.inc36.1
for.inc36.1: ; preds = %if.else.1
%indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
br label %for.body18
for.inc41: ; preds = %for.inc36
%indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
%exitcond84.not = icmp eq i64 %indvars.iv.next82, 1001
br i1 %exitcond84.not, label %cleanup43, label %for.cond14.preheader, !llvm.loop !12
cleanup43: ; preds = %for.inc41, %if.then, %if.then32
call void @llvm.lifetime.end.p0(i64 8008, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long 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}
|
/*
AOJ 2300
Calender Calors
2016/1/6
*/
#include<stdio.h>
#include<math.h>
#define COLOR_N_MAX 21
struct color
{
double l, a, b;
};
struct color colors[COLOR_N_MAX];
double dis[100000];
double max;
void calc_sum(int* com, int k)
{
int i, j;
double sum = 0;
for(i = 0; i < k; i++)
{
for(j = i + 1; j < k; j++)
{
sum += dis[com[i] * 100 + com[j]];
}
}
if(max < sum)
{
max = sum;
}
}
void combination(int l, int r, int k, int* com, int index)
{
int i;
if(l > r + 1) return;
else if(index > k) return ;
else if(index == k)
{
calc_sum(com, k);
return ;
}
for(i = l; i <= r; i++)
{
com[index] = i;
combination(i + 1, r, k, com, index + 1);
}
}
void answer(int color_n, int member_n)
{
int i, j;
double l_dis, a_dis, b_dis;
for(i = 0; i < color_n; i++)
{
for(j = i + 1; j < color_n; j++)
{
l_dis = fabs(colors[i].l - colors[j].l);
a_dis = fabs(colors[i].a - colors[j].a);
b_dis = fabs(colors[i].b - colors[j].b);
dis[i * 100 + j] = l_dis * l_dis + a_dis * a_dis + b_dis * b_dis;
}
}
int com[member_n];
combination(0, color_n - 1, member_n,com, 0);
}
int main(void)
{
int i, color_n, member_n;
scanf("%d %d", &color_n, &member_n);
for(i = 0; i < color_n; i++)
{
scanf("%lf %lf %lf", &colors[i].l, &colors[i].a, &colors[i].b);
}
answer(color_n, member_n);
printf("%lf\n", max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254387/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254387/source.c"
target datalayout = "e-m:e-p270: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.color = type { double, double, double }
@dis = dso_local local_unnamed_addr global [100000 x double] zeroinitializer, align 16
@max = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@colors = dso_local global [21 x %struct.color] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"%lf %lf %lf\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local void @calc_sum(ptr nocapture noundef readonly %com, i32 noundef %k) local_unnamed_addr #0 {
entry:
%cmp26 = icmp sgt i32 %k, 0
br i1 %cmp26, label %for.body.preheader, label %for.end12
for.body.preheader: ; preds = %entry
%0 = zext i32 %k to i64
%wide.trip.count36 = zext i32 %k to i64
br label %for.body
for.cond.loopexit: ; preds = %for.body3, %for.body
%sum.1.lcssa = phi double [ %sum.028, %for.body ], [ %add9, %for.body3 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond37.not = icmp eq i64 %indvars.iv.next34, %wide.trip.count36
br i1 %exitcond37.not, label %for.end12, label %for.body, !llvm.loop !5
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv33 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next34, %for.cond.loopexit ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond.loopexit ]
%sum.028 = phi double [ 0.000000e+00, %for.body.preheader ], [ %sum.1.lcssa, %for.cond.loopexit ]
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%cmp223 = icmp ult i64 %indvars.iv.next34, %0
br i1 %cmp223, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%arrayidx = getelementptr inbounds i32, ptr %com, i64 %indvars.iv33
%1 = load i32, ptr %arrayidx, align 4, !tbaa !7
%mul = mul nsw i32 %1, 100
br label %for.body3
for.body3: ; preds = %for.body3.lr.ph, %for.body3
%indvars.iv30 = phi i64 [ %indvars.iv, %for.body3.lr.ph ], [ %indvars.iv.next31, %for.body3 ]
%sum.125 = phi double [ %sum.028, %for.body3.lr.ph ], [ %add9, %for.body3 ]
%arrayidx5 = getelementptr inbounds i32, ptr %com, i64 %indvars.iv30
%2 = load i32, ptr %arrayidx5, align 4, !tbaa !7
%add6 = add nsw i32 %mul, %2
%idxprom7 = sext i32 %add6 to i64
%arrayidx8 = getelementptr inbounds [100000 x double], ptr @dis, i64 0, i64 %idxprom7
%3 = load double, ptr %arrayidx8, align 8, !tbaa !11
%add9 = fadd double %sum.125, %3
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%exitcond.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count36
br i1 %exitcond.not, label %for.cond.loopexit, label %for.body3, !llvm.loop !13
for.end12: ; preds = %for.cond.loopexit, %entry
%sum.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %sum.1.lcssa, %for.cond.loopexit ]
%4 = load double, ptr @max, align 8, !tbaa !11
%cmp13 = fcmp olt double %4, %sum.0.lcssa
br i1 %cmp13, label %if.then, label %if.end
if.then: ; preds = %for.end12
store double %sum.0.lcssa, ptr @max, align 8, !tbaa !11
br label %if.end
if.end: ; preds = %if.then, %for.end12
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @combination(i32 noundef %l, i32 noundef %r, i32 noundef %k, ptr nocapture noundef %com, i32 noundef %index) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %r, 1
%cmp = icmp slt i32 %add, %l
%cmp1 = icmp sgt i32 %index, %k
%or.cond = or i1 %cmp, %cmp1
br i1 %or.cond, label %cleanup, label %if.else3
if.else3: ; preds = %entry
%cmp4 = icmp eq i32 %index, %k
br i1 %cmp4, label %if.then5, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else3
%cmp8.not25 = icmp sgt i32 %l, %r
br i1 %cmp8.not25, label %cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %for.cond.preheader
%idxprom = sext i32 %index to i64
%arrayidx = getelementptr inbounds i32, ptr %com, i64 %idxprom
%add10 = add nsw i32 %index, 1
br label %for.body
if.then5: ; preds = %if.else3
%cmp26.i = icmp sgt i32 %index, 0
br i1 %cmp26.i, label %for.body.preheader.i, label %for.end12.i
for.body.preheader.i: ; preds = %if.then5
%0 = zext i32 %index to i64
br label %for.body.i
for.cond.loopexit.i: ; preds = %for.body3.i, %for.body.i
%sum.1.lcssa.i = phi double [ %sum.028.i, %for.body.i ], [ %add9.i, %for.body3.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond37.not.i = icmp eq i64 %indvars.iv.next34.i, %0
br i1 %exitcond37.not.i, label %for.end12.i, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.loopexit.i, %for.body.preheader.i
%indvars.iv33.i = phi i64 [ 0, %for.body.preheader.i ], [ %indvars.iv.next34.i, %for.cond.loopexit.i ]
%indvars.iv.i = phi i64 [ 1, %for.body.preheader.i ], [ %indvars.iv.next.i, %for.cond.loopexit.i ]
%sum.028.i = phi double [ 0.000000e+00, %for.body.preheader.i ], [ %sum.1.lcssa.i, %for.cond.loopexit.i ]
%indvars.iv.next34.i = add nuw nsw i64 %indvars.iv33.i, 1
%cmp223.i = icmp ult i64 %indvars.iv.next34.i, %0
br i1 %cmp223.i, label %for.body3.lr.ph.i, label %for.cond.loopexit.i
for.body3.lr.ph.i: ; preds = %for.body.i
%arrayidx.i = getelementptr inbounds i32, ptr %com, i64 %indvars.iv33.i
%1 = load i32, ptr %arrayidx.i, align 4, !tbaa !7
%mul.i = mul nsw i32 %1, 100
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i, %for.body3.lr.ph.i
%indvars.iv30.i = phi i64 [ %indvars.iv.i, %for.body3.lr.ph.i ], [ %indvars.iv.next31.i, %for.body3.i ]
%sum.125.i = phi double [ %sum.028.i, %for.body3.lr.ph.i ], [ %add9.i, %for.body3.i ]
%arrayidx5.i = getelementptr inbounds i32, ptr %com, i64 %indvars.iv30.i
%2 = load i32, ptr %arrayidx5.i, align 4, !tbaa !7
%add6.i = add nsw i32 %2, %mul.i
%idxprom7.i = sext i32 %add6.i to i64
%arrayidx8.i = getelementptr inbounds [100000 x double], ptr @dis, i64 0, i64 %idxprom7.i
%3 = load double, ptr %arrayidx8.i, align 8, !tbaa !11
%add9.i = fadd double %sum.125.i, %3
%indvars.iv.next31.i = add nuw nsw i64 %indvars.iv30.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next31.i, %0
br i1 %exitcond.not.i, label %for.cond.loopexit.i, label %for.body3.i, !llvm.loop !13
for.end12.i: ; preds = %for.cond.loopexit.i, %if.then5
%sum.0.lcssa.i = phi double [ 0.000000e+00, %if.then5 ], [ %sum.1.lcssa.i, %for.cond.loopexit.i ]
%4 = load double, ptr @max, align 8, !tbaa !11
%cmp13.i = fcmp olt double %4, %sum.0.lcssa.i
br i1 %cmp13.i, label %if.then.i, label %cleanup
if.then.i: ; preds = %for.end12.i
store double %sum.0.lcssa.i, ptr @max, align 8, !tbaa !11
br label %cleanup
for.body: ; preds = %for.body.lr.ph, %for.body
%i.026 = phi i32 [ %l, %for.body.lr.ph ], [ %add9, %for.body ]
store i32 %i.026, ptr %arrayidx, align 4, !tbaa !7
%add9 = add nsw i32 %i.026, 1
tail call void @combination(i32 noundef %add9, i32 noundef %r, i32 noundef %k, ptr noundef %com, i32 noundef %add10)
%exitcond.not = icmp eq i32 %i.026, %r
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !14
cleanup: ; preds = %for.body, %for.cond.preheader, %if.then.i, %for.end12.i, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @answer(i32 noundef %color_n, i32 noundef %member_n) local_unnamed_addr #2 {
entry:
%cmp46 = icmp sgt i32 %color_n, 0
br i1 %cmp46, label %for.body.preheader, label %for.end25
for.body.preheader: ; preds = %entry
%0 = zext i32 %color_n to i64
%wide.trip.count55 = zext i32 %color_n to i64
br label %for.body
for.cond.loopexit: ; preds = %for.body3, %middle.block, %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond56.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count55
br i1 %exitcond56.not, label %for.end25, label %for.body, !llvm.loop !15
for.body: ; preds = %for.body.preheader, %for.cond.loopexit
%indvars.iv52 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next53, %for.cond.loopexit ]
%indvars.iv = phi i64 [ 1, %for.body.preheader ], [ %indvars.iv.next, %for.cond.loopexit ]
%1 = xor i64 %indvars.iv52, -1
%2 = add nsw i64 %1, %wide.trip.count55
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%cmp244 = icmp ult i64 %indvars.iv.next53, %0
br i1 %cmp244, label %for.body3.lr.ph, label %for.cond.loopexit
for.body3.lr.ph: ; preds = %for.body
%arrayidx = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv52
%3 = load double, ptr %arrayidx, align 8, !tbaa !16
%a = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv52, i32 1
%4 = load double, ptr %a, align 8, !tbaa !18
%b = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv52, i32 2
%5 = load double, ptr %b, align 8, !tbaa !19
%mul = mul i64 %indvars.iv52, 100
%6 = and i64 %mul, 4294967292
%min.iters.check = icmp ult i64 %2, 2
br i1 %min.iters.check, label %for.body3.preheader, label %vector.ph
vector.ph: ; preds = %for.body3.lr.ph
%n.vec = and i64 %2, -2
%ind.end = add i64 %indvars.iv, %n.vec
%broadcast.splatinsert = insertelement <2 x double> poison, double %3, i64 0
%broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
%broadcast.splatinsert57 = insertelement <2 x double> poison, double %4, i64 0
%broadcast.splat58 = shufflevector <2 x double> %broadcast.splatinsert57, <2 x double> poison, <2 x i32> zeroinitializer
%broadcast.splatinsert59 = insertelement <2 x double> poison, double %5, i64 0
%broadcast.splat60 = shufflevector <2 x double> %broadcast.splatinsert59, <2 x double> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = add i64 %indvars.iv, %index
%7 = add i64 %offset.idx, 1
%8 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %offset.idx
%9 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %7
%10 = load double, ptr %8, align 8, !tbaa !16
%11 = load double, ptr %9, align 8, !tbaa !16
%12 = insertelement <2 x double> poison, double %10, i64 0
%13 = insertelement <2 x double> %12, double %11, i64 1
%14 = fsub <2 x double> %broadcast.splat, %13
%15 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %offset.idx, i32 1
%16 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %7, i32 1
%17 = load double, ptr %15, align 8, !tbaa !18
%18 = load double, ptr %16, align 8, !tbaa !18
%19 = insertelement <2 x double> poison, double %17, i64 0
%20 = insertelement <2 x double> %19, double %18, i64 1
%21 = fsub <2 x double> %broadcast.splat58, %20
%22 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %offset.idx, i32 2
%23 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %7, i32 2
%24 = load double, ptr %22, align 8, !tbaa !19
%25 = load double, ptr %23, align 8, !tbaa !19
%26 = insertelement <2 x double> poison, double %24, i64 0
%27 = insertelement <2 x double> %26, double %25, i64 1
%28 = fsub <2 x double> %broadcast.splat60, %27
%29 = fmul <2 x double> %21, %21
%30 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %14, <2 x double> %14, <2 x double> %29)
%31 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %28, <2 x double> %30)
%32 = add nuw nsw i64 %offset.idx, %6
%33 = getelementptr inbounds [100000 x double], ptr @dis, i64 0, i64 %32
store <2 x double> %31, ptr %33, align 8, !tbaa !11
%index.next = add nuw i64 %index, 2
%34 = icmp eq i64 %index.next, %n.vec
br i1 %34, label %middle.block, label %vector.body, !llvm.loop !20
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %2, %n.vec
br i1 %cmp.n, label %for.cond.loopexit, label %for.body3.preheader
for.body3.preheader: ; preds = %for.body3.lr.ph, %middle.block
%indvars.iv48.ph = phi i64 [ %indvars.iv, %for.body3.lr.ph ], [ %ind.end, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body3 ], [ %indvars.iv48.ph, %for.body3.preheader ]
%arrayidx5 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv48
%35 = load double, ptr %arrayidx5, align 8, !tbaa !16
%sub = fsub double %3, %35
%a11 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv48, i32 1
%36 = load double, ptr %a11, align 8, !tbaa !18
%sub12 = fsub double %4, %36
%b17 = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv48, i32 2
%37 = load double, ptr %b17, align 8, !tbaa !19
%sub18 = fsub double %5, %37
%mul19 = fmul double %sub12, %sub12
%38 = tail call double @llvm.fmuladd.f64(double %sub, double %sub, double %mul19)
%39 = tail call double @llvm.fmuladd.f64(double %sub18, double %sub18, double %38)
%40 = add nuw nsw i64 %indvars.iv48, %6
%arrayidx22 = getelementptr inbounds [100000 x double], ptr @dis, i64 0, i64 %40
store double %39, ptr %arrayidx22, align 8, !tbaa !11
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count55
br i1 %exitcond.not, label %for.cond.loopexit, label %for.body3, !llvm.loop !23
for.end25: ; preds = %for.cond.loopexit, %entry
%41 = zext i32 %member_n to i64
%vla = alloca i32, i64 %41, align 16
%sub26 = add nsw i32 %color_n, -1
call void @combination(i32 noundef 0, i32 noundef %sub26, i32 noundef %member_n, ptr noundef nonnull %vla, i32 noundef 0)
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%color_n = alloca i32, align 4
%member_n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %color_n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %member_n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %color_n, ptr noundef nonnull %member_n)
%0 = load i32, ptr %color_n, align 4, !tbaa !7
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv
%a = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv, i32 1
%b = getelementptr inbounds [21 x %struct.color], ptr @colors, i64 0, i64 %indvars.iv, i32 2
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %a, ptr noundef nonnull %b)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %color_n, align 4, !tbaa !7
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !24
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%3 = load i32, ptr %member_n, align 4, !tbaa !7
call void @answer(i32 noundef %.lcssa, i32 noundef %3)
%4 = load double, ptr @max, align 8, !tbaa !11
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %member_n) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %color_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 <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #6
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = 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 = !{!12, !12, i64 0}
!12 = !{!"double", !9, i64 0}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !12, i64 0}
!17 = !{!"color", !12, i64 0, !12, i64 8, !12, i64 16}
!18 = !{!17, !12, i64 8}
!19 = !{!17, !12, i64 16}
!20 = distinct !{!20, !6, !21, !22}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = distinct !{!23, !6, !22, !21}
!24 = distinct !{!24, !6}
|
#include<stdio.h>
#include<math.h>
int main(){
while(1){
int x,h;
double s;
scanf("%d\n%d\n",&x,&h);
if(x==0&&h==0)break;
s=sqrt(((x*x)/4.0)+(h*h));
printf("%.6f\n",(2.0*x*s)+(x*x));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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\0A%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%.6f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %h)
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp16 = icmp eq i32 %0, 0
%1 = load i32, ptr %h, align 4
%cmp117 = icmp eq i32 %1, 0
%or.cond18 = select i1 %cmp16, i1 %cmp117, i1 false
br i1 %or.cond18, label %while.end, label %cleanup
cleanup: ; preds = %entry, %cleanup
%2 = phi i32 [ %7, %cleanup ], [ %1, %entry ]
%3 = phi i32 [ %6, %cleanup ], [ %0, %entry ]
%mul = mul nsw i32 %3, %3
%conv = sitofp i32 %mul to double
%div = fmul double %conv, 2.500000e-01
%mul2 = mul nsw i32 %2, %2
%conv3 = sitofp i32 %mul2 to double
%add = fadd double %div, %conv3
%call4 = call double @sqrt(double noundef %add) #5
%4 = load i32, ptr %x, align 4, !tbaa !5
%conv5 = sitofp i32 %4 to double
%mul6 = fmul double %conv5, 2.000000e+00
%mul8 = mul nsw i32 %4, %4
%conv9 = sitofp i32 %mul8 to double
%5 = call double @llvm.fmuladd.f64(double %mul6, double %call4, double %conv9)
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %5)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %h)
%6 = load i32, ptr %x, align 4, !tbaa !5
%cmp = icmp eq i32 %6, 0
%7 = load i32, ptr %h, 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 %cleanup
while.end: ; preds = %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4
; 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(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
int main(void){
double x,h;
while(1){
scanf("%lf\n%lf\n",&x,&h);
if(x==0&&h==0)break;
printf("%lf\n",2*x*sqrt(pow((x/2),2)+pow(h,2))+pow(x,2));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254480/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\0A%lf\0A\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca double, align 8
%h = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #5
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %h)
%0 = load double, ptr %x, align 8, !tbaa !5
%cmp11 = fcmp oeq double %0, 0.000000e+00
%1 = load double, ptr %h, align 8
%cmp112 = fcmp oeq double %1, 0.000000e+00
%or.cond13 = select i1 %cmp11, i1 %cmp112, i1 false
br i1 %or.cond13, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%2 = phi double [ %6, %if.end ], [ %1, %entry ]
%3 = phi double [ %5, %if.end ], [ %0, %entry ]
%mul = fmul double %3, 2.000000e+00
%div = fmul double %3, 5.000000e-01
%square = fmul double %div, %div
%square8 = fmul double %2, %2
%add = fadd double %square, %square8
%sqrt = call double @llvm.sqrt.f64(double %add)
%square9 = fmul double %3, %3
%4 = call double @llvm.fmuladd.f64(double %mul, double %sqrt, double %square9)
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %4)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %h)
%5 = load double, ptr %x, align 8, !tbaa !5
%cmp = fcmp oeq double %5, 0.000000e+00
%6 = load double, ptr %h, align 8
%cmp1 = fcmp oeq double %6, 0.000000e+00
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<math.h>
int main(void)
{
double x,h,a;
double S;
while(1){
scanf("%lf",&x);
scanf("%lf",&h);
if(x == 0 && h == 0){
break;
}
S = x * x + 4 * x * sqrt(x * x / 4 + h * h) / 2;
printf("%f\n",S);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254538/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254538/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca double, align 8
%h = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #5
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%call111 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h)
%0 = load double, ptr %x, align 8, !tbaa !5
%cmp12 = fcmp oeq double %0, 0.000000e+00
%1 = load double, ptr %h, align 8
%cmp213 = fcmp oeq double %1, 0.000000e+00
%or.cond14 = select i1 %cmp12, i1 %cmp213, i1 false
br i1 %or.cond14, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%2 = phi double [ %7, %if.end ], [ %1, %entry ]
%3 = phi double [ %6, %if.end ], [ %0, %entry ]
%mul3 = fmul double %3, 4.000000e+00
%mul4 = fmul double %3, %3
%div = fmul double %mul4, 2.500000e-01
%4 = call double @llvm.fmuladd.f64(double %2, double %2, double %div)
%call6 = call double @sqrt(double noundef %4) #5
%mul7 = fmul double %mul3, %call6
%div8 = fmul double %mul7, 5.000000e-01
%5 = call double @llvm.fmuladd.f64(double %3, double %3, double %div8)
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %5)
%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 %h)
%6 = load double, ptr %x, align 8, !tbaa !5
%cmp = fcmp oeq double %6, 0.000000e+00
%7 = load double, ptr %h, align 8
%cmp2 = fcmp oeq double %7, 0.000000e+00
%or.cond = select i1 %cmp, i1 %cmp2, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define inf 5000000000000000
long long maxs(long long a,long long b,long long c){
if(a<=b && b<=c){return c-a;}
if(a<=c && c<=b){return b-a;}
if(b<=a && a<=c){return c-b;}
if(b<=c && c<=a){return a-b;}
if(c<=a && a<=b){return b-c;}
if(c<=b && b<=a){return a-c;}
}
long long hk(long long a,long long b){
if(a<b){return a;}return b;
}
int main(void){
long long h,w,i,d,min;
scanf("%lld%lld",&h,&w);
if((h*w)%3 == 0){printf("0\n");return 0;}
min = hk(h,w);
for(i = 1;i <= h-1;i++){
if(w%2 == 0){d = maxs(w*i,(w/2)*(h-i),(w/2)*(h-i));}
else{d = maxs(w*i,((w/2)+1)*(h-i),(w/2)*(h-i));}
min = hk(min,d);
}
for(i = 1;i <= w-1;i++){
if(h%2 == 0){d = maxs(h*i,(h/2)*(w-i),(h/2)*(w-i));}
else{d = maxs(h*i,((h/2)+1)*(w-i),(h/2)*(w-i));}
min = hk(min,d);
}
printf("%lld\n",min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254589/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254589/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @maxs(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #0 {
entry:
%cmp.not = icmp sgt i64 %a, %b
%cmp1.not = icmp sgt i64 %b, %c
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %if.end, label %if.then
if.then: ; preds = %entry
%sub = sub nsw i64 %c, %a
br label %if.end31
if.end: ; preds = %entry
%cmp2.not = icmp sgt i64 %a, %c
%cmp4.not = icmp sgt i64 %c, %b
%or.cond65 = or i1 %cmp2.not, %cmp4.not
br i1 %or.cond65, label %if.end7, label %if.then5
if.then5: ; preds = %if.end
%sub6 = sub nsw i64 %b, %a
br label %if.end31
if.end7: ; preds = %if.end
%cmp8.not = icmp sgt i64 %b, %a
%brmerge = or i1 %cmp8.not, %cmp2.not
br i1 %brmerge, label %if.end13, label %if.then11
if.then11: ; preds = %if.end7
%sub12 = sub nsw i64 %c, %b
br label %if.end31
if.end13: ; preds = %if.end7
%cmp16.not = icmp sgt i64 %c, %a
%or.cond66 = or i1 %cmp1.not, %cmp16.not
br i1 %or.cond66, label %if.end19, label %if.then17
if.then17: ; preds = %if.end13
%sub18 = sub nsw i64 %a, %b
br label %if.end31
if.end19: ; preds = %if.end13
%brmerge67 = or i1 %cmp.not, %cmp16.not
br i1 %brmerge67, label %if.end25, label %if.then23
if.then23: ; preds = %if.end19
%sub24 = sub nsw i64 %b, %c
br label %if.end31
if.end25: ; preds = %if.end19
br i1 %cmp4.not, label %if.end31, label %land.lhs.true27
land.lhs.true27: ; preds = %if.end25
%sub30 = sub nsw i64 %a, %c
%spec.select = select i1 %cmp8.not, i64 undef, i64 %sub30
br label %if.end31
if.end31: ; preds = %land.lhs.true27, %if.then, %if.then5, %if.then11, %if.then17, %if.then23, %if.end25
%retval.0 = phi i64 [ %sub, %if.then ], [ %sub6, %if.then5 ], [ %sub12, %if.then11 ], [ %sub18, %if.then17 ], [ %sub24, %if.then23 ], [ undef, %if.end25 ], [ %spec.select, %land.lhs.true27 ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @hk(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%h = alloca i64, align 8
%w = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #7
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i64, ptr %h, align 8, !tbaa !5
%1 = load i64, ptr %w, align 8, !tbaa !5
%mul = mul nsw i64 %1, %0
%rem = srem i64 %mul, 3
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.end: ; preds = %entry
%a.b.i = call i64 @llvm.smin.i64(i64 %0, i64 %1)
%cmp3.not.not158 = icmp sgt i64 %0, 1
br i1 %cmp3.not.not158, label %for.body.lr.ph, label %for.cond24.preheader
for.body.lr.ph: ; preds = %if.end
%2 = and i64 %1, 1
%cmp5 = icmp eq i64 %2, 0
%div15 = sdiv i64 %1, 2
%add = add nsw i64 %div15, 1
%div.neg = sdiv i64 %1, -2
br i1 %cmp5, label %for.body.us.preheader, label %for.body
for.body.us.preheader: ; preds = %for.body.lr.ph
%3 = add i64 %0, -1
%xtraiter = and i64 %3, 1
%4 = icmp eq i64 %0, 2
br i1 %4, label %for.cond24.preheader.loopexit.unr-lcssa, label %for.body.us.preheader.new
for.body.us.preheader.new: ; preds = %for.body.us.preheader
%unroll_iter = and i64 %3, -2
br label %for.body.us
for.body.us: ; preds = %for.body.us, %for.body.us.preheader.new
%min.0160.us = phi i64 [ %a.b.i, %for.body.us.preheader.new ], [ %a.b.i100.us.1, %for.body.us ]
%i.0159.us = phi i64 [ 1, %for.body.us.preheader.new ], [ %inc.us.1, %for.body.us ]
%niter = phi i64 [ 0, %for.body.us.preheader.new ], [ %niter.next.1, %for.body.us ]
%mul7.us = mul nsw i64 %i.0159.us, %1
%sub8.us = sub nsw i64 %0, %i.0159.us
%mul9.us.neg = mul i64 %div.neg, %sub8.us
%sub18.i.us = add i64 %mul9.us.neg, %mul7.us
%d.0.us = call i64 @llvm.abs.i64(i64 %sub18.i.us, i1 true)
%a.b.i100.us = call i64 @llvm.smin.i64(i64 %min.0160.us, i64 %d.0.us)
%inc.us = add nuw nsw i64 %i.0159.us, 1
%mul7.us.1 = mul nsw i64 %inc.us, %1
%sub8.us.1 = sub nsw i64 %0, %inc.us
%mul9.us.neg.1 = mul i64 %div.neg, %sub8.us.1
%sub18.i.us.1 = add i64 %mul9.us.neg.1, %mul7.us.1
%d.0.us.1 = call i64 @llvm.abs.i64(i64 %sub18.i.us.1, i1 true)
%a.b.i100.us.1 = call i64 @llvm.smin.i64(i64 %a.b.i100.us, i64 %d.0.us.1)
%inc.us.1 = add nuw nsw i64 %i.0159.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.cond24.preheader.loopexit.unr-lcssa, label %for.body.us, !llvm.loop !9
for.cond24.preheader.loopexit.unr-lcssa: ; preds = %for.body.us, %for.body.us.preheader
%a.b.i100.us.lcssa.ph = phi i64 [ undef, %for.body.us.preheader ], [ %a.b.i100.us.1, %for.body.us ]
%min.0160.us.unr = phi i64 [ %a.b.i, %for.body.us.preheader ], [ %a.b.i100.us.1, %for.body.us ]
%i.0159.us.unr = phi i64 [ 1, %for.body.us.preheader ], [ %inc.us.1, %for.body.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond24.preheader, label %for.body.us.epil
for.body.us.epil: ; preds = %for.cond24.preheader.loopexit.unr-lcssa
%mul7.us.epil = mul nsw i64 %i.0159.us.unr, %1
%sub8.us.epil = sub nsw i64 %0, %i.0159.us.unr
%mul9.us.neg.epil = mul i64 %div.neg, %sub8.us.epil
%sub18.i.us.epil = add i64 %mul9.us.neg.epil, %mul7.us.epil
%d.0.us.epil = call i64 @llvm.abs.i64(i64 %sub18.i.us.epil, i1 true)
%a.b.i100.us.epil = call i64 @llvm.smin.i64(i64 %min.0160.us.unr, i64 %d.0.us.epil)
br label %for.cond24.preheader
for.cond24.preheader: ; preds = %if.end22, %for.body.us.epil, %for.cond24.preheader.loopexit.unr-lcssa, %if.end
%min.0.lcssa = phi i64 [ %a.b.i, %if.end ], [ %a.b.i100.us.lcssa.ph, %for.cond24.preheader.loopexit.unr-lcssa ], [ %a.b.i100.us.epil, %for.body.us.epil ], [ %a.b.i100, %if.end22 ]
%cmp26.not.not161 = icmp sgt i64 %1, 1
br i1 %cmp26.not.not161, label %for.body27.lr.ph, label %for.end53
for.body27.lr.ph: ; preds = %for.cond24.preheader
%5 = and i64 %0, 1
%cmp29 = icmp eq i64 %5, 0
%div41 = sdiv i64 %0, 2
%add42 = add nsw i64 %div41, 1
%div32.neg = sdiv i64 %0, -2
br i1 %cmp29, label %for.body27.us.preheader, label %for.body27
for.body27.us.preheader: ; preds = %for.body27.lr.ph
%6 = add i64 %1, -1
%xtraiter178 = and i64 %6, 1
%7 = icmp eq i64 %1, 2
br i1 %7, label %for.end53.loopexit.unr-lcssa, label %for.body27.us.preheader.new
for.body27.us.preheader.new: ; preds = %for.body27.us.preheader
%unroll_iter181 = and i64 %6, -2
br label %for.body27.us
for.body27.us: ; preds = %for.body27.us, %for.body27.us.preheader.new
%min.1163.us = phi i64 [ %min.0.lcssa, %for.body27.us.preheader.new ], [ %a.b.i156.us.1, %for.body27.us ]
%i.1162.us = phi i64 [ 1, %for.body27.us.preheader.new ], [ %inc52.us.1, %for.body27.us ]
%niter182 = phi i64 [ 0, %for.body27.us.preheader.new ], [ %niter182.next.1, %for.body27.us ]
%mul31.us = mul nsw i64 %i.1162.us, %0
%sub33.us = sub nsw i64 %1, %i.1162.us
%mul34.us.neg = mul i64 %div32.neg, %sub33.us
%sub18.i116.us = add i64 %mul34.us.neg, %mul31.us
%d.1.us = call i64 @llvm.abs.i64(i64 %sub18.i116.us, i1 true)
%a.b.i156.us = call i64 @llvm.smin.i64(i64 %min.1163.us, i64 %d.1.us)
%inc52.us = add nuw nsw i64 %i.1162.us, 1
%mul31.us.1 = mul nsw i64 %inc52.us, %0
%sub33.us.1 = sub nsw i64 %1, %inc52.us
%mul34.us.neg.1 = mul i64 %div32.neg, %sub33.us.1
%sub18.i116.us.1 = add i64 %mul34.us.neg.1, %mul31.us.1
%d.1.us.1 = call i64 @llvm.abs.i64(i64 %sub18.i116.us.1, i1 true)
%a.b.i156.us.1 = call i64 @llvm.smin.i64(i64 %a.b.i156.us, i64 %d.1.us.1)
%inc52.us.1 = add nuw nsw i64 %i.1162.us, 2
%niter182.next.1 = add i64 %niter182, 2
%niter182.ncmp.1 = icmp eq i64 %niter182.next.1, %unroll_iter181
br i1 %niter182.ncmp.1, label %for.end53.loopexit.unr-lcssa, label %for.body27.us, !llvm.loop !11
for.body: ; preds = %for.body.lr.ph, %if.end22
%min.0160 = phi i64 [ %a.b.i100, %if.end22 ], [ %a.b.i, %for.body.lr.ph ]
%i.0159 = phi i64 [ %inc, %if.end22 ], [ 1, %for.body.lr.ph ]
%mul14 = mul nsw i64 %i.0159, %1
%sub16 = sub nsw i64 %0, %i.0159
%mul17 = mul nsw i64 %sub16, %add
%mul20 = mul nsw i64 %sub16, %div15
%cmp.not.i77 = icmp sgt i64 %mul14, %mul17
%cmp1.not.i = icmp sgt i64 %mul17, %mul20
%or.cond.i = or i1 %cmp.not.i77, %cmp1.not.i
br i1 %or.cond.i, label %if.end.i81, label %if.then.i78
if.then.i78: ; preds = %for.body
%sub.i79 = sub nsw i64 %mul20, %mul14
br label %if.end22
if.end.i81: ; preds = %for.body
%cmp2.not.i82 = icmp sgt i64 %mul14, %mul20
%cmp4.not.i = icmp sgt i64 %mul20, %mul17
%or.cond65.i = or i1 %cmp2.not.i82, %cmp4.not.i
br i1 %or.cond65.i, label %if.end7.i85, label %if.then5.i83
if.then5.i83: ; preds = %if.end.i81
%sub6.i84 = sub nsw i64 %mul17, %mul14
br label %if.end22
if.end7.i85: ; preds = %if.end.i81
%cmp8.not.i86 = icmp sgt i64 %mul17, %mul14
%brmerge.i87 = or i1 %cmp8.not.i86, %cmp2.not.i82
br i1 %brmerge.i87, label %if.end13.i89, label %if.then11.i88
if.then11.i88: ; preds = %if.end7.i85
%sub12.i = sub i64 0, %sub16
br label %if.end22
if.end13.i89: ; preds = %if.end7.i85
%cmp16.not.i90 = icmp sgt i64 %mul20, %mul14
%or.cond66.i = or i1 %cmp1.not.i, %cmp16.not.i90
br i1 %or.cond66.i, label %if.end19.i93, label %if.then17.i91
if.then17.i91: ; preds = %if.end13.i89
%sub18.i92 = sub nsw i64 %mul14, %mul17
br label %if.end22
if.end19.i93: ; preds = %if.end13.i89
%brmerge67.i94 = or i1 %cmp.not.i77, %cmp16.not.i90
%brmerge67.i94.not = xor i1 %brmerge67.i94, true
%brmerge = or i1 %cmp4.not.i, %brmerge67.i94.not
br i1 %brmerge, label %if.end22, label %land.lhs.true27.i
land.lhs.true27.i: ; preds = %if.end19.i93
%sub30.i97 = sub nsw i64 %mul14, %mul20
%spec.select.i98 = select i1 %cmp8.not.i86, i64 undef, i64 %sub30.i97
br label %if.end22
if.end22: ; preds = %if.end19.i93, %land.lhs.true27.i, %if.then17.i91, %if.then11.i88, %if.then5.i83, %if.then.i78
%d.0 = phi i64 [ %sub.i79, %if.then.i78 ], [ %sub6.i84, %if.then5.i83 ], [ %sub12.i, %if.then11.i88 ], [ %sub18.i92, %if.then17.i91 ], [ %spec.select.i98, %land.lhs.true27.i ], [ %sub16, %if.end19.i93 ]
%a.b.i100 = call i64 @llvm.smin.i64(i64 %min.0160, i64 %d.0)
%inc = add nuw nsw i64 %i.0159, 1
%exitcond.not = icmp eq i64 %inc, %0
br i1 %exitcond.not, label %for.cond24.preheader, label %for.body, !llvm.loop !9
for.body27: ; preds = %for.body27.lr.ph, %if.end49
%min.1163 = phi i64 [ %a.b.i156, %if.end49 ], [ %min.0.lcssa, %for.body27.lr.ph ]
%i.1162 = phi i64 [ %inc52, %if.end49 ], [ 1, %for.body27.lr.ph ]
%mul40 = mul nsw i64 %i.1162, %0
%sub43 = sub nsw i64 %1, %i.1162
%mul44 = mul nsw i64 %sub43, %add42
%mul47 = mul nsw i64 %sub43, %div41
%cmp.not.i125 = icmp sgt i64 %mul40, %mul44
%cmp1.not.i126 = icmp sgt i64 %mul44, %mul47
%or.cond.i127 = or i1 %cmp.not.i125, %cmp1.not.i126
br i1 %or.cond.i127, label %if.end.i131, label %if.then.i128
if.then.i128: ; preds = %for.body27
%sub.i129 = sub nsw i64 %mul47, %mul40
br label %if.end49
if.end.i131: ; preds = %for.body27
%cmp2.not.i132 = icmp sgt i64 %mul40, %mul47
%cmp4.not.i133 = icmp sgt i64 %mul47, %mul44
%or.cond65.i134 = or i1 %cmp2.not.i132, %cmp4.not.i133
br i1 %or.cond65.i134, label %if.end7.i137, label %if.then5.i135
if.then5.i135: ; preds = %if.end.i131
%sub6.i136 = sub nsw i64 %mul44, %mul40
br label %if.end49
if.end7.i137: ; preds = %if.end.i131
%cmp8.not.i138 = icmp sgt i64 %mul44, %mul40
%brmerge.i139 = or i1 %cmp8.not.i138, %cmp2.not.i132
br i1 %brmerge.i139, label %if.end13.i142, label %if.then11.i140
if.then11.i140: ; preds = %if.end7.i137
%sub12.i141 = sub i64 0, %sub43
br label %if.end49
if.end13.i142: ; preds = %if.end7.i137
%cmp16.not.i143 = icmp sgt i64 %mul47, %mul40
%or.cond66.i144 = or i1 %cmp1.not.i126, %cmp16.not.i143
br i1 %or.cond66.i144, label %if.end19.i147, label %if.then17.i145
if.then17.i145: ; preds = %if.end13.i142
%sub18.i146 = sub nsw i64 %mul40, %mul44
br label %if.end49
if.end19.i147: ; preds = %if.end13.i142
%brmerge67.i148 = or i1 %cmp.not.i125, %cmp16.not.i143
%brmerge67.i148.not = xor i1 %brmerge67.i148, true
%brmerge157 = or i1 %cmp4.not.i133, %brmerge67.i148.not
br i1 %brmerge157, label %if.end49, label %land.lhs.true27.i152
land.lhs.true27.i152: ; preds = %if.end19.i147
%sub30.i153 = sub nsw i64 %mul40, %mul47
%spec.select.i154 = select i1 %cmp8.not.i138, i64 undef, i64 %sub30.i153
br label %if.end49
if.end49: ; preds = %if.end19.i147, %land.lhs.true27.i152, %if.then17.i145, %if.then11.i140, %if.then5.i135, %if.then.i128
%d.1 = phi i64 [ %sub.i129, %if.then.i128 ], [ %sub6.i136, %if.then5.i135 ], [ %sub12.i141, %if.then11.i140 ], [ %sub18.i146, %if.then17.i145 ], [ %spec.select.i154, %land.lhs.true27.i152 ], [ %sub43, %if.end19.i147 ]
%a.b.i156 = call i64 @llvm.smin.i64(i64 %min.1163, i64 %d.1)
%inc52 = add nuw nsw i64 %i.1162, 1
%exitcond169.not = icmp eq i64 %inc52, %1
br i1 %exitcond169.not, label %for.end53, label %for.body27, !llvm.loop !11
for.end53.loopexit.unr-lcssa: ; preds = %for.body27.us, %for.body27.us.preheader
%a.b.i156.us.lcssa.ph = phi i64 [ undef, %for.body27.us.preheader ], [ %a.b.i156.us.1, %for.body27.us ]
%min.1163.us.unr = phi i64 [ %min.0.lcssa, %for.body27.us.preheader ], [ %a.b.i156.us.1, %for.body27.us ]
%i.1162.us.unr = phi i64 [ 1, %for.body27.us.preheader ], [ %inc52.us.1, %for.body27.us ]
%lcmp.mod179.not = icmp eq i64 %xtraiter178, 0
br i1 %lcmp.mod179.not, label %for.end53, label %for.body27.us.epil
for.body27.us.epil: ; preds = %for.end53.loopexit.unr-lcssa
%mul31.us.epil = mul nsw i64 %i.1162.us.unr, %0
%sub33.us.epil = sub nsw i64 %1, %i.1162.us.unr
%mul34.us.neg.epil = mul i64 %div32.neg, %sub33.us.epil
%sub18.i116.us.epil = add i64 %mul34.us.neg.epil, %mul31.us.epil
%d.1.us.epil = call i64 @llvm.abs.i64(i64 %sub18.i116.us.epil, i1 true)
%a.b.i156.us.epil = call i64 @llvm.smin.i64(i64 %min.1163.us.unr, i64 %d.1.us.epil)
br label %for.end53
for.end53: ; preds = %if.end49, %for.body27.us.epil, %for.end53.loopexit.unr-lcssa, %for.cond24.preheader
%min.1.lcssa = phi i64 [ %min.0.lcssa, %for.cond24.preheader ], [ %a.b.i156.us.lcssa.ph, %for.end53.loopexit.unr-lcssa ], [ %a.b.i156.us.epil, %for.body27.us.epil ], [ %a.b.i156, %if.end49 ]
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %min.1.lcssa)
br label %cleanup
cleanup: ; preds = %for.end53, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #7
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; 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.smin.i64(i64, i64) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #6
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 "no-trapping-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}
|
#include <stdio.h>
#include <math.h>
#define S(num) ((num) * (num))
typedef struct {
float vertical;
float horizontal;
float height;
} DATA;
int main(void)
{
DATA cheese;
float min_line;
float in_circle;
int n;
int i;
while (1){
scanf("%f %f %f", &cheese.vertical, &cheese.horizontal, &cheese.height);
if (cheese.vertical == 0){
break;
}
scanf("%d", &n);
min_line = sqrt(S(cheese.vertical) + S(cheese.horizontal));
if (sqrt(S(cheese.vertical) + S(cheese.height)) < min_line){
min_line = sqrt(S(cheese.vertical) + S(cheese.height));
}
if (sqrt(S(cheese.horizontal) + S(cheese.height)) < min_line){
min_line = sqrt(S(cheese.horizontal) + S(cheese.height));
}
for (i = 0; i < n; i++){
scanf("%f", &in_circle);
if (in_circle * 2 > min_line){
printf("OK\n");
}
else {
printf("NA\n");
}
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254646/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254646/source.c"
target datalayout = "e-m:e-p270: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 { float, float, float }
@.str = private unnamed_addr constant [9 x i8] c"%f %f %f\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"%f\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
@str.5 = private unnamed_addr constant [3 x i8] c"OK\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%cheese = alloca %struct.DATA, align 4
%in_circle = alloca float, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %cheese) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in_circle) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%horizontal = getelementptr inbounds %struct.DATA, ptr %cheese, i64 0, i32 1
%height = getelementptr inbounds %struct.DATA, ptr %cheese, i64 0, i32 2
%call71 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cheese, ptr noundef nonnull %horizontal, ptr noundef nonnull %height)
%0 = load float, ptr %cheese, align 4, !tbaa !5
%cmp72 = fcmp oeq float %0, 0.000000e+00
br i1 %cmp72, label %while.end, label %if.end
while.cond.loopexit: ; preds = %for.body, %if.end
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %cheese, ptr noundef nonnull %horizontal, ptr noundef nonnull %height)
%1 = load float, ptr %cheese, align 4, !tbaa !5
%cmp = fcmp oeq float %1, 0.000000e+00
br i1 %cmp, label %while.end, label %if.end
if.end: ; preds = %entry, %while.cond.loopexit
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n)
%2 = load float, ptr %cheese, align 4, !tbaa !5
%3 = load float, ptr %horizontal, align 4, !tbaa !10
%mul7 = fmul float %3, %3
%4 = call float @llvm.fmuladd.f32(float %2, float %2, float %mul7)
%sqrt65 = call float @llvm.sqrt.f32(float %4)
%5 = load float, ptr %height, align 4, !tbaa !11
%mul14 = fmul float %5, %5
%6 = call float @llvm.fmuladd.f32(float %2, float %2, float %mul14)
%conv15 = fpext float %6 to double
%sqrt = call double @llvm.sqrt.f64(double %conv15)
%conv17 = fpext float %sqrt65 to double
%cmp18 = fcmp olt double %sqrt, %conv17
%sqrt66 = call float @llvm.sqrt.f32(float %6)
%.pre = fpext float %sqrt66 to double
%conv37.pre-phi = select i1 %cmp18, double %.pre, double %conv17
%min_line.0 = select i1 %cmp18, float %sqrt66, float %sqrt65
%7 = call float @llvm.fmuladd.f32(float %3, float %3, float %mul14)
%conv35 = fpext float %7 to double
%sqrt67 = call double @llvm.sqrt.f64(double %conv35)
%cmp38 = fcmp olt double %sqrt67, %conv37.pre-phi
%sqrt68 = call float @llvm.sqrt.f32(float %7)
%min_line.1 = select i1 %cmp38, float %sqrt68, float %min_line.0
%8 = load i32, ptr %n, align 4, !tbaa !12
%cmp5069 = icmp sgt i32 %8, 0
br i1 %cmp5069, label %for.body, label %while.cond.loopexit
for.body: ; preds = %if.end, %for.body
%i.070 = phi i32 [ %inc, %for.body ], [ 0, %if.end ]
%call52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %in_circle)
%9 = load float, ptr %in_circle, align 4, !tbaa !14
%mul = fmul float %9, 2.000000e+00
%cmp53 = fcmp ogt float %mul, %min_line.1
%str.5.str = select i1 %cmp53, ptr @str.5, ptr @str
%puts64 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.str)
%inc = add nuw nsw i32 %i.070, 1
%10 = load i32, ptr %n, align 4, !tbaa !12
%cmp50 = icmp slt i32 %inc, %10
br i1 %cmp50, label %for.body, label %while.cond.loopexit, !llvm.loop !15
while.end: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in_circle) #6
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %cheese) #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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.sqrt.f32(float) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
float m1, m2, n1, n2;
float ans_m1, ans_n1;
float x, y;
float a, b, c;
float a1, b1, c1;
while (scanf("%f %f %f %f %f %f", &m1, &m2, &ans_m1, &n1, &n2, &ans_n1) != EOF){
a = (m1 * n2) - (m2 * n1);
b = 1.0 / a;
a1 = m1;
m1 = n2 * b;
m2 = -1 * m2 * b;
n1 = -1 * n1 * b;
n2 = a1 * b;
x = (m1 * ans_m1) + (m2 * ans_n1);
y = (n1 * ans_m1) + (n2 * ans_n1);
printf("%.3f %.3f\n", x, y);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254703/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254703/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [18 x i8] c"%f %f %f %f %f %f\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m1 = alloca float, align 4
%m2 = alloca float, align 4
%n1 = alloca float, align 4
%n2 = alloca float, align 4
%ans_m1 = alloca float, align 4
%ans_n1 = alloca float, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n2) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ans_m1) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ans_n1) #4
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m1, ptr noundef nonnull %m2, ptr noundef nonnull %ans_m1, ptr noundef nonnull %n1, ptr noundef nonnull %n2, ptr noundef nonnull %ans_n1)
%cmp.not19 = icmp eq i32 %call18, -1
br i1 %cmp.not19, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load float, ptr %m1, align 4, !tbaa !5
%1 = load float, ptr %n2, align 4, !tbaa !5
%2 = load float, ptr %m2, align 4, !tbaa !5
%3 = load float, ptr %n1, align 4, !tbaa !5
%4 = fneg float %2
%neg = fmul float %3, %4
%5 = call float @llvm.fmuladd.f32(float %0, float %1, float %neg)
%conv2 = fdiv float 1.000000e+00, %5
%mul = fmul float %1, %conv2
store float %mul, ptr %m1, align 4, !tbaa !5
%mul4 = fmul float %conv2, %4
store float %mul4, ptr %m2, align 4, !tbaa !5
%mul5 = fneg float %3
%mul6 = fmul float %conv2, %mul5
store float %mul6, ptr %n1, align 4, !tbaa !5
%mul7 = fmul float %0, %conv2
store float %mul7, ptr %n2, align 4, !tbaa !5
%6 = load float, ptr %ans_m1, align 4, !tbaa !5
%7 = load float, ptr %ans_n1, align 4, !tbaa !5
%mul9 = fmul float %mul4, %7
%8 = call float @llvm.fmuladd.f32(float %mul, float %6, float %mul9)
%mul11 = fmul float %mul7, %7
%9 = call float @llvm.fmuladd.f32(float %mul6, float %6, float %mul11)
%conv12 = fpext float %8 to double
%conv13 = fpext float %9 to double
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv12, double noundef %conv13)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m1, ptr noundef nonnull %m2, ptr noundef nonnull %ans_m1, ptr noundef nonnull %n1, ptr noundef nonnull %n2, ptr noundef nonnull %ans_n1)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ans_n1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ans_m1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n1) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m2) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
double a,b,c,d,e,f;
double y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
y = (f-d/a*c)/(-d/a*b+e);
printf("%.3lf %.3lf\n",(c - b*y)/a,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254747/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254747/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not8 = icmp eq i32 %call7, -1
br i1 %cmp.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %f, align 8, !tbaa !5
%1 = load double, ptr %d, align 8, !tbaa !5
%2 = load double, ptr %a, align 8, !tbaa !5
%3 = load double, ptr %c, align 8, !tbaa !5
%4 = fneg double %1
%neg = fdiv double %4, %2
%5 = call double @llvm.fmuladd.f64(double %neg, double %3, double %0)
%6 = load double, ptr %b, align 8, !tbaa !5
%7 = load double, ptr %e, align 8, !tbaa !5
%8 = call double @llvm.fmuladd.f64(double %neg, double %6, double %7)
%div2 = fdiv double %5, %8
%neg3 = fneg double %6
%9 = call double @llvm.fmuladd.f64(double %neg3, double %div2, double %3)
%div4 = fdiv double %9, %2
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div4, double noundef %div2)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
double a,b,c,d,e,f;
double x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
x = (e*c-b*f) / (e*a-b*d);
y = (c*d-a*f) / (b*d-e*a);
if(x == -0.0) x = 0;
if(y == -0.0) y = 0;
printf("%.3f %.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254790/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254790/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not17 = icmp eq i32 %call16, -1
br i1 %cmp.not17, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %e, align 8, !tbaa !5
%1 = load double, ptr %c, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = fneg double %2
%5 = load double, ptr %a, align 8, !tbaa !5
%6 = load double, ptr %d, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %3, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = insertelement <2 x double> %14, double %5, i64 1
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = insertelement <2 x double> poison, double %5, i64 0
%18 = insertelement <2 x double> %17, double %0, i64 1
%19 = fneg <2 x double> %18
%20 = insertelement <2 x double> %7, double %5, i64 1
%21 = fmul <2 x double> %20, %19
%22 = insertelement <2 x double> %14, double %2, i64 1
%23 = insertelement <2 x double> poison, double %6, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> %21)
%26 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 0, i32 2>
%27 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 1, i32 3>
%28 = fdiv <2 x double> %26, %27
%29 = fcmp oeq <2 x double> %28, zeroinitializer
%30 = extractelement <2 x i1> %29, i64 1
%31 = extractelement <2 x double> %28, i64 1
%x.0 = select i1 %30, double 0.000000e+00, double %31
%32 = extractelement <2 x i1> %29, i64 0
%33 = extractelement <2 x double> %28, i64 0
%y.0 = select i1 %32, double 0.000000e+00, double %33
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0, double noundef %y.0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
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 <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
double a1,b1,e1,a2,b2,e2;
double x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a1,&b1,&e1,&a2,&b2,&e2) != EOF){
// x = (e1*b2 - b1*e2) / (a1*b2 - b1*a2);
// y = (e2*a1 - e1*a2) / (a1*b2 - a2*b1);
x = e1*b2 / (a1*b2 - b1*a2) - b1*e2 / (a1*b2 - b1*a2);
y = e2*a1 / (a1*b2 - b1*a2) - e1*a2 / (a1*b2 - b1*a2);
printf("%.3f %.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254877/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254877/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a1 = alloca double, align 8
%b1 = alloca double, align 8
%e1 = alloca double, align 8
%a2 = alloca double, align 8
%b2 = alloca double, align 8
%e2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e2) #4
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %b1, ptr noundef nonnull %e1, ptr noundef nonnull %a2, ptr noundef nonnull %b2, ptr noundef nonnull %e2)
%cmp.not21 = icmp eq i32 %call20, -1
br i1 %cmp.not21, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %e1, align 8, !tbaa !5
%1 = load double, ptr %b2, align 8, !tbaa !5
%2 = load double, ptr %a1, align 8, !tbaa !5
%3 = load double, ptr %b1, align 8, !tbaa !5
%4 = load double, ptr %a2, align 8, !tbaa !5
%5 = fneg double %3
%neg = fmul double %4, %5
%6 = call double @llvm.fmuladd.f64(double %2, double %1, double %neg)
%7 = load double, ptr %e2, align 8, !tbaa !5
%8 = insertelement <2 x double> poison, double %0, i64 0
%9 = insertelement <2 x double> %8, double %3, i64 1
%10 = insertelement <2 x double> poison, double %1, i64 0
%11 = insertelement <2 x double> %10, double %7, i64 1
%12 = fmul <2 x double> %9, %11
%13 = insertelement <2 x double> poison, double %6, i64 0
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> zeroinitializer
%15 = fdiv <2 x double> %12, %14
%shift = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%16 = fsub <2 x double> %15, %shift
%sub = extractelement <2 x double> %16, i64 0
%17 = insertelement <2 x double> poison, double %2, i64 0
%18 = insertelement <2 x double> %17, double %0, i64 1
%19 = insertelement <2 x double> poison, double %7, i64 0
%20 = insertelement <2 x double> %19, double %4, i64 1
%21 = fmul <2 x double> %18, %20
%22 = fdiv <2 x double> %21, %14
%shift22 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%23 = fsub <2 x double> %22, %shift22
%sub18 = extractelement <2 x double> %23, i64 0
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sub, double noundef %sub18)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a1, ptr noundef nonnull %b1, ptr noundef nonnull %e1, ptr noundef nonnull %a2, ptr noundef nonnull %b2, ptr noundef nonnull %e2)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a1) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
#define lli long long int
bool chksq(int m){
double a = sqrt((double)m);
if(a==(int)sqrt((double)m))
return true;
return false;
}
// bool check(int n, int i, int len, lli mul)
// {
// if(i>=n && !len){
// if((lli)sqrt(mul))
// }
// if(!len)
// if(!check(n,i+1,len-1,mul*a[i])) return fasle;
// if(!check(n,i+1,len,mul)) return fasle;
// }
int main()
{
int t,n,flag;
int a;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
flag = 0;
while(n--){
scanf("%d", &a);
if(!flag)
if(!chksq(a)){printf("YES\n"); flag = 1;}
}
if(!flag) printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25492/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25492/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local zeroext i1 @chksq(i32 noundef %m) local_unnamed_addr #0 {
entry:
%conv = sitofp i32 %m to double
%call = tail call double @sqrt(double noundef %conv) #6
%call2 = tail call double @sqrt(double noundef %conv) #6
%conv3 = fptosi double %call2 to i32
%conv4 = sitofp i32 %conv3 to double
%cmp = fcmp oeq double %call, %conv4
ret i1 %cmp
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%t = alloca i32, align 4
%n = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec22 = add nsw i32 %0, -1
store i32 %dec22, ptr %t, align 4, !tbaa !5
%tobool.not23 = icmp eq i32 %0, 0
br i1 %tobool.not23, label %while.end16, label %while.body
while.body: ; preds = %entry, %if.end15
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%dec319 = add nsw i32 %1, -1
store i32 %dec319, ptr %n, align 4, !tbaa !5
%tobool4.not20 = icmp eq i32 %1, 0
br i1 %tobool4.not20, label %if.then13, label %while.body5
while.body5: ; preds = %while.body, %if.end11
%flag.021 = phi i32 [ %flag.1, %if.end11 ], [ 0, %while.body ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%tobool7.not = icmp eq i32 %flag.021, 0
br i1 %tobool7.not, label %if.then, label %if.end11
if.then: ; preds = %while.body5
%2 = load i32, ptr %a, align 4, !tbaa !5
%conv.i = sitofp i32 %2 to double
%call.i = call double @sqrt(double noundef %conv.i) #6
%call2.i = call double @sqrt(double noundef %conv.i) #6
%conv3.i = fptosi double %call2.i to i32
%conv4.i = sitofp i32 %conv3.i to double
%cmp.i = fcmp oeq double %call.i, %conv4.i
br i1 %cmp.i, label %if.end11, label %if.then9
if.then9: ; preds = %if.then
%puts18 = call i32 @puts(ptr nonnull dereferenceable(1) @str.3)
br label %if.end11
if.end11: ; preds = %if.then, %if.then9, %while.body5
%tobool12.not = phi i1 [ false, %while.body5 ], [ true, %if.then ], [ false, %if.then9 ]
%flag.1 = phi i32 [ 1, %while.body5 ], [ 0, %if.then ], [ 1, %if.then9 ]
%3 = load i32, ptr %n, align 4, !tbaa !5
%dec3 = add nsw i32 %3, -1
store i32 %dec3, ptr %n, align 4, !tbaa !5
%tobool4.not = icmp eq i32 %3, 0
br i1 %tobool4.not, label %while.end, label %while.body5, !llvm.loop !9
while.end: ; preds = %if.end11
br i1 %tobool12.not, label %if.then13, label %if.end15
if.then13: ; preds = %while.body, %while.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end15
if.end15: ; preds = %if.then13, %while.end
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end16, label %while.body, !llvm.loop !11
while.end16: ; preds = %if.end15, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #5
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int a,b,c,d,e,f;
float x,y;
while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)!=EOF){
/*if((b>=0&&e>=0)||(b<0&&e<0)){
x=(c*abs(e)-f*abs(b))/(a*abs(e)-d*abs(b));
y=(d*abs(c)-f*abs(a))/(b*abs(d)-e*abs(a));
}
else{
x=(c*abs(e)+f*abs(b))/(a*abs(e)+d*abs(b));
y=(d*abs(c)+f*abs(a))/(b*abs(d)+e*abs(a));
}*/
x=(float)(c*e-f*b)/(a*e-d*b);
y=(float)(d*c-f*a)/(b*d-e*a);
if(-0.0005<x && x<=0)x=0;
if(-0.0005<y && y<=0)y=0;
printf("%1.3f %1.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_254963/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_254963/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%d%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%1.3f %1.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i32, align 4
%f = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #3
%call37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not38 = icmp eq i32 %call37, -1
br i1 %cmp.not38, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %c, align 4, !tbaa !5
%1 = load i32, ptr %e, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%2 = load i32, ptr %f, align 4, !tbaa !5
%3 = load i32, ptr %b, align 4, !tbaa !5
%mul1 = mul nsw i32 %3, %2
%sub = sub nsw i32 %mul, %mul1
%conv = sitofp i32 %sub to float
%4 = load i32, ptr %a, align 4, !tbaa !5
%mul2 = mul nsw i32 %4, %1
%5 = load i32, ptr %d, align 4, !tbaa !5
%mul3 = mul nsw i32 %5, %3
%sub4 = sub nsw i32 %mul2, %mul3
%conv5 = sitofp i32 %sub4 to float
%div = fdiv float %conv, %conv5
%mul6 = mul nsw i32 %5, %0
%mul7 = mul nsw i32 %4, %2
%sub8 = sub nsw i32 %mul6, %mul7
%conv9 = sitofp i32 %sub8 to float
%sub12 = sub nsw i32 %mul3, %mul2
%conv13 = sitofp i32 %sub12 to float
%div14 = fdiv float %conv9, %conv13
%conv15 = fpext float %div to double
%cmp16 = fcmp ogt double %conv15, -5.000000e-04
%cmp18 = fcmp ole float %div, 0.000000e+00
%or.cond = and i1 %cmp18, %cmp16
%conv20 = fpext float %div14 to double
%cmp21 = fcmp ogt double %conv20, -5.000000e-04
%cmp24 = fcmp ole float %div14, 0.000000e+00
%or.cond31 = and i1 %cmp24, %cmp21
%conv28 = select i1 %or.cond, double 0.000000e+00, double %conv15
%conv29 = select i1 %or.cond31, double 0.000000e+00, double %conv20
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %conv28, double noundef %conv29)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
double a,b,c,d,e,f,x,y;
while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
y=((f*a)-(d*c))/((a*e)-(d*b));
x=(c-(b*y))/a;
printf("%.3lf %.3lf\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255005/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255005/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [19 x i8] c"%lf%lf%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %f, align 8, !tbaa !5
%1 = load double, ptr %a, align 8, !tbaa !5
%2 = load double, ptr %d, align 8, !tbaa !5
%3 = load double, ptr %c, align 8, !tbaa !5
%4 = fneg double %2
%5 = load double, ptr %e, align 8, !tbaa !5
%6 = load double, ptr %b, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %3, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = insertelement <2 x double> %12, double %1, i64 1
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = insertelement <2 x double> %14, double %5, i64 1
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div = fdiv double %17, %18
%neg4 = fneg double %6
%19 = call double @llvm.fmuladd.f64(double %neg4, double %div, double %3)
%div5 = fdiv double %19, %1
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div5, double noundef %div)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int a, b, c, d, e, f;
double x, y;
while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f)>0) {
x = (double)c*e-(double)b*f;
if (x) x /= (double)a*e-(double)b*d;
y = (double)c*d-(double)a*f;
if (y) y /= (double)b*d-(double)a*e;
printf("%.3f %.3f\n", x, y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255049/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255049/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%d%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i32, align 4
%f = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #4
%call34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp35 = icmp sgt i32 %call34, 0
br i1 %cmp35, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %c, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%1 = load i32, ptr %e, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%2 = load i32, ptr %b, align 4, !tbaa !5
%conv2 = sitofp i32 %2 to double
%3 = load i32, ptr %f, align 4, !tbaa !5
%conv3 = sitofp i32 %3 to double
%4 = fneg double %conv2
%neg = fmul double %4, %conv3
%5 = call double @llvm.fmuladd.f64(double %conv, double %conv1, double %neg)
%tobool = fcmp une double %5, 0.000000e+00
%.pre = load i32, ptr %d, align 4, !tbaa !5
%.pre36 = load i32, ptr %a, align 4, !tbaa !5
br i1 %tobool, label %if.then, label %while.body.if.end_crit_edge
while.body.if.end_crit_edge: ; preds = %while.body
%.pre37 = sitofp i32 %.pre to double
%.pre38 = sitofp i32 %.pre36 to double
br label %if.end
if.then: ; preds = %while.body
%conv5 = sitofp i32 %.pre36 to double
%conv8 = sitofp i32 %.pre to double
%neg10 = fmul double %4, %conv8
%6 = call double @llvm.fmuladd.f64(double %conv5, double %conv1, double %neg10)
%div = fdiv double %5, %6
br label %if.end
if.end: ; preds = %while.body.if.end_crit_edge, %if.then
%conv13.pre-phi = phi double [ %.pre38, %while.body.if.end_crit_edge ], [ %conv5, %if.then ]
%conv12.pre-phi = phi double [ %.pre37, %while.body.if.end_crit_edge ], [ %conv8, %if.then ]
%x.0 = phi double [ %5, %while.body.if.end_crit_edge ], [ %div, %if.then ]
%7 = fneg double %conv13.pre-phi
%neg16 = fmul double %conv3, %7
%8 = call double @llvm.fmuladd.f64(double %conv, double %conv12.pre-phi, double %neg16)
%tobool17 = fcmp une double %8, 0.000000e+00
%neg24 = fmul double %conv1, %7
%9 = call double @llvm.fmuladd.f64(double %conv2, double %conv12.pre-phi, double %neg24)
%div25 = select i1 %tobool17, double %9, double 1.000000e+00
%y.0 = fdiv double %8, %div25
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %x.0, double noundef %y.0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp = icmp sgt i32 %call, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
long na,nb,k,m,i;
long a[100000],b[100000];
scanf("%ld%ld",&na,&nb);
scanf("%ld%ld",&k,&m);
for (i=1;i<=na;i++)
scanf("%ld",&a[i]);
for (i=1;i<=nb;i++)
scanf("%ld",&b[i]);
if (a[k]<b[nb-m+1])
printf("YES");
else
printf("NO");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_2551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_2551/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%na = alloca i64, align 8
%nb = alloca i64, align 8
%k = alloca i64, align 8
%m = alloca i64, align 8
%a = alloca [100000 x i64], align 16
%b = alloca [100000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %na) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %nb) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #3
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %na, ptr noundef nonnull %nb)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %m)
%0 = load i64, ptr %na, align 8, !tbaa !5
%cmp.not21 = icmp slt i64 %0, 1
br i1 %cmp.not21, label %for.cond3.preheader, label %for.body
for.cond3.preheader: ; preds = %for.body, %entry
%1 = load i64, ptr %nb, align 8, !tbaa !5
%cmp4.not23 = icmp slt i64 %1, 1
br i1 %cmp4.not23, label %for.end10, label %for.body5
for.body: ; preds = %entry, %for.body
%i.022 = phi i64 [ %inc, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %i.022
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.022, 1
%2 = load i64, ptr %na, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.022, %2
br i1 %cmp.not.not, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.body5: ; preds = %for.cond3.preheader, %for.body5
%i.124 = phi i64 [ %inc9, %for.body5 ], [ 1, %for.cond3.preheader ]
%arrayidx6 = getelementptr inbounds [100000 x i64], ptr %b, i64 0, i64 %i.124
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%inc9 = add nuw nsw i64 %i.124, 1
%3 = load i64, ptr %nb, align 8, !tbaa !5
%cmp4.not.not = icmp slt i64 %i.124, %3
br i1 %cmp4.not.not, label %for.body5, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.body5, %for.cond3.preheader
%.lcssa = phi i64 [ %1, %for.cond3.preheader ], [ %3, %for.body5 ]
%4 = load i64, ptr %k, align 8, !tbaa !5
%arrayidx11 = getelementptr inbounds [100000 x i64], ptr %a, i64 0, i64 %4
%5 = load i64, ptr %arrayidx11, align 8, !tbaa !5
%6 = load i64, ptr %m, align 8, !tbaa !5
%sub = add i64 %.lcssa, 1
%add = sub i64 %sub, %6
%arrayidx12 = getelementptr inbounds [100000 x i64], ptr %b, i64 0, i64 %add
%7 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%cmp13 = icmp slt i64 %5, %7
%.str.2..str.3 = select i1 %cmp13, ptr @.str.2, ptr @.str.3
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %nb) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %na) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
double a,b,c,d,e,f,x,y;
while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
y=(c*d-a*f)/(b*d-a*e);
x=(c-b*y)/a;
x+=0.0004;
y+=0.0004;
printf("%.3lf %.3lf\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255157/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255157/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [19 x i8] c"%lf%lf%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not12 = icmp eq i32 %call11, -1
br i1 %cmp.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %c, align 8, !tbaa !5
%1 = load double, ptr %d, align 8, !tbaa !5
%2 = load double, ptr %a, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = fneg double %2
%5 = load double, ptr %b, align 8, !tbaa !5
%6 = load double, ptr %e, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %3, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = insertelement <2 x double> %12, double %5, i64 1
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div = fdiv double %17, %18
%neg4 = fneg double %5
%19 = call double @llvm.fmuladd.f64(double %neg4, double %div, double %0)
%div5 = fdiv double %19, %2
%add = fadd double %div5, 4.000000e-04
%add6 = fadd double %div, 4.000000e-04
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %add, double noundef %add6)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
long long ok(long long x)
{
long long p=sqrt(x);
return p*p==x;
}
void solve()
{
long long n;
scanf("%lld",&n);
long long v[n];
for(int i=0;i<n;i++)
{
scanf("%lld",&v[i]);
}
for(long long i=0;i<n;i++)
{
if(!ok(v[i]))
{
printf("Yes\n");
return ;
}
}
printf("No\n");
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
solve();
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25520/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25520/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local i64 @ok(i64 noundef %x) local_unnamed_addr #0 {
entry:
%conv = sitofp i64 %x to double
%call = tail call double @sqrt(double noundef %conv) #7
%conv1 = fptosi double %call to i64
%mul = mul nsw i64 %conv1, %conv1
%cmp = icmp eq i64 %mul, %x
%conv3 = zext i1 %cmp to i64
ret i64 %conv3
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve() local_unnamed_addr #3 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp24 = icmp sgt i64 %2, 0
br i1 %cmp24, label %for.body, label %cleanup16
for.cond4.preheader: ; preds = %for.body
%3 = icmp sgt i64 %4, 0
br i1 %3, label %for.body8, label %cleanup16
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %4, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !9
for.cond4: ; preds = %for.body8
%inc13 = add nuw nsw i64 %i3.028, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp5.not = icmp slt i64 %inc13, %5
br i1 %cmp5.not, label %for.body8, label %cleanup16, !llvm.loop !11
for.body8: ; preds = %for.cond4.preheader, %for.cond4
%i3.028 = phi i64 [ %inc13, %for.cond4 ], [ 0, %for.cond4.preheader ]
%arrayidx9 = getelementptr inbounds i64, ptr %vla, i64 %i3.028
%6 = load i64, ptr %arrayidx9, align 8, !tbaa !5
%conv.i = sitofp i64 %6 to double
%call.i = call double @sqrt(double noundef %conv.i) #7
%conv1.i = fptosi double %call.i to i64
%mul.i = mul nsw i64 %conv1.i, %conv1.i
%cmp.i.not = icmp eq i64 %mul.i, %6
br i1 %cmp.i.not, label %for.cond4, label %cleanup16
cleanup16: ; preds = %for.cond4, %for.body8, %for.cond4.preheader, %entry
%str.sink = phi ptr [ @str.4, %entry ], [ @str.4, %for.cond4.preheader ], [ @str, %for.body8 ], [ @str.4, %for.cond4 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #7
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !12
%dec1 = add nsw i32 %0, -1
store i32 %dec1, ptr %t, align 4, !tbaa !12
%tobool.not2 = icmp eq i32 %0, 0
br i1 %tobool.not2, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
call void @solve()
%1 = load i32, ptr %t, align 4, !tbaa !12
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %t, align 4, !tbaa !12
%tobool.not = icmp eq i32 %1, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #7
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !10}
|
/*
連立方程式を解くプログラム
小数点以下第4位を四捨五入しなければならない。
*/
#include<stdio.h>
#include<math.h>
int main(void){
double a,b,c,d,e,f;
double x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a ,&b ,&c ,&d ,&e ,&f) != EOF){
//ガウスの掃き出し法
y = ( f+(c/a)*(-d) ) / ( e+(b/a)*(-d) );
x = c/a-(b/a)*y;
/*
//クラメールの公式を使っています
x = (c*e-b*f)/(a*e-b*d);
y = (a*f-c*d)/(a*e-b*d);
*/
printf("%.3lf %.3lf\n",x ,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%.3lf %.3lf\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %f, align 8, !tbaa !5
%1 = load double, ptr %c, align 8, !tbaa !5
%2 = load double, ptr %a, align 8, !tbaa !5
%3 = load double, ptr %d, align 8, !tbaa !5
%fneg = fneg double %3
%4 = load double, ptr %e, align 8, !tbaa !5
%5 = load double, ptr %b, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %5, i64 1
%8 = insertelement <2 x double> poison, double %2, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%10 = fdiv <2 x double> %7, %9
%11 = insertelement <2 x double> poison, double %fneg, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = insertelement <2 x double> poison, double %0, i64 0
%14 = insertelement <2 x double> %13, double %4, i64 1
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %10, <2 x double> %12, <2 x double> %14)
%16 = extractelement <2 x double> %15, i64 0
%17 = extractelement <2 x double> %15, i64 1
%div3 = fdiv double %16, %17
%18 = extractelement <2 x double> %10, i64 1
%neg = fneg double %18
%19 = extractelement <2 x double> %10, i64 0
%20 = call double @llvm.fmuladd.f64(double %neg, double %div3, double %19)
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %20, double noundef %div3)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
double a,b,c,d,e,f,x,y;
while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
if(b!=0){
x=((e*c/b)-f)/((e*a/b)-d);
}
else{
x=c/a;
}
if(a!=0){
y=((d*c/a)-f)/((d*b/a)-e);
}
else{
y=c/b;
}
x=x*1000,y=y*1000;
if(x>0){
x=(double)(int)(x+0.5);
}
else{
x=(double)(int)(x-0.5);
}
if(y>0){
y=(double)(int)(y+0.5);
}
else{
y=(double)(int)(y-0.5);
}
x=x/1000;y=y/1000;
printf("%.3f %.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255294/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255294/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #3
%call54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not55 = icmp eq i32 %call54, -1
br i1 %cmp.not55, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end18
%0 = load double, ptr %b, align 8, !tbaa !5
%cmp1 = fcmp une double %0, 0.000000e+00
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %c, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = load double, ptr %a, align 8, !tbaa !5
%5 = load double, ptr %d, align 8, !tbaa !5
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = insertelement <2 x double> poison, double %2, i64 0
%9 = insertelement <2 x double> %8, double %4, i64 1
%10 = fmul <2 x double> %7, %9
%11 = insertelement <2 x double> poison, double %0, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
%14 = insertelement <2 x double> poison, double %3, i64 0
%15 = insertelement <2 x double> %14, double %5, i64 1
%16 = fsub <2 x double> %13, %15
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%div5 = fdiv double %17, %18
br label %if.end
if.else: ; preds = %while.body
%19 = load double, ptr %c, align 8, !tbaa !5
%20 = load double, ptr %a, align 8, !tbaa !5
%div6 = fdiv double %19, %20
br label %if.end
if.end: ; preds = %if.else, %if.then
%21 = phi double [ %19, %if.else ], [ %2, %if.then ]
%22 = phi double [ %20, %if.else ], [ %4, %if.then ]
%x.0 = phi double [ %div6, %if.else ], [ %div5, %if.then ]
%cmp7 = fcmp une double %22, 0.000000e+00
br i1 %cmp7, label %if.then8, label %if.else16
if.then8: ; preds = %if.end
%23 = load double, ptr %d, align 8, !tbaa !5
%24 = load double, ptr %f, align 8, !tbaa !5
%25 = load double, ptr %e, align 8, !tbaa !5
%26 = insertelement <2 x double> poison, double %23, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %21, i64 0
%29 = insertelement <2 x double> %28, double %0, i64 1
%30 = fmul <2 x double> %27, %29
%31 = insertelement <2 x double> poison, double %22, i64 0
%32 = shufflevector <2 x double> %31, <2 x double> poison, <2 x i32> zeroinitializer
%33 = fdiv <2 x double> %30, %32
%34 = insertelement <2 x double> poison, double %24, i64 0
%35 = insertelement <2 x double> %34, double %25, i64 1
%36 = fsub <2 x double> %33, %35
%37 = extractelement <2 x double> %36, i64 0
%38 = extractelement <2 x double> %36, i64 1
%div15 = fdiv double %37, %38
br label %if.end18
if.else16: ; preds = %if.end
%div17 = fdiv double %21, %0
br label %if.end18
if.end18: ; preds = %if.else16, %if.then8
%y.0 = phi double [ %div15, %if.then8 ], [ %div17, %if.else16 ]
%mul19 = fmul double %x.0, 1.000000e+03
%mul20 = fmul double %y.0, 1.000000e+03
%cmp21 = fcmp ogt double %mul19, 0.000000e+00
%x.1.in.in.v = select i1 %cmp21, double 5.000000e-01, double -5.000000e-01
%x.1.in.in = fadd double %mul19, %x.1.in.in.v
%x.1.in = fptosi double %x.1.in.in to i32
%x.1 = sitofp i32 %x.1.in to double
%cmp29 = fcmp ogt double %mul20, 0.000000e+00
%y.1.in.in.v = select i1 %cmp29, double 5.000000e-01, double -5.000000e-01
%y.1.in.in = fadd double %mul20, %y.1.in.in.v
%y.1.in = fptosi double %y.1.in.in to i32
%y.1 = sitofp i32 %y.1.in to double
%div40 = fdiv double %x.1, 1.000000e+03
%div41 = fdiv double %y.1, 1.000000e+03
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div40, double noundef %div41)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end18, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
double a,b,c,d,e,f,x,y,work1,work2;
while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF){
work1=c*e-b*f;work2=a*e-b*d;
x=work1/work2;
work1=c*d-a*f;work2=b*d-a*e;
y=work1/work2;
if(x<=0 && x>-0.0001)x=0;
if(y<=0 && y>-0.0001)y=0;
printf("%.3f %.3f\n",x,y);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255337/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255337/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [19 x i8] c"%lf%lf%lf%lf%lf%lf\00", align 1
@.str.1 = private unnamed_addr constant [11 x i8] c"%.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, 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 void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #4
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not26 = icmp eq i32 %call25, -1
br i1 %cmp.not26, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load double, ptr %c, align 8, !tbaa !5
%1 = load double, ptr %e, align 8, !tbaa !5
%2 = load double, ptr %b, align 8, !tbaa !5
%3 = load double, ptr %f, align 8, !tbaa !5
%4 = fneg double %2
%5 = load double, ptr %a, align 8, !tbaa !5
%6 = load double, ptr %d, align 8, !tbaa !5
%7 = insertelement <2 x double> poison, double %3, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = insertelement <2 x double> poison, double %4, i64 0
%10 = shufflevector <2 x double> %9, <2 x double> poison, <2 x i32> zeroinitializer
%11 = fmul <2 x double> %8, %10
%12 = insertelement <2 x double> poison, double %0, i64 0
%13 = insertelement <2 x double> %12, double %5, i64 1
%14 = insertelement <2 x double> poison, double %1, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %15, <2 x double> %11)
%17 = fneg double %5
%18 = insertelement <2 x double> %7, double %1, i64 1
%19 = insertelement <2 x double> poison, double %17, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = fmul <2 x double> %18, %20
%22 = insertelement <2 x double> %12, double %2, i64 1
%23 = insertelement <2 x double> poison, double %6, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %24, <2 x double> %21)
%26 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 0, i32 2>
%27 = shufflevector <2 x double> %25, <2 x double> %16, <2 x i32> <i32 1, i32 3>
%28 = fdiv <2 x double> %26, %27
%29 = extractelement <2 x double> %28, i64 1
%cmp9 = fcmp ole double %29, 0.000000e+00
%30 = fcmp ogt <2 x double> %28, <double -1.000000e-04, double -1.000000e-04>
%31 = extractelement <2 x i1> %30, i64 1
%or.cond = and i1 %cmp9, %31
%spec.store.select = select i1 %or.cond, double 0.000000e+00, double %29
%32 = extractelement <2 x double> %28, i64 0
%cmp11 = fcmp ole double %32, 0.000000e+00
%33 = extractelement <2 x i1> %30, i64 0
%or.cond17 = and i1 %cmp11, %33
%spec.store.select18 = select i1 %or.cond17, double 0.000000e+00, double %32
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %spec.store.select, double noundef %spec.store.select18)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #4
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 <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !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 NO_DATA -1
#define MAX_COUNT 100
int main(int argc, const char * argv[]) {
double result[MAX_COUNT][2];
double a,b,c,d,e,f;
int scanResult;
for (int i = 0; i < MAX_COUNT; i++ ) {
result[i][0] = NO_DATA;
result[i][1] = NO_DATA;
}
int count=0;
scanResult = scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);
while (scanResult!=EOF) {
result[count][0]=(e*c+(-b*f))/(a*e-d*b);
result[count][1]=(-d*c+a*f)/(a*e-d*b);
count++;
scanResult = scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);
}
for (int i=0;i<count;i++) {
double x = (int)(1000 * result[i][0] + 2 * (1000 * result[i][0] - (int)(1000 * result[i][0]))) / 1000.0;
double y = (int)(1000 * result[i][1] + 2 * (1000 * result[i][1] - (int)(1000 * result[i][1]))) / 1000.0;
printf("%.3lf %.3f\n", x, y);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255380/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255380/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.1 = private unnamed_addr constant [12 x i8] c"%.3lf %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%result = alloca [100 x [2 x double]], align 16
%a = alloca double, align 8
%b = alloca double, align 8
%c = alloca double, align 8
%d = alloca double, align 8
%e = alloca double, align 8
%f = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 1600, ptr nonnull %result) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %f) #5
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %result, align 16, !tbaa !5
%0 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 2
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 4
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 6
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 8
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %3, align 16, !tbaa !5
%4 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 10
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 12
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 14
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 16
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 18
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 20
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 22
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 24
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %11, align 16, !tbaa !5
%12 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 26
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %12, align 16, !tbaa !5
%13 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 28
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 30
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %14, align 16, !tbaa !5
%15 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 32
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %15, align 16, !tbaa !5
%16 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 34
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %16, align 16, !tbaa !5
%17 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 36
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %17, align 16, !tbaa !5
%18 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 38
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %18, align 16, !tbaa !5
%19 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 40
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 42
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 44
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %21, align 16, !tbaa !5
%22 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 46
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %22, align 16, !tbaa !5
%23 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 48
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %23, align 16, !tbaa !5
%24 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 50
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %24, align 16, !tbaa !5
%25 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 52
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %25, align 16, !tbaa !5
%26 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 54
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %26, align 16, !tbaa !5
%27 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 56
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %27, align 16, !tbaa !5
%28 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 58
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %28, align 16, !tbaa !5
%29 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 60
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %29, align 16, !tbaa !5
%30 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 62
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %30, align 16, !tbaa !5
%31 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 64
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %31, align 16, !tbaa !5
%32 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 66
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %32, align 16, !tbaa !5
%33 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 68
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %33, align 16, !tbaa !5
%34 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 70
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %34, align 16, !tbaa !5
%35 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 72
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %35, align 16, !tbaa !5
%36 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 74
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %36, align 16, !tbaa !5
%37 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 76
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %37, align 16, !tbaa !5
%38 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 78
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %38, align 16, !tbaa !5
%39 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 80
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %39, align 16, !tbaa !5
%40 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 82
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %40, align 16, !tbaa !5
%41 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 84
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %41, align 16, !tbaa !5
%42 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 86
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %42, align 16, !tbaa !5
%43 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 88
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %43, align 16, !tbaa !5
%44 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 90
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %44, align 16, !tbaa !5
%45 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 92
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %45, align 16, !tbaa !5
%46 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 94
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %46, align 16, !tbaa !5
%47 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 96
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %47, align 16, !tbaa !5
%48 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 98
store <4 x double> <double -1.000000e+00, double -1.000000e+00, double -1.000000e+00, double -1.000000e+00>, ptr %48, align 16, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp5.not79 = icmp eq i32 %call, -1
br i1 %cmp5.not79, label %for.cond.cleanup24, label %while.body
for.cond22.preheader: ; preds = %while.body
%49 = and i64 %indvars.iv.next85, 4294967295
%cmp2381.not = icmp eq i64 %49, 0
br i1 %cmp2381.not, label %for.cond.cleanup24, label %for.body25.preheader
for.body25.preheader: ; preds = %for.cond22.preheader
%wide.trip.count = and i64 %indvars.iv.next85, 4294967295
br label %for.body25
while.body: ; preds = %entry, %while.body
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %while.body ], [ 0, %entry ]
%50 = load double, ptr %e, align 8, !tbaa !5
%51 = load double, ptr %c, align 8, !tbaa !5
%52 = load double, ptr %b, align 8, !tbaa !5
%fneg = fneg double %52
%53 = load double, ptr %f, align 8, !tbaa !5
%54 = load double, ptr %a, align 8, !tbaa !5
%55 = load double, ptr %d, align 8, !tbaa !5
%56 = fneg double %55
%neg = fmul double %52, %56
%57 = call double @llvm.fmuladd.f64(double %54, double %50, double %neg)
%arrayidx9 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 %indvars.iv84
%58 = insertelement <2 x double> poison, double %53, i64 0
%59 = shufflevector <2 x double> %58, <2 x double> poison, <2 x i32> zeroinitializer
%60 = insertelement <2 x double> poison, double %fneg, i64 0
%61 = insertelement <2 x double> %60, double %54, i64 1
%62 = fmul <2 x double> %59, %61
%63 = insertelement <2 x double> poison, double %50, i64 0
%64 = insertelement <2 x double> %63, double %56, i64 1
%65 = insertelement <2 x double> poison, double %51, i64 0
%66 = shufflevector <2 x double> %65, <2 x double> poison, <2 x i32> zeroinitializer
%67 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %64, <2 x double> %66, <2 x double> %62)
%68 = insertelement <2 x double> poison, double %57, i64 0
%69 = shufflevector <2 x double> %68, <2 x double> poison, <2 x i32> zeroinitializer
%70 = fdiv <2 x double> %67, %69
store <2 x double> %70, ptr %arrayidx9, align 16, !tbaa !5
%indvars.iv.next85 = add nuw i64 %indvars.iv84, 1
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d, ptr noundef nonnull %e, ptr noundef nonnull %f)
%cmp5.not = icmp eq i32 %call20, -1
br i1 %cmp5.not, label %for.cond22.preheader, label %while.body, !llvm.loop !9
for.cond.cleanup24: ; preds = %for.body25, %entry, %for.cond22.preheader
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %f) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 1600, ptr nonnull %result) #5
ret i32 0
for.body25: ; preds = %for.body25.preheader, %for.body25
%indvars.iv87 = phi i64 [ 0, %for.body25.preheader ], [ %indvars.iv.next88, %for.body25 ]
%arrayidx27 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 %indvars.iv87
%71 = load double, ptr %arrayidx27, align 16, !tbaa !5
%mul36 = fmul double %71, 1.000000e+03
%conv = fptosi double %mul36 to i32
%conv37 = sitofp i32 %conv to double
%neg38 = fneg double %conv37
%72 = call double @llvm.fmuladd.f64(double %71, double 1.000000e+03, double %neg38)
%mul39 = fmul double %72, 2.000000e+00
%73 = call double @llvm.fmuladd.f64(double %71, double 1.000000e+03, double %mul39)
%conv40 = fptosi double %73 to i32
%conv41 = sitofp i32 %conv40 to double
%div42 = fdiv double %conv41, 1.000000e+03
%arrayidx45 = getelementptr inbounds [100 x [2 x double]], ptr %result, i64 0, i64 %indvars.iv87, i64 1
%74 = load double, ptr %arrayidx45, align 8, !tbaa !5
%mul53 = fmul double %74, 1.000000e+03
%conv54 = fptosi double %mul53 to i32
%conv55 = sitofp i32 %conv54 to double
%neg56 = fneg double %conv55
%75 = call double @llvm.fmuladd.f64(double %74, double 1.000000e+03, double %neg56)
%mul57 = fmul double %75, 2.000000e+00
%76 = call double @llvm.fmuladd.f64(double %74, double 1.000000e+03, double %mul57)
%conv58 = fptosi double %76 to i32
%conv59 = sitofp i32 %conv58 to double
%div60 = fdiv double %conv59, 1.000000e+03
%call61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div42, double noundef %div60)
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%exitcond90.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count
br i1 %exitcond90.not, label %for.cond.cleanup24, label %for.body25, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: 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 <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define INF 1000000000
inline int nextInt(void) {
int ch;
int sign, x;
do {
ch = getchar();
} while (ch < '-');
if (ch == '-') {
sign = -1;
ch = getchar();
} else
sign = 1;
x = 0;
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return sign * x;
}
int main(void) {
int i, j, o;
int n, m, l, k, a, h;
while (scanf("%d %d %d %d %d %d", &n, &m, &l, &k, &a, &h), n) {
int canFreeze[100] = {0}, adj[100][100];
canFreeze[a] = canFreeze[h] = 1;
for (i = 0; i < l; i++)
canFreeze[nextInt()] = 1;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
adj[i][j] = INF;
for (i = 0; i < k; i++) {
const int x = nextInt(), y = nextInt(), t = nextInt();
adj[x][y] = adj[y][x] = t;
}
for (o = 0; o < n; o++)
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
adj[i][j] = min(adj[i][j], adj[i][o] + adj[o][j]);
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (!canFreeze[i] || !canFreeze[j] || adj[i][j] > m)
adj[i][j] = INF;
for (o = 0; o < n; o++)
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
adj[i][j] = min(adj[i][j], adj[i][o] + adj[o][j]);
if (adj[a][h] != INF)
printf("%d\n", adj[a][h] + max(0, adj[a][h] - m));
else
puts("Help!");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255423/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255423/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [18 x i8] c"%d %d %d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"Help!\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%l = alloca i32, align 4
%k = alloca i32, align 4
%a = alloca i32, align 4
%h = alloca i32, align 4
%canFreeze = alloca [100 x i32], align 16
%adj = alloca [100 x [100 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call349 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %l, ptr noundef nonnull %k, ptr noundef nonnull %a, ptr noundef nonnull %h)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not350 = icmp eq i32 %0, 0
br i1 %tobool.not350, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%invariant.gep = getelementptr i8, ptr %adj, i64 4
%invariant.gep478 = getelementptr i8, ptr %adj, i64 4
br label %while.body
while.body: ; preds = %while.body.preheader, %if.end195
%1 = phi i32 [ %114, %if.end195 ], [ %0, %while.body.preheader ]
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %canFreeze) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %canFreeze, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %adj) #5
%2 = load i32, ptr %h, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%3 = load i32, ptr %a, align 4, !tbaa !5
%idxprom1 = sext i32 %3 to i64
%arrayidx2 = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %idxprom1
store i32 1, ptr %arrayidx2, align 4, !tbaa !5
%4 = load i32, ptr %l, align 4, !tbaa !5
%cmp317 = icmp sgt i32 %4, 0
br i1 %cmp317, label %do.body.i.preheader, label %for.cond6.preheader
for.cond6.preheader.loopexit: ; preds = %nextInt.exit
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond6.preheader
for.cond6.preheader: ; preds = %for.cond6.preheader.loopexit, %while.body
%5 = phi i32 [ %.pre, %for.cond6.preheader.loopexit ], [ %1, %while.body ]
%cmp7321 = icmp sgt i32 %5, 0
br i1 %cmp7321, label %for.cond9.preheader.us.preheader, label %for.cond22.preheader
for.cond9.preheader.us.preheader: ; preds = %for.cond6.preheader
%wide.trip.count356 = zext i32 %5 to i64
%min.iters.check463 = icmp ult i32 %5, 8
%n.vec466 = and i64 %wide.trip.count356, 4294967288
%cmp.n468 = icmp eq i64 %n.vec466, %wide.trip.count356
br label %for.cond9.preheader.us
for.cond9.preheader.us: ; preds = %for.cond9.preheader.us.preheader, %for.cond9.for.inc19_crit_edge.us
%indvars.iv353 = phi i64 [ 0, %for.cond9.preheader.us.preheader ], [ %indvars.iv.next354, %for.cond9.for.inc19_crit_edge.us ]
br i1 %min.iters.check463, label %for.body11.us.preheader, label %vector.body469
vector.body469: ; preds = %for.cond9.preheader.us, %vector.body469
%index470 = phi i64 [ %index.next471, %vector.body469 ], [ 0, %for.cond9.preheader.us ]
%6 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv353, i64 %index470
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %7, align 16, !tbaa !5
%index.next471 = add nuw i64 %index470, 8
%8 = icmp eq i64 %index.next471, %n.vec466
br i1 %8, label %middle.block461, label %vector.body469, !llvm.loop !9
middle.block461: ; preds = %vector.body469
br i1 %cmp.n468, label %for.cond9.for.inc19_crit_edge.us, label %for.body11.us.preheader
for.body11.us.preheader: ; preds = %for.cond9.preheader.us, %middle.block461
%indvars.iv.ph = phi i64 [ 0, %for.cond9.preheader.us ], [ %n.vec466, %middle.block461 ]
br label %for.body11.us
for.body11.us: ; preds = %for.body11.us.preheader, %for.body11.us
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body11.us ], [ %indvars.iv.ph, %for.body11.us.preheader ]
%arrayidx15.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv353, i64 %indvars.iv
store i32 1000000000, ptr %arrayidx15.us, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count356
br i1 %exitcond.not, label %for.cond9.for.inc19_crit_edge.us, label %for.body11.us, !llvm.loop !13
for.cond9.for.inc19_crit_edge.us: ; preds = %for.body11.us, %middle.block461
%indvars.iv.next354 = add nuw nsw i64 %indvars.iv353, 1
%exitcond357.not = icmp eq i64 %indvars.iv.next354, %wide.trip.count356
br i1 %exitcond357.not, label %for.cond22.preheader, label %for.cond9.preheader.us, !llvm.loop !14
do.body.i.preheader: ; preds = %while.body, %nextInt.exit
%i.0318 = phi i32 [ %inc, %nextInt.exit ], [ 0, %while.body ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %do.body.i
%9 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i.i = call i32 @getc(ptr noundef %9)
%cmp.i = icmp slt i32 %call.i.i, 45
br i1 %cmp.i, label %do.body.i, label %do.end.i, !llvm.loop !17
do.end.i: ; preds = %do.body.i
%cmp1.i = icmp eq i32 %call.i.i, 45
br i1 %cmp1.i, label %if.then.i, label %if.end.i
if.then.i: ; preds = %do.end.i
%10 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i12.i = call i32 @getc(ptr noundef %10)
br label %if.end.i
if.end.i: ; preds = %if.then.i, %do.end.i
%ch.0.i = phi i32 [ %call.i12.i, %if.then.i ], [ %call.i.i, %do.end.i ]
%sign.0.i = phi i32 [ -1, %if.then.i ], [ 1, %do.end.i ]
%11 = add i32 %ch.0.i, -48
%12 = icmp ult i32 %11, 10
br i1 %12, label %while.body.i, label %nextInt.exit
while.body.i: ; preds = %if.end.i, %while.body.i
%x.015.i = phi i32 [ %sub.i, %while.body.i ], [ 0, %if.end.i ]
%ch.114.i = phi i32 [ %call.i13.i, %while.body.i ], [ %ch.0.i, %if.end.i ]
%mul.i = mul nsw i32 %x.015.i, 10
%add.i = add nsw i32 %ch.114.i, -48
%sub.i = add i32 %add.i, %mul.i
%13 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i13.i = call i32 @getc(ptr noundef %13)
%14 = add i32 %call.i13.i, -48
%15 = icmp ult i32 %14, 10
br i1 %15, label %while.body.i, label %nextInt.exit, !llvm.loop !18
nextInt.exit: ; preds = %while.body.i, %if.end.i
%x.0.lcssa.i = phi i32 [ 0, %if.end.i ], [ %sub.i, %while.body.i ]
%mul6.i = mul nsw i32 %x.0.lcssa.i, %sign.0.i
%idxprom4 = sext i32 %mul6.i to i64
%arrayidx5 = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %idxprom4
store i32 1, ptr %arrayidx5, align 4, !tbaa !5
%inc = add nuw nsw i32 %i.0318, 1
%16 = load i32, ptr %l, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %16
br i1 %cmp, label %do.body.i.preheader, label %for.cond6.preheader.loopexit, !llvm.loop !19
for.cond22.preheader: ; preds = %for.cond9.for.inc19_crit_edge.us, %for.cond6.preheader
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp23323 = icmp sgt i32 %17, 0
br i1 %cmp23323, label %do.body.i257.preheader, label %for.cond39.preheader
for.cond39.preheader.loopexit: ; preds = %nextInt.exit316
%.pre403 = load i32, ptr %n, align 4, !tbaa !5
br label %for.cond39.preheader
for.cond39.preheader: ; preds = %for.cond39.preheader.loopexit, %for.cond22.preheader
%18 = phi i32 [ %.pre403, %for.cond39.preheader.loopexit ], [ %5, %for.cond22.preheader ]
%cmp40329 = icmp sgt i32 %18, 0
br i1 %cmp40329, label %for.cond42.preheader.us.preheader, label %for.end167
for.cond42.preheader.us.preheader: ; preds = %for.cond39.preheader
%wide.trip.count371 = zext i32 %18 to i64
%19 = shl nuw nsw i64 %wide.trip.count371, 2
%20 = add nsw i64 %wide.trip.count371, -1
%21 = getelementptr i8, ptr %adj, i64 %19
%min.iters.check446 = icmp ult i32 %18, 12
%22 = getelementptr i8, ptr %adj, i64 %19
%n.vec449 = and i64 %wide.trip.count371, 4294967288
%cmp.n451 = icmp eq i64 %n.vec449, %wide.trip.count371
%xtraiter = and i64 %wide.trip.count371, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond42.preheader.us
for.cond42.preheader.us: ; preds = %for.cond42.preheader.us.preheader, %for.cond42.for.inc84_crit_edge.split.us.us
%indvars.iv368 = phi i64 [ 0, %for.cond42.preheader.us.preheader ], [ %indvars.iv.next369, %for.cond42.for.inc84_crit_edge.split.us.us ]
%23 = shl nuw nsw i64 %indvars.iv368, 2
%24 = mul nuw nsw i64 %indvars.iv368, 400
%scevgep435 = getelementptr i8, ptr %adj, i64 %24
%scevgep436 = getelementptr i8, ptr %21, i64 %24
%gep = getelementptr i8, ptr %invariant.gep, i64 %23
%25 = getelementptr i8, ptr %adj, i64 %23
%bound0437 = icmp ult ptr %adj, %gep
%bound1438 = icmp ult ptr %25, %22
%found.conflict439 = and i1 %bound0437, %bound1438
br label %for.cond45.preheader.us.us
for.cond45.preheader.us.us: ; preds = %for.cond45.for.inc81_crit_edge.us.us, %for.cond42.preheader.us
%indvars.iv363 = phi i64 [ %indvars.iv.next364, %for.cond45.for.inc81_crit_edge.us.us ], [ 0, %for.cond42.preheader.us ]
%arrayidx55.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv363, i64 %indvars.iv368
br i1 %min.iters.check446, label %for.body47.us.us.preheader, label %vector.memcheck430
vector.memcheck430: ; preds = %for.cond45.preheader.us.us
%26 = mul nuw nsw i64 %indvars.iv363, 400
%scevgep432 = getelementptr i8, ptr %22, i64 %26
%scevgep431 = getelementptr i8, ptr %adj, i64 %26
%bound0440 = icmp ult ptr %scevgep431, %scevgep436
%bound1441 = icmp ult ptr %scevgep435, %scevgep432
%found.conflict442 = and i1 %bound0440, %bound1441
%conflict.rdx443 = or i1 %found.conflict439, %found.conflict442
br i1 %conflict.rdx443, label %for.body47.us.us.preheader, label %vector.ph447
vector.ph447: ; preds = %vector.memcheck430
%27 = load i32, ptr %arrayidx55.us.us, align 4, !tbaa !5, !alias.scope !20
%broadcast.splatinsert458 = insertelement <4 x i32> poison, i32 %27, i64 0
%broadcast.splat459 = shufflevector <4 x i32> %broadcast.splatinsert458, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body452
vector.body452: ; preds = %vector.body452, %vector.ph447
%index453 = phi i64 [ 0, %vector.ph447 ], [ %index.next460, %vector.body452 ]
%28 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv363, i64 %index453
%wide.load454 = load <4 x i32>, ptr %28, align 16, !tbaa !5, !alias.scope !23, !noalias !25
%29 = getelementptr inbounds i32, ptr %28, i64 4
%wide.load455 = load <4 x i32>, ptr %29, align 16, !tbaa !5, !alias.scope !23, !noalias !25
%30 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv368, i64 %index453
%wide.load456 = load <4 x i32>, ptr %30, align 16, !tbaa !5, !alias.scope !27
%31 = getelementptr inbounds i32, ptr %30, i64 4
%wide.load457 = load <4 x i32>, ptr %31, align 16, !tbaa !5, !alias.scope !27
%32 = add nsw <4 x i32> %wide.load456, %broadcast.splat459
%33 = add nsw <4 x i32> %wide.load457, %broadcast.splat459
%34 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load454, <4 x i32> %32)
%35 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load455, <4 x i32> %33)
store <4 x i32> %34, ptr %28, align 16, !tbaa !5, !alias.scope !23, !noalias !25
store <4 x i32> %35, ptr %29, align 16, !tbaa !5, !alias.scope !23, !noalias !25
%index.next460 = add nuw i64 %index453, 8
%36 = icmp eq i64 %index.next460, %n.vec449
br i1 %36, label %middle.block444, label %vector.body452, !llvm.loop !28
middle.block444: ; preds = %vector.body452
br i1 %cmp.n451, label %for.cond45.for.inc81_crit_edge.us.us, label %for.body47.us.us.preheader
for.body47.us.us.preheader: ; preds = %vector.memcheck430, %for.cond45.preheader.us.us, %middle.block444
%indvars.iv358.ph = phi i64 [ 0, %vector.memcheck430 ], [ 0, %for.cond45.preheader.us.us ], [ %n.vec449, %middle.block444 ]
br i1 %lcmp.mod.not, label %for.body47.us.us.prol.loopexit, label %for.body47.us.us.prol
for.body47.us.us.prol: ; preds = %for.body47.us.us.preheader
%arrayidx51.us.us.prol = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv363, i64 %indvars.iv358.ph
%37 = load i32, ptr %arrayidx51.us.us.prol, align 16, !tbaa !5
%38 = load i32, ptr %arrayidx55.us.us, align 4, !tbaa !5
%arrayidx59.us.us.prol = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv368, i64 %indvars.iv358.ph
%39 = load i32, ptr %arrayidx59.us.us.prol, align 16, !tbaa !5
%add.us.us.prol = add nsw i32 %39, %38
%.add.us.us.prol = call i32 @llvm.smin.i32(i32 %37, i32 %add.us.us.prol)
store i32 %.add.us.us.prol, ptr %arrayidx51.us.us.prol, align 16, !tbaa !5
%indvars.iv.next359.prol = or i64 %indvars.iv358.ph, 1
br label %for.body47.us.us.prol.loopexit
for.body47.us.us.prol.loopexit: ; preds = %for.body47.us.us.prol, %for.body47.us.us.preheader
%indvars.iv358.unr = phi i64 [ %indvars.iv358.ph, %for.body47.us.us.preheader ], [ %indvars.iv.next359.prol, %for.body47.us.us.prol ]
%40 = icmp eq i64 %20, %indvars.iv358.ph
br i1 %40, label %for.cond45.for.inc81_crit_edge.us.us, label %for.body47.us.us
for.body47.us.us: ; preds = %for.body47.us.us.prol.loopexit, %for.body47.us.us
%indvars.iv358 = phi i64 [ %indvars.iv.next359.1, %for.body47.us.us ], [ %indvars.iv358.unr, %for.body47.us.us.prol.loopexit ]
%arrayidx51.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv363, i64 %indvars.iv358
%41 = load i32, ptr %arrayidx51.us.us, align 4, !tbaa !5
%42 = load i32, ptr %arrayidx55.us.us, align 4, !tbaa !5
%arrayidx59.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv368, i64 %indvars.iv358
%43 = load i32, ptr %arrayidx59.us.us, align 4, !tbaa !5
%add.us.us = add nsw i32 %43, %42
%.add.us.us = call i32 @llvm.smin.i32(i32 %41, i32 %add.us.us)
store i32 %.add.us.us, ptr %arrayidx51.us.us, align 4, !tbaa !5
%indvars.iv.next359 = add nuw nsw i64 %indvars.iv358, 1
%arrayidx51.us.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv363, i64 %indvars.iv.next359
%44 = load i32, ptr %arrayidx51.us.us.1, align 4, !tbaa !5
%45 = load i32, ptr %arrayidx55.us.us, align 4, !tbaa !5
%arrayidx59.us.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv368, i64 %indvars.iv.next359
%46 = load i32, ptr %arrayidx59.us.us.1, align 4, !tbaa !5
%add.us.us.1 = add nsw i32 %46, %45
%.add.us.us.1 = call i32 @llvm.smin.i32(i32 %44, i32 %add.us.us.1)
store i32 %.add.us.us.1, ptr %arrayidx51.us.us.1, align 4, !tbaa !5
%indvars.iv.next359.1 = add nuw nsw i64 %indvars.iv358, 2
%exitcond362.not.1 = icmp eq i64 %indvars.iv.next359.1, %wide.trip.count371
br i1 %exitcond362.not.1, label %for.cond45.for.inc81_crit_edge.us.us, label %for.body47.us.us, !llvm.loop !29
for.cond45.for.inc81_crit_edge.us.us: ; preds = %for.body47.us.us.prol.loopexit, %for.body47.us.us, %middle.block444
%indvars.iv.next364 = add nuw nsw i64 %indvars.iv363, 1
%exitcond367.not = icmp eq i64 %indvars.iv.next364, %wide.trip.count371
br i1 %exitcond367.not, label %for.cond42.for.inc84_crit_edge.split.us.us, label %for.cond45.preheader.us.us, !llvm.loop !30
for.cond42.for.inc84_crit_edge.split.us.us: ; preds = %for.cond45.for.inc81_crit_edge.us.us
%indvars.iv.next369 = add nuw nsw i64 %indvars.iv368, 1
%exitcond372.not = icmp eq i64 %indvars.iv.next369, %wide.trip.count371
br i1 %exitcond372.not, label %for.cond87.preheader, label %for.cond42.preheader.us, !llvm.loop !31
do.body.i257.preheader: ; preds = %for.cond22.preheader, %nextInt.exit316
%i.2324 = phi i32 [ %inc37, %nextInt.exit316 ], [ 0, %for.cond22.preheader ]
br label %do.body.i257
do.body.i257: ; preds = %do.body.i257.preheader, %do.body.i257
%47 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i.i258 = call i32 @getc(ptr noundef %47)
%cmp.i259 = icmp slt i32 %call.i.i258, 45
br i1 %cmp.i259, label %do.body.i257, label %do.end.i260, !llvm.loop !17
do.end.i260: ; preds = %do.body.i257
%cmp1.i261 = icmp eq i32 %call.i.i258, 45
br i1 %cmp1.i261, label %if.then.i274, label %if.end.i262
if.then.i274: ; preds = %do.end.i260
%48 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i12.i275 = call i32 @getc(ptr noundef %48)
br label %if.end.i262
if.end.i262: ; preds = %if.then.i274, %do.end.i260
%ch.0.i263 = phi i32 [ %call.i12.i275, %if.then.i274 ], [ %call.i.i258, %do.end.i260 ]
%sign.0.i264 = phi i32 [ -1, %if.then.i274 ], [ 1, %do.end.i260 ]
%49 = add i32 %ch.0.i263, -48
%50 = icmp ult i32 %49, 10
br i1 %50, label %while.body.i267, label %nextInt.exit276
while.body.i267: ; preds = %if.end.i262, %while.body.i267
%x.015.i268 = phi i32 [ %sub.i272, %while.body.i267 ], [ 0, %if.end.i262 ]
%ch.114.i269 = phi i32 [ %call.i13.i273, %while.body.i267 ], [ %ch.0.i263, %if.end.i262 ]
%mul.i270 = mul nsw i32 %x.015.i268, 10
%add.i271 = add nsw i32 %ch.114.i269, -48
%sub.i272 = add i32 %add.i271, %mul.i270
%51 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i13.i273 = call i32 @getc(ptr noundef %51)
%52 = add i32 %call.i13.i273, -48
%53 = icmp ult i32 %52, 10
br i1 %53, label %while.body.i267, label %nextInt.exit276, !llvm.loop !18
nextInt.exit276: ; preds = %while.body.i267, %if.end.i262
%x.0.lcssa.i265 = phi i32 [ 0, %if.end.i262 ], [ %sub.i272, %while.body.i267 ]
br label %do.body.i277
do.body.i277: ; preds = %do.body.i277, %nextInt.exit276
%54 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i.i278 = call i32 @getc(ptr noundef %54)
%cmp.i279 = icmp slt i32 %call.i.i278, 45
br i1 %cmp.i279, label %do.body.i277, label %do.end.i280, !llvm.loop !17
do.end.i280: ; preds = %do.body.i277
%mul6.i266 = mul nsw i32 %x.0.lcssa.i265, %sign.0.i264
%cmp1.i281 = icmp eq i32 %call.i.i278, 45
br i1 %cmp1.i281, label %if.then.i294, label %if.end.i282
if.then.i294: ; preds = %do.end.i280
%55 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i12.i295 = call i32 @getc(ptr noundef %55)
br label %if.end.i282
if.end.i282: ; preds = %if.then.i294, %do.end.i280
%ch.0.i283 = phi i32 [ %call.i12.i295, %if.then.i294 ], [ %call.i.i278, %do.end.i280 ]
%sign.0.i284 = phi i32 [ -1, %if.then.i294 ], [ 1, %do.end.i280 ]
%56 = add i32 %ch.0.i283, -48
%57 = icmp ult i32 %56, 10
br i1 %57, label %while.body.i287, label %nextInt.exit296
while.body.i287: ; preds = %if.end.i282, %while.body.i287
%x.015.i288 = phi i32 [ %sub.i292, %while.body.i287 ], [ 0, %if.end.i282 ]
%ch.114.i289 = phi i32 [ %call.i13.i293, %while.body.i287 ], [ %ch.0.i283, %if.end.i282 ]
%mul.i290 = mul nsw i32 %x.015.i288, 10
%add.i291 = add nsw i32 %ch.114.i289, -48
%sub.i292 = add i32 %add.i291, %mul.i290
%58 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i13.i293 = call i32 @getc(ptr noundef %58)
%59 = add i32 %call.i13.i293, -48
%60 = icmp ult i32 %59, 10
br i1 %60, label %while.body.i287, label %nextInt.exit296, !llvm.loop !18
nextInt.exit296: ; preds = %while.body.i287, %if.end.i282
%x.0.lcssa.i285 = phi i32 [ 0, %if.end.i282 ], [ %sub.i292, %while.body.i287 ]
br label %do.body.i297
do.body.i297: ; preds = %do.body.i297, %nextInt.exit296
%61 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i.i298 = call i32 @getc(ptr noundef %61)
%cmp.i299 = icmp slt i32 %call.i.i298, 45
br i1 %cmp.i299, label %do.body.i297, label %do.end.i300, !llvm.loop !17
do.end.i300: ; preds = %do.body.i297
%mul6.i286 = mul nsw i32 %x.0.lcssa.i285, %sign.0.i284
%cmp1.i301 = icmp eq i32 %call.i.i298, 45
br i1 %cmp1.i301, label %if.then.i314, label %if.end.i302
if.then.i314: ; preds = %do.end.i300
%62 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i12.i315 = call i32 @getc(ptr noundef %62)
br label %if.end.i302
if.end.i302: ; preds = %if.then.i314, %do.end.i300
%ch.0.i303 = phi i32 [ %call.i12.i315, %if.then.i314 ], [ %call.i.i298, %do.end.i300 ]
%sign.0.i304 = phi i32 [ -1, %if.then.i314 ], [ 1, %do.end.i300 ]
%63 = add i32 %ch.0.i303, -48
%64 = icmp ult i32 %63, 10
br i1 %64, label %while.body.i307, label %nextInt.exit316
while.body.i307: ; preds = %if.end.i302, %while.body.i307
%x.015.i308 = phi i32 [ %sub.i312, %while.body.i307 ], [ 0, %if.end.i302 ]
%ch.114.i309 = phi i32 [ %call.i13.i313, %while.body.i307 ], [ %ch.0.i303, %if.end.i302 ]
%mul.i310 = mul nsw i32 %x.015.i308, 10
%add.i311 = add nsw i32 %ch.114.i309, -48
%sub.i312 = add i32 %add.i311, %mul.i310
%65 = load ptr, ptr @stdin, align 8, !tbaa !15
%call.i13.i313 = call i32 @getc(ptr noundef %65)
%66 = add i32 %call.i13.i313, -48
%67 = icmp ult i32 %66, 10
br i1 %67, label %while.body.i307, label %nextInt.exit316, !llvm.loop !18
nextInt.exit316: ; preds = %while.body.i307, %if.end.i302
%x.0.lcssa.i305 = phi i32 [ 0, %if.end.i302 ], [ %sub.i312, %while.body.i307 ]
%mul6.i306 = mul nsw i32 %x.0.lcssa.i305, %sign.0.i304
%idxprom28 = sext i32 %mul6.i286 to i64
%idxprom30 = sext i32 %mul6.i266 to i64
%arrayidx31 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %idxprom28, i64 %idxprom30
store i32 %mul6.i306, ptr %arrayidx31, align 4, !tbaa !5
%arrayidx35 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %idxprom30, i64 %idxprom28
store i32 %mul6.i306, ptr %arrayidx35, align 4, !tbaa !5
%inc37 = add nuw nsw i32 %i.2324, 1
%68 = load i32, ptr %k, align 4, !tbaa !5
%cmp23 = icmp slt i32 %inc37, %68
br i1 %cmp23, label %do.body.i257.preheader, label %for.cond39.preheader.loopexit, !llvm.loop !32
for.cond87.preheader: ; preds = %for.cond42.for.inc84_crit_edge.split.us.us
br i1 %cmp40329, label %for.cond90.preheader.lr.ph, label %for.end167
for.cond90.preheader.lr.ph: ; preds = %for.cond87.preheader
%69 = load i32, ptr %m, align 4
%wide.trip.count386 = zext i32 %18 to i64
%xtraiter474 = and i64 %wide.trip.count371, 1
%70 = icmp eq i64 %20, 0
%unroll_iter = and i64 %wide.trip.count371, 4294967294
%lcmp.mod475.not = icmp eq i64 %xtraiter474, 0
%min.iters.check421 = icmp ult i32 %18, 8
%n.vec424 = and i64 %wide.trip.count371, 4294967288
%cmp.n426 = icmp eq i64 %n.vec424, %wide.trip.count371
br label %for.cond90.preheader.us
for.cond90.preheader.us: ; preds = %for.cond90.for.inc112_crit_edge.us, %for.cond90.preheader.lr.ph
%indvars.iv383 = phi i64 [ %indvars.iv.next384, %for.cond90.for.inc112_crit_edge.us ], [ 0, %for.cond90.preheader.lr.ph ]
%arrayidx94.us = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %indvars.iv383
%71 = load i32, ptr %arrayidx94.us, align 4, !tbaa !5
%tobool95.not.us = icmp eq i32 %71, 0
br i1 %tobool95.not.us, label %for.body92.us.us.preheader, label %for.body92.us335.preheader
for.body92.us335.preheader: ; preds = %for.cond90.preheader.us
br i1 %70, label %for.cond90.for.inc112_crit_edge.us.loopexit473.unr-lcssa, label %for.body92.us335
for.body92.us.us.preheader: ; preds = %for.cond90.preheader.us
br i1 %min.iters.check421, label %for.body92.us.us.preheader472, label %vector.body427
vector.body427: ; preds = %for.body92.us.us.preheader, %vector.body427
%index428 = phi i64 [ %index.next429, %vector.body427 ], [ 0, %for.body92.us.us.preheader ]
%72 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %index428
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %72, align 16, !tbaa !5
%73 = getelementptr inbounds i32, ptr %72, i64 4
store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %73, align 16, !tbaa !5
%index.next429 = add nuw i64 %index428, 8
%74 = icmp eq i64 %index.next429, %n.vec424
br i1 %74, label %middle.block419, label %vector.body427, !llvm.loop !33
middle.block419: ; preds = %vector.body427
br i1 %cmp.n426, label %for.cond90.for.inc112_crit_edge.us, label %for.body92.us.us.preheader472
for.body92.us.us.preheader472: ; preds = %for.body92.us.us.preheader, %middle.block419
%indvars.iv378.ph = phi i64 [ 0, %for.body92.us.us.preheader ], [ %n.vec424, %middle.block419 ]
br label %for.body92.us.us
for.body92.us335: ; preds = %for.body92.us335.preheader, %for.inc109.us.1
%indvars.iv373 = phi i64 [ %indvars.iv.next374.1, %for.inc109.us.1 ], [ 0, %for.body92.us335.preheader ]
%niter = phi i64 [ %niter.next.1, %for.inc109.us.1 ], [ 0, %for.body92.us335.preheader ]
%arrayidx97.us = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %indvars.iv373
%75 = load i32, ptr %arrayidx97.us, align 8, !tbaa !5
%tobool98.not.us = icmp eq i32 %75, 0
br i1 %tobool98.not.us, label %if.then.us, label %lor.lhs.false99.us
lor.lhs.false99.us: ; preds = %for.body92.us335
%arrayidx103.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv373
%76 = load i32, ptr %arrayidx103.us, align 8, !tbaa !5
%cmp104.us = icmp sgt i32 %76, %69
br i1 %cmp104.us, label %if.then.us, label %for.inc109.us
if.then.us: ; preds = %lor.lhs.false99.us, %for.body92.us335
%arrayidx108.us338 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv373
store i32 1000000000, ptr %arrayidx108.us338, align 8, !tbaa !5
br label %for.inc109.us
for.inc109.us: ; preds = %if.then.us, %lor.lhs.false99.us
%indvars.iv.next374 = or i64 %indvars.iv373, 1
%arrayidx97.us.1 = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %indvars.iv.next374
%77 = load i32, ptr %arrayidx97.us.1, align 4, !tbaa !5
%tobool98.not.us.1 = icmp eq i32 %77, 0
br i1 %tobool98.not.us.1, label %if.then.us.1, label %lor.lhs.false99.us.1
lor.lhs.false99.us.1: ; preds = %for.inc109.us
%arrayidx103.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv.next374
%78 = load i32, ptr %arrayidx103.us.1, align 4, !tbaa !5
%cmp104.us.1 = icmp sgt i32 %78, %69
br i1 %cmp104.us.1, label %if.then.us.1, label %for.inc109.us.1
if.then.us.1: ; preds = %lor.lhs.false99.us.1, %for.inc109.us
%arrayidx108.us338.1 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv.next374
store i32 1000000000, ptr %arrayidx108.us338.1, align 4, !tbaa !5
br label %for.inc109.us.1
for.inc109.us.1: ; preds = %if.then.us.1, %lor.lhs.false99.us.1
%indvars.iv.next374.1 = add nuw nsw i64 %indvars.iv373, 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.cond90.for.inc112_crit_edge.us.loopexit473.unr-lcssa, label %for.body92.us335, !llvm.loop !34
for.cond90.for.inc112_crit_edge.us.loopexit473.unr-lcssa: ; preds = %for.inc109.us.1, %for.body92.us335.preheader
%indvars.iv373.unr = phi i64 [ 0, %for.body92.us335.preheader ], [ %indvars.iv.next374.1, %for.inc109.us.1 ]
br i1 %lcmp.mod475.not, label %for.cond90.for.inc112_crit_edge.us, label %for.body92.us335.epil
for.body92.us335.epil: ; preds = %for.cond90.for.inc112_crit_edge.us.loopexit473.unr-lcssa
%arrayidx97.us.epil = getelementptr inbounds [100 x i32], ptr %canFreeze, i64 0, i64 %indvars.iv373.unr
%79 = load i32, ptr %arrayidx97.us.epil, align 4, !tbaa !5
%tobool98.not.us.epil = icmp eq i32 %79, 0
br i1 %tobool98.not.us.epil, label %if.then.us.epil, label %lor.lhs.false99.us.epil
lor.lhs.false99.us.epil: ; preds = %for.body92.us335.epil
%arrayidx103.us.epil = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv373.unr
%80 = load i32, ptr %arrayidx103.us.epil, align 4, !tbaa !5
%cmp104.us.epil = icmp sgt i32 %80, %69
br i1 %cmp104.us.epil, label %if.then.us.epil, label %for.cond90.for.inc112_crit_edge.us
if.then.us.epil: ; preds = %lor.lhs.false99.us.epil, %for.body92.us335.epil
%arrayidx108.us338.epil = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv373.unr
store i32 1000000000, ptr %arrayidx108.us338.epil, align 4, !tbaa !5
br label %for.cond90.for.inc112_crit_edge.us
for.cond90.for.inc112_crit_edge.us: ; preds = %for.cond90.for.inc112_crit_edge.us.loopexit473.unr-lcssa, %if.then.us.epil, %lor.lhs.false99.us.epil, %for.body92.us.us, %middle.block419
%indvars.iv.next384 = add nuw nsw i64 %indvars.iv383, 1
%exitcond387.not = icmp eq i64 %indvars.iv.next384, %wide.trip.count386
br i1 %exitcond387.not, label %for.cond115.preheader, label %for.cond90.preheader.us, !llvm.loop !35
for.body92.us.us: ; preds = %for.body92.us.us.preheader472, %for.body92.us.us
%indvars.iv378 = phi i64 [ %indvars.iv.next379, %for.body92.us.us ], [ %indvars.iv378.ph, %for.body92.us.us.preheader472 ]
%arrayidx108.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv383, i64 %indvars.iv378
store i32 1000000000, ptr %arrayidx108.us.us, align 4, !tbaa !5
%indvars.iv.next379 = add nuw nsw i64 %indvars.iv378, 1
%exitcond382.not = icmp eq i64 %indvars.iv.next379, %wide.trip.count386
br i1 %exitcond382.not, label %for.cond90.for.inc112_crit_edge.us, label %for.body92.us.us, !llvm.loop !36
for.cond115.preheader: ; preds = %for.cond90.for.inc112_crit_edge.us
br i1 %cmp40329, label %for.cond118.preheader.us.preheader, label %for.end167
for.cond118.preheader.us.preheader: ; preds = %for.cond115.preheader
%wide.trip.count401 = zext i32 %18 to i64
%81 = shl nuw nsw i64 %wide.trip.count371, 2
%82 = getelementptr i8, ptr %adj, i64 %81
%min.iters.check = icmp ult i32 %18, 12
%83 = getelementptr i8, ptr %adj, i64 %81
%n.vec = and i64 %wide.trip.count371, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count371
%xtraiter476 = and i64 %wide.trip.count371, 1
%lcmp.mod477.not = icmp eq i64 %xtraiter476, 0
%84 = sub nsw i64 0, %wide.trip.count371
br label %for.cond118.preheader.us
for.cond118.preheader.us: ; preds = %for.cond118.preheader.us.preheader, %for.cond118.for.inc165_crit_edge.split.us.us
%indvars.iv398 = phi i64 [ 0, %for.cond118.preheader.us.preheader ], [ %indvars.iv.next399, %for.cond118.for.inc165_crit_edge.split.us.us ]
%85 = shl nuw nsw i64 %indvars.iv398, 2
%86 = mul nuw nsw i64 %indvars.iv398, 400
%scevgep409 = getelementptr i8, ptr %adj, i64 %86
%scevgep410 = getelementptr i8, ptr %82, i64 %86
%gep479 = getelementptr i8, ptr %invariant.gep478, i64 %85
%87 = getelementptr i8, ptr %adj, i64 %85
%bound0 = icmp ult ptr %adj, %gep479
%bound1 = icmp ult ptr %87, %83
%found.conflict = and i1 %bound0, %bound1
br label %for.cond121.preheader.us.us
for.cond121.preheader.us.us: ; preds = %for.cond121.for.inc162_crit_edge.us.us, %for.cond118.preheader.us
%indvars.iv393 = phi i64 [ %indvars.iv.next394, %for.cond121.for.inc162_crit_edge.us.us ], [ 0, %for.cond118.preheader.us ]
%arrayidx131.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv393, i64 %indvars.iv398
br i1 %min.iters.check, label %for.body123.us.us.preheader, label %vector.memcheck
vector.memcheck: ; preds = %for.cond121.preheader.us.us
%88 = mul nuw nsw i64 %indvars.iv393, 400
%scevgep406 = getelementptr i8, ptr %83, i64 %88
%scevgep = getelementptr i8, ptr %adj, i64 %88
%bound0411 = icmp ult ptr %scevgep, %scevgep410
%bound1412 = icmp ult ptr %scevgep409, %scevgep406
%found.conflict413 = and i1 %bound0411, %bound1412
%conflict.rdx = or i1 %found.conflict, %found.conflict413
br i1 %conflict.rdx, label %for.body123.us.us.preheader, label %vector.ph
vector.ph: ; preds = %vector.memcheck
%89 = load i32, ptr %arrayidx131.us.us, align 4, !tbaa !5, !alias.scope !37
%broadcast.splatinsert417 = insertelement <4 x i32> poison, i32 %89, i64 0
%broadcast.splat418 = shufflevector <4 x i32> %broadcast.splatinsert417, <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 ]
%90 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv393, i64 %index
%wide.load = load <4 x i32>, ptr %90, align 16, !tbaa !5, !alias.scope !40, !noalias !42
%91 = getelementptr inbounds i32, ptr %90, i64 4
%wide.load414 = load <4 x i32>, ptr %91, align 16, !tbaa !5, !alias.scope !40, !noalias !42
%92 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv398, i64 %index
%wide.load415 = load <4 x i32>, ptr %92, align 16, !tbaa !5, !alias.scope !44
%93 = getelementptr inbounds i32, ptr %92, i64 4
%wide.load416 = load <4 x i32>, ptr %93, align 16, !tbaa !5, !alias.scope !44
%94 = add nsw <4 x i32> %wide.load415, %broadcast.splat418
%95 = add nsw <4 x i32> %wide.load416, %broadcast.splat418
%96 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %94)
%97 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load414, <4 x i32> %95)
store <4 x i32> %96, ptr %90, align 16, !tbaa !5, !alias.scope !40, !noalias !42
store <4 x i32> %97, ptr %91, align 16, !tbaa !5, !alias.scope !40, !noalias !42
%index.next = add nuw i64 %index, 8
%98 = icmp eq i64 %index.next, %n.vec
br i1 %98, label %middle.block, label %vector.body, !llvm.loop !45
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond121.for.inc162_crit_edge.us.us, label %for.body123.us.us.preheader
for.body123.us.us.preheader: ; preds = %vector.memcheck, %for.cond121.preheader.us.us, %middle.block
%indvars.iv388.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %for.cond121.preheader.us.us ], [ %n.vec, %middle.block ]
br i1 %lcmp.mod477.not, label %for.body123.us.us.prol.loopexit, label %for.body123.us.us.prol
for.body123.us.us.prol: ; preds = %for.body123.us.us.preheader
%arrayidx127.us.us.prol = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv393, i64 %indvars.iv388.ph
%99 = load i32, ptr %arrayidx127.us.us.prol, align 16, !tbaa !5
%100 = load i32, ptr %arrayidx131.us.us, align 4, !tbaa !5
%arrayidx135.us.us.prol = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv398, i64 %indvars.iv388.ph
%101 = load i32, ptr %arrayidx135.us.us.prol, align 16, !tbaa !5
%add136.us.us.prol = add nsw i32 %101, %100
%.add136.us.us.prol = call i32 @llvm.smin.i32(i32 %99, i32 %add136.us.us.prol)
store i32 %.add136.us.us.prol, ptr %arrayidx127.us.us.prol, align 16, !tbaa !5
%indvars.iv.next389.prol = or i64 %indvars.iv388.ph, 1
br label %for.body123.us.us.prol.loopexit
for.body123.us.us.prol.loopexit: ; preds = %for.body123.us.us.prol, %for.body123.us.us.preheader
%indvars.iv388.unr = phi i64 [ %indvars.iv388.ph, %for.body123.us.us.preheader ], [ %indvars.iv.next389.prol, %for.body123.us.us.prol ]
%102 = xor i64 %indvars.iv388.ph, %84
%103 = icmp eq i64 %102, -1
br i1 %103, label %for.cond121.for.inc162_crit_edge.us.us, label %for.body123.us.us
for.body123.us.us: ; preds = %for.body123.us.us.prol.loopexit, %for.body123.us.us
%indvars.iv388 = phi i64 [ %indvars.iv.next389.1, %for.body123.us.us ], [ %indvars.iv388.unr, %for.body123.us.us.prol.loopexit ]
%arrayidx127.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv393, i64 %indvars.iv388
%104 = load i32, ptr %arrayidx127.us.us, align 4, !tbaa !5
%105 = load i32, ptr %arrayidx131.us.us, align 4, !tbaa !5
%arrayidx135.us.us = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv398, i64 %indvars.iv388
%106 = load i32, ptr %arrayidx135.us.us, align 4, !tbaa !5
%add136.us.us = add nsw i32 %106, %105
%.add136.us.us = call i32 @llvm.smin.i32(i32 %104, i32 %add136.us.us)
store i32 %.add136.us.us, ptr %arrayidx127.us.us, align 4, !tbaa !5
%indvars.iv.next389 = add nuw nsw i64 %indvars.iv388, 1
%arrayidx127.us.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv393, i64 %indvars.iv.next389
%107 = load i32, ptr %arrayidx127.us.us.1, align 4, !tbaa !5
%108 = load i32, ptr %arrayidx131.us.us, align 4, !tbaa !5
%arrayidx135.us.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %indvars.iv398, i64 %indvars.iv.next389
%109 = load i32, ptr %arrayidx135.us.us.1, align 4, !tbaa !5
%add136.us.us.1 = add nsw i32 %109, %108
%.add136.us.us.1 = call i32 @llvm.smin.i32(i32 %107, i32 %add136.us.us.1)
store i32 %.add136.us.us.1, ptr %arrayidx127.us.us.1, align 4, !tbaa !5
%indvars.iv.next389.1 = add nuw nsw i64 %indvars.iv388, 2
%exitcond392.not.1 = icmp eq i64 %indvars.iv.next389.1, %wide.trip.count401
br i1 %exitcond392.not.1, label %for.cond121.for.inc162_crit_edge.us.us, label %for.body123.us.us, !llvm.loop !46
for.cond121.for.inc162_crit_edge.us.us: ; preds = %for.body123.us.us.prol.loopexit, %for.body123.us.us, %middle.block
%indvars.iv.next394 = add nuw nsw i64 %indvars.iv393, 1
%exitcond397.not = icmp eq i64 %indvars.iv.next394, %wide.trip.count401
br i1 %exitcond397.not, label %for.cond118.for.inc165_crit_edge.split.us.us, label %for.cond121.preheader.us.us, !llvm.loop !47
for.cond118.for.inc165_crit_edge.split.us.us: ; preds = %for.cond121.for.inc162_crit_edge.us.us
%indvars.iv.next399 = add nuw nsw i64 %indvars.iv398, 1
%exitcond402.not = icmp eq i64 %indvars.iv.next399, %wide.trip.count401
br i1 %exitcond402.not, label %for.end167, label %for.cond118.preheader.us, !llvm.loop !48
for.end167: ; preds = %for.cond118.for.inc165_crit_edge.split.us.us, %for.cond39.preheader, %for.cond87.preheader, %for.cond115.preheader
%110 = load i32, ptr %a, align 4, !tbaa !5
%idxprom168 = sext i32 %110 to i64
%111 = load i32, ptr %h, align 4, !tbaa !5
%idxprom170 = sext i32 %111 to i64
%arrayidx171 = getelementptr inbounds [100 x [100 x i32]], ptr %adj, i64 0, i64 %idxprom168, i64 %idxprom170
%112 = load i32, ptr %arrayidx171, align 4, !tbaa !5
%cmp172.not = icmp eq i32 %112, 1000000000
br i1 %cmp172.not, label %if.else, label %if.then173
if.then173: ; preds = %for.end167
%113 = load i32, ptr %m, align 4, !tbaa !5
%sub = sub nsw i32 %112, %113
%spec.select = call i32 @llvm.smax.i32(i32 %sub, i32 0)
%add192 = add nsw i32 %spec.select, %112
%call193 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add192)
br label %if.end195
if.else: ; preds = %for.end167
%call194 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end195
if.end195: ; preds = %if.else, %if.then173
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %adj) #5
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %canFreeze) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m, ptr noundef nonnull %l, ptr noundef nonnull %k, ptr noundef nonnull %a, ptr noundef nonnull %h)
%114 = load i32, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %114, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !49
while.end: ; preds = %if.end195, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, !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}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21}
!21 = distinct !{!21, !22}
!22 = distinct !{!22, !"LVerDomain"}
!23 = !{!24}
!24 = distinct !{!24, !22}
!25 = !{!21, !26}
!26 = distinct !{!26, !22}
!27 = !{!26}
!28 = distinct !{!28, !10, !11, !12}
!29 = distinct !{!29, !10, !11}
!30 = distinct !{!30, !10}
!31 = distinct !{!31, !10}
!32 = distinct !{!32, !10}
!33 = distinct !{!33, !10, !11, !12}
!34 = distinct !{!34, !10}
!35 = distinct !{!35, !10}
!36 = distinct !{!36, !10, !12, !11}
!37 = !{!38}
!38 = distinct !{!38, !39}
!39 = distinct !{!39, !"LVerDomain"}
!40 = !{!41}
!41 = distinct !{!41, !39}
!42 = !{!38, !43}
!43 = distinct !{!43, !39}
!44 = !{!43}
!45 = distinct !{!45, !10, !11, !12}
!46 = distinct !{!46, !10, !11}
!47 = distinct !{!47, !10}
!48 = distinct !{!48, !10}
!49 = distinct !{!49, !10}
|
#include<stdio.h>
int main(){
int n,k,i,min=0;
scanf("%d%d",&n,&k);
int x[n+1];
for(i=0;i<n;i++)
scanf("%d",&x[i]);
for(i=0;i<n;i++){
if(x[i]<k-x[i])
min+=2*x[i];
else
min+=2*(k-x[i]);
}
printf("%d\n",min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255467/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255467/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%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
%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
%cmp32 = icmp sgt i32 %3, 0
br i1 %cmp32, label %for.body, label %for.end20
for.cond2.preheader: ; preds = %for.body
%cmp334 = icmp sgt i32 %17, 0
br i1 %cmp334, label %for.body4.lr.ph, label %for.end20
for.body4.lr.ph: ; preds = %for.cond2.preheader
%4 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %17 to i64
%min.iters.check = icmp ult i32 %17, 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 ], [ %13, %vector.body ]
%vec.phi45 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %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.load46 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = sub nsw <4 x i32> %broadcast.splat, %wide.load
%8 = sub nsw <4 x i32> %broadcast.splat, %wide.load46
%9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %7)
%10 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load46, <4 x i32> %8)
%11 = shl nsw <4 x i32> %9, <i32 1, i32 1, i32 1, i32 1>
%12 = shl nsw <4 x i32> %10, <i32 1, i32 1, i32 1, i32 1>
%13 = add <4 x i32> %11, %vec.phi
%14 = add <4 x i32> %12, %vec.phi45
%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 !9
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 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end20, label %for.body4.preheader
for.body4.preheader: ; preds = %for.body4.lr.ph, %middle.block
%indvars.iv40.ph = phi i64 [ 0, %for.body4.lr.ph ], [ %n.vec, %middle.block ]
%min.035.ph = phi i32 [ 0, %for.body4.lr.ph ], [ %16, %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
%17 = load i32, ptr %n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp = icmp slt i64 %indvars.iv.next, %18
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv40 = phi i64 [ %indvars.iv.next41, %for.body4 ], [ %indvars.iv40.ph, %for.body4.preheader ]
%min.035 = phi i32 [ %min.1, %for.body4 ], [ %min.035.ph, %for.body4.preheader ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv40
%19 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%sub = sub nsw i32 %4, %19
%.sub = call i32 @llvm.smin.i32(i32 %19, i32 %sub)
%mul.pn = shl nsw i32 %.sub, 1
%min.1 = add nsw i32 %mul.pn, %min.035
%indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
%exitcond.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.body4, !llvm.loop !14
for.end20: ; preds = %for.body4, %middle.block, %entry, %for.cond2.preheader
%min.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %16, %middle.block ], [ %min.1, %for.body4 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %min.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.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree 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>
int main(){
int n, t, a, b, s;
scanf("%d", &t);
for (int i = 0; i < t; i++){
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &n);
if (n % 3 == 0)
s = a;
if (n % 3 == 1)
s = b;
if (n % 3 == 2)
s = a ^ b;
printf("%d\n", s);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25551/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25551/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%t = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %0, 0
br i1 %cmp15, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.017 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%s.016 = phi i32 [ %s.3, %for.body ], [ undef, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%rem = srem i32 %1, 3
%cmp4 = icmp eq i32 %rem, 0
%2 = load i32, ptr %a, align 4
%spec.select = select i1 %cmp4, i32 %2, i32 %s.016
%cmp6 = icmp eq i32 %rem, 1
%3 = load i32, ptr %b, align 4
%s.2 = select i1 %cmp6, i32 %3, i32 %spec.select
%cmp10 = icmp eq i32 %rem, 2
%xor = xor i32 %3, %2
%s.3 = select i1 %cmp10, i32 %xor, i32 %s.2
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.3)
%inc = add nuw nsw i32 %i.017, 1
%4 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %4
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: 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 <string.h>
int min(int a,int b){
if(a<b){
return a;
}else{
return b;
}
}
int abs(int a){
if(a<0){
return -a;
}else{
return a;
}
}
int main(){
int n,i,k,ans=0;
scanf("%d",&n);
scanf("%d",&k);
int x[100];
for(i=0;i<n;i++){
scanf("%d",&x[i]);
}
for(i=0;i<n;i++){
ans += min(x[i],abs(k-x[i]));
}
printf("%d\n",2*ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255568/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %a) local_unnamed_addr #1 {
entry:
%retval.0 = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %retval.0
}
; 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
%x = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %x) #7
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %0, 0
br i1 %cmp22, label %for.body, label %for.end13
for.cond3.preheader: ; preds = %for.body
%cmp424 = icmp sgt i32 %14, 0
br i1 %cmp424, label %for.body5.lr.ph, label %for.end13
for.body5.lr.ph: ; preds = %for.cond3.preheader
%1 = load i32, ptr %k, align 4, !tbaa !5
%wide.trip.count = zext i32 %14 to i64
%min.iters.check = icmp ult i32 %14, 8
br i1 %min.iters.check, label %for.body5.preheader, label %vector.ph
vector.ph: ; preds = %for.body5.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967288
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %1, 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 ], [ %10, %vector.body ]
%vec.phi35 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%2 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load36 = load <4 x i32>, ptr %3, align 16, !tbaa !5
%4 = sub nsw <4 x i32> %broadcast.splat, %wide.load
%5 = sub nsw <4 x i32> %broadcast.splat, %wide.load36
%6 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %4, i1 true)
%7 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %5, i1 true)
%8 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %6)
%9 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load36, <4 x i32> %7)
%10 = add <4 x i32> %8, %vec.phi
%11 = add <4 x i32> %9, %vec.phi35
%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 !9
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.end13.loopexit, label %for.body5.preheader
for.body5.preheader: ; preds = %for.body5.lr.ph, %middle.block
%indvars.iv30.ph = phi i64 [ 0, %for.body5.lr.ph ], [ %n.vec, %middle.block ]
%ans.026.ph = phi i32 [ 0, %for.body5.lr.ph ], [ %13, %middle.block ]
br label %for.body5
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !13
for.body5: ; preds = %for.body5.preheader, %for.body5
%indvars.iv30 = phi i64 [ %indvars.iv.next31, %for.body5 ], [ %indvars.iv30.ph, %for.body5.preheader ]
%ans.026 = phi i32 [ %add, %for.body5 ], [ %ans.026.ph, %for.body5.preheader ]
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %x, i64 0, i64 %indvars.iv30
%16 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%sub = sub nsw i32 %1, %16
%17 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%a.b.i = call i32 @llvm.smin.i32(i32 %16, i32 %17)
%add = add nsw i32 %a.b.i, %ans.026
%indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
%exitcond.not = icmp eq i64 %indvars.iv.next31, %wide.trip.count
br i1 %exitcond.not, label %for.end13.loopexit, label %for.body5, !llvm.loop !14
for.end13.loopexit: ; preds = %for.body5, %middle.block
%add.lcssa = phi i32 [ %13, %middle.block ], [ %add, %for.body5 ]
%18 = shl nsw i32 %add.lcssa, 1
br label %for.end13
for.end13: ; preds = %entry, %for.end13.loopexit, %for.cond3.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond3.preheader ], [ %18, %for.end13.loopexit ], [ 0, %entry ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %x) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !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>
int main()
{
int n, k, arr[105], i;
scanf("%d%d", &n, &k);
for(i = 1; i <= n; i++)scanf("%d", &arr[i]);
int sum=0;
for(i = 1; i <= n; i++)
{
int disA, disB;
disA = arr[i];
if(arr[i] >= k) disB = arr[i] - k;
else disB = k - arr[i];
if(disA <= disB) sum = sum + 2*disA;
else sum = sum + 2*disB;
}
printf("%d\n", sum);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255618/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255618/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%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
%arr = alloca [105 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 %k) #4
call void @llvm.lifetime.start.p0(i64 420, ptr nonnull %arr) #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
%cmp.not39 = icmp slt i32 %0, 1
br i1 %cmp.not39, label %for.end23, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not41 = icmp slt i32 %18, 1
br i1 %cmp3.not41, label %for.end23, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %for.cond2.preheader
%1 = load i32, ptr %k, align 4, !tbaa !5
%2 = add nuw i32 %18, 1
%wide.trip.count = zext i32 %2 to i64
%3 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %18, 8
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.body4.lr.ph
%n.vec = and i64 %3, -8
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %1, 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 ], [ %14, %vector.body ]
%vec.phi52 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%offset.idx = or i64 %index, 1
%4 = getelementptr inbounds [105 x i32], ptr %arr, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %4, align 4, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load53 = load <4 x i32>, ptr %5, align 4, !tbaa !5
%6 = sub nsw <4 x i32> %wide.load, %broadcast.splat
%7 = sub nsw <4 x i32> %wide.load53, %broadcast.splat
%8 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %6, i1 true)
%9 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %7, i1 true)
%10 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> %8)
%11 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load53, <4 x i32> %9)
%12 = shl nsw <4 x i32> %10, <i32 1, i32 1, i32 1, i32 1>
%13 = shl nsw <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%14 = add <4 x i32> %12, %vec.phi
%15 = add <4 x i32> %13, %vec.phi52
%index.next = add nuw i64 %index, 8
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %15, %14
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %3, %n.vec
br i1 %cmp.n, label %for.end23, label %for.body4.preheader
for.body4.preheader: ; preds = %for.body4.lr.ph, %middle.block
%indvars.iv47.ph = phi i64 [ 1, %for.body4.lr.ph ], [ %ind.end, %middle.block ]
%sum.042.ph = phi i32 [ 0, %for.body4.lr.ph ], [ %17, %middle.block ]
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [105 x i32], ptr %arr, 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
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %19
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body4 ], [ %indvars.iv47.ph, %for.body4.preheader ]
%sum.042 = phi i32 [ %sum.1, %for.body4 ], [ %sum.042.ph, %for.body4.preheader ]
%arrayidx6 = getelementptr inbounds [105 x i32], ptr %arr, i64 0, i64 %indvars.iv47
%20 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%sub = sub nsw i32 %20, %1
%disB.0 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%mul.pn.in = call i32 @llvm.smin.i32(i32 %20, i32 %disB.0)
%mul.pn = shl nsw i32 %mul.pn.in, 1
%sum.1 = add nsw i32 %mul.pn, %sum.042
%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.end23, label %for.body4, !llvm.loop !14
for.end23: ; preds = %for.body4, %middle.block, %entry, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %17, %middle.block ], [ %sum.1, %for.body4 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 420, ptr nonnull %arr) #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 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.abs.i32(i32, i1 immarg) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.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, !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>
int main(){
int i,j,k;
int N;
scanf("%d",&N);
int A[N];
for(i=0;i<N;i++)
scanf("%d ",&A[i]);
int kisuu=0,two=0,four=0;
for(i=0;i<N;i++){
if(A[i] %4 ==0)
four++;
else if(A[i] % 4 != 0 && A[i] %2 == 0)
two++;
else
kisuu++;
}
if(kisuu - four > 1){
puts("No");
return 0;
}
four -= kisuu-1;
if(two %2 == 1 && four <= 0){
puts("No");
return 0;
}
puts("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255661/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255661/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
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
%cmp59 = icmp sgt i32 %3, 0
br i1 %cmp59, label %for.body, label %for.end24
for.cond2.preheader: ; preds = %for.body
%cmp361 = icmp sgt i32 %26, 0
br i1 %cmp361, label %for.body4.preheader, label %for.end24
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %26 to i64
%min.iters.check = icmp ult i32 %26, 8
br i1 %min.iters.check, label %for.body4.preheader105, label %vector.ph
vector.ph: ; preds = %for.body4.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 ], [ %predphi91, %vector.body ]
%vec.phi76 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi92, %vector.body ]
%vec.phi77 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi87, %vector.body ]
%vec.phi78 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi88, %vector.body ]
%vec.phi79 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi83, %vector.body ]
%vec.phi80 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi84, %vector.body ]
%4 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load81 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = and <4 x i32> %wide.load, <i32 3, i32 3, i32 3, i32 3>
%7 = and <4 x i32> %wide.load81, <i32 3, i32 3, i32 3, i32 3>
%8 = icmp ne <4 x i32> %6, zeroinitializer
%9 = icmp ne <4 x i32> %7, zeroinitializer
%10 = and <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%11 = and <4 x i32> %wide.load81, <i32 1, i32 1, i32 1, i32 1>
%12 = icmp eq <4 x i32> %10, zeroinitializer
%13 = icmp eq <4 x i32> %11, zeroinitializer
%14 = and <4 x i1> %8, %12
%15 = and <4 x i1> %9, %13
%16 = xor <4 x i1> %12, <i1 true, i1 true, i1 true, i1 true>
%17 = xor <4 x i1> %13, <i1 true, i1 true, i1 true, i1 true>
%18 = select <4 x i1> %8, <4 x i1> %16, <4 x i1> zeroinitializer
%19 = select <4 x i1> %9, <4 x i1> %17, <4 x i1> zeroinitializer
%20 = zext <4 x i1> %18 to <4 x i32>
%predphi83 = add <4 x i32> %vec.phi79, %20
%21 = zext <4 x i1> %19 to <4 x i32>
%predphi84 = add <4 x i32> %vec.phi80, %21
%not. = xor <4 x i1> %18, <i1 true, i1 true, i1 true, i1 true>
%narrow = select <4 x i1> %not., <4 x i1> %14, <4 x i1> zeroinitializer
%predphi85 = zext <4 x i1> %narrow to <4 x i32>
%predphi87 = add <4 x i32> %vec.phi77, %predphi85
%not.98 = xor <4 x i1> %19, <i1 true, i1 true, i1 true, i1 true>
%narrow97 = select <4 x i1> %not.98, <4 x i1> %15, <4 x i1> zeroinitializer
%predphi86 = zext <4 x i1> %narrow97 to <4 x i32>
%predphi88 = add <4 x i32> %vec.phi78, %predphi86
%narrow101 = xor <4 x i1> %8, <i1 true, i1 true, i1 true, i1 true>
%predphi89 = zext <4 x i1> %narrow101 to <4 x i32>
%predphi91 = add <4 x i32> %vec.phi, %predphi89
%narrow103 = xor <4 x i1> %9, <i1 true, i1 true, i1 true, i1 true>
%predphi90 = zext <4 x i1> %narrow103 to <4 x i32>
%predphi92 = add <4 x i32> %vec.phi76, %predphi90
%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 !9
middle.block: ; preds = %vector.body
%bin.rdx95 = add <4 x i32> %predphi84, %predphi83
%23 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx95)
%bin.rdx93 = add <4 x i32> %predphi88, %predphi87
%24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx93)
%bin.rdx = add <4 x i32> %predphi92, %predphi91
%25 = 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.end24.loopexit, label %for.body4.preheader105
for.body4.preheader105: ; preds = %for.body4.preheader, %middle.block
%indvars.iv71.ph = phi i64 [ 0, %for.body4.preheader ], [ %n.vec, %middle.block ]
%four.065.ph = phi i32 [ 0, %for.body4.preheader ], [ %25, %middle.block ]
%two.064.ph = phi i32 [ 0, %for.body4.preheader ], [ %24, %middle.block ]
%kisuu.063.ph = phi i32 [ 0, %for.body4.preheader ], [ %23, %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
%26 = load i32, ptr %N, align 4, !tbaa !5
%27 = sext i32 %26 to i64
%cmp = icmp slt i64 %indvars.iv.next, %27
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader105, %for.inc22
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.inc22 ], [ %indvars.iv71.ph, %for.body4.preheader105 ]
%four.065 = phi i32 [ %four.1, %for.inc22 ], [ %four.065.ph, %for.body4.preheader105 ]
%two.064 = phi i32 [ %two.1, %for.inc22 ], [ %two.064.ph, %for.body4.preheader105 ]
%kisuu.063 = phi i32 [ %kisuu.1, %for.inc22 ], [ %kisuu.063.ph, %for.body4.preheader105 ]
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv71
%28 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%29 = and i32 %28, 3
%cmp7 = icmp eq i32 %29, 0
br i1 %cmp7, label %if.then, label %land.lhs.true
if.then: ; preds = %for.body4
%inc8 = add nsw i32 %four.065, 1
br label %for.inc22
land.lhs.true: ; preds = %for.body4
%30 = and i32 %28, 1
%cmp16 = icmp eq i32 %30, 0
br i1 %cmp16, label %if.then17, label %if.else19
if.then17: ; preds = %land.lhs.true
%inc18 = add nsw i32 %two.064, 1
br label %for.inc22
if.else19: ; preds = %land.lhs.true
%inc20 = add nsw i32 %kisuu.063, 1
br label %for.inc22
for.inc22: ; preds = %if.then, %if.else19, %if.then17
%kisuu.1 = phi i32 [ %kisuu.063, %if.then ], [ %kisuu.063, %if.then17 ], [ %inc20, %if.else19 ]
%two.1 = phi i32 [ %two.064, %if.then ], [ %inc18, %if.then17 ], [ %two.064, %if.else19 ]
%four.1 = phi i32 [ %inc8, %if.then ], [ %four.065, %if.then17 ], [ %four.065, %if.else19 ]
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count
br i1 %exitcond.not, label %for.end24.loopexit, label %for.body4, !llvm.loop !14
for.end24.loopexit: ; preds = %for.inc22, %middle.block
%kisuu.1.lcssa = phi i32 [ %23, %middle.block ], [ %kisuu.1, %for.inc22 ]
%two.1.lcssa = phi i32 [ %24, %middle.block ], [ %two.1, %for.inc22 ]
%four.1.lcssa = phi i32 [ %25, %middle.block ], [ %four.1, %for.inc22 ]
%31 = and i32 %two.1.lcssa, -2147483647
%32 = icmp eq i32 %31, 1
br label %for.end24
for.end24: ; preds = %entry, %for.end24.loopexit, %for.cond2.preheader
%kisuu.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %kisuu.1.lcssa, %for.end24.loopexit ], [ 0, %entry ]
%two.0.lcssa = phi i1 [ false, %for.cond2.preheader ], [ %32, %for.end24.loopexit ], [ false, %entry ]
%four.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %four.1.lcssa, %for.end24.loopexit ], [ 0, %entry ]
%sub = sub nsw i32 %kisuu.0.lcssa, %four.0.lcssa
%cmp25 = icmp sgt i32 %sub, 1
%cmp34 = icmp slt i32 %four.0.lcssa, %kisuu.0.lcssa
%or.cond = and i1 %two.0.lcssa, %cmp34
%33 = select i1 %cmp25, i1 true, i1 %or.cond
%.str.3.sink = select i1 %33, ptr @.str.2, ptr @.str.3
%call38 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.3.sink)
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 @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: 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, !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>
int main(int argc, char *argv[])
{
int i, N, kisu = 0, time2 = 0, time4 = 0;
scanf("%d", &N);
for ( i = 0; i < N; i++ ){
int a;
scanf("%d", &a);
if ( a%2 == 1 ){
kisu++;
} else if ( a%4 == 0 ){
time4++;
} else {
time2++;
}
}
if ( kisu > time4 + 1 ){
printf("No\n");
} else if ( kisu == time4 + 1 ){
if ( time2 > 0 ){
printf("No\n");
} else {
printf("Yes\n");
}
} else {
printf("Yes\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255711/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255711/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.5 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%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
%cmp37 = icmp sgt i32 %0, 0
br i1 %cmp37, label %for.body, label %if.end27
for.body: ; preds = %entry, %if.end9
%time4.041 = phi i32 [ %time4.1, %if.end9 ], [ 0, %entry ]
%time2.040 = phi i32 [ %time2.1, %if.end9 ], [ 0, %entry ]
%kisu.039 = phi i32 [ %kisu.1, %if.end9 ], [ 0, %entry ]
%i.038 = phi i32 [ %inc10, %if.end9 ], [ 0, %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)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = and i32 %1, -2147483647
%cmp2 = icmp eq i32 %2, 1
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %kisu.039, 1
br label %if.end9
if.else: ; preds = %for.body
%3 = and i32 %1, 3
%cmp4 = icmp eq i32 %3, 0
br i1 %cmp4, label %if.then5, label %if.else7
if.then5: ; preds = %if.else
%inc6 = add nsw i32 %time4.041, 1
br label %if.end9
if.else7: ; preds = %if.else
%inc8 = add nsw i32 %time2.040, 1
br label %if.end9
if.end9: ; preds = %if.then5, %if.else7, %if.then
%kisu.1 = phi i32 [ %inc, %if.then ], [ %kisu.039, %if.then5 ], [ %kisu.039, %if.else7 ]
%time2.1 = phi i32 [ %time2.040, %if.then ], [ %time2.040, %if.then5 ], [ %inc8, %if.else7 ]
%time4.1 = phi i32 [ %time4.041, %if.then ], [ %inc6, %if.then5 ], [ %time4.041, %if.else7 ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
%inc10 = add nuw nsw i32 %i.038, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc10, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %if.end9
%5 = add nsw i32 %time4.1, 1
%cmp11 = icmp sgt i32 %kisu.1, %5
br i1 %cmp11, label %if.end27, label %if.else14
if.else14: ; preds = %for.end
%6 = icmp sgt i32 %time2.1, 0
%cmp16 = icmp eq i32 %kisu.1, %5
%str.4.str.3 = select i1 %6, ptr @str.5, ptr @str.3
%spec.select = select i1 %cmp16, ptr %str.4.str.3, ptr @str.3
br label %if.end27
if.end27: ; preds = %if.else14, %entry, %for.end
%str.sink = phi ptr [ @str.5, %for.end ], [ @str.3, %entry ], [ %spec.select, %if.else14 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, H, N, A[1001], B[1001];
scanf("%d %d", &H, &N);
for (i = 1; i <= N; i++) scanf("%d %d", &(A[i]), &(B[i]));
int h, j, cost[10001] = {};
for (h = 1; h <= H; h++) {
cost[h] = cost[h-1] + B[1];
for (i = 1; i <= N; i++) {
j = (h >= A[i])? h - A[i]: 0;
if (cost[j] + B[i] < cost[h]) cost[h] = cost[j] + B[i];
}
}
printf("%d\n", cost[H]);
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255755/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255755/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@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
%N = alloca i32, align 4
%A = alloca [1001 x i32], align 16
%B = alloca [1001 x i32], align 16
%cost = alloca [10001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 4004, ptr nonnull %B) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not65 = icmp slt i32 %0, 1
br i1 %cmp.not65, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv
%arrayidx2 = getelementptr inbounds [1001 x i32], ptr %B, i64 0, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa64 = phi i32 [ %0, %entry ], [ %1, %for.body ]
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %cost) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) %cost, i8 0, i64 40004, i1 false)
%3 = load i32, ptr %H, align 4, !tbaa !5
%cmp5.not70 = icmp slt i32 %3, 1
br i1 %cmp5.not70, label %for.end41, label %for.body6.lr.ph
for.body6.lr.ph: ; preds = %for.end
%arrayidx9 = getelementptr inbounds [1001 x i32], ptr %B, i64 0, i64 1
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp13.not67 = icmp slt i32 %.lcssa64, 1
br i1 %cmp13.not67, label %for.body6.us.preheader, label %for.body6.preheader
for.body6.preheader: ; preds = %for.body6.lr.ph
%5 = add nuw i32 %3, 1
%wide.trip.count82 = zext i32 %5 to i64
%6 = zext i32 %.lcssa64 to i64
%xtraiter = and i64 %6, 1
%7 = icmp eq i32 %.lcssa64, 1
%unroll_iter = and i64 %6, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.body6
for.body6.us.preheader: ; preds = %for.body6.lr.ph
%8 = add nuw i32 %3, 1
%wide.trip.count88 = zext i32 %8 to i64
%9 = add nsw i64 %wide.trip.count88, -1
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body6.us.preheader97, label %vector.ph
vector.ph: ; preds = %for.body6.us.preheader
%n.vec = and i64 %9, -8
%.cast = trunc i64 %n.vec to i32
%ind.end = mul i32 %4, %.cast
%ind.end92 = or i64 %n.vec, 1
%.splatinsert = insertelement <4 x i32> poison, i32 %4, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%10 = mul <4 x i32> %.splat, <i32 0, i32 1, i32 2, i32 3>
%11 = shl i32 %4, 2
%.splatinsert94 = insertelement <4 x i32> poison, i32 %11, i64 0
%.splat95 = shufflevector <4 x i32> %.splatinsert94, <4 x i32> poison, <4 x i32> zeroinitializer
%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.ind = phi <4 x i32> [ %10, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, %.splat95
%offset.idx = or i64 %index, 1
%12 = add nsw <4 x i32> %broadcast.splat, %vec.ind
%13 = add nsw <4 x i32> %broadcast.splat, %step.add
%14 = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %offset.idx
store <4 x i32> %12, ptr %14, align 4, !tbaa !5
%15 = getelementptr inbounds i32, ptr %14, i64 4
store <4 x i32> %13, ptr %15, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %step.add, %.splat95
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.end41, label %for.body6.us.preheader97
for.body6.us.preheader97: ; preds = %for.body6.us.preheader, %middle.block
%.ph = phi i32 [ 0, %for.body6.us.preheader ], [ %ind.end, %middle.block ]
%indvars.iv84.ph = phi i64 [ 1, %for.body6.us.preheader ], [ %ind.end92, %middle.block ]
br label %for.body6.us
for.body6.us: ; preds = %for.body6.us.preheader97, %for.body6.us
%17 = phi i32 [ %add.us, %for.body6.us ], [ %.ph, %for.body6.us.preheader97 ]
%indvars.iv84 = phi i64 [ %indvars.iv.next85, %for.body6.us ], [ %indvars.iv84.ph, %for.body6.us.preheader97 ]
%add.us = add nsw i32 %4, %17
%arrayidx11.us = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %indvars.iv84
store i32 %add.us, ptr %arrayidx11.us, align 4, !tbaa !5
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%exitcond89.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count88
br i1 %exitcond89.not, label %for.end41, label %for.body6.us, !llvm.loop !14
for.body6: ; preds = %for.body6.preheader, %for.cond12.for.inc39_crit_edge
%18 = phi i32 [ 0, %for.body6.preheader ], [ %spec.store.select.lcssa, %for.cond12.for.inc39_crit_edge ]
%indvars.iv78 = phi i64 [ 1, %for.body6.preheader ], [ %indvars.iv.next79, %for.cond12.for.inc39_crit_edge ]
%add = add nsw i32 %4, %18
%arrayidx11 = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %indvars.iv78
store i32 %add, ptr %arrayidx11, align 4, !tbaa !5
%19 = trunc i64 %indvars.iv78 to i32
br i1 %7, label %for.cond12.for.inc39_crit_edge.unr-lcssa, label %for.body14
for.body14: ; preds = %for.body6, %for.body14
%indvars.iv75 = phi i64 [ %indvars.iv.next76.1, %for.body14 ], [ 1, %for.body6 ]
%spec.store.select69 = phi i32 [ %spec.store.select.1, %for.body14 ], [ %add, %for.body6 ]
%niter = phi i64 [ %niter.next.1, %for.body14 ], [ 0, %for.body6 ]
%arrayidx16 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv75
%20 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp17.not = icmp slt i64 %indvars.iv78, %21
%sub20 = sub nsw i32 %19, %20
%22 = sext i32 %sub20 to i64
%idxprom21 = select i1 %cmp17.not, i64 0, i64 %22
%arrayidx22 = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %idxprom21
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%arrayidx24 = getelementptr inbounds [1001 x i32], ptr %B, i64 0, i64 %indvars.iv75
%24 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%add25 = add nsw i32 %24, %23
%spec.store.select = call i32 @llvm.smin.i32(i32 %add25, i32 %spec.store.select69)
store i32 %spec.store.select, ptr %arrayidx11, align 4
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%arrayidx16.1 = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv.next76
%25 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp17.not.1 = icmp slt i64 %indvars.iv78, %26
%sub20.1 = sub nsw i32 %19, %25
%27 = sext i32 %sub20.1 to i64
%idxprom21.1 = select i1 %cmp17.not.1, i64 0, i64 %27
%arrayidx22.1 = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %idxprom21.1
%28 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%arrayidx24.1 = getelementptr inbounds [1001 x i32], ptr %B, i64 0, i64 %indvars.iv.next76
%29 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%add25.1 = add nsw i32 %29, %28
%spec.store.select.1 = call i32 @llvm.smin.i32(i32 %add25.1, i32 %spec.store.select)
store i32 %spec.store.select.1, ptr %arrayidx11, align 4
%indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 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.cond12.for.inc39_crit_edge.unr-lcssa, label %for.body14, !llvm.loop !15
for.cond12.for.inc39_crit_edge.unr-lcssa: ; preds = %for.body14, %for.body6
%spec.store.select.lcssa.ph = phi i32 [ undef, %for.body6 ], [ %spec.store.select.1, %for.body14 ]
%indvars.iv75.unr = phi i64 [ 1, %for.body6 ], [ %indvars.iv.next76.1, %for.body14 ]
%spec.store.select69.unr = phi i32 [ %add, %for.body6 ], [ %spec.store.select.1, %for.body14 ]
br i1 %lcmp.mod.not, label %for.cond12.for.inc39_crit_edge, label %for.body14.epil
for.body14.epil: ; preds = %for.cond12.for.inc39_crit_edge.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [1001 x i32], ptr %A, i64 0, i64 %indvars.iv75.unr
%30 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%31 = sext i32 %30 to i64
%cmp17.not.epil = icmp slt i64 %indvars.iv78, %31
%sub20.epil = sub nsw i32 %19, %30
%32 = sext i32 %sub20.epil to i64
%idxprom21.epil = select i1 %cmp17.not.epil, i64 0, i64 %32
%arrayidx22.epil = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %idxprom21.epil
%33 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !5
%arrayidx24.epil = getelementptr inbounds [1001 x i32], ptr %B, i64 0, i64 %indvars.iv75.unr
%34 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5
%add25.epil = add nsw i32 %34, %33
%spec.store.select.epil = call i32 @llvm.smin.i32(i32 %add25.epil, i32 %spec.store.select69.unr)
store i32 %spec.store.select.epil, ptr %arrayidx11, align 4
br label %for.cond12.for.inc39_crit_edge
for.cond12.for.inc39_crit_edge: ; preds = %for.cond12.for.inc39_crit_edge.unr-lcssa, %for.body14.epil
%spec.store.select.lcssa = phi i32 [ %spec.store.select.lcssa.ph, %for.cond12.for.inc39_crit_edge.unr-lcssa ], [ %spec.store.select.epil, %for.body14.epil ]
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond83.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count82
br i1 %exitcond83.not, label %for.end41, label %for.body6, !llvm.loop !16
for.end41: ; preds = %for.cond12.for.inc39_crit_edge, %for.body6.us, %middle.block, %for.end
%idxprom42 = sext i32 %3 to i64
%arrayidx43 = getelementptr inbounds [10001 x i32], ptr %cost, i64 0, i64 %idxprom42
%35 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %35)
%36 = load ptr, ptr @stdout, align 8, !tbaa !17
%call45 = call i32 @fflush(ptr noundef %36)
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %cost) #5
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 4004, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; }
int compare_sz_asc(const void* a, const void* b) {
return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}
int compare_sz_desc(const void* a, const void* b) {
return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}
int compare_i64_asc(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_i64_desc(const void* a, const void* b) {
return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}
int compare_u64_asc(const void* a, const void* b) {
return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1;
}
int compare_u64_desc(const void* a, const void* b) {
return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}
int compare_c_asc(const void* a, const void* b) {
return *((char*)a) < *((char*)b) ? -1 : 1;
}
int compare_c_desc(const void* a, const void* b) {
return *((char*)a) > * ((char*)b) ? -1 : 1;
}
int compare_dp_asc(const void* a, const void* b) {
return *((double*)a) < *((double*)b) ? -1 : 1;
}
static uint64_t modinvU64(const uint64_t a, const uint64_t m) {
int64_t aa = (int64_t)a;
const int64_t mm = (int64_t)m;
int64_t b = mm;
int64_t u = 1;
int64_t v = 0;
while (b != 0) {
const int64_t t = aa / b;
aa -= t * b;
SWAP(uint64_t, aa, b);
u -= t * v;
SWAP(uint64_t, u, v);
}
u %= mm;
if (u < 0) {
u += m;
}
return (uint64_t)u;
}
static size_t powSz(const size_t base, const size_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powSz(base * base, exp / 2);
}
else {
return base * powSz(base, exp - 1);
}
}
static uint64_t powU64(const uint64_t base, const uint64_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powU64(base * base, exp / 2);
}
else {
return base * powU64(base, exp - 1);
}
}
static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base % m;
}
if (exp % 2 == 0) {
return powU64WMod(base * base % m, exp / 2, m);
}
else {
return base * powU64WMod(base, exp - 1, m) % m;
}
}
static size_t combSz(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;
uint64_t inv = 1;
for (uint64_t i = 0; i < r; i++) {
result = result * (n - i) % m;
inv = inv * (i + 1) % m;
}
return result * modinvU64(inv, m) % m;
}
static uint64_t permU64(const uint64_t n) {
uint64_t result = 1;
for (uint64_t v = 2; v <= n; v++) {
result *= v;
}
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;
}
static uint64_t popcntU64(uint64_t val) {
uint64_t cnt = 0;
while (val != 0) {
if ((val & UINT64_C(0x1)) != 0) {
cnt++;
}
val >>= UINT64_C(0x1);
}
return cnt;
}
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 UF_ROOT ((size_t)10000000)
typedef struct {
size_t parent;
uint64_t w;
uint64_t v;
uint64_t wSum;
uint64_t vSum;
} UF_Node;
static UF_Node uf_Node[101];
static size_t uf_GetRoot(const size_t idx) {
if (uf_Node[idx].parent == UF_ROOT) {
return idx;
}
const size_t root = uf_GetRoot(uf_Node[idx].parent);
uf_Node[idx].parent = root;
return root;
}
static void uf_Merge(const size_t a, const size_t b) {
const size_t aRoot = uf_GetRoot(a);
const size_t bRoot = uf_GetRoot(b);
if (aRoot != bRoot) {
uf_Node[aRoot].parent = bRoot;
uf_Node[bRoot].wSum += uf_Node[aRoot].wSum;
uf_Node[bRoot].vSum += uf_Node[aRoot].vSum;
}
}
#define MOD_VAL (UINT64_C(1000000007))
#define MP_COST_MAX (UINT64_MAX)
static uint64_t dp[10001];
int main(void) {
uint64_t H, N, A[1000], B[1000];
scanf("%"PRIu64"%"PRIu64, &H, &N);
for (uint64_t i = 0; i < N; i++) {
scanf("%"PRIu64"%"PRIu64, &A[i], &B[i]);
}
for (uint64_t i = 0; i < N; i++) {
dp[H] = 0;
for (uint64_t hOfs = 1; hOfs <= H; hOfs++) {
const uint64_t h = H - hOfs;
if (H < A[i] || H - A[i] < h) {
dp[h] = (i == 0 ? B[i] : MIN(dp[h], B[i]));
}
else {
if (i == 0) {
dp[h] = dp[h + A[i]] + B[i];
}
else {
dp[h] = MIN(dp[h], dp[h + A[i]] + B[i]);
}
}
}
}
printf("%"PRIu64, dp[0]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255799/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255799/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@dp = internal unnamed_addr global [10001 x i64] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%lu\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:
%H = alloca i64, align 8
%N = alloca i64, align 8
%A = alloca [1000 x i64], align 16
%B = alloca [1000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %H) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %A) #5
call void @llvm.lifetime.start.p0(i64 8000, ptr nonnull %B) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%cmp97.not = icmp eq i64 %0, 0
br i1 %cmp97.not, label %for.cond.cleanup6, label %for.body
for.cond4.preheader: ; preds = %for.body
%cmp5115.not = icmp eq i64 %6, 0
br i1 %cmp5115.not, label %for.cond.cleanup6, label %for.body7.lr.ph
for.body7.lr.ph: ; preds = %for.cond4.preheader
%1 = load i64, ptr %H, align 8, !tbaa !5
%arrayidx8 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %1
%cmp10.not99 = icmp eq i64 %1, 0
%2 = load i64, ptr %B, align 16
br i1 %cmp10.not99, label %for.body7.lr.ph.split.us, label %for.body7.preheader
for.body7.preheader: ; preds = %for.body7.lr.ph
%3 = add i64 %1, 1
%umax = call i64 @llvm.umax.i64(i64 %3, i64 2)
%4 = add i64 %umax, -1
%xtraiter = and i64 %4, 1
%5 = icmp ult i64 %3, 3
%unroll_iter = and i64 %4, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%min.iters.check137 = icmp ult i64 %3, 5
%n.vec140 = and i64 %4, -4
%ind.end141 = or i64 %n.vec140, 1
%cmp.n143 = icmp eq i64 %4, %n.vec140
%min.iters.check = icmp ult i64 %3, 5
%n.vec = and i64 %4, -4
%ind.end = or i64 %n.vec, 1
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %2, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
%cmp.n = icmp eq i64 %4, %n.vec
br label %for.body7
for.body7.lr.ph.split.us: ; preds = %for.body7.lr.ph
store i64 0, ptr %arrayidx8, align 8, !tbaa !5
br label %for.cond.cleanup6
for.body: ; preds = %entry, %for.body
%i.098 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1000 x i64], ptr %A, i64 0, i64 %i.098
%arrayidx1 = getelementptr inbounds [1000 x i64], ptr %B, i64 0, i64 %i.098
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx1)
%inc = add nuw i64 %i.098, 1
%6 = load i64, ptr %N, align 8, !tbaa !5
%cmp = icmp ult i64 %inc, %6
br i1 %cmp, label %for.body, label %for.cond4.preheader, !llvm.loop !12
for.cond.cleanup6: ; preds = %for.cond9.for.cond.cleanup11_crit_edge, %entry, %for.body7.lr.ph.split.us, %for.cond4.preheader
%7 = load i64, ptr @dp, align 16, !tbaa !5
%call63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %7)
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %B) #5
call void @llvm.lifetime.end.p0(i64 8000, ptr nonnull %A) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %H) #5
ret i32 0
for.body7: ; preds = %for.body7.preheader, %for.cond9.for.cond.cleanup11_crit_edge
%i3.0116 = phi i64 [ %inc61, %for.cond9.for.cond.cleanup11_crit_edge ], [ 0, %for.body7.preheader ]
store i64 0, ptr %arrayidx8, align 8, !tbaa !5
%arrayidx13 = getelementptr inbounds [1000 x i64], ptr %A, i64 0, i64 %i3.0116
%8 = load i64, ptr %arrayidx13, align 8, !tbaa !5
%cmp14 = icmp ult i64 %1, %8
%sub16 = sub i64 %1, %8
%arrayidx42 = getelementptr inbounds [1000 x i64], ptr %B, i64 0, i64 %i3.0116
%cmp18 = icmp eq i64 %i3.0116, 0
%cmp14.fr = freeze i1 %cmp14
br i1 %cmp14.fr, label %for.body12.lr.ph.split.us, label %for.body12.lr.ph.split
for.body12.lr.ph.split.us: ; preds = %for.body7
br i1 %cmp18, label %for.body12.us.us.preheader, label %for.body12.lr.ph.split.us.split
for.body12.us.us.preheader: ; preds = %for.body12.lr.ph.split.us
br i1 %min.iters.check, label %for.body12.us.us.preheader155, label %vector.body
vector.body: ; preds = %for.body12.us.us.preheader, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body12.us.us.preheader ]
%offset.idx.neg = xor i64 %index, -1
%9 = add i64 %1, %offset.idx.neg
%10 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %9
%11 = getelementptr inbounds i64, ptr %10, i64 -1
store <2 x i64> %broadcast.splat, ptr %11, align 8, !tbaa !5
%12 = getelementptr inbounds i64, ptr %10, i64 -3
store <2 x i64> %broadcast.splat, ptr %12, align 8, !tbaa !5
%index.next = add nuw i64 %index, 4
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond9.for.cond.cleanup11_crit_edge, label %for.body12.us.us.preheader155
for.body12.us.us.preheader155: ; preds = %for.body12.us.us.preheader, %middle.block
%hOfs.0100.us.us.ph = phi i64 [ 1, %for.body12.us.us.preheader ], [ %ind.end, %middle.block ]
br label %for.body12.us.us
for.body12.us.us: ; preds = %for.body12.us.us.preheader155, %for.body12.us.us
%hOfs.0100.us.us = phi i64 [ %inc58.us.us, %for.body12.us.us ], [ %hOfs.0100.us.us.ph, %for.body12.us.us.preheader155 ]
%sub.us.us = sub i64 %1, %hOfs.0100.us.us
%arrayidx29.us.us = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub.us.us
store i64 %2, ptr %arrayidx29.us.us, align 8, !tbaa !5
%inc58.us.us = add nuw i64 %hOfs.0100.us.us, 1
%exitcond124 = icmp eq i64 %inc58.us.us, %umax
br i1 %exitcond124, label %for.cond9.for.cond.cleanup11_crit_edge, label %for.body12.us.us, !llvm.loop !17
for.body12.lr.ph.split.us.split: ; preds = %for.body12.lr.ph.split.us
%14 = load i64, ptr %arrayidx42, align 8, !tbaa !5
br i1 %min.iters.check137, label %for.body12.us.preheader, label %vector.ph138
vector.ph138: ; preds = %for.body12.lr.ph.split.us.split
%broadcast.splatinsert150 = insertelement <2 x i64> poison, i64 %14, i64 0
%broadcast.splat151 = shufflevector <2 x i64> %broadcast.splatinsert150, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body144
vector.body144: ; preds = %vector.body144, %vector.ph138
%index145 = phi i64 [ 0, %vector.ph138 ], [ %index.next154, %vector.body144 ]
%offset.idx146.neg = xor i64 %index145, -1
%15 = add i64 %1, %offset.idx146.neg
%16 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %15
%17 = getelementptr inbounds i64, ptr %16, i64 -1
%wide.load = load <2 x i64>, ptr %17, align 8, !tbaa !5
%reverse147 = shufflevector <2 x i64> %wide.load, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%18 = getelementptr inbounds i64, ptr %16, i64 -3
%wide.load148 = load <2 x i64>, ptr %18, align 8, !tbaa !5
%reverse149 = shufflevector <2 x i64> %wide.load148, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
%19 = call <2 x i64> @llvm.umin.v2i64(<2 x i64> %reverse147, <2 x i64> %broadcast.splat151)
%20 = call <2 x i64> @llvm.umin.v2i64(<2 x i64> %reverse149, <2 x i64> %broadcast.splat151)
%reverse152 = shufflevector <2 x i64> %19, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %reverse152, ptr %17, align 8, !tbaa !5
%reverse153 = shufflevector <2 x i64> %20, <2 x i64> poison, <2 x i32> <i32 1, i32 0>
store <2 x i64> %reverse153, ptr %18, align 8, !tbaa !5
%index.next154 = add nuw i64 %index145, 4
%21 = icmp eq i64 %index.next154, %n.vec140
br i1 %21, label %middle.block135, label %vector.body144, !llvm.loop !18
middle.block135: ; preds = %vector.body144
br i1 %cmp.n143, label %for.cond9.for.cond.cleanup11_crit_edge, label %for.body12.us.preheader
for.body12.us.preheader: ; preds = %for.body12.lr.ph.split.us.split, %middle.block135
%hOfs.0100.us.ph = phi i64 [ 1, %for.body12.lr.ph.split.us.split ], [ %ind.end141, %middle.block135 ]
br label %for.body12.us
for.body12.us: ; preds = %for.body12.us.preheader, %for.body12.us
%hOfs.0100.us = phi i64 [ %inc58.us, %for.body12.us ], [ %hOfs.0100.us.ph, %for.body12.us.preheader ]
%sub.us = sub i64 %1, %hOfs.0100.us
%arrayidx20.us = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub.us
%22 = load i64, ptr %arrayidx20.us, align 8, !tbaa !5
%..us = call i64 @llvm.umin.i64(i64 %22, i64 %14)
store i64 %..us, ptr %arrayidx20.us, align 8, !tbaa !5
%inc58.us = add nuw i64 %hOfs.0100.us, 1
%exitcond123 = icmp eq i64 %inc58.us, %umax
br i1 %exitcond123, label %for.cond9.for.cond.cleanup11_crit_edge, label %for.body12.us, !llvm.loop !19
for.body12.lr.ph.split: ; preds = %for.body7
br i1 %cmp18, label %for.body12.us101.preheader, label %for.body12
for.body12.us101.preheader: ; preds = %for.body12.lr.ph.split
br i1 %5, label %for.cond9.for.cond.cleanup11_crit_edge.loopexit157.unr-lcssa, label %for.body12.us101
for.body12.us101: ; preds = %for.body12.us101.preheader, %if.end56.us112.1
%hOfs.0100.us102 = phi i64 [ %inc58.us113.1, %if.end56.us112.1 ], [ 1, %for.body12.us101.preheader ]
%niter = phi i64 [ %niter.next.1, %if.end56.us112.1 ], [ 0, %for.body12.us101.preheader ]
%sub.us103 = sub i64 %1, %hOfs.0100.us102
%cmp17.us = icmp ult i64 %sub16, %sub.us103
br i1 %cmp17.us, label %if.end56.us112, label %if.else.us
if.else.us: ; preds = %for.body12.us101
%add.us = add i64 %8, %sub.us103
%arrayidx33.us = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %add.us
%23 = load i64, ptr %arrayidx33.us, align 8, !tbaa !5
%add35.us = add i64 %2, %23
br label %if.end56.us112
if.end56.us112: ; preds = %for.body12.us101, %if.else.us
%.sink = phi i64 [ %add35.us, %if.else.us ], [ %2, %for.body12.us101 ]
%arrayidx29.us111 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub.us103
store i64 %.sink, ptr %arrayidx29.us111, align 8, !tbaa !5
%inc58.us113.neg = xor i64 %hOfs.0100.us102, -1
%sub.us103.1 = add i64 %1, %inc58.us113.neg
%cmp17.us.1 = icmp ult i64 %sub16, %sub.us103.1
br i1 %cmp17.us.1, label %if.end56.us112.1, label %if.else.us.1
if.else.us.1: ; preds = %if.end56.us112
%add.us.1 = add i64 %8, %sub.us103.1
%arrayidx33.us.1 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %add.us.1
%24 = load i64, ptr %arrayidx33.us.1, align 8, !tbaa !5
%add35.us.1 = add i64 %2, %24
br label %if.end56.us112.1
if.end56.us112.1: ; preds = %if.else.us.1, %if.end56.us112
%.sink.1 = phi i64 [ %add35.us.1, %if.else.us.1 ], [ %2, %if.end56.us112 ]
%arrayidx29.us111.1 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub.us103.1
store i64 %.sink.1, ptr %arrayidx29.us111.1, align 8, !tbaa !5
%inc58.us113.1 = add nuw i64 %hOfs.0100.us102, 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.cond9.for.cond.cleanup11_crit_edge.loopexit157.unr-lcssa, label %for.body12.us101, !llvm.loop !20
for.cond9.for.cond.cleanup11_crit_edge.loopexit157.unr-lcssa: ; preds = %if.end56.us112.1, %for.body12.us101.preheader
%hOfs.0100.us102.unr = phi i64 [ 1, %for.body12.us101.preheader ], [ %inc58.us113.1, %if.end56.us112.1 ]
br i1 %lcmp.mod.not, label %for.cond9.for.cond.cleanup11_crit_edge, label %for.body12.us101.epil
for.body12.us101.epil: ; preds = %for.cond9.for.cond.cleanup11_crit_edge.loopexit157.unr-lcssa
%sub.us103.epil = sub i64 %1, %hOfs.0100.us102.unr
%cmp17.us.epil = icmp ult i64 %sub16, %sub.us103.epil
br i1 %cmp17.us.epil, label %if.end56.us112.epil, label %if.else.us.epil
if.else.us.epil: ; preds = %for.body12.us101.epil
%add.us.epil = add i64 %8, %sub.us103.epil
%arrayidx33.us.epil = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %add.us.epil
%25 = load i64, ptr %arrayidx33.us.epil, align 8, !tbaa !5
%add35.us.epil = add i64 %2, %25
br label %if.end56.us112.epil
if.end56.us112.epil: ; preds = %if.else.us.epil, %for.body12.us101.epil
%.sink.epil = phi i64 [ %add35.us.epil, %if.else.us.epil ], [ %2, %for.body12.us101.epil ]
%arrayidx29.us111.epil = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub.us103.epil
store i64 %.sink.epil, ptr %arrayidx29.us111.epil, align 8, !tbaa !5
br label %for.cond9.for.cond.cleanup11_crit_edge
for.cond9.for.cond.cleanup11_crit_edge: ; preds = %if.end56, %if.end56.us112.epil, %for.cond9.for.cond.cleanup11_crit_edge.loopexit157.unr-lcssa, %for.body12.us, %for.body12.us.us, %middle.block135, %middle.block
%inc61 = add nuw i64 %i3.0116, 1
%exitcond125.not = icmp eq i64 %inc61, %6
br i1 %exitcond125.not, label %for.cond.cleanup6, label %for.body7, !llvm.loop !21
for.body12: ; preds = %for.body12.lr.ph.split, %if.end56
%hOfs.0100 = phi i64 [ %inc58, %if.end56 ], [ 1, %for.body12.lr.ph.split ]
%sub = sub i64 %1, %hOfs.0100
%cmp17 = icmp ult i64 %sub16, %sub
%arrayidx20 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub
%26 = load i64, ptr %arrayidx20, align 8, !tbaa !5
br i1 %cmp17, label %cond.end27, label %if.else
cond.end27: ; preds = %for.body12
%27 = load i64, ptr %arrayidx42, align 8, !tbaa !5
%. = call i64 @llvm.umin.i64(i64 %26, i64 %27)
%arrayidx29 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %sub
store i64 %., ptr %arrayidx29, align 8, !tbaa !5
br label %if.end56
if.else: ; preds = %for.body12
%add40 = add i64 %8, %sub
%arrayidx41 = getelementptr inbounds [10001 x i64], ptr @dp, i64 0, i64 %add40
%28 = load i64, ptr %arrayidx41, align 8, !tbaa !5
%29 = load i64, ptr %arrayidx42, align 8, !tbaa !5
%add43 = add i64 %29, %28
%.add43 = call i64 @llvm.umin.i64(i64 %26, i64 %add43)
store i64 %.add43, ptr %arrayidx20, align 8, !tbaa !5
br label %if.end56
if.end56: ; preds = %if.else, %cond.end27
%inc58 = add nuw i64 %hOfs.0100, 1
%exitcond = icmp eq i64 %inc58, %umax
br i1 %exitcond, label %for.cond9.for.cond.cleanup11_crit_edge, label %for.body12, !llvm.loop !20
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.umin.v2i64(<2 x i64>, <2 x i64>) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !13, !16, !15}
!18 = distinct !{!18, !13, !15, !16}
!19 = distinct !{!19, !13, !16, !15}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
|
#include<stdio.h>
#include<string.h>
typedef long long ll;
int main(){
char s[200000];
scanf("%s",s);
for(int i=0;i<strlen(s);i++){
if(s[i]=='?') s[i]='D';
}
printf("%s",s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255841/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255841/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [200000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%char0 = load i8, ptr %s, align 16
%cmp15.not = icmp eq i8 %char0, 0
br i1 %cmp15.not, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %s) #4
ret i32 0
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp5 = icmp eq i8 %0, 63
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i8 68, ptr %arrayidx, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%cmp = icmp ugt i64 %call2, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !8
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
char str[200000];
int i;
scanf("%s", str);
for (i=0;str[i]!='\0';i++){
if(str[i]=='?')
str[i]='D';
}
printf("%s", str);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255885/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [200000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %str) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %for.cond
for.cond: ; preds = %for.inc, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %0, label %for.inc [
i8 0, label %for.end
i8 63, label %if.then
]
if.then: ; preds = %for.cond
store i8 68, ptr %arrayidx, align 1, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.cond, %if.then
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %for.cond, !llvm.loop !8
for.end: ; preds = %for.cond
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %str)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %str) #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 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
int main(){
char t[300000];
scanf("%s",t);
int len=strlen(t);
for(int i=0;i<len;i++){
if(t[i]=='?'){
t[i]='D';
}
}
printf("%s",t);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca [300000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 300000, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %t) #5
%conv = trunc i64 %call2 to i32
%cmp14 = icmp sgt i32 %conv, 0
br i1 %cmp14, label %iter.check, label %for.cond.cleanup
iter.check: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.main.loop.iter.check
vector.main.loop.iter.check: ; preds = %iter.check
%min.iters.check17 = icmp ult i64 %wide.trip.count, 32
br i1 %min.iters.check17, label %vec.epilog.ph, label %vector.ph
vector.ph: ; preds = %vector.main.loop.iter.check
%n.mod.vf = and i64 %call2, 31
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %pred.store.continue80, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue80 ]
%0 = or i64 %index, 16
%1 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %index
%wide.load = load <16 x i8>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 16
%wide.load18 = load <16 x i8>, ptr %2, align 16, !tbaa !5
%3 = icmp eq <16 x i8> %wide.load, <i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63>
%4 = icmp eq <16 x i8> %wide.load18, <i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63>
%5 = extractelement <16 x i1> %3, i64 0
br i1 %5, label %pred.store.if, label %pred.store.continue
pred.store.if: ; preds = %vector.body
%6 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %index
store i8 68, ptr %6, align 16, !tbaa !5
br label %pred.store.continue
pred.store.continue: ; preds = %pred.store.if, %vector.body
%7 = extractelement <16 x i1> %3, i64 1
br i1 %7, label %pred.store.if19, label %pred.store.continue20
pred.store.if19: ; preds = %pred.store.continue
%8 = or i64 %index, 1
%9 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %8
store i8 68, ptr %9, align 1, !tbaa !5
br label %pred.store.continue20
pred.store.continue20: ; preds = %pred.store.if19, %pred.store.continue
%10 = extractelement <16 x i1> %3, i64 2
br i1 %10, label %pred.store.if21, label %pred.store.continue22
pred.store.if21: ; preds = %pred.store.continue20
%11 = or i64 %index, 2
%12 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %11
store i8 68, ptr %12, align 2, !tbaa !5
br label %pred.store.continue22
pred.store.continue22: ; preds = %pred.store.if21, %pred.store.continue20
%13 = extractelement <16 x i1> %3, i64 3
br i1 %13, label %pred.store.if23, label %pred.store.continue24
pred.store.if23: ; preds = %pred.store.continue22
%14 = or i64 %index, 3
%15 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %14
store i8 68, ptr %15, align 1, !tbaa !5
br label %pred.store.continue24
pred.store.continue24: ; preds = %pred.store.if23, %pred.store.continue22
%16 = extractelement <16 x i1> %3, i64 4
br i1 %16, label %pred.store.if25, label %pred.store.continue26
pred.store.if25: ; preds = %pred.store.continue24
%17 = or i64 %index, 4
%18 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %17
store i8 68, ptr %18, align 4, !tbaa !5
br label %pred.store.continue26
pred.store.continue26: ; preds = %pred.store.if25, %pred.store.continue24
%19 = extractelement <16 x i1> %3, i64 5
br i1 %19, label %pred.store.if27, label %pred.store.continue28
pred.store.if27: ; preds = %pred.store.continue26
%20 = or i64 %index, 5
%21 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %20
store i8 68, ptr %21, align 1, !tbaa !5
br label %pred.store.continue28
pred.store.continue28: ; preds = %pred.store.if27, %pred.store.continue26
%22 = extractelement <16 x i1> %3, i64 6
br i1 %22, label %pred.store.if29, label %pred.store.continue30
pred.store.if29: ; preds = %pred.store.continue28
%23 = or i64 %index, 6
%24 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %23
store i8 68, ptr %24, align 2, !tbaa !5
br label %pred.store.continue30
pred.store.continue30: ; preds = %pred.store.if29, %pred.store.continue28
%25 = extractelement <16 x i1> %3, i64 7
br i1 %25, label %pred.store.if31, label %pred.store.continue32
pred.store.if31: ; preds = %pred.store.continue30
%26 = or i64 %index, 7
%27 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %26
store i8 68, ptr %27, align 1, !tbaa !5
br label %pred.store.continue32
pred.store.continue32: ; preds = %pred.store.if31, %pred.store.continue30
%28 = extractelement <16 x i1> %3, i64 8
br i1 %28, label %pred.store.if33, label %pred.store.continue34
pred.store.if33: ; preds = %pred.store.continue32
%29 = or i64 %index, 8
%30 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %29
store i8 68, ptr %30, align 8, !tbaa !5
br label %pred.store.continue34
pred.store.continue34: ; preds = %pred.store.if33, %pred.store.continue32
%31 = extractelement <16 x i1> %3, i64 9
br i1 %31, label %pred.store.if35, label %pred.store.continue36
pred.store.if35: ; preds = %pred.store.continue34
%32 = or i64 %index, 9
%33 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %32
store i8 68, ptr %33, align 1, !tbaa !5
br label %pred.store.continue36
pred.store.continue36: ; preds = %pred.store.if35, %pred.store.continue34
%34 = extractelement <16 x i1> %3, i64 10
br i1 %34, label %pred.store.if37, label %pred.store.continue38
pred.store.if37: ; preds = %pred.store.continue36
%35 = or i64 %index, 10
%36 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %35
store i8 68, ptr %36, align 2, !tbaa !5
br label %pred.store.continue38
pred.store.continue38: ; preds = %pred.store.if37, %pred.store.continue36
%37 = extractelement <16 x i1> %3, i64 11
br i1 %37, label %pred.store.if39, label %pred.store.continue40
pred.store.if39: ; preds = %pred.store.continue38
%38 = or i64 %index, 11
%39 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %38
store i8 68, ptr %39, align 1, !tbaa !5
br label %pred.store.continue40
pred.store.continue40: ; preds = %pred.store.if39, %pred.store.continue38
%40 = extractelement <16 x i1> %3, i64 12
br i1 %40, label %pred.store.if41, label %pred.store.continue42
pred.store.if41: ; preds = %pred.store.continue40
%41 = or i64 %index, 12
%42 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %41
store i8 68, ptr %42, align 4, !tbaa !5
br label %pred.store.continue42
pred.store.continue42: ; preds = %pred.store.if41, %pred.store.continue40
%43 = extractelement <16 x i1> %3, i64 13
br i1 %43, label %pred.store.if43, label %pred.store.continue44
pred.store.if43: ; preds = %pred.store.continue42
%44 = or i64 %index, 13
%45 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %44
store i8 68, ptr %45, align 1, !tbaa !5
br label %pred.store.continue44
pred.store.continue44: ; preds = %pred.store.if43, %pred.store.continue42
%46 = extractelement <16 x i1> %3, i64 14
br i1 %46, label %pred.store.if45, label %pred.store.continue46
pred.store.if45: ; preds = %pred.store.continue44
%47 = or i64 %index, 14
%48 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %47
store i8 68, ptr %48, align 2, !tbaa !5
br label %pred.store.continue46
pred.store.continue46: ; preds = %pred.store.if45, %pred.store.continue44
%49 = extractelement <16 x i1> %3, i64 15
br i1 %49, label %pred.store.if47, label %pred.store.continue48
pred.store.if47: ; preds = %pred.store.continue46
%50 = or i64 %index, 15
%51 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %50
store i8 68, ptr %51, align 1, !tbaa !5
br label %pred.store.continue48
pred.store.continue48: ; preds = %pred.store.if47, %pred.store.continue46
%52 = extractelement <16 x i1> %4, i64 0
br i1 %52, label %pred.store.if49, label %pred.store.continue50
pred.store.if49: ; preds = %pred.store.continue48
%53 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %0
store i8 68, ptr %53, align 16, !tbaa !5
br label %pred.store.continue50
pred.store.continue50: ; preds = %pred.store.if49, %pred.store.continue48
%54 = extractelement <16 x i1> %4, i64 1
br i1 %54, label %pred.store.if51, label %pred.store.continue52
pred.store.if51: ; preds = %pred.store.continue50
%55 = or i64 %index, 17
%56 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %55
store i8 68, ptr %56, align 1, !tbaa !5
br label %pred.store.continue52
pred.store.continue52: ; preds = %pred.store.if51, %pred.store.continue50
%57 = extractelement <16 x i1> %4, i64 2
br i1 %57, label %pred.store.if53, label %pred.store.continue54
pred.store.if53: ; preds = %pred.store.continue52
%58 = or i64 %index, 18
%59 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %58
store i8 68, ptr %59, align 2, !tbaa !5
br label %pred.store.continue54
pred.store.continue54: ; preds = %pred.store.if53, %pred.store.continue52
%60 = extractelement <16 x i1> %4, i64 3
br i1 %60, label %pred.store.if55, label %pred.store.continue56
pred.store.if55: ; preds = %pred.store.continue54
%61 = or i64 %index, 19
%62 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %61
store i8 68, ptr %62, align 1, !tbaa !5
br label %pred.store.continue56
pred.store.continue56: ; preds = %pred.store.if55, %pred.store.continue54
%63 = extractelement <16 x i1> %4, i64 4
br i1 %63, label %pred.store.if57, label %pred.store.continue58
pred.store.if57: ; preds = %pred.store.continue56
%64 = or i64 %index, 20
%65 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %64
store i8 68, ptr %65, align 4, !tbaa !5
br label %pred.store.continue58
pred.store.continue58: ; preds = %pred.store.if57, %pred.store.continue56
%66 = extractelement <16 x i1> %4, i64 5
br i1 %66, label %pred.store.if59, label %pred.store.continue60
pred.store.if59: ; preds = %pred.store.continue58
%67 = or i64 %index, 21
%68 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %67
store i8 68, ptr %68, align 1, !tbaa !5
br label %pred.store.continue60
pred.store.continue60: ; preds = %pred.store.if59, %pred.store.continue58
%69 = extractelement <16 x i1> %4, i64 6
br i1 %69, label %pred.store.if61, label %pred.store.continue62
pred.store.if61: ; preds = %pred.store.continue60
%70 = or i64 %index, 22
%71 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %70
store i8 68, ptr %71, align 2, !tbaa !5
br label %pred.store.continue62
pred.store.continue62: ; preds = %pred.store.if61, %pred.store.continue60
%72 = extractelement <16 x i1> %4, i64 7
br i1 %72, label %pred.store.if63, label %pred.store.continue64
pred.store.if63: ; preds = %pred.store.continue62
%73 = or i64 %index, 23
%74 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %73
store i8 68, ptr %74, align 1, !tbaa !5
br label %pred.store.continue64
pred.store.continue64: ; preds = %pred.store.if63, %pred.store.continue62
%75 = extractelement <16 x i1> %4, i64 8
br i1 %75, label %pred.store.if65, label %pred.store.continue66
pred.store.if65: ; preds = %pred.store.continue64
%76 = or i64 %index, 24
%77 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %76
store i8 68, ptr %77, align 8, !tbaa !5
br label %pred.store.continue66
pred.store.continue66: ; preds = %pred.store.if65, %pred.store.continue64
%78 = extractelement <16 x i1> %4, i64 9
br i1 %78, label %pred.store.if67, label %pred.store.continue68
pred.store.if67: ; preds = %pred.store.continue66
%79 = or i64 %index, 25
%80 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %79
store i8 68, ptr %80, align 1, !tbaa !5
br label %pred.store.continue68
pred.store.continue68: ; preds = %pred.store.if67, %pred.store.continue66
%81 = extractelement <16 x i1> %4, i64 10
br i1 %81, label %pred.store.if69, label %pred.store.continue70
pred.store.if69: ; preds = %pred.store.continue68
%82 = or i64 %index, 26
%83 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %82
store i8 68, ptr %83, align 2, !tbaa !5
br label %pred.store.continue70
pred.store.continue70: ; preds = %pred.store.if69, %pred.store.continue68
%84 = extractelement <16 x i1> %4, i64 11
br i1 %84, label %pred.store.if71, label %pred.store.continue72
pred.store.if71: ; preds = %pred.store.continue70
%85 = or i64 %index, 27
%86 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %85
store i8 68, ptr %86, align 1, !tbaa !5
br label %pred.store.continue72
pred.store.continue72: ; preds = %pred.store.if71, %pred.store.continue70
%87 = extractelement <16 x i1> %4, i64 12
br i1 %87, label %pred.store.if73, label %pred.store.continue74
pred.store.if73: ; preds = %pred.store.continue72
%88 = or i64 %index, 28
%89 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %88
store i8 68, ptr %89, align 4, !tbaa !5
br label %pred.store.continue74
pred.store.continue74: ; preds = %pred.store.if73, %pred.store.continue72
%90 = extractelement <16 x i1> %4, i64 13
br i1 %90, label %pred.store.if75, label %pred.store.continue76
pred.store.if75: ; preds = %pred.store.continue74
%91 = or i64 %index, 29
%92 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %91
store i8 68, ptr %92, align 1, !tbaa !5
br label %pred.store.continue76
pred.store.continue76: ; preds = %pred.store.if75, %pred.store.continue74
%93 = extractelement <16 x i1> %4, i64 14
br i1 %93, label %pred.store.if77, label %pred.store.continue78
pred.store.if77: ; preds = %pred.store.continue76
%94 = or i64 %index, 30
%95 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %94
store i8 68, ptr %95, align 2, !tbaa !5
br label %pred.store.continue78
pred.store.continue78: ; preds = %pred.store.if77, %pred.store.continue76
%96 = extractelement <16 x i1> %4, i64 15
br i1 %96, label %pred.store.if79, label %pred.store.continue80
pred.store.if79: ; preds = %pred.store.continue78
%97 = or i64 %index, 31
%98 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %97
store i8 68, ptr %98, align 1, !tbaa !5
br label %pred.store.continue80
pred.store.continue80: ; preds = %pred.store.if79, %pred.store.continue78
%index.next = add nuw i64 %index, 32
%99 = icmp eq i64 %index.next, %n.vec
br i1 %99, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %pred.store.continue80
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.cond.cleanup, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
%min.epilog.iters.check = icmp ult i64 %n.mod.vf, 8
br i1 %min.epilog.iters.check, label %for.body.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
%n.mod.vf81 = and i64 %call2, 7
%n.vec82 = sub nsw i64 %wide.trip.count, %n.mod.vf81
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %pred.store.continue101, %vec.epilog.ph
%index84 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next102, %pred.store.continue101 ]
%100 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %index84
%wide.load85 = load <8 x i8>, ptr %100, align 1, !tbaa !5
%101 = icmp eq <8 x i8> %wide.load85, <i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63, i8 63>
%102 = extractelement <8 x i1> %101, i64 0
br i1 %102, label %pred.store.if86, label %pred.store.continue87
pred.store.if86: ; preds = %vec.epilog.vector.body
%103 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %index84
store i8 68, ptr %103, align 1, !tbaa !5
br label %pred.store.continue87
pred.store.continue87: ; preds = %pred.store.if86, %vec.epilog.vector.body
%104 = extractelement <8 x i1> %101, i64 1
br i1 %104, label %pred.store.if88, label %pred.store.continue89
pred.store.if88: ; preds = %pred.store.continue87
%105 = add i64 %index84, 1
%106 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %105
store i8 68, ptr %106, align 1, !tbaa !5
br label %pred.store.continue89
pred.store.continue89: ; preds = %pred.store.if88, %pred.store.continue87
%107 = extractelement <8 x i1> %101, i64 2
br i1 %107, label %pred.store.if90, label %pred.store.continue91
pred.store.if90: ; preds = %pred.store.continue89
%108 = add i64 %index84, 2
%109 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %108
store i8 68, ptr %109, align 1, !tbaa !5
br label %pred.store.continue91
pred.store.continue91: ; preds = %pred.store.if90, %pred.store.continue89
%110 = extractelement <8 x i1> %101, i64 3
br i1 %110, label %pred.store.if92, label %pred.store.continue93
pred.store.if92: ; preds = %pred.store.continue91
%111 = add i64 %index84, 3
%112 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %111
store i8 68, ptr %112, align 1, !tbaa !5
br label %pred.store.continue93
pred.store.continue93: ; preds = %pred.store.if92, %pred.store.continue91
%113 = extractelement <8 x i1> %101, i64 4
br i1 %113, label %pred.store.if94, label %pred.store.continue95
pred.store.if94: ; preds = %pred.store.continue93
%114 = add i64 %index84, 4
%115 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %114
store i8 68, ptr %115, align 1, !tbaa !5
br label %pred.store.continue95
pred.store.continue95: ; preds = %pred.store.if94, %pred.store.continue93
%116 = extractelement <8 x i1> %101, i64 5
br i1 %116, label %pred.store.if96, label %pred.store.continue97
pred.store.if96: ; preds = %pred.store.continue95
%117 = add i64 %index84, 5
%118 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %117
store i8 68, ptr %118, align 1, !tbaa !5
br label %pred.store.continue97
pred.store.continue97: ; preds = %pred.store.if96, %pred.store.continue95
%119 = extractelement <8 x i1> %101, i64 6
br i1 %119, label %pred.store.if98, label %pred.store.continue99
pred.store.if98: ; preds = %pred.store.continue97
%120 = add i64 %index84, 6
%121 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %120
store i8 68, ptr %121, align 1, !tbaa !5
br label %pred.store.continue99
pred.store.continue99: ; preds = %pred.store.if98, %pred.store.continue97
%122 = extractelement <8 x i1> %101, i64 7
br i1 %122, label %pred.store.if100, label %pred.store.continue101
pred.store.if100: ; preds = %pred.store.continue99
%123 = add i64 %index84, 7
%124 = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %123
store i8 68, ptr %124, align 1, !tbaa !5
br label %pred.store.continue101
pred.store.continue101: ; preds = %pred.store.if100, %pred.store.continue99
%index.next102 = add nuw i64 %index84, 8
%125 = icmp eq i64 %index.next102, %n.vec82
br i1 %125, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !12
vec.epilog.middle.block: ; preds = %pred.store.continue101
%cmp.n83 = icmp eq i64 %n.mod.vf81, 0
br i1 %cmp.n83, label %for.cond.cleanup, label %for.body.preheader
for.body.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec82, %vec.epilog.middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.inc, %middle.block, %vec.epilog.middle.block, %entry
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %t)
call void @llvm.lifetime.end.p0(i64 300000, ptr nonnull %t) #4
ret i32 0
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds [300000 x i8], ptr %t, i64 0, i64 %indvars.iv
%126 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp5 = icmp eq i8 %126, 63
br i1 %cmp5, label %if.then, label %for.inc
if.then: ; preds = %for.body
store i8 68, ptr %arrayidx, align 1, !tbaa !5
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, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10, !11}
!13 = distinct !{!13, !9, !11, !10}
|
#include <stdio.h>
int main()
{
int n, a, b;
int i, j, high, mid, x, y, z;
int m;
int max = -1;
int low = 1;
int h[100001] = {};
scanf("%d %d %d", &n, &a, &b);
for(i=0; i<n; i++)
{
scanf("%d", &h[i]);
if(max < h[i])
{
max = h[i];
}
}
high = max / b;
while(low <= high)
{
mid = (low + high) / 2;
z = 0;
m = mid;
for(j=0; j<n; j++)
{
x = h[j] - mid * b;
if(x > 0)
{
y = x / (a-b);
if(x % (a-b) != 0) y++;
m = m - y;
if(m < 0)
{
z = 1;
break;
}
}
}
if(z == 1)
{
low = mid + 1;
}
else
{
high = mid - 1;
}
}
printf("%d\n", low);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_255971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_255971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%h = alloca [100001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 400004, ptr nonnull %h) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400004) %h, i8 0, i64 400004, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp55 = icmp sgt i32 %0, 0
br i1 %cmp55, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%max.057 = phi i32 [ %spec.select, %for.body ], [ -1, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr %h, 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
%spec.select = call i32 @llvm.smax.i32(i32 %max.057, i32 %1)
%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, %entry
%max.0.lcssa = phi i32 [ -1, %entry ], [ %spec.select, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%4 = load i32, ptr %b, align 4, !tbaa !5
%div = sdiv i32 %max.0.lcssa, %4
%cmp7.not62 = icmp slt i32 %div, 1
br i1 %cmp7.not62, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %for.end
%cmp1059 = icmp sgt i32 %.lcssa, 0
%5 = load i32, ptr %a, align 4
%sub16 = sub nsw i32 %5, %4
br i1 %cmp1059, label %while.body.us.preheader, label %while.end
while.body.us.preheader: ; preds = %while.body.lr.ph
%wide.trip.count = zext i32 %.lcssa to i64
br label %while.body.us
while.body.us: ; preds = %while.body.us.preheader, %if.end35.us
%low.064.us = phi i32 [ %low.1.us, %if.end35.us ], [ 1, %while.body.us.preheader ]
%high.063.us = phi i32 [ %high.1.us, %if.end35.us ], [ %div, %while.body.us.preheader ]
%add.us = add nsw i32 %low.064.us, %high.063.us
%div8.us = sdiv i32 %add.us, 2
%mul.us = mul nsw i32 %div8.us, %4
br label %for.body11.us
for.body11.us: ; preds = %while.body.us, %for.inc28.us
%indvars.iv69 = phi i64 [ 0, %while.body.us ], [ %indvars.iv.next70, %for.inc28.us ]
%m.061.us = phi i32 [ %div8.us, %while.body.us ], [ %m.1.us, %for.inc28.us ]
%arrayidx13.us = getelementptr inbounds [100001 x i32], ptr %h, i64 0, i64 %indvars.iv69
%6 = load i32, ptr %arrayidx13.us, align 4, !tbaa !5
%sub.us = sub nsw i32 %6, %mul.us
%cmp14.us = icmp sgt i32 %sub.us, 0
br i1 %cmp14.us, label %if.then15.us, label %for.inc28.us
if.then15.us: ; preds = %for.body11.us
%div17.us = sdiv i32 %sub.us, %sub16
%rem.us = srem i32 %sub.us, %sub16
%cmp19.not.us = icmp ne i32 %rem.us, 0
%inc21.us.neg = sext i1 %cmp19.not.us to i32
%spec.select54.neg.us = sub i32 %m.061.us, %div17.us
%sub23.us = add i32 %spec.select54.neg.us, %inc21.us.neg
%cmp24.us = icmp slt i32 %sub23.us, 0
br i1 %cmp24.us, label %if.then32.us, label %for.inc28.us
for.inc28.us: ; preds = %if.then15.us, %for.body11.us
%m.1.us = phi i32 [ %sub23.us, %if.then15.us ], [ %m.061.us, %for.body11.us ]
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count
br i1 %exitcond.not, label %for.cond9.if.else_crit_edge.us, label %for.body11.us, !llvm.loop !11
if.then32.us: ; preds = %if.then15.us
%add33.us = add nsw i32 %div8.us, 1
br label %if.end35.us
if.end35.us: ; preds = %if.then32.us, %for.cond9.if.else_crit_edge.us
%high.1.us = phi i32 [ %high.063.us, %if.then32.us ], [ %sub34.us, %for.cond9.if.else_crit_edge.us ]
%low.1.us = phi i32 [ %add33.us, %if.then32.us ], [ %low.064.us, %for.cond9.if.else_crit_edge.us ]
%cmp7.not.us = icmp sgt i32 %low.1.us, %high.1.us
br i1 %cmp7.not.us, label %while.end, label %while.body.us, !llvm.loop !12
for.cond9.if.else_crit_edge.us: ; preds = %for.inc28.us
%sub34.us = add nsw i32 %div8.us, -1
br label %if.end35.us
while.end: ; preds = %if.end35.us, %while.body.lr.ph, %for.end
%low.0.lcssa = phi i32 [ 1, %for.end ], [ 1, %while.body.lr.ph ], [ %low.1.us, %if.end35.us ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %low.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400004, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void)
{
int a,b,n,m,i,j,k,y;
int c,d[100];
for(i=0;i<100;i++){
d[i]=0;
}
scanf("%d",&n);
scanf("%d %d",&a,&b);
scanf("%d",&c);
for(i=0;i<n;i++){
scanf("%d",&d[i]);
}
for(j=0;j<n;j++){
for(k=0;k<n-1;k++){
if(d[k]<d[k+1]){
m=d[k+1];
d[k+1]=d[k];
d[k]=m;
}
}
}
for(i=0;i<n;i++){
if(c/(a+i*b)<d[i]/b){
c+=d[i];
}
else{
y=c/(a+i*b);
printf("%d\n",y);
break;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256028/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256028/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
%b = alloca i32, align 4
%n = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %d) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %d, i8 0, i64 400, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp480 = icmp sgt i32 %0, 0
br i1 %cmp480, label %for.body5, label %for.end58
for.cond12.preheader: ; preds = %for.body5
%cmp1384 = icmp sgt i32 %8, 0
br i1 %cmp1384, label %for.cond15.preheader.lr.ph, label %for.end58
for.cond15.preheader.lr.ph: ; preds = %for.cond12.preheader
%cmp1682.not = icmp eq i32 %8, 1
br i1 %cmp1682.not, label %for.body41.lr.ph, label %for.cond15.preheader.us.preheader
for.cond15.preheader.us.preheader: ; preds = %for.cond15.preheader.lr.ph
%sub = add i32 %8, -1
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %sub, 1
%unroll_iter = and i64 %wide.trip.count, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond15.preheader.us
for.cond15.preheader.us: ; preds = %for.cond15.preheader.us.preheader, %for.cond15.for.inc36_crit_edge.us
%j.085.us = phi i32 [ %inc37.us, %for.cond15.for.inc36_crit_edge.us ], [ 0, %for.cond15.preheader.us.preheader ]
%.pre = load i32, ptr %d, align 16, !tbaa !5
br i1 %1, label %for.cond15.for.inc36_crit_edge.us.unr-lcssa, label %for.body17.us
for.body17.us: ; preds = %for.cond15.preheader.us, %for.inc33.us.1
%2 = phi i32 [ %6, %for.inc33.us.1 ], [ %.pre, %for.cond15.preheader.us ]
%indvars.iv95 = phi i64 [ %indvars.iv.next96.1, %for.inc33.us.1 ], [ 0, %for.cond15.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc33.us.1 ], [ 0, %for.cond15.preheader.us ]
%indvars.iv.next96 = or i64 %indvars.iv95, 1
%arrayidx21.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv.next96
%3 = load i32, ptr %arrayidx21.us, align 4, !tbaa !5
%cmp22.us = icmp slt i32 %2, %3
br i1 %cmp22.us, label %if.then.us, label %for.inc33.us
if.then.us: ; preds = %for.body17.us
%arrayidx19.us = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv95
store i32 %2, ptr %arrayidx21.us, align 4, !tbaa !5
store i32 %3, ptr %arrayidx19.us, align 8, !tbaa !5
br label %for.inc33.us
for.inc33.us: ; preds = %if.then.us, %for.body17.us
%4 = phi i32 [ %2, %if.then.us ], [ %3, %for.body17.us ]
%indvars.iv.next96.1 = add nuw nsw i64 %indvars.iv95, 2
%arrayidx21.us.1 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv.next96.1
%5 = load i32, ptr %arrayidx21.us.1, align 8, !tbaa !5
%cmp22.us.1 = icmp slt i32 %4, %5
br i1 %cmp22.us.1, label %if.then.us.1, label %for.inc33.us.1
if.then.us.1: ; preds = %for.inc33.us
%arrayidx19.us.1 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv.next96
store i32 %4, ptr %arrayidx21.us.1, align 8, !tbaa !5
store i32 %5, ptr %arrayidx19.us.1, align 4, !tbaa !5
br label %for.inc33.us.1
for.inc33.us.1: ; preds = %if.then.us.1, %for.inc33.us
%6 = phi i32 [ %4, %if.then.us.1 ], [ %5, %for.inc33.us ]
%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.cond15.for.inc36_crit_edge.us.unr-lcssa, label %for.body17.us, !llvm.loop !9
for.cond15.for.inc36_crit_edge.us.unr-lcssa: ; preds = %for.inc33.us.1, %for.cond15.preheader.us
%.unr = phi i32 [ %.pre, %for.cond15.preheader.us ], [ %6, %for.inc33.us.1 ]
%indvars.iv95.unr = phi i64 [ 0, %for.cond15.preheader.us ], [ %indvars.iv.next96.1, %for.inc33.us.1 ]
br i1 %lcmp.mod.not, label %for.cond15.for.inc36_crit_edge.us, label %for.body17.us.epil
for.body17.us.epil: ; preds = %for.cond15.for.inc36_crit_edge.us.unr-lcssa
%indvars.iv.next96.epil = add nuw nsw i64 %indvars.iv95.unr, 1
%arrayidx21.us.epil = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv.next96.epil
%7 = load i32, ptr %arrayidx21.us.epil, align 4, !tbaa !5
%cmp22.us.epil = icmp slt i32 %.unr, %7
br i1 %cmp22.us.epil, label %if.then.us.epil, label %for.cond15.for.inc36_crit_edge.us
if.then.us.epil: ; preds = %for.body17.us.epil
%arrayidx19.us.epil = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv95.unr
store i32 %.unr, ptr %arrayidx21.us.epil, align 4, !tbaa !5
store i32 %7, ptr %arrayidx19.us.epil, align 4, !tbaa !5
br label %for.cond15.for.inc36_crit_edge.us
for.cond15.for.inc36_crit_edge.us: ; preds = %for.body17.us.epil, %if.then.us.epil, %for.cond15.for.inc36_crit_edge.us.unr-lcssa
%inc37.us = add nuw nsw i32 %j.085.us, 1
%exitcond98.not = icmp eq i32 %inc37.us, %8
br i1 %exitcond98.not, label %for.cond39.preheader, label %for.cond15.preheader.us, !llvm.loop !11
for.body5: ; preds = %entry, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %entry ]
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = load i32, ptr %n, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %9
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !12
for.cond39.preheader: ; preds = %for.cond15.for.inc36_crit_edge.us
br i1 %cmp1384, label %for.body41.lr.ph, label %for.end58
for.body41.lr.ph: ; preds = %for.cond15.preheader.lr.ph, %for.cond39.preheader
%.lcssa108115 = phi i32 [ %8, %for.cond39.preheader ], [ 1, %for.cond15.preheader.lr.ph ]
%c.promoted = load i32, ptr %c, align 4, !tbaa !5
%10 = load i32, ptr %a, align 4, !tbaa !5
%11 = load i32, ptr %b, align 4, !tbaa !5
%wide.trip.count104 = zext i32 %.lcssa108115 to i64
br label %for.body41
for.body41: ; preds = %for.body41.lr.ph, %if.then47
%indvars.iv99 = phi i64 [ 0, %for.body41.lr.ph ], [ %indvars.iv.next100, %if.then47 ]
%add508688 = phi i32 [ %c.promoted, %for.body41.lr.ph ], [ %add50, %if.then47 ]
%12 = trunc i64 %indvars.iv99 to i32
%13 = mul i32 %11, %12
%14 = add i32 %13, %10
%div = sdiv i32 %add508688, %14
%arrayidx44 = getelementptr inbounds [100 x i32], ptr %d, i64 0, i64 %indvars.iv99
%15 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%div45 = sdiv i32 %15, %11
%cmp46 = icmp slt i32 %div, %div45
br i1 %cmp46, label %if.then47, label %if.else
if.then47: ; preds = %for.body41
%add50 = add nsw i32 %15, %add508688
store i32 %add50, ptr %c, align 4, !tbaa !5
%indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
%exitcond105.not = icmp eq i64 %indvars.iv.next100, %wide.trip.count104
br i1 %exitcond105.not, label %for.end58, label %for.body41, !llvm.loop !13
if.else: ; preds = %for.body41
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div)
br label %for.end58
for.end58: ; preds = %if.then47, %entry, %for.cond12.preheader, %for.cond39.preheader, %if.else
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main(void) {
int num,a,b,c,d[10001],i,j,temp,cal,price;
scanf("%d%d%d%d",&num,&a,&b,&c);
for (i=0; i<num; i++) scanf("%d",&d[i]);
for (i=0; i<num-1; i++) {
for (j=0; j<num-1-i; j++) {
if (d[j]<d[j+1]) {
temp=d[j];
d[j]=d[j+1];
d[j+1]=temp;
}
}
}
cal=c,price=a;
for (i=0; i<num; i++) {
if (1.0*cal/price<1.0*(cal+d[i])/(price+b)) {
cal+=d[i];
price+=b;
} else {
break;
}
}
printf("%d\n",cal/price);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256079/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256079/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.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:
%num = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca [10001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #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 40004, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %num, align 4, !tbaa !5
%cmp79 = icmp sgt i32 %0, 0
br i1 %cmp79, label %for.body, label %for.end30.thread
for.end30.thread: ; preds = %entry
%1 = load i32, ptr %c, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
br label %for.end53
for.cond2.preheader: ; preds = %for.body
%sub = add i32 %3, -1
%cmp383 = icmp sgt i32 %3, 1
br i1 %cmp383, label %for.cond5.preheader, label %for.end30
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [10001 x i32], ptr %d, 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
%3 = load i32, ptr %num, 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.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond2.preheader, %for.inc28
%indvars.iv98 = phi i32 [ %indvars.iv.next99, %for.inc28 ], [ %sub, %for.cond2.preheader ]
%i.184 = phi i32 [ %inc29, %for.inc28 ], [ 0, %for.cond2.preheader ]
%5 = zext i32 %indvars.iv98 to i64
%6 = xor i32 %i.184, -1
%sub7 = add i32 %3, %6
%cmp881 = icmp sgt i32 %sub7, 0
br i1 %cmp881, label %for.body9.preheader, label %for.inc28
for.body9.preheader: ; preds = %for.cond5.preheader
%.pre = load i32, ptr %d, align 16, !tbaa !5
%xtraiter = and i64 %5, 1
%7 = icmp eq i32 %indvars.iv98, 1
br i1 %7, label %for.inc28.loopexit.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %5, 4294967294
br label %for.body9
for.body9: ; preds = %for.inc25.1, %for.body9.preheader.new
%8 = phi i32 [ %.pre, %for.body9.preheader.new ], [ %12, %for.inc25.1 ]
%indvars.iv95 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next96.1, %for.inc25.1 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.1, %for.inc25.1 ]
%indvars.iv.next96 = or i64 %indvars.iv95, 1
%arrayidx13 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv.next96
%9 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%cmp14 = icmp slt i32 %8, %9
br i1 %cmp14, label %if.then, label %for.inc25
if.then: ; preds = %for.body9
%arrayidx11 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv95
store i32 %9, ptr %arrayidx11, align 8, !tbaa !5
store i32 %8, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %for.body9, %if.then
%10 = phi i32 [ %9, %for.body9 ], [ %8, %if.then ]
%indvars.iv.next96.1 = add nuw nsw i64 %indvars.iv95, 2
%arrayidx13.1 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv.next96.1
%11 = load i32, ptr %arrayidx13.1, align 8, !tbaa !5
%cmp14.1 = icmp slt i32 %10, %11
br i1 %cmp14.1, label %if.then.1, label %for.inc25.1
if.then.1: ; preds = %for.inc25
%arrayidx11.1 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv.next96
store i32 %11, ptr %arrayidx11.1, align 4, !tbaa !5
store i32 %10, ptr %arrayidx13.1, align 8, !tbaa !5
br label %for.inc25.1
for.inc25.1: ; preds = %if.then.1, %for.inc25
%12 = phi i32 [ %11, %for.inc25 ], [ %10, %if.then.1 ]
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.inc28.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11
for.inc28.loopexit.unr-lcssa: ; preds = %for.inc25.1, %for.body9.preheader
%.unr = phi i32 [ %.pre, %for.body9.preheader ], [ %12, %for.inc25.1 ]
%indvars.iv95.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next96.1, %for.inc25.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.inc28, label %for.body9.epil
for.body9.epil: ; preds = %for.inc28.loopexit.unr-lcssa
%indvars.iv.next96.epil = add nuw nsw i64 %indvars.iv95.unr, 1
%arrayidx13.epil = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv.next96.epil
%13 = load i32, ptr %arrayidx13.epil, align 4, !tbaa !5
%cmp14.epil = icmp slt i32 %.unr, %13
br i1 %cmp14.epil, label %if.then.epil, label %for.inc28
if.then.epil: ; preds = %for.body9.epil
%arrayidx11.epil = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv95.unr
store i32 %13, ptr %arrayidx11.epil, align 4, !tbaa !5
store i32 %.unr, ptr %arrayidx13.epil, align 4, !tbaa !5
br label %for.inc28
for.inc28: ; preds = %for.inc28.loopexit.unr-lcssa, %if.then.epil, %for.body9.epil, %for.cond5.preheader
%inc29 = add nuw nsw i32 %i.184, 1
%indvars.iv.next99 = add i32 %indvars.iv98, -1
%exitcond100.not = icmp eq i32 %inc29, %sub
br i1 %exitcond100.not, label %for.end30, label %for.cond5.preheader, !llvm.loop !12
for.end30: ; preds = %for.inc28, %for.cond2.preheader
%14 = load i32, ptr %c, align 4, !tbaa !5
%15 = load i32, ptr %a, align 4, !tbaa !5
%cmp3285 = icmp sgt i32 %3, 0
br i1 %cmp3285, label %for.body33.lr.ph, label %for.end53
for.body33.lr.ph: ; preds = %for.end30
%16 = load i32, ptr %b, align 4, !tbaa !5
%17 = mul i32 %3, %16
%18 = add i32 %15, %17
%wide.trip.count104 = zext i32 %3 to i64
br label %for.body33
for.cond31: ; preds = %for.body33
%indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
%exitcond105.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count104
br i1 %exitcond105.not, label %for.end53, label %for.body33, !llvm.loop !13
for.body33: ; preds = %for.body33.lr.ph, %for.cond31
%indvars.iv101 = phi i64 [ 0, %for.body33.lr.ph ], [ %indvars.iv.next102, %for.cond31 ]
%price.088 = phi i32 [ %15, %for.body33.lr.ph ], [ %add40, %for.cond31 ]
%cal.087 = phi i32 [ %14, %for.body33.lr.ph ], [ %add37, %for.cond31 ]
%arrayidx36 = getelementptr inbounds [10001 x i32], ptr %d, i64 0, i64 %indvars.iv101
%19 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%add37 = add nsw i32 %19, %cal.087
%add40 = add nsw i32 %16, %price.088
%20 = insertelement <2 x i32> poison, i32 %cal.087, i64 0
%21 = insertelement <2 x i32> %20, i32 %add37, i64 1
%22 = sitofp <2 x i32> %21 to <2 x double>
%23 = insertelement <2 x i32> poison, i32 %price.088, i64 0
%24 = insertelement <2 x i32> %23, i32 %add40, i64 1
%25 = sitofp <2 x i32> %24 to <2 x double>
%26 = fdiv <2 x double> %22, %25
%27 = extractelement <2 x double> %26, i64 0
%28 = extractelement <2 x double> %26, i64 1
%cmp43 = fcmp olt double %27, %28
br i1 %cmp43, label %for.cond31, label %for.end53
for.end53: ; preds = %for.cond31, %for.body33, %for.end30.thread, %for.end30
%cal.0.lcssa = phi i32 [ %14, %for.end30 ], [ %1, %for.end30.thread ], [ %cal.087, %for.body33 ], [ %add37, %for.cond31 ]
%price.0.lcssa = phi i32 [ %15, %for.end30 ], [ %2, %for.end30.thread ], [ %price.088, %for.body33 ], [ %18, %for.cond31 ]
%div54 = sdiv i32 %cal.0.lcssa, %price.0.lcssa
%call55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %div54)
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
// Aizu Vol-1 0164: Ohajiki Game
// 2017.8.3
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
char *gets(char *);
char buf[100], *p;
int a[10];
int getInt(void)
{
int n = 0;
while (isspace(*p)) p++;
while (isdigit(*p)) n = 10 * n + (*p++ - '0');
return n;
}
int main()
{
int i, n, k;
while (1) {
gets(p = buf);
if (!(n = getInt())) break;
gets(p = buf);
for (i = 0; i < n; i++) a[i] = getInt();
puts("31"), k = 31;
for (i = 0, k = 31; k > 1; ) {
k -= a[i];
printf("%d\n", k);
k = k - (k - 1) % 5;
printf("%d\n", k);
if (++i >= n) i = 0;
}
puts("0");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256121/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256121/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@p = dso_local local_unnamed_addr global ptr null, align 8
@buf = dso_local global [100 x i8] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"31\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local i32 @getInt() local_unnamed_addr #0 {
entry:
%call = tail call ptr @__ctype_b_loc() #4
%0 = load ptr, ptr %call, align 8, !tbaa !5
%1 = load ptr, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %1, align 1, !tbaa !9
%idxprom15 = sext i8 %2 to i64
%arrayidx16 = getelementptr inbounds i16, ptr %0, i64 %idxprom15
%3 = load i16, ptr %arrayidx16, align 2, !tbaa !10
%4 = and i16 %3, 8192
%tobool.not17 = icmp eq i16 %4, 0
br i1 %tobool.not17, label %while.cond2.preheader, label %while.body
while.cond2.preheader: ; preds = %while.body, %entry
%5 = phi i16 [ %3, %entry ], [ %11, %while.body ]
%6 = phi ptr [ %1, %entry ], [ %incdec.ptr, %while.body ]
%7 = and i16 %5, 2048
%tobool9.not20 = icmp eq i16 %7, 0
br i1 %tobool9.not20, label %while.end13, label %while.body10
while.body: ; preds = %entry, %while.body
%8 = phi ptr [ %incdec.ptr, %while.body ], [ %1, %entry ]
%incdec.ptr = getelementptr inbounds i8, ptr %8, i64 1
store ptr %incdec.ptr, ptr @p, align 8, !tbaa !5
%9 = load ptr, ptr %call, align 8, !tbaa !5
%10 = load i8, ptr %incdec.ptr, align 1, !tbaa !9
%idxprom = sext i8 %10 to i64
%arrayidx = getelementptr inbounds i16, ptr %9, i64 %idxprom
%11 = load i16, ptr %arrayidx, align 2, !tbaa !10
%12 = and i16 %11, 8192
%tobool.not = icmp eq i16 %12, 0
br i1 %tobool.not, label %while.cond2.preheader, label %while.body, !llvm.loop !12
while.body10: ; preds = %while.cond2.preheader, %while.body10
%13 = phi ptr [ %incdec.ptr11, %while.body10 ], [ %6, %while.cond2.preheader ]
%n.021 = phi i32 [ %add, %while.body10 ], [ 0, %while.cond2.preheader ]
%mul = mul nsw i32 %n.021, 10
%incdec.ptr11 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr11, ptr @p, align 8, !tbaa !5
%14 = load i8, ptr %13, align 1, !tbaa !9
%conv12 = sext i8 %14 to i32
%sub = add i32 %mul, -48
%add = add i32 %sub, %conv12
%15 = load ptr, ptr %call, align 8, !tbaa !5
%16 = load i8, ptr %incdec.ptr11, align 1, !tbaa !9
%idxprom5 = sext i8 %16 to i64
%arrayidx6 = getelementptr inbounds i16, ptr %15, i64 %idxprom5
%17 = load i16, ptr %arrayidx6, align 2, !tbaa !10
%18 = and i16 %17, 2048
%tobool9.not = icmp eq i16 %18, 0
br i1 %tobool9.not, label %while.end13, label %while.body10, !llvm.loop !14
while.end13: ; preds = %while.body10, %while.cond2.preheader
%n.0.lcssa = phi i32 [ 0, %while.cond2.preheader ], [ %add, %while.body10 ]
ret i32 %n.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
br label %while.cond
while.cond: ; preds = %for.end18, %entry
store ptr @buf, ptr @p, align 8, !tbaa !5
%call = tail call ptr @gets(ptr noundef nonnull @buf)
%call.i = tail call ptr @__ctype_b_loc() #4
%0 = load ptr, ptr %call.i, align 8, !tbaa !5
%1 = load ptr, ptr @p, align 8, !tbaa !5
%2 = load i8, ptr %1, align 1, !tbaa !9
%idxprom15.i = sext i8 %2 to i64
%arrayidx16.i = getelementptr inbounds i16, ptr %0, i64 %idxprom15.i
%3 = load i16, ptr %arrayidx16.i, align 2, !tbaa !10
%4 = and i16 %3, 8192
%tobool.not17.i = icmp eq i16 %4, 0
br i1 %tobool.not17.i, label %while.cond2.preheader.i, label %while.body.i
while.cond2.preheader.i: ; preds = %while.body.i, %while.cond
%5 = phi i16 [ %3, %while.cond ], [ %11, %while.body.i ]
%6 = phi ptr [ %1, %while.cond ], [ %incdec.ptr.i, %while.body.i ]
%7 = and i16 %5, 2048
%tobool9.not20.i = icmp eq i16 %7, 0
br i1 %tobool9.not20.i, label %while.end, label %while.body10.i
while.body.i: ; preds = %while.cond, %while.body.i
%8 = phi ptr [ %incdec.ptr.i, %while.body.i ], [ %1, %while.cond ]
%incdec.ptr.i = getelementptr inbounds i8, ptr %8, i64 1
store ptr %incdec.ptr.i, ptr @p, align 8, !tbaa !5
%9 = load ptr, ptr %call.i, align 8, !tbaa !5
%10 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !9
%idxprom.i = sext i8 %10 to i64
%arrayidx.i = getelementptr inbounds i16, ptr %9, i64 %idxprom.i
%11 = load i16, ptr %arrayidx.i, align 2, !tbaa !10
%12 = and i16 %11, 8192
%tobool.not.i = icmp eq i16 %12, 0
br i1 %tobool.not.i, label %while.cond2.preheader.i, label %while.body.i, !llvm.loop !12
while.body10.i: ; preds = %while.cond2.preheader.i, %while.body10.i
%13 = phi ptr [ %incdec.ptr11.i, %while.body10.i ], [ %6, %while.cond2.preheader.i ]
%n.021.i = phi i32 [ %add.i, %while.body10.i ], [ 0, %while.cond2.preheader.i ]
%mul.i = mul nsw i32 %n.021.i, 10
%incdec.ptr11.i = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr11.i, ptr @p, align 8, !tbaa !5
%14 = load i8, ptr %13, align 1, !tbaa !9
%conv12.i = sext i8 %14 to i32
%sub.i = add i32 %mul.i, -48
%add.i = add i32 %sub.i, %conv12.i
%15 = load ptr, ptr %call.i, align 8, !tbaa !5
%16 = load i8, ptr %incdec.ptr11.i, align 1, !tbaa !9
%idxprom5.i = sext i8 %16 to i64
%arrayidx6.i = getelementptr inbounds i16, ptr %15, i64 %idxprom5.i
%17 = load i16, ptr %arrayidx6.i, align 2, !tbaa !10
%18 = and i16 %17, 2048
%tobool9.not.i = icmp eq i16 %18, 0
br i1 %tobool9.not.i, label %getInt.exit, label %while.body10.i, !llvm.loop !14
getInt.exit: ; preds = %while.body10.i
%tobool.not = icmp eq i32 %add.i, 0
br i1 %tobool.not, label %while.end, label %if.end
if.end: ; preds = %getInt.exit
store ptr @buf, ptr @p, align 8, !tbaa !5
%call2 = tail call ptr @gets(ptr noundef nonnull @buf)
%cmp56 = icmp sgt i32 %add.i, 0
br i1 %cmp56, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %if.end
%wide.trip.count = zext i32 %add.i to i64
%.pre = load ptr, ptr %call.i, align 8, !tbaa !5
%.pre62 = load ptr, ptr @p, align 8, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.preheader, %getInt.exit52
%19 = phi ptr [ %.pre62, %for.body.preheader ], [ %39, %getInt.exit52 ]
%20 = phi ptr [ %.pre, %for.body.preheader ], [ %40, %getInt.exit52 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %getInt.exit52 ]
%21 = load i8, ptr %19, align 1, !tbaa !9
%idxprom15.i31 = sext i8 %21 to i64
%arrayidx16.i32 = getelementptr inbounds i16, ptr %20, i64 %idxprom15.i31
%22 = load i16, ptr %arrayidx16.i32, align 2, !tbaa !10
%23 = and i16 %22, 8192
%tobool.not17.i33 = icmp eq i16 %23, 0
br i1 %tobool.not17.i33, label %while.cond2.preheader.i39, label %while.body.i34
while.cond2.preheader.i39: ; preds = %while.body.i34, %for.body
%24 = phi ptr [ %19, %for.body ], [ %incdec.ptr.i35, %while.body.i34 ]
%25 = phi ptr [ %20, %for.body ], [ %29, %while.body.i34 ]
%26 = phi i16 [ %22, %for.body ], [ %31, %while.body.i34 ]
%27 = and i16 %26, 2048
%tobool9.not20.i40 = icmp eq i16 %27, 0
br i1 %tobool9.not20.i40, label %getInt.exit52, label %while.body10.i41
while.body.i34: ; preds = %for.body, %while.body.i34
%28 = phi ptr [ %incdec.ptr.i35, %while.body.i34 ], [ %19, %for.body ]
%incdec.ptr.i35 = getelementptr inbounds i8, ptr %28, i64 1
store ptr %incdec.ptr.i35, ptr @p, align 8, !tbaa !5
%29 = load ptr, ptr %call.i, align 8, !tbaa !5
%30 = load i8, ptr %incdec.ptr.i35, align 1, !tbaa !9
%idxprom.i36 = sext i8 %30 to i64
%arrayidx.i37 = getelementptr inbounds i16, ptr %29, i64 %idxprom.i36
%31 = load i16, ptr %arrayidx.i37, align 2, !tbaa !10
%32 = and i16 %31, 8192
%tobool.not.i38 = icmp eq i16 %32, 0
br i1 %tobool.not.i38, label %while.cond2.preheader.i39, label %while.body.i34, !llvm.loop !12
while.body10.i41: ; preds = %while.cond2.preheader.i39, %while.body10.i41
%33 = phi ptr [ %incdec.ptr11.i44, %while.body10.i41 ], [ %24, %while.cond2.preheader.i39 ]
%n.021.i42 = phi i32 [ %add.i47, %while.body10.i41 ], [ 0, %while.cond2.preheader.i39 ]
%mul.i43 = mul nsw i32 %n.021.i42, 10
%incdec.ptr11.i44 = getelementptr inbounds i8, ptr %33, i64 1
store ptr %incdec.ptr11.i44, ptr @p, align 8, !tbaa !5
%34 = load i8, ptr %33, align 1, !tbaa !9
%conv12.i45 = sext i8 %34 to i32
%sub.i46 = add i32 %mul.i43, -48
%add.i47 = add i32 %sub.i46, %conv12.i45
%35 = load ptr, ptr %call.i, align 8, !tbaa !5
%36 = load i8, ptr %incdec.ptr11.i44, align 1, !tbaa !9
%idxprom5.i48 = sext i8 %36 to i64
%arrayidx6.i49 = getelementptr inbounds i16, ptr %35, i64 %idxprom5.i48
%37 = load i16, ptr %arrayidx6.i49, align 2, !tbaa !10
%38 = and i16 %37, 2048
%tobool9.not.i50 = icmp eq i16 %38, 0
br i1 %tobool9.not.i50, label %getInt.exit52, label %while.body10.i41, !llvm.loop !14
getInt.exit52: ; preds = %while.body10.i41, %while.cond2.preheader.i39
%39 = phi ptr [ %24, %while.cond2.preheader.i39 ], [ %incdec.ptr11.i44, %while.body10.i41 ]
%40 = phi ptr [ %25, %while.cond2.preheader.i39 ], [ %35, %while.body10.i41 ]
%n.0.lcssa.i51 = phi i32 [ 0, %while.cond2.preheader.i39 ], [ %add.i47, %while.body10.i41 ]
%arrayidx = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %n.0.lcssa.i51, ptr %arrayidx, align 4, !tbaa !15
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %getInt.exit52, %if.end
%call4 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
br label %for.body7
for.body7: ; preds = %for.end, %for.body7
%k.059 = phi i32 [ 31, %for.end ], [ %sub12, %for.body7 ]
%i.158 = phi i32 [ 0, %for.end ], [ %spec.store.select, %for.body7 ]
%idxprom8 = sext i32 %i.158 to i64
%arrayidx9 = getelementptr inbounds [10 x i32], ptr @a, i64 0, i64 %idxprom8
%41 = load i32, ptr %arrayidx9, align 4, !tbaa !15
%sub = sub nsw i32 %k.059, %41
%call10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%sub11 = add nsw i32 %sub, -1
%rem = srem i32 %sub11, 5
%sub12 = sub nsw i32 %sub, %rem
%call13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub12)
%inc14 = add nsw i32 %i.158, 1
%cmp15.not = icmp slt i32 %inc14, %add.i
%spec.store.select = select i1 %cmp15.not, i32 %inc14, i32 0
%cmp6 = icmp sgt i32 %sub12, 1
br i1 %cmp6, label %for.body7, label %for.end18, !llvm.loop !18
for.end18: ; preds = %for.body7
%call19 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %while.cond
while.end: ; preds = %while.cond2.preheader.i, %getInt.exit
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @gets(ptr noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
|
#include <stdio.h>
int a[6];
int main(void)
{
int n;
int i;
int j;
double high;
scanf("%d", &n);
for (i = 0;i < n;i++){
scanf("%lf", &high);
if (high < 165.0){
a[0]++;
}
else if (high < 170.0){
a[1]++;
}
else if (high < 175.0){
a[2]++;
}
else if (high < 180.0){
a[3]++;
}
else if (high < 185.0){
a[4]++;
}
else {
a[5]++;
}
}
for (i = 1;i <= 6; i++){
printf("%d:", i);
for (j = 0; j < a[i - 1]; j++){
printf("*");
}
printf("\n");
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256172/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256172/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@a = dso_local local_unnamed_addr global [6 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d:\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%high = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %high) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %for.cond25.preheader
for.cond25.preheader: ; preds = %for.inc, %entry
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 1)
%1 = load i32, ptr @a, align 16, !tbaa !5
%cmp3049 = icmp sgt i32 %1, 0
br i1 %cmp3049, label %for.body31, label %for.end35
for.body: ; preds = %entry, %for.inc
%i.048 = phi i32 [ %inc24, %for.inc ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %high)
%2 = load double, ptr %high, align 8, !tbaa !9
%cmp2 = fcmp olt double %2, 1.650000e+02
br i1 %cmp2, label %if.then, label %if.else
if.then: ; preds = %for.body
%3 = load i32, ptr @a, align 16, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr @a, align 16, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%cmp3 = fcmp olt double %2, 1.700000e+02
br i1 %cmp3, label %if.then4, label %if.else6
if.then4: ; preds = %if.else
%4 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%inc5 = add nsw i32 %4, 1
store i32 %inc5, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
br label %for.inc
if.else6: ; preds = %if.else
%cmp7 = fcmp olt double %2, 1.750000e+02
br i1 %cmp7, label %if.then8, label %if.else10
if.then8: ; preds = %if.else6
%5 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%inc9 = add nsw i32 %5, 1
store i32 %inc9, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
br label %for.inc
if.else10: ; preds = %if.else6
%cmp11 = fcmp olt double %2, 1.800000e+02
br i1 %cmp11, label %if.then12, label %if.else14
if.then12: ; preds = %if.else10
%6 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%inc13 = add nsw i32 %6, 1
store i32 %inc13, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
br label %for.inc
if.else14: ; preds = %if.else10
%cmp15 = fcmp olt double %2, 1.850000e+02
br i1 %cmp15, label %if.then16, label %if.else18
if.then16: ; preds = %if.else14
%7 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%inc17 = add nsw i32 %7, 1
store i32 %inc17, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
br label %for.inc
if.else18: ; preds = %if.else14
%8 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%inc19 = add nsw i32 %8, 1
store i32 %inc19, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.then8, %if.then16, %if.else18, %if.then12, %if.then4
%inc24 = add nuw nsw i32 %i.048, 1
%9 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc24, %9
br i1 %cmp, label %for.body, label %for.cond25.preheader, !llvm.loop !11
for.body31: ; preds = %for.cond25.preheader, %for.body31
%j.050 = phi i32 [ %inc34, %for.body31 ], [ 0, %for.cond25.preheader ]
%putchar46 = call i32 @putchar(i32 42)
%inc34 = add nuw nsw i32 %j.050, 1
%10 = load i32, ptr @a, align 16, !tbaa !5
%cmp30 = icmp slt i32 %inc34, %10
br i1 %cmp30, label %for.body31, label %for.end35, !llvm.loop !13
for.end35: ; preds = %for.body31, %for.cond25.preheader
%putchar = call i32 @putchar(i32 10)
%call28.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 2)
%11 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%cmp3049.1 = icmp sgt i32 %11, 0
br i1 %cmp3049.1, label %for.body31.1, label %for.end35.1
for.body31.1: ; preds = %for.end35, %for.body31.1
%j.050.1 = phi i32 [ %inc34.1, %for.body31.1 ], [ 0, %for.end35 ]
%putchar46.1 = call i32 @putchar(i32 42)
%inc34.1 = add nuw nsw i32 %j.050.1, 1
%12 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
%cmp30.1 = icmp slt i32 %inc34.1, %12
br i1 %cmp30.1, label %for.body31.1, label %for.end35.1, !llvm.loop !13
for.end35.1: ; preds = %for.body31.1, %for.end35
%putchar.1 = call i32 @putchar(i32 10)
%call28.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 3)
%13 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%cmp3049.2 = icmp sgt i32 %13, 0
br i1 %cmp3049.2, label %for.body31.2, label %for.end35.2
for.body31.2: ; preds = %for.end35.1, %for.body31.2
%j.050.2 = phi i32 [ %inc34.2, %for.body31.2 ], [ 0, %for.end35.1 ]
%putchar46.2 = call i32 @putchar(i32 42)
%inc34.2 = add nuw nsw i32 %j.050.2, 1
%14 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
%cmp30.2 = icmp slt i32 %inc34.2, %14
br i1 %cmp30.2, label %for.body31.2, label %for.end35.2, !llvm.loop !13
for.end35.2: ; preds = %for.body31.2, %for.end35.1
%putchar.2 = call i32 @putchar(i32 10)
%call28.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 4)
%15 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%cmp3049.3 = icmp sgt i32 %15, 0
br i1 %cmp3049.3, label %for.body31.3, label %for.end35.3
for.body31.3: ; preds = %for.end35.2, %for.body31.3
%j.050.3 = phi i32 [ %inc34.3, %for.body31.3 ], [ 0, %for.end35.2 ]
%putchar46.3 = call i32 @putchar(i32 42)
%inc34.3 = add nuw nsw i32 %j.050.3, 1
%16 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 3), align 4, !tbaa !5
%cmp30.3 = icmp slt i32 %inc34.3, %16
br i1 %cmp30.3, label %for.body31.3, label %for.end35.3, !llvm.loop !13
for.end35.3: ; preds = %for.body31.3, %for.end35.2
%putchar.3 = call i32 @putchar(i32 10)
%call28.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 5)
%17 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%cmp3049.4 = icmp sgt i32 %17, 0
br i1 %cmp3049.4, label %for.body31.4, label %for.end35.4
for.body31.4: ; preds = %for.end35.3, %for.body31.4
%j.050.4 = phi i32 [ %inc34.4, %for.body31.4 ], [ 0, %for.end35.3 ]
%putchar46.4 = call i32 @putchar(i32 42)
%inc34.4 = add nuw nsw i32 %j.050.4, 1
%18 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 4), align 16, !tbaa !5
%cmp30.4 = icmp slt i32 %inc34.4, %18
br i1 %cmp30.4, label %for.body31.4, label %for.end35.4, !llvm.loop !13
for.end35.4: ; preds = %for.body31.4, %for.end35.3
%putchar.4 = call i32 @putchar(i32 10)
%call28.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 6)
%19 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp3049.5 = icmp sgt i32 %19, 0
br i1 %cmp3049.5, label %for.body31.5, label %for.end35.5
for.body31.5: ; preds = %for.end35.4, %for.body31.5
%j.050.5 = phi i32 [ %inc34.5, %for.body31.5 ], [ 0, %for.end35.4 ]
%putchar46.5 = call i32 @putchar(i32 42)
%inc34.5 = add nuw nsw i32 %j.050.5, 1
%20 = load i32, ptr getelementptr inbounds ([6 x i32], ptr @a, i64 0, i64 5), align 4, !tbaa !5
%cmp30.5 = icmp slt i32 %inc34.5, %20
br i1 %cmp30.5, label %for.body31.5, label %for.end35.5, !llvm.loop !13
for.end35.5: ; preds = %for.body31.5, %for.end35.4
%putchar.5 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %high) #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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include <stdio.h>
int main(void){
int n,i,j,res[7];
double a[4000];
char b='*';
res[1]=0;
res[2]=0;
res[3]=0;
res[4]=0;
res[5]=0;
res[6]=0;
scanf("%d",&n);
for(i=1;i<n+1;i++){
scanf("%lf",&a[i]);
if( a[i] < 165.0 ){
res[1]=res[1]+1;
}
else if( a[i] >= 165.0 && a[i] < 170.0 ){
res[2]=res[2]+1;
}
else if( a[i] >= 170.0 && a[i] < 175.0 ){
res[3]=res[3]+1;
}
else if( a[i] >= 175.0 && a[i] < 180.0 ){
res[4]=res[4]+1;
}
else if( a[i] >= 180.0 && a[i] < 185.0 ){
res[5]=res[5]+1;
}
else{
res[6]=res[6]+1;
}
}
for( n=1 ; n<7 ; n++ ){
printf("%d:",n);
j=1;
while( j < res[n]+1 ){
printf("%c",b);
j = j + 1;
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256222/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256222/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d:\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%res = alloca [7 x i32], align 16
%a = alloca [4000 x double], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %res) #4
call void @llvm.lifetime.start.p0(i64 32000, ptr nonnull %a) #4
%arrayidx = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 1
%arrayidx1 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 2
%arrayidx2 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 3
%arrayidx3 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 4
%arrayidx4 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 5
%arrayidx5 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not114 = icmp slt i32 %0, 1
br i1 %cmp.not114, label %for.cond68.preheader, label %for.body
for.cond68.preheader: ; preds = %for.inc, %entry
%add12113.lcssa = phi i32 [ 0, %entry ], [ %add12112, %for.inc ]
%add22111.lcssa = phi i32 [ 0, %entry ], [ %add22110, %for.inc ]
%add34109.lcssa = phi i32 [ 0, %entry ], [ %add34108, %for.inc ]
%add46107.lcssa = phi i32 [ 0, %entry ], [ %add46106, %for.inc ]
%add58105.lcssa = phi i32 [ 0, %entry ], [ %add58104, %for.inc ]
%add62103.lcssa = phi i32 [ 0, %entry ], [ %add62102, %for.inc ]
store i32 %add62103.lcssa, ptr %arrayidx5, align 8, !tbaa !5
store i32 %add58105.lcssa, ptr %arrayidx4, align 4, !tbaa !5
store i32 %add46107.lcssa, ptr %arrayidx3, align 16, !tbaa !5
store i32 %add34109.lcssa, ptr %arrayidx2, align 4, !tbaa !5
store i32 %add22111.lcssa, ptr %arrayidx1, align 8, !tbaa !5
store i32 %add12113.lcssa, ptr %arrayidx, align 4, !tbaa !5
store i32 1, ptr %n, align 4, !tbaa !5
br label %for.body70
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%add62103120 = phi i32 [ %add62102, %for.inc ], [ 0, %entry ]
%add58105119 = phi i32 [ %add58104, %for.inc ], [ 0, %entry ]
%add46107118 = phi i32 [ %add46106, %for.inc ], [ 0, %entry ]
%add34109117 = phi i32 [ %add34108, %for.inc ], [ 0, %entry ]
%add22111116 = phi i32 [ %add22110, %for.inc ], [ 0, %entry ]
%add12113115 = phi i32 [ %add12112, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [4000 x double], ptr %a, i64 0, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%1 = load double, ptr %arrayidx6, align 8, !tbaa !9
%cmp10 = fcmp olt double %1, 1.650000e+02
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %for.body
%add12 = add nsw i32 %add12113115, 1
br label %for.inc
if.else: ; preds = %for.body
%cmp16 = fcmp oge double %1, 1.650000e+02
%cmp19 = fcmp olt double %1, 1.700000e+02
%or.cond = and i1 %cmp16, %cmp19
br i1 %or.cond, label %if.then20, label %if.else24
if.then20: ; preds = %if.else
%add22 = add nsw i32 %add22111116, 1
br label %for.inc
if.else24: ; preds = %if.else
%cmp27 = fcmp oge double %1, 1.700000e+02
%cmp31 = fcmp olt double %1, 1.750000e+02
%or.cond99 = and i1 %cmp27, %cmp31
br i1 %or.cond99, label %if.then32, label %if.else36
if.then32: ; preds = %if.else24
%add34 = add nsw i32 %add34109117, 1
br label %for.inc
if.else36: ; preds = %if.else24
%cmp39 = fcmp oge double %1, 1.750000e+02
%cmp43 = fcmp olt double %1, 1.800000e+02
%or.cond100 = and i1 %cmp39, %cmp43
br i1 %or.cond100, label %if.then44, label %if.else48
if.then44: ; preds = %if.else36
%add46 = add nsw i32 %add46107118, 1
br label %for.inc
if.else48: ; preds = %if.else36
%cmp51 = fcmp oge double %1, 1.800000e+02
%cmp55 = fcmp olt double %1, 1.850000e+02
%or.cond101 = and i1 %cmp51, %cmp55
br i1 %or.cond101, label %if.then56, label %if.else60
if.then56: ; preds = %if.else48
%add58 = add nsw i32 %add58105119, 1
br label %for.inc
if.else60: ; preds = %if.else48
%add62 = add nsw i32 %add62103120, 1
br label %for.inc
for.inc: ; preds = %if.then, %if.then32, %if.then56, %if.else60, %if.then44, %if.then20
%add12112 = phi i32 [ %add12, %if.then ], [ %add12113115, %if.then32 ], [ %add12113115, %if.then56 ], [ %add12113115, %if.else60 ], [ %add12113115, %if.then44 ], [ %add12113115, %if.then20 ]
%add22110 = phi i32 [ %add22111116, %if.then ], [ %add22111116, %if.then32 ], [ %add22111116, %if.then56 ], [ %add22111116, %if.else60 ], [ %add22111116, %if.then44 ], [ %add22, %if.then20 ]
%add34108 = phi i32 [ %add34109117, %if.then ], [ %add34, %if.then32 ], [ %add34109117, %if.then56 ], [ %add34109117, %if.else60 ], [ %add34109117, %if.then44 ], [ %add34109117, %if.then20 ]
%add46106 = phi i32 [ %add46107118, %if.then ], [ %add46107118, %if.then32 ], [ %add46107118, %if.then56 ], [ %add46107118, %if.else60 ], [ %add46, %if.then44 ], [ %add46107118, %if.then20 ]
%add58104 = phi i32 [ %add58105119, %if.then ], [ %add58105119, %if.then32 ], [ %add58, %if.then56 ], [ %add58105119, %if.else60 ], [ %add58105119, %if.then44 ], [ %add58105119, %if.then20 ]
%add62102 = phi i32 [ %add62103120, %if.then ], [ %add62103120, %if.then32 ], [ %add62103120, %if.then56 ], [ %add62, %if.else60 ], [ %add62103120, %if.then44 ], [ %add62103120, %if.then20 ]
%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.cond68.preheader, !llvm.loop !11
for.body70: ; preds = %for.cond68.preheader, %while.end
%storemerge131 = phi i32 [ 1, %for.cond68.preheader ], [ %inc80, %while.end ]
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %storemerge131)
%4 = load i32, ptr %n, align 4, !tbaa !5
%idxprom72127 = sext i32 %4 to i64
%arrayidx73128 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 %idxprom72127
%5 = load i32, ptr %arrayidx73128, align 4, !tbaa !5
%cmp75.not129 = icmp slt i32 %5, 1
br i1 %cmp75.not129, label %while.end, label %while.body
while.body: ; preds = %for.body70, %while.body
%j.0130 = phi i32 [ %add77, %while.body ], [ 1, %for.body70 ]
%putchar98 = call i32 @putchar(i32 42)
%add77 = add nuw nsw i32 %j.0130, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%idxprom72 = sext i32 %6 to i64
%arrayidx73 = getelementptr inbounds [7 x i32], ptr %res, i64 0, i64 %idxprom72
%7 = load i32, ptr %arrayidx73, align 4, !tbaa !5
%cmp75.not.not = icmp slt i32 %j.0130, %7
br i1 %cmp75.not.not, label %while.body, label %while.end, !llvm.loop !13
while.end: ; preds = %while.body, %for.body70
%putchar = call i32 @putchar(i32 10)
%8 = load i32, ptr %n, align 4, !tbaa !5
%inc80 = add nsw i32 %8, 1
store i32 %inc80, ptr %n, align 4, !tbaa !5
%cmp69 = icmp slt i32 %8, 6
br i1 %cmp69, label %for.body70, label %for.end81, !llvm.loop !14
for.end81: ; preds = %while.end
call void @llvm.lifetime.end.p0(i64 32000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %res) #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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include<stdio.h>
int main(){
int i;
int n;
int a[6];
double b;
int j;
for(i = 0; i < 6; i++){
a[i] = 0;
}
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%lf", &b);
if(b < 165.0){
a[0]++;
}else if(b < 170.0){
a[1]++;
}else if(b < 175.0){
a[2]++;
}else if(b < 180.0){
a[3]++;
}else if(b < 185.0){
a[4]++;
}else{
a[5]++;
}
}
for(i = 0; i < 6; i++){
printf("%d", i + 1);
printf(":");
for(j = 0; j < a[i]; j++){
printf("*");
}
printf("\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256273/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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 %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp267 = icmp sgt i32 %0, 0
br i1 %cmp267, label %for.body3, label %for.cond37.preheader
for.cond37.preheader: ; preds = %for.inc34, %entry
%a.sroa.6.0 = phi i32 [ 0, %entry ], [ %inc1177, %for.inc34 ]
%a.sroa.9.0 = phi i32 [ 0, %entry ], [ %inc1675, %for.inc34 ]
%a.sroa.12.0 = phi i32 [ 0, %entry ], [ %inc2173, %for.inc34 ]
%a.sroa.15.0 = phi i32 [ 0, %entry ], [ %inc2671, %for.inc34 ]
%a.sroa.18.0 = phi i32 [ 0, %entry ], [ %inc2969, %for.inc34 ]
%.lcssa = phi i32 [ 0, %entry ], [ %3, %for.inc34 ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 1)
%putchar = call i32 @putchar(i32 58)
%cmp4579 = icmp sgt i32 %.lcssa, 0
br i1 %cmp4579, label %for.body46, label %for.end50
for.body3: ; preds = %entry, %for.inc34
%inc1178 = phi i32 [ %inc1177, %for.inc34 ], [ 0, %entry ]
%inc1676 = phi i32 [ %inc1675, %for.inc34 ], [ 0, %entry ]
%inc2174 = phi i32 [ %inc2173, %for.inc34 ], [ 0, %entry ]
%inc2672 = phi i32 [ %inc2671, %for.inc34 ], [ 0, %entry ]
%inc2970 = phi i32 [ %inc2969, %for.inc34 ], [ 0, %entry ]
%i.168 = phi i32 [ %inc35, %for.inc34 ], [ 0, %entry ]
%1 = phi i32 [ %3, %for.inc34 ], [ 0, %entry ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%2 = load double, ptr %b, align 8, !tbaa !9
%cmp5 = fcmp olt double %2, 1.650000e+02
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %for.body3
%inc7 = add nsw i32 %1, 1
br label %for.inc34
if.else: ; preds = %for.body3
%cmp8 = fcmp olt double %2, 1.700000e+02
br i1 %cmp8, label %if.then9, label %if.else12
if.then9: ; preds = %if.else
%inc11 = add nsw i32 %inc1178, 1
br label %for.inc34
if.else12: ; preds = %if.else
%cmp13 = fcmp olt double %2, 1.750000e+02
br i1 %cmp13, label %if.then14, label %if.else17
if.then14: ; preds = %if.else12
%inc16 = add nsw i32 %inc1676, 1
br label %for.inc34
if.else17: ; preds = %if.else12
%cmp18 = fcmp olt double %2, 1.800000e+02
br i1 %cmp18, label %if.then19, label %if.else22
if.then19: ; preds = %if.else17
%inc21 = add nsw i32 %inc2174, 1
br label %for.inc34
if.else22: ; preds = %if.else17
%cmp23 = fcmp olt double %2, 1.850000e+02
br i1 %cmp23, label %if.then24, label %if.else27
if.then24: ; preds = %if.else22
%inc26 = add nsw i32 %inc2672, 1
br label %for.inc34
if.else27: ; preds = %if.else22
%inc29 = add nsw i32 %inc2970, 1
br label %for.inc34
for.inc34: ; preds = %if.then, %if.then14, %if.then24, %if.else27, %if.then19, %if.then9
%inc1177 = phi i32 [ %inc1178, %if.then ], [ %inc1178, %if.then14 ], [ %inc1178, %if.then24 ], [ %inc1178, %if.else27 ], [ %inc1178, %if.then19 ], [ %inc11, %if.then9 ]
%inc1675 = phi i32 [ %inc1676, %if.then ], [ %inc16, %if.then14 ], [ %inc1676, %if.then24 ], [ %inc1676, %if.else27 ], [ %inc1676, %if.then19 ], [ %inc1676, %if.then9 ]
%inc2173 = phi i32 [ %inc2174, %if.then ], [ %inc2174, %if.then14 ], [ %inc2174, %if.then24 ], [ %inc2174, %if.else27 ], [ %inc21, %if.then19 ], [ %inc2174, %if.then9 ]
%inc2671 = phi i32 [ %inc2672, %if.then ], [ %inc2672, %if.then14 ], [ %inc26, %if.then24 ], [ %inc2672, %if.else27 ], [ %inc2672, %if.then19 ], [ %inc2672, %if.then9 ]
%inc2969 = phi i32 [ %inc2970, %if.then ], [ %inc2970, %if.then14 ], [ %inc2970, %if.then24 ], [ %inc29, %if.else27 ], [ %inc2970, %if.then19 ], [ %inc2970, %if.then9 ]
%3 = phi i32 [ %inc7, %if.then ], [ %1, %if.then14 ], [ %1, %if.then24 ], [ %1, %if.else27 ], [ %1, %if.then19 ], [ %1, %if.then9 ]
%inc35 = add nuw nsw i32 %i.168, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc35, %4
br i1 %cmp2, label %for.body3, label %for.cond37.preheader, !llvm.loop !11
for.body46: ; preds = %for.cond37.preheader, %for.body46
%j.080 = phi i32 [ %inc49, %for.body46 ], [ 0, %for.cond37.preheader ]
%putchar65 = call i32 @putchar(i32 42)
%inc49 = add nuw nsw i32 %j.080, 1
%exitcond.not = icmp eq i32 %inc49, %.lcssa
br i1 %exitcond.not, label %for.end50, label %for.body46, !llvm.loop !13
for.end50: ; preds = %for.body46, %for.cond37.preheader
%putchar64 = call i32 @putchar(i32 10)
%call40.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 2)
%putchar.1 = call i32 @putchar(i32 58)
%cmp4579.1 = icmp sgt i32 %a.sroa.6.0, 0
br i1 %cmp4579.1, label %for.body46.1, label %for.end50.1
for.body46.1: ; preds = %for.end50, %for.body46.1
%j.080.1 = phi i32 [ %inc49.1, %for.body46.1 ], [ 0, %for.end50 ]
%putchar65.1 = call i32 @putchar(i32 42)
%inc49.1 = add nuw nsw i32 %j.080.1, 1
%exitcond.1.not = icmp eq i32 %inc49.1, %a.sroa.6.0
br i1 %exitcond.1.not, label %for.end50.1, label %for.body46.1, !llvm.loop !13
for.end50.1: ; preds = %for.body46.1, %for.end50
%putchar64.1 = call i32 @putchar(i32 10)
%call40.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 3)
%putchar.2 = call i32 @putchar(i32 58)
%cmp4579.2 = icmp sgt i32 %a.sroa.9.0, 0
br i1 %cmp4579.2, label %for.body46.2, label %for.end50.2
for.body46.2: ; preds = %for.end50.1, %for.body46.2
%j.080.2 = phi i32 [ %inc49.2, %for.body46.2 ], [ 0, %for.end50.1 ]
%putchar65.2 = call i32 @putchar(i32 42)
%inc49.2 = add nuw nsw i32 %j.080.2, 1
%exitcond.2.not = icmp eq i32 %inc49.2, %a.sroa.9.0
br i1 %exitcond.2.not, label %for.end50.2, label %for.body46.2, !llvm.loop !13
for.end50.2: ; preds = %for.body46.2, %for.end50.1
%putchar64.2 = call i32 @putchar(i32 10)
%call40.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 4)
%putchar.3 = call i32 @putchar(i32 58)
%cmp4579.3 = icmp sgt i32 %a.sroa.12.0, 0
br i1 %cmp4579.3, label %for.body46.3, label %for.end50.3
for.body46.3: ; preds = %for.end50.2, %for.body46.3
%j.080.3 = phi i32 [ %inc49.3, %for.body46.3 ], [ 0, %for.end50.2 ]
%putchar65.3 = call i32 @putchar(i32 42)
%inc49.3 = add nuw nsw i32 %j.080.3, 1
%exitcond.3.not = icmp eq i32 %inc49.3, %a.sroa.12.0
br i1 %exitcond.3.not, label %for.end50.3, label %for.body46.3, !llvm.loop !13
for.end50.3: ; preds = %for.body46.3, %for.end50.2
%putchar64.3 = call i32 @putchar(i32 10)
%call40.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 5)
%putchar.4 = call i32 @putchar(i32 58)
%cmp4579.4 = icmp sgt i32 %a.sroa.15.0, 0
br i1 %cmp4579.4, label %for.body46.4, label %for.end50.4
for.body46.4: ; preds = %for.end50.3, %for.body46.4
%j.080.4 = phi i32 [ %inc49.4, %for.body46.4 ], [ 0, %for.end50.3 ]
%putchar65.4 = call i32 @putchar(i32 42)
%inc49.4 = add nuw nsw i32 %j.080.4, 1
%exitcond.4.not = icmp eq i32 %inc49.4, %a.sroa.15.0
br i1 %exitcond.4.not, label %for.end50.4, label %for.body46.4, !llvm.loop !13
for.end50.4: ; preds = %for.body46.4, %for.end50.3
%putchar64.4 = call i32 @putchar(i32 10)
%call40.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 6)
%putchar.5 = call i32 @putchar(i32 58)
%cmp4579.5 = icmp sgt i32 %a.sroa.18.0, 0
br i1 %cmp4579.5, label %for.body46.5, label %for.end50.5
for.body46.5: ; preds = %for.end50.4, %for.body46.5
%j.080.5 = phi i32 [ %inc49.5, %for.body46.5 ], [ 0, %for.end50.4 ]
%putchar65.5 = call i32 @putchar(i32 42)
%inc49.5 = add nuw nsw i32 %j.080.5, 1
%exitcond.5.not = icmp eq i32 %inc49.5, %a.sroa.18.0
br i1 %exitcond.5.not, label %for.end50.5, label %for.body46.5, !llvm.loop !13
for.end50.5: ; preds = %for.body46.5, %for.end50.4
%putchar64.5 = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #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 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a==3||a==5||a==7)printf("YES");
else printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256316/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256316/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, 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 willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
int a,b,c,num;
int ans;
while(t--)
{
scanf("%d%d%d",&a,&b,&c);
if(a>b)
num=2*(a-b);
else
num=2*(b-a);
if(num<a||num<b||num<c)
{
printf("-1\n");
continue;
}
if(c<num/2)
ans=c+num/2;
else if(c==num/2)
ans=num;
else
ans=c-num/2;
printf("%d\n",ans);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25641/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25641/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec34 = add nsw i32 %0, -1
store i32 %dec34, ptr %t, align 4, !tbaa !5
%tobool.not35 = icmp eq i32 %0, 0
br i1 %tobool.not35, label %while.end, label %while.body
while.body: ; preds = %entry, %while.cond.backedge
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4
%sub = sub nsw i32 %1, %2
%num.0.in = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%num.0 = shl nuw nsw i32 %num.0.in, 1
%cmp4 = icmp slt i32 %num.0, %1
%cmp5 = icmp slt i32 %num.0, %2
%or.cond = select i1 %cmp4, i1 true, i1 %cmp5
br i1 %or.cond, label %if.then8, label %lor.lhs.false6
lor.lhs.false6: ; preds = %while.body
%3 = load i32, ptr %c, align 4, !tbaa !5
%cmp7 = icmp slt i32 %num.0, %3
br i1 %cmp7, label %if.then8, label %if.end10
if.then8: ; preds = %lor.lhs.false6, %while.body
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %while.cond.backedge
while.cond.backedge: ; preds = %if.then8, %if.end10
%4 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
if.end10: ; preds = %lor.lhs.false6
%cmp11 = icmp slt i32 %3, %num.0.in
%add = add nsw i32 %3, %num.0.in
%cmp16 = icmp eq i32 %3, %num.0.in
%sub20 = sub nsw i32 %3, %num.0.in
%spec.select = select i1 %cmp16, i32 %num.0, i32 %sub20
%ans.0 = select i1 %cmp11, i32 %add, i32 %spec.select
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %ans.0)
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, 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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int x;
scanf("%d", &x);
if(x == 7 || x == 5 || x == 3){
printf("YES");
} else{
printf("NO");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256453/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256453/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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: 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, 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 willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a==7||a==5||a==3) puts("YES");
else puts("NO");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256497/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256497/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, 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 willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main()
{
int t,n=0,i,j,k;
scanf("%d",&t);
for(j=1;j<=t;j++)
{
scanf("%d",&k);
n = 0;
for(i=1;i<=k;)
{
n++;
if(n%3==0 || (n-3)%10==0) continue;
i++;
}
printf("%d\n",n);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25654/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%t = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not26 = icmp slt i32 %0, 1
br i1 %cmp.not26, label %for.end11, label %for.body
for.body: ; preds = %entry, %for.end
%j.027 = phi i32 [ %inc10, %for.end ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not21 = icmp slt i32 %1, 1
br i1 %cmp3.not21, label %for.end, label %for.body4.lr.ph
for.body4.lr.ph: ; preds = %for.body, %if.end
%cmp3.not24 = phi i1 [ %cmp3.not, %if.end ], [ false, %for.body ]
%i.0.ph23 = phi i32 [ %inc8, %if.end ], [ 1, %for.body ]
%n.0.ph22 = phi i32 [ %.us-phi, %if.end ], [ 0, %for.body ]
br i1 %cmp3.not24, label %for.body4.lr.ph.split.us, label %for.body4, !llvm.loop !9
for.body4.lr.ph.split.us: ; preds = %for.body4.lr.ph
%inc.us = add nsw i32 %n.0.ph22, 1
%rem.us = srem i32 %inc.us, 3
%cmp5.us = icmp eq i32 %rem.us, 0
br i1 %cmp5.us, label %for.end, label %lor.lhs.false.us
lor.lhs.false.us: ; preds = %for.body4.lr.ph.split.us
%sub.us = add nsw i32 %n.0.ph22, -2
%rem6.us = srem i32 %sub.us, 10
%cmp7.us = icmp eq i32 %rem6.us, 0
br i1 %cmp7.us, label %for.end, label %if.end
for.body4: ; preds = %for.body4.lr.ph, %for.body4.backedge
%n.018 = phi i32 [ %inc, %for.body4.backedge ], [ %n.0.ph22, %for.body4.lr.ph ]
%inc = add nsw i32 %n.018, 1
%rem = srem i32 %inc, 3
%cmp5 = icmp eq i32 %rem, 0
br i1 %cmp5, label %for.body4.backedge, label %lor.lhs.false
lor.lhs.false: ; preds = %for.body4
%sub = add nsw i32 %n.018, -2
%rem6 = srem i32 %sub, 10
%cmp7 = icmp eq i32 %rem6, 0
br i1 %cmp7, label %for.body4.backedge, label %if.end
for.body4.backedge: ; preds = %lor.lhs.false, %for.body4
br label %for.body4
if.end: ; preds = %lor.lhs.false, %lor.lhs.false.us
%.us-phi = phi i32 [ %inc.us, %lor.lhs.false.us ], [ %inc, %lor.lhs.false ]
%inc8 = add nuw i32 %i.0.ph23, 1
%cmp3.not = icmp sge i32 %i.0.ph23, %1
%exitcond = icmp eq i32 %i.0.ph23, %1
br i1 %exitcond, label %for.end, label %for.body4.lr.ph, !llvm.loop !9
for.end: ; preds = %if.end, %for.body4.lr.ph.split.us, %lor.lhs.false.us, %for.body
%n.0.lcssa = phi i32 [ 0, %for.body ], [ %inc.us, %lor.lhs.false.us ], [ %inc.us, %for.body4.lr.ph.split.us ], [ %.us-phi, %if.end ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.0.lcssa)
%inc10 = add nuw nsw i32 %j.027, 1
%2 = load i32, ptr %t, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %j.027, %2
br i1 %cmp.not.not, label %for.body, label %for.end11, !llvm.loop !11
for.end11: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int X;
scanf("%d", &X);
if(X==7 || X==5 || X==3){
printf("YES\n");
}
else{
printf("NO\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256583/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256583/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%X = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %X)
%0 = load i32, ptr %X, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %entry ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
int x;
while(scanf("%d",&x)!=EOF)
{
if(x==3||x==5||x==7)
printf("YES\n");
else printf("NO\n");
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256626/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256626/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not10 = icmp eq i32 %call9, -1
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %x, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %while.body
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %while.body, %switch.lookup
%str.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str, %while.body ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int a;
scanf("%d",&a);
if(a == 3 || a == 5 || a == 7){
printf("YES");
}
else{
printf("NO");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256677/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256677/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@reltable.main = private unnamed_addr constant [5 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%switch.tableidx = add i32 %0, -3
%1 = icmp ult i32 %switch.tableidx, 5
br i1 %1, label %switch.lookup, label %if.end
switch.lookup: ; preds = %entry
%2 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %2, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %if.end
if.end: ; preds = %entry, %switch.lookup
%.str.2.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @.str.2, %entry ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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 willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, 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 willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef long long ll;
int main()
{
char str[1001];
scanf("%s", str);
int len = strlen(str);
int i = 0;
int n = 0, e = 0, w = 0, s = 0;
while (str[i])
{
if (str[i] == 'N')
n++;
if (str[i] == 'S')
s++;
if (str[i] == 'E')
e++;
if (str[i] == 'W')
w++;
i++;
}
if ((n > 0 && s == 0) || (n == 0 && s > 0))
{
printf("No\n");
return (0);
}
if ((e > 0 && w == 0) || (e == 0 && w > 0))
{
printf("No\n");
return (0);
}
printf("Yes\n");
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256727/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256727/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str = private unnamed_addr constant [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:
%str = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %str) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
br label %while.cond
while.cond: ; preds = %if.end, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%n.0 = phi i32 [ %n.1, %if.end ], [ 0, %entry ]
%e.0 = phi i32 [ %e.1, %if.end ], [ 0, %entry ]
%w.0 = phi i32 [ %w.1, %if.end ], [ 0, %entry ]
%s.0 = phi i32 [ %spec.select, %if.end ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1001 x i8], ptr %str, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
switch i8 %0, label %if.end [
i8 0, label %while.end
i8 78, label %if.then
]
if.then: ; preds = %while.cond
%inc = add nsw i32 %n.0, 1
br label %if.end
if.end: ; preds = %while.cond, %if.then
%n.1 = phi i32 [ %inc, %if.then ], [ %n.0, %while.cond ]
%cmp10 = icmp eq i8 %0, 83
%inc13 = zext i1 %cmp10 to i32
%spec.select = add nuw nsw i32 %s.0, %inc13
%cmp18 = icmp eq i8 %0, 69
%inc21 = zext i1 %cmp18 to i32
%e.1 = add nuw nsw i32 %e.0, %inc21
%cmp26 = icmp eq i8 %0, 87
%inc29 = zext i1 %cmp26 to i32
%w.1 = add nuw nsw i32 %w.0, %inc29
%indvars.iv.next = add nuw i64 %indvars.iv, 1
br label %while.cond, !llvm.loop !8
while.end: ; preds = %while.cond
%cmp32 = icmp sgt i32 %n.0, 0
%cmp34 = icmp eq i32 %s.0, 0
%or.cond = select i1 %cmp32, i1 %cmp34, i1 false
br i1 %or.cond, label %cleanup, label %lor.lhs.false
lor.lhs.false: ; preds = %while.end
%cmp36 = icmp eq i32 %n.0, 0
%cmp39 = icmp ne i32 %s.0, 0
%or.cond65 = select i1 %cmp36, i1 %cmp39, i1 false
br i1 %or.cond65, label %cleanup, label %if.end43
if.end43: ; preds = %lor.lhs.false
%cmp44 = icmp ne i32 %e.0, 0
%cmp47 = icmp eq i32 %w.0, 0
%or.cond66 = select i1 %cmp44, i1 %cmp47, i1 false
br i1 %or.cond66, label %cleanup, label %lor.lhs.false49
lor.lhs.false49: ; preds = %if.end43
%cmp50 = icmp eq i32 %e.0, 0
%cmp53 = icmp ne i32 %w.0, 0
%or.cond67 = select i1 %cmp50, i1 %cmp53, i1 false
%spec.select84 = select i1 %or.cond67, ptr @str.4, ptr @str
br label %cleanup
cleanup: ; preds = %lor.lhs.false49, %if.end43, %while.end, %lor.lhs.false
%str.sink = phi ptr [ @str.4, %lor.lhs.false ], [ @str.4, %while.end ], [ @str.4, %if.end43 ], [ %spec.select84, %lor.lhs.false49 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<string.h>
char ch[200];
int main()
{
int S=0,N=0,W=0,E=0,i,s,f,g;
scanf("%s",ch);
int l=strlen(ch);
if(l==1)
printf("No\n");
else
{
for(i=0;i<l;i++)
{
if(ch[i]=='S') S++;
if(ch[i]=='E') E++;
if(ch[i]=='W') W++;
if(ch[i]=='N') N++;
}
if(S>0&&N==0||N>0&&S==0||W>0&&E==0||E>0&&W==0)
printf("No\n");
else
printf("Yes\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@ch = dso_local global [200 x i8] zeroinitializer, align 16
@str = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @ch)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @ch) #5
%conv = trunc i64 %call1 to i32
%cmp = icmp eq i32 %conv, 1
br i1 %cmp, label %if.end61, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp481 = icmp sgt i32 %conv, 0
br i1 %cmp481, label %for.body.preheader, label %if.else58
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = and i64 %call1, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader137, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call1, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi123 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi124 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
%vec.phi125 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %25, %vector.body ]
%vec.phi126 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %18, %vector.body ]
%vec.phi127 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.phi128 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%vec.phi129 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %13, %vector.body ]
%0 = getelementptr inbounds [200 x i8], ptr @ch, 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.load130 = load <4 x i8>, ptr %1, align 4, !tbaa !5
%2 = icmp eq <4 x i8> %wide.load, <i8 83, i8 83, i8 83, i8 83>
%3 = icmp eq <4 x i8> %wide.load130, <i8 83, i8 83, i8 83, i8 83>
%4 = zext <4 x i1> %2 to <4 x i32>
%5 = zext <4 x i1> %3 to <4 x i32>
%6 = add <4 x i32> %vec.phi, %4
%7 = add <4 x i32> %vec.phi123, %5
%8 = icmp eq <4 x i8> %wide.load, <i8 69, i8 69, i8 69, i8 69>
%9 = icmp eq <4 x i8> %wide.load130, <i8 69, i8 69, i8 69, i8 69>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = add <4 x i32> %vec.phi128, %10
%13 = add <4 x i32> %vec.phi129, %11
%14 = icmp eq <4 x i8> %wide.load, <i8 87, i8 87, i8 87, i8 87>
%15 = icmp eq <4 x i8> %wide.load130, <i8 87, i8 87, i8 87, i8 87>
%16 = zext <4 x i1> %14 to <4 x i32>
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = add <4 x i32> %vec.phi126, %16
%19 = add <4 x i32> %vec.phi127, %17
%20 = icmp eq <4 x i8> %wide.load, <i8 78, i8 78, i8 78, i8 78>
%21 = icmp eq <4 x i8> %wide.load130, <i8 78, i8 78, i8 78, i8 78>
%22 = zext <4 x i1> %20 to <4 x i32>
%23 = zext <4 x i1> %21 to <4 x i32>
%24 = add <4 x i32> %vec.phi124, %22
%25 = add <4 x i32> %vec.phi125, %23
%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 !8
middle.block: ; preds = %vector.body
%bin.rdx135 = add <4 x i32> %13, %12
%27 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx135)
%bin.rdx133 = add <4 x i32> %19, %18
%28 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx133)
%bin.rdx131 = add <4 x i32> %25, %24
%29 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx131)
%bin.rdx = add <4 x i32> %7, %6
%30 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader137
for.body.preheader137: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%S.086.ph = phi i32 [ 0, %for.body.preheader ], [ %30, %middle.block ]
%N.085.ph = phi i32 [ 0, %for.body.preheader ], [ %29, %middle.block ]
%W.084.ph = phi i32 [ 0, %for.body.preheader ], [ %28, %middle.block ]
%E.083.ph = phi i32 [ 0, %for.body.preheader ], [ %27, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader137, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader137 ]
%S.086 = phi i32 [ %spec.select, %for.body ], [ %S.086.ph, %for.body.preheader137 ]
%N.085 = phi i32 [ %N.1, %for.body ], [ %N.085.ph, %for.body.preheader137 ]
%W.084 = phi i32 [ %W.1, %for.body ], [ %W.084.ph, %for.body.preheader137 ]
%E.083 = phi i32 [ %E.1, %for.body ], [ %E.083.ph, %for.body.preheader137 ]
%arrayidx = getelementptr inbounds [200 x i8], ptr @ch, i64 0, i64 %indvars.iv
%31 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp7 = icmp eq i8 %31, 83
%inc = zext i1 %cmp7 to i32
%spec.select = add nuw nsw i32 %S.086, %inc
%cmp13 = icmp eq i8 %31, 69
%inc16 = zext i1 %cmp13 to i32
%E.1 = add nuw nsw i32 %E.083, %inc16
%cmp21 = icmp eq i8 %31, 87
%inc24 = zext i1 %cmp21 to i32
%W.1 = add nuw nsw i32 %W.084, %inc24
%cmp29 = icmp eq i8 %31, 78
%inc32 = zext i1 %cmp29 to i32
%N.1 = add nuw nsw i32 %N.085, %inc32
%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 !12
for.end: ; preds = %for.body, %middle.block
%spec.select.lcssa = phi i32 [ %30, %middle.block ], [ %spec.select, %for.body ]
%E.1.lcssa = phi i32 [ %27, %middle.block ], [ %E.1, %for.body ]
%W.1.lcssa = phi i32 [ %28, %middle.block ], [ %W.1, %for.body ]
%N.1.lcssa = phi i32 [ %29, %middle.block ], [ %N.1, %for.body ]
%cmp35 = icmp ne i32 %spec.select.lcssa, 0
%cmp37 = icmp eq i32 %N.1.lcssa, 0
%or.cond = select i1 %cmp35, i1 %cmp37, i1 false
br i1 %or.cond, label %if.end61, label %lor.lhs.false
lor.lhs.false: ; preds = %for.end
%cmp39 = icmp ne i32 %N.1.lcssa, 0
%cmp42 = icmp eq i32 %spec.select.lcssa, 0
%or.cond62 = and i1 %cmp39, %cmp42
br i1 %or.cond62, label %if.end61, label %lor.lhs.false44
lor.lhs.false44: ; preds = %lor.lhs.false
%cmp45 = icmp ne i32 %W.1.lcssa, 0
%cmp48 = icmp eq i32 %E.1.lcssa, 0
%or.cond63 = select i1 %cmp45, i1 %cmp48, i1 false
br i1 %or.cond63, label %if.end61, label %lor.lhs.false50
lor.lhs.false50: ; preds = %lor.lhs.false44
%cmp51 = icmp ne i32 %E.1.lcssa, 0
%cmp54 = icmp eq i32 %W.1.lcssa, 0
%or.cond64 = select i1 %cmp51, i1 %cmp54, i1 false
br i1 %or.cond64, label %if.end61, label %if.else58
if.else58: ; preds = %for.cond.preheader, %lor.lhs.false50
br label %if.end61
if.end61: ; preds = %for.end, %lor.lhs.false, %lor.lhs.false44, %lor.lhs.false50, %entry, %if.else58
%str.3.sink = phi ptr [ @str, %if.else58 ], [ @str.4, %entry ], [ @str.4, %lor.lhs.false50 ], [ @str.4, %lor.lhs.false44 ], [ @str.4, %lor.lhs.false ], [ @str.4, %for.end ]
%puts79 = tail call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
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 @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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !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>
void swap(int *a,int *b){
int t=*a;
*a=*b;
*b=t;
}
int main(void){
int a,b;
double ans;
scanf("%d %d",&a,&b);
if(a>b){
swap(&a,&b);
}
if(b-a>180){
b-=360;
}
ans=(a+b)*1.0/2;
if(ans<0){
ans+=360;
}
printf("%.1f\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256820/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256820/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%.1f\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%3 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%sub = sub nsw i32 %3, %2
%cmp1 = icmp sgt i32 %sub, 180
br i1 %cmp1, label %if.then2, label %if.end4
if.then2: ; preds = %if.end
%sub3 = add nsw i32 %3, -360
store i32 %sub3, ptr %b, align 4, !tbaa !5
br label %if.end4
if.end4: ; preds = %if.then2, %if.end
%4 = phi i32 [ %sub3, %if.then2 ], [ %3, %if.end ]
%add = add nsw i32 %4, %2
%conv = sitofp i32 %add to double
%div = fmul double %conv, 5.000000e-01
%cmp5 = fcmp olt double %div, 0.000000e+00
%add8 = fadd double %div, 3.600000e+02
%ans.0 = select i1 %cmp5, double %add8, double %div
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int i=0,j=0,z=0,m=0,n=0,Nmin=0,Nmax=0,p[200];
int gya[200],count=0,goukaku[200],max=0;
for(int o=0;o<200;o++){
goukaku[o]=0;
}
while(1){
scanf("%d %d %d",&m,&Nmin,&Nmax);
if(m==0 && Nmin==0 && Nmax==0){
break;
}
for(int o=0;o<m;o++){
p[o]=0;
gya[o]=0;
}
for(i=0;i<m;i++){
scanf("%d",&p[i]);
}
for(j=Nmin-1;j<Nmax;j++){
gya[j] = p[j] - p[j+1];
}
max=gya[Nmin-1];
goukaku[count]=Nmin-1;
for(j=Nmin;j<Nmax;j++){
if(gya[j]>=max){
max=gya[j];
goukaku[count]=j;
}
}
count++;
}
for(i=0;i<count;i++){
printf("%d\n",goukaku[i]+1);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256871/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256871/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%m = alloca i32, align 4
%Nmin = alloca i32, align 4
%Nmax = alloca i32, align 4
%p = alloca [200 x i32], align 16
%gya = alloca [200 x i32], align 16
%goukaku = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
store i32 0, ptr %m, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Nmin) #4
store i32 0, ptr %Nmin, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %Nmax) #4
store i32 0, ptr %Nmax, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %p) #4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %gya) #4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %goukaku) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %goukaku, i8 0, i64 800, i1 false), !tbaa !5
%call104 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %Nmin, ptr noundef nonnull %Nmax)
%0 = load i32, ptr %m, align 4, !tbaa !5
%cmp1105 = icmp eq i32 %0, 0
%1 = load i32, ptr %Nmin, align 4
%cmp2106 = icmp eq i32 %1, 0
%or.cond107 = select i1 %cmp1105, i1 %cmp2106, i1 false
%2 = load i32, ptr %Nmax, align 4
%cmp4108 = icmp eq i32 %2, 0
%or.cond71109 = select i1 %or.cond107, i1 %cmp4108, i1 false
br i1 %or.cond71109, label %for.end70, label %for.cond6.preheader
for.cond6.preheader: ; preds = %entry, %for.end59
%3 = phi i32 [ %40, %for.end59 ], [ %2, %entry ]
%4 = phi i32 [ %39, %for.end59 ], [ %1, %entry ]
%indvars.iv123 = phi i64 [ %indvars.iv.next124, %for.end59 ], [ 0, %entry ]
%5 = phi i32 [ %38, %for.end59 ], [ %0, %entry ]
%cmp795 = icmp sgt i32 %5, 0
br i1 %cmp795, label %for.body19.preheader, label %for.end25
for.cond61.preheader: ; preds = %for.end59
%6 = and i64 %indvars.iv.next124, 4294967295
%cmp62111.not = icmp eq i64 %6, 0
br i1 %cmp62111.not, label %for.end70, label %for.body63.preheader
for.body63.preheader: ; preds = %for.cond61.preheader
%wide.trip.count129 = and i64 %indvars.iv.next124, 4294967295
br label %for.body63
for.body19.preheader: ; preds = %for.cond6.preheader
%7 = zext i32 %5 to i64
%8 = shl nuw nsw i64 %7, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %p, i8 0, i64 %8, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 16 %gya, i8 0, i64 %8, i1 false), !tbaa !5
br label %for.body19
for.body19: ; preds = %for.body19.preheader, %for.body19
%indvars.iv = phi i64 [ 0, %for.body19.preheader ], [ %indvars.iv.next, %for.body19 ]
%arrayidx21 = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %indvars.iv
%call22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx21)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%9 = load i32, ptr %m, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp18 = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp18, label %for.body19, label %for.end25.loopexit, !llvm.loop !9
for.end25.loopexit: ; preds = %for.body19
%.pre = load i32, ptr %Nmin, align 4, !tbaa !5
%.pre131 = load i32, ptr %Nmax, align 4, !tbaa !5
br label %for.end25
for.end25: ; preds = %for.cond6.preheader, %for.end25.loopexit
%11 = phi i32 [ %.pre131, %for.end25.loopexit ], [ %3, %for.cond6.preheader ]
%12 = phi i32 [ %.pre, %for.end25.loopexit ], [ %4, %for.cond6.preheader ]
%sub = add i32 %12, -1
%cmp2799.not = icmp sgt i32 %12, %11
%.pre133 = sext i32 %sub to i64
br i1 %cmp2799.not, label %for.end38, label %for.body28.preheader
for.body28.preheader: ; preds = %for.end25
%arrayidx30.phi.trans.insert = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %.pre133
%.pre132 = load i32, ptr %arrayidx30.phi.trans.insert, align 4, !tbaa !5
%13 = sub i32 %11, %12
%14 = zext i32 %13 to i64
%15 = add nuw nsw i64 %14, 1
%min.iters.check = icmp ult i32 %13, 7
br i1 %min.iters.check, label %for.body28.preheader137, label %vector.ph
vector.ph: ; preds = %for.body28.preheader
%n.vec = and i64 %15, 8589934584
%ind.end = add nsw i64 %n.vec, %.pre133
%vector.recur.init = insertelement <4 x i32> poison, i32 %.pre132, i64 3
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load136, %vector.body ]
%offset.idx = add i64 %index, %.pre133
%16 = add nsw i64 %offset.idx, 1
%17 = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %16
%wide.load = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load136 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%20 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load136, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
%21 = sub nsw <4 x i32> %19, %wide.load
%22 = sub nsw <4 x i32> %20, %wide.load136
%23 = getelementptr inbounds [200 x i32], ptr %gya, i64 0, i64 %offset.idx
store <4 x i32> %21, ptr %23, align 4, !tbaa !5
%24 = getelementptr inbounds i32, ptr %23, i64 4
store <4 x i32> %22, ptr %24, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%25 = icmp eq i64 %index.next, %n.vec
br i1 %25, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %15, %n.vec
%vector.recur.extract = extractelement <4 x i32> %wide.load136, i64 3
br i1 %cmp.n, label %for.end38, label %for.body28.preheader137
for.body28.preheader137: ; preds = %for.body28.preheader, %middle.block
%scalar.recur.ph = phi i32 [ %vector.recur.extract, %middle.block ], [ %.pre132, %for.body28.preheader ]
%indvars.iv116.ph = phi i64 [ %ind.end, %middle.block ], [ %.pre133, %for.body28.preheader ]
br label %for.body28
for.body28: ; preds = %for.body28.preheader137, %for.body28
%scalar.recur = phi i32 [ %26, %for.body28 ], [ %scalar.recur.ph, %for.body28.preheader137 ]
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.body28 ], [ %indvars.iv116.ph, %for.body28.preheader137 ]
%indvars.iv.next117 = add nsw i64 %indvars.iv116, 1
%arrayidx32 = getelementptr inbounds [200 x i32], ptr %p, i64 0, i64 %indvars.iv.next117
%26 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%sub33 = sub nsw i32 %scalar.recur, %26
%arrayidx35 = getelementptr inbounds [200 x i32], ptr %gya, i64 0, i64 %indvars.iv116
store i32 %sub33, ptr %arrayidx35, align 4, !tbaa !5
%lftr.wideiv = trunc i64 %indvars.iv.next117 to i32
%exitcond.not = icmp eq i32 %11, %lftr.wideiv
br i1 %exitcond.not, label %for.end38, label %for.body28, !llvm.loop !14
for.end38: ; preds = %for.body28, %middle.block, %for.end25
%arrayidx41 = getelementptr inbounds [200 x i32], ptr %gya, i64 0, i64 %.pre133
%27 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%arrayidx44 = getelementptr inbounds [200 x i32], ptr %goukaku, i64 0, i64 %indvars.iv123
store i32 %sub, ptr %arrayidx44, align 4, !tbaa !5
%cmp46101 = icmp slt i32 %12, %11
br i1 %cmp46101, label %for.body47.preheader, label %for.end59
for.body47.preheader: ; preds = %for.end38
%28 = sext i32 %12 to i64
%wide.trip.count = sext i32 %11 to i64
%29 = sub nsw i64 %wide.trip.count, %28
%xtraiter = and i64 %29, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body47.prol.loopexit, label %for.body47.prol
for.body47.prol: ; preds = %for.body47.preheader
%arrayidx49.prol = getelementptr inbounds [200 x i32], ptr %gya, i64 0, i64 %28
%30 = load i32, ptr %arrayidx49.prol, align 4, !tbaa !5
%cmp50.not.prol = icmp slt i32 %30, %27
br i1 %cmp50.not.prol, label %for.inc57.prol, label %if.then51.prol
if.then51.prol: ; preds = %for.body47.prol
store i32 %12, ptr %arrayidx44, align 4, !tbaa !5
br label %for.inc57.prol
for.inc57.prol: ; preds = %if.then51.prol, %for.body47.prol
%max.1.prol = phi i32 [ %30, %if.then51.prol ], [ %27, %for.body47.prol ]
%indvars.iv.next120.prol = add nsw i64 %28, 1
br label %for.body47.prol.loopexit
for.body47.prol.loopexit: ; preds = %for.inc57.prol, %for.body47.preheader
%indvars.iv119.unr = phi i64 [ %28, %for.body47.preheader ], [ %indvars.iv.next120.prol, %for.inc57.prol ]
%max.0103.unr = phi i32 [ %27, %for.body47.preheader ], [ %max.1.prol, %for.inc57.prol ]
%31 = sub nsw i64 0, %wide.trip.count
%32 = xor i64 %28, %31
%33 = icmp eq i64 %32, -1
br i1 %33, label %for.end59, label %for.body47
for.body47: ; preds = %for.body47.prol.loopexit, %for.inc57.1
%indvars.iv119 = phi i64 [ %indvars.iv.next120.1, %for.inc57.1 ], [ %indvars.iv119.unr, %for.body47.prol.loopexit ]
%max.0103 = phi i32 [ %max.1.1, %for.inc57.1 ], [ %max.0103.unr, %for.body47.prol.loopexit ]
%arrayidx49 = getelementptr inbounds [200 x i32], ptr %gya, i64 0, i64 %indvars.iv119
%34 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%cmp50.not = icmp slt i32 %34, %max.0103
br i1 %cmp50.not, label %for.inc57, label %if.then51
if.then51: ; preds = %for.body47
%35 = trunc i64 %indvars.iv119 to i32
store i32 %35, ptr %arrayidx44, align 4, !tbaa !5
br label %for.inc57
for.inc57: ; preds = %for.body47, %if.then51
%max.1 = phi i32 [ %34, %if.then51 ], [ %max.0103, %for.body47 ]
%indvars.iv.next120 = add nsw i64 %indvars.iv119, 1
%arrayidx49.1 = getelementptr inbounds [200 x i32], ptr %gya, i64 0, i64 %indvars.iv.next120
%36 = load i32, ptr %arrayidx49.1, align 4, !tbaa !5
%cmp50.not.1 = icmp slt i32 %36, %max.1
br i1 %cmp50.not.1, label %for.inc57.1, label %if.then51.1
if.then51.1: ; preds = %for.inc57
%37 = trunc i64 %indvars.iv.next120 to i32
store i32 %37, ptr %arrayidx44, align 4, !tbaa !5
br label %for.inc57.1
for.inc57.1: ; preds = %if.then51.1, %for.inc57
%max.1.1 = phi i32 [ %36, %if.then51.1 ], [ %max.1, %for.inc57 ]
%indvars.iv.next120.1 = add nsw i64 %indvars.iv119, 2
%exitcond122.not.1 = icmp eq i64 %indvars.iv.next120.1, %wide.trip.count
br i1 %exitcond122.not.1, label %for.end59, label %for.body47, !llvm.loop !15
for.end59: ; preds = %for.body47.prol.loopexit, %for.inc57.1, %for.end38
%indvars.iv.next124 = add nuw i64 %indvars.iv123, 1
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m, ptr noundef nonnull %Nmin, ptr noundef nonnull %Nmax)
%38 = load i32, ptr %m, align 4, !tbaa !5
%cmp1 = icmp eq i32 %38, 0
%39 = load i32, ptr %Nmin, align 4
%cmp2 = icmp eq i32 %39, 0
%or.cond = select i1 %cmp1, i1 %cmp2, i1 false
%40 = load i32, ptr %Nmax, align 4
%cmp4 = icmp eq i32 %40, 0
%or.cond71 = select i1 %or.cond, i1 %cmp4, i1 false
br i1 %or.cond71, label %for.cond61.preheader, label %for.cond6.preheader
for.body63: ; preds = %for.body63.preheader, %for.body63
%indvars.iv126 = phi i64 [ 0, %for.body63.preheader ], [ %indvars.iv.next127, %for.body63 ]
%arrayidx65 = getelementptr inbounds [200 x i32], ptr %goukaku, i64 0, i64 %indvars.iv126
%41 = load i32, ptr %arrayidx65, align 4, !tbaa !5
%add66 = add nsw i32 %41, 1
%call67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add66)
%indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
%exitcond130.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count129
br i1 %exitcond130.not, label %for.end70, label %for.body63, !llvm.loop !16
for.end70: ; preds = %for.body63, %entry, %for.cond61.preheader
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %goukaku) #4
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %gya) #4
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %p) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Nmax) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Nmin) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 @__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: 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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main(void)
{
int n;
int i = 0;
int ans = 0;
int table[100000][3];
int value[100000][3];
scanf("%d",&n);
while(i<n){
scanf("%d%d%d",&table[i][0],&table[i][1],&table[i][2]);
i++;
}
value[0][0] = table[0][0];
value[0][1] = table[0][1];
value[0][2] = table[0][2];
i = 1;
while(i<n){
if(value[i-1][1] < value[i-1][2]){
value[i][0] = value[i-1][2] + table[i][0];
}else{
value[i][0] = value[i-1][1] + table[i][0];
}
if(value[i-1][0] < value[i-1][2]){
value[i][1] = value[i-1][2] + table[i][1];
}else{
value[i][1] = value[i-1][0] + table[i][1];
}
if(value[i-1][0] < value[i-1][1]){
value[i][2] = value[i-1][1] + table[i][2];
}else{
value[i][2] = value[i-1][0] + table[i][2];
}
i++;
}
i = 0;
while(i<3){
if(ans < value[n-1][i])
ans = value[n-1][i];
i++;
}
printf("%d",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%table = alloca [100000 x [3 x i32]], align 16
%value = alloca [100000 x [3 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 1200000, ptr nonnull %table) #4
call void @llvm.lifetime.start.p0(i64 1200000, ptr nonnull %value) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp183 = icmp sgt i32 %0, 0
br i1 %cmp183, label %while.body, label %while.cond123.preheader
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x [3 x i32]], ptr %table, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [100000 x [3 x i32]], ptr %table, i64 0, i64 %indvars.iv, i64 1
%arrayidx7 = getelementptr inbounds [100000 x [3 x i32]], ptr %table, i64 0, i64 %indvars.iv, i64 2
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx7)
%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 %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body
%.pre = load i32, ptr %table, align 16, !tbaa !5
%arrayidx14.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %table, i64 0, i64 1
%.pre199 = load i32, ptr %arrayidx14.phi.trans.insert, align 4, !tbaa !5
%arrayidx18.phi.trans.insert = getelementptr inbounds [3 x i32], ptr %table, i64 0, i64 2
%.pre200 = load i32, ptr %arrayidx18.phi.trans.insert, align 8, !tbaa !5
store i32 %.pre, ptr %value, align 16, !tbaa !5
%arrayidx16 = getelementptr inbounds [3 x i32], ptr %value, i64 0, i64 1
store i32 %.pre199, ptr %arrayidx16, align 4, !tbaa !5
%arrayidx20 = getelementptr inbounds [3 x i32], ptr %value, i64 0, i64 2
store i32 %.pre200, ptr %arrayidx20, align 8, !tbaa !5
%cmp22185 = icmp sgt i32 %1, 1
br i1 %cmp22185, label %while.body23.preheader, label %while.cond123.preheader
while.body23.preheader: ; preds = %while.end
%wide.trip.count = zext i32 %1 to i64
br label %while.body23
while.cond123.preheader: ; preds = %while.body23, %entry, %while.end
%.lcssa209 = phi i32 [ %1, %while.end ], [ %0, %entry ], [ %1, %while.body23 ]
%sub126 = add nsw i32 %.lcssa209, -1
%idxprom127 = sext i32 %sub126 to i64
%arrayidx130 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %idxprom127, i64 0
%3 = load i32, ptr %arrayidx130, align 4, !tbaa !5
%arrayidx130.1 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %idxprom127, i64 1
%4 = load i32, ptr %arrayidx130.1, align 4, !tbaa !5
%spec.select = call i32 @llvm.smax.i32(i32 %3, i32 %4)
%arrayidx130.2 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %idxprom127, i64 2
%5 = load i32, ptr %arrayidx130.2, align 4, !tbaa !5
%spec.select.1 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %5)
%spec.select.2 = call i32 @llvm.smax.i32(i32 %spec.select.1, i32 0)
%call141 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %spec.select.2)
call void @llvm.lifetime.end.p0(i64 1200000, ptr nonnull %value) #4
call void @llvm.lifetime.end.p0(i64 1200000, ptr nonnull %table) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
while.body23: ; preds = %while.body23.preheader, %while.body23
%6 = phi i32 [ %.pre, %while.body23.preheader ], [ %add49, %while.body23 ]
%7 = phi i32 [ %.pre200, %while.body23.preheader ], [ %add116, %while.body23 ]
%8 = phi i32 [ %.pre199, %while.body23.preheader ], [ %add82, %while.body23 ]
%indvars.iv191 = phi i64 [ 1, %while.body23.preheader ], [ %indvars.iv.next192, %while.body23 ]
%9 = add nsw i64 %indvars.iv191, -1
%arrayidx25 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %9
%arrayidx37 = getelementptr inbounds [100000 x [3 x i32]], ptr %table, i64 0, i64 %indvars.iv191
%10 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %8, i32 %7)
%add49 = add nsw i32 %10, %.
%11 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %indvars.iv191
store i32 %add49, ptr %11, align 4
%.sink211 = call i32 @llvm.smax.i32(i32 %6, i32 %7)
%arrayidx81 = getelementptr inbounds [100000 x [3 x i32]], ptr %table, i64 0, i64 %indvars.iv191, i64 1
%12 = load i32, ptr %arrayidx81, align 4, !tbaa !5
%add82 = add nsw i32 %12, %.sink211
%13 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %indvars.iv191, i64 1
store i32 %add82, ptr %13, align 4
%14 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%.sink213 = call i32 @llvm.smax.i32(i32 %14, i32 %8)
%arrayidx115 = getelementptr inbounds [100000 x [3 x i32]], ptr %table, i64 0, i64 %indvars.iv191, i64 2
%15 = load i32, ptr %arrayidx115, align 4, !tbaa !5
%add116 = add nsw i32 %15, %.sink213
%16 = getelementptr inbounds [100000 x [3 x i32]], ptr %value, i64 0, i64 %indvars.iv191, i64 2
store i32 %add116, ptr %16, align 4
%indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
%exitcond.not = icmp eq i64 %indvars.iv.next192, %wide.trip.count
br i1 %exitcond.not, label %while.cond123.preheader, label %while.body23, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
/* AUTHOR: AKASH JAIN
* EMAIL: akash19jain@gmail.com
* ID: akash19jain
* DATE: 04-02-2020 10:25:43
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x) scanf("%lld",&x)
#define SC2(x,y) scanf("%lld%lld",&x,&y)
#define SC3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x) scanf("\n%s", x)
#define SCA(a,n) for(long long i=0;i<n;i++) scanf("%lld",&a[i]);
#define PF1(x) printf("%lld\n",x)
#define PF2(x,y) printf("%lld %lld\n",x,y)
#define PF3(x,y,z) printf("%lld %lld %lld\n",x,y,z)
#define PFA(a,n) for(long long i=0;i<n;i++) printf("%lld ",a[i]); printf("\n");
#define PFN printf("\n")
#define PFS(x) printf("%s\n",x)
#define REP(i,n) for(long long i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b) for(long long i=(a);i>=(b);--i)
#define WHILE(n) while(n--)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ITOC(c) ((char)(((ll)'0')+c))
#define MID(s,e) (s+(e-s)/2)
#define SZ(a) strlen(a)
#define PI 3.1415926535897932384626433832795
#define DEB(x) printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES ll t;SC1(t);while(t--)
#define ABS(a) ((a>0)?a:-(a))
#define SWAP(a,b) ll z=a;a=b;b=z
#define SWAPC(a,b) char z=a;a=b;b=z
#define FLSH fflush(stdout)
typedef long long ll;
typedef unsigned long long ull;
const ll INF = 1<<29;
const ll MOD = 1000000007;
const ll FMOD = 998244353;
const ll MAX = 10000000005;
const ll MIN = -10000000005;
#define FILEIO(name) \ freopen(name".in", "r", stdin); \ freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool ispoweroftwo(long long n);
bool isvowel(char x);
ll chartoint(char ch);
ll CEIL(ll x,ll y);
ll FLOOR(ll x,ll y);
int main()
{
ll n;
SC1(n);
ll dp[n+1][3];
MEM(dp,0);
REP(i,n)
{
ll a,b,c;
SC3(a,b,c);
dp[i+1][0]=maxv(dp[i][1],dp[i][2])+a;
dp[i+1][1]=maxv(dp[i][0],dp[i][2])+b;
dp[i+1][2]=maxv(dp[i][1],dp[i][0])+c;
}
ll ans=maxv(dp[n][0],dp[n][1]);
ans=maxv(ans,dp[n][2]);
PF1(ans);
return 0;
}
//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
if( *(ll*)a - *(ll*)b < 0 ) return -1;
if( *(ll*)a - *(ll*)b > 0 ) return 1;
return 0;
}
long long maxv(long long a,long long b)
{
if(a>b) return a;
return b;
}
long long minv(long long a,long long b)
{
if(a<b) return a;
return b;
}
long long gcd(long long u,long long v)
{
if (v == 0) return u;
return gcd(v, u%v);
}
long long digits(long long n) //to calculate no of digits in a number
{
return floor(log10(n))+1;
}
bool ispoweroftwo(long long x)
{
return x && (!(x&(x-1)));
}
bool isvowel(char x)
{
return(x=='a' || x== 'e' ||x=='i' || x== 'o' || x=='u' );
}
ll chartoint(char ch)
{
if(ch>='A' && ch<='Z') return(ch-'A');
else if(ch>='0' && ch<='9') return (ch-'0');
else if(ch>='a' && ch<='z') return (ch-'a');
else return 0;
}
ll CEIL(ll x,ll y)
{
if(x%y==0) return(x/y);
else return(x/y +1);
}
ll FLOOR(ll x,ll y)
{
if(x%y==0) return(x/y);
else return(x/y -1);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_256958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_256958/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@INF = dso_local local_unnamed_addr constant i64 536870912, align 8
@MOD = dso_local local_unnamed_addr constant i64 1000000007, align 8
@FMOD = dso_local local_unnamed_addr constant i64 998244353, align 8
@MAX = dso_local local_unnamed_addr constant i64 10000000005, align 8
@MIN = dso_local local_unnamed_addr constant i64 -10000000005, align 8
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #13
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%add = add nsw i64 %0, 1
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca [3 x i64], i64 %add, align 16
%2 = mul nuw i64 %add, 24
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %2, i1 false)
%3 = load i64, ptr %n, align 8, !tbaa !5
%cmp52 = icmp sgt i64 %3, 0
br i1 %cmp52, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%.lcssa = phi i64 [ %3, %entry ], [ %13, %for.body ]
%arrayidx28 = getelementptr inbounds [3 x i64], ptr %vla, i64 %.lcssa
%4 = load i64, ptr %arrayidx28, align 8, !tbaa !5
%arrayidx31 = getelementptr inbounds [3 x i64], ptr %vla, i64 %.lcssa, i64 1
%5 = load i64, ptr %arrayidx31, align 8, !tbaa !5
%a.b.i = call i64 @llvm.smax.i64(i64 %4, i64 %5)
%arrayidx34 = getelementptr inbounds [3 x i64], ptr %vla, i64 %.lcssa, i64 2
%6 = load i64, ptr %arrayidx34, align 8, !tbaa !5
%a.b.i48 = call i64 @llvm.smax.i64(i64 %a.b.i, i64 %6)
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %a.b.i48)
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #13
ret i32 0
for.body: ; preds = %entry, %for.body
%i.053 = phi i64 [ %add7, %for.body ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #13
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #13
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #13
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%arrayidx = getelementptr inbounds [3 x i64], ptr %vla, i64 %i.053
%arrayidx2 = getelementptr inbounds [3 x i64], ptr %vla, i64 %i.053, i64 1
%7 = load i64, ptr %arrayidx2, align 8, !tbaa !5
%arrayidx4 = getelementptr inbounds [3 x i64], ptr %vla, i64 %i.053, i64 2
%8 = load i64, ptr %arrayidx4, align 8, !tbaa !5
%a.b.i49 = call i64 @llvm.smax.i64(i64 %7, i64 %8)
%9 = load i64, ptr %a, align 8, !tbaa !5
%add6 = add nsw i64 %a.b.i49, %9
%add7 = add nuw nsw i64 %i.053, 1
%arrayidx8 = getelementptr inbounds [3 x i64], ptr %vla, i64 %add7
store i64 %add6, ptr %arrayidx8, align 8, !tbaa !5
%10 = load i64, ptr %arrayidx, align 8, !tbaa !5
%a.b.i50 = call i64 @llvm.smax.i64(i64 %10, i64 %8)
%11 = load i64, ptr %b, align 8, !tbaa !5
%add15 = add nsw i64 %a.b.i50, %11
%arrayidx18 = getelementptr inbounds [3 x i64], ptr %vla, i64 %add7, i64 1
store i64 %add15, ptr %arrayidx18, align 8, !tbaa !5
%a.b.i51 = call i64 @llvm.smax.i64(i64 %7, i64 %10)
%12 = load i64, ptr %c, align 8, !tbaa !5
%add24 = add nsw i64 %12, %a.b.i51
%arrayidx27 = getelementptr inbounds [3 x i64], ptr %vla, i64 %add7, i64 2
store i64 %add24, ptr %arrayidx27, align 8, !tbaa !5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %c) #13
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #13
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #13
%13 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %add7, %13
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @maxv(i64 noundef %a, i64 noundef %b) local_unnamed_addr #5 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
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
%cmp2.not = icmp ne i64 %0, %1
%. = zext i1 %cmp2.not to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @minv(i64 noundef %a, i64 noundef %b) local_unnamed_addr #5 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %u, i64 noundef %v) local_unnamed_addr #7 {
entry:
%cmp4 = icmp eq i64 %v, 0
br i1 %cmp4, label %return, label %if.end
if.end: ; preds = %entry, %if.end
%v.tr6 = phi i64 [ %rem, %if.end ], [ %v, %entry ]
%u.tr5 = phi i64 [ %v.tr6, %if.end ], [ %u, %entry ]
%rem = srem i64 %u.tr5, %v.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.end
return: ; preds = %if.end, %entry
%u.tr.lcssa = phi i64 [ %u, %entry ], [ %v.tr6, %if.end ]
ret i64 %u.tr.lcssa
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write) uwtable
define dso_local i64 @digits(i64 noundef %n) local_unnamed_addr #8 {
entry:
%conv = sitofp i64 %n to double
%call = tail call double @log10(double noundef %conv) #13
%0 = tail call double @llvm.floor.f64(double %call)
%add = fadd double %0, 1.000000e+00
%conv1 = fptosi double %add to i64
ret i64 %conv1
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log10(double noundef) local_unnamed_addr #9
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #10
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @ispoweroftwo(i64 noundef %x) local_unnamed_addr #5 {
entry:
%tobool.not = icmp eq i64 %x, 0
br i1 %tobool.not, label %land.end, label %land.rhs
land.rhs: ; preds = %entry
%0 = tail call i64 @llvm.ctpop.i64(i64 %x), !range !11
%tobool1.not = icmp ult i64 %0, 2
br label %land.end
land.end: ; preds = %land.rhs, %entry
%1 = phi i1 [ false, %entry ], [ %tobool1.not, %land.rhs ]
ret i1 %1
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isvowel(i8 noundef signext %x) local_unnamed_addr #5 {
entry:
%0 = add i8 %x, -97
%1 = tail call i8 @llvm.fshl.i8(i8 %0, i8 %0, i8 7)
%2 = icmp ult i8 %1, 11
%switch.cast = zext i8 %1 to i11
%switch.downshift = lshr i11 -875, %switch.cast
%3 = and i11 %switch.downshift, 1
%switch.masked = icmp ne i11 %3, 0
%4 = select i1 %2, i1 %switch.masked, i1 false
ret i1 %4
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @chartoint(i8 noundef signext %ch) local_unnamed_addr #11 {
entry:
%conv = sext i8 %ch to i32
%0 = add i8 %ch, -65
%or.cond = icmp ult i8 %0, 26
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %entry
%sub = add nsw i32 %conv, -65
br label %return
if.else: ; preds = %entry
%1 = add i8 %ch, -48
%or.cond31 = icmp ult i8 %1, 10
br i1 %or.cond31, label %if.then14, label %if.else18
if.then14: ; preds = %if.else
%sub16 = add nsw i32 %conv, -48
br label %return
if.else18: ; preds = %if.else
%2 = add i8 %ch, -97
%or.cond32 = icmp ult i8 %2, 26
%sub28 = add nsw i32 %conv, -97
%spec.select = select i1 %or.cond32, i32 %sub28, i32 0
br label %return
return: ; preds = %if.else18, %if.then14, %if.then
%retval.0.shrunk = phi i32 [ %sub, %if.then ], [ %sub16, %if.then14 ], [ %spec.select, %if.else18 ]
%retval.0 = zext i32 %retval.0.shrunk to i64
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @CEIL(i64 noundef %x, i64 noundef %y) local_unnamed_addr #11 {
entry:
%rem = srem i64 %x, %y
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %x, %y
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @FLOOR(i64 noundef %x, i64 noundef %y) local_unnamed_addr #11 {
entry:
%rem = srem i64 %x, %y
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %x, %y
%sub = sext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %sub
ret i64 %retval.0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.ctpop.i64(i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #12
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.fshl.i8(i8, i8, i8) #12
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 #9 = { 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 #10 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #13 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !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 = !{i64 0, i64 65}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct word_s {
char word[21];
long long int cost;
int ind;
};
int compare(const void *a, const void *b) {
const struct word_s *as = a;
const struct word_s *bs = b;
return strcmp(as->word, bs->word);
}
int main(void) {
long long int n, k, m;
scanf("%lld%lld%lld", &n, &k, &m);
struct word_s words[n];
for (int i = 0; i < n; i++) {
scanf("%s", words[i].word);
words[i].ind = i;
}
for (int i = 0; i < n; i++) {
scanf("%lld", &words[i].cost);
}
int group_tmp[n];
for (int gid = 0; gid < k; gid++) {
long long int x;
scanf("%lld", &x);
long long int min = -1;
for (int i = 0; i < x; i++) {
scanf("%d", &group_tmp[i]);
group_tmp[i]--;
long long int cost = words[group_tmp[i]].cost;
if (min < 0 || cost < min) {
min = cost;
}
}
for (int i = 0; i < x; i++) {
words[group_tmp[i]].cost = min;
}
}
qsort(words, n, sizeof(words[0]), compare);
char tmp[21];
long long int cur = 0;
for (int i = 0; i < m; i++) {
scanf("%s", tmp);
struct word_s *wd = bsearch(tmp, words, n, sizeof(words[0]), compare);
cur += wd->cost;
}
printf("%lld\n", cur);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25700/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25700/source.c"
target datalayout = "e-m:e-p270: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.word_s = type { [21 x i8], i64, i32 }
@.str = private unnamed_addr constant [13 x i8] c"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #8
ret i32 %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 memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i64, align 8
%k = alloca i64, align 8
%m = alloca i64, align 8
%x = alloca i64, align 8
%tmp = alloca [21 x i8], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #9
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k, ptr noundef nonnull %m)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca %struct.word_s, i64 %0, align 16
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp105 = icmp sgt i64 %2, 0
br i1 %cmp105, label %for.body, label %for.cond.cleanup10
for.cond6.preheader: ; preds = %for.body
%cmp8108 = icmp sgt i64 %4, 0
br i1 %cmp8108, label %for.body11, label %for.cond.cleanup10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds %struct.word_s, ptr %vla, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%ind = getelementptr inbounds %struct.word_s, ptr %vla, i64 %indvars.iv, i32 2
%3 = trunc i64 %indvars.iv to i32
store i32 %3, ptr %ind, align 8, !tbaa !9
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp sgt i64 %4, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !12
for.cond.cleanup10: ; preds = %for.body11, %entry, %for.cond6.preheader
%.lcssa104 = phi i64 [ %4, %for.cond6.preheader ], [ %2, %entry ], [ %6, %for.body11 ]
%vla18 = alloca i32, i64 %.lcssa104, align 16
%5 = load i64, ptr %k, align 8, !tbaa !5
%cmp21120 = icmp sgt i64 %5, 0
br i1 %cmp21120, label %for.body24, label %for.cond.cleanup23
for.body11: ; preds = %for.cond6.preheader, %for.body11
%indvars.iv129 = phi i64 [ %indvars.iv.next130, %for.body11 ], [ 0, %for.cond6.preheader ]
%cost = getelementptr inbounds %struct.word_s, ptr %vla, i64 %indvars.iv129, i32 1
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %cost)
%indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
%6 = load i64, ptr %n, align 8, !tbaa !5
%cmp8 = icmp sgt i64 %6, %indvars.iv.next130
br i1 %cmp8, label %for.body11, label %for.cond.cleanup10, !llvm.loop !14
for.cond.cleanup23.loopexit: ; preds = %for.cond.cleanup56
%.pre = load i64, ptr %n, align 8, !tbaa !5
br label %for.cond.cleanup23
for.cond.cleanup23: ; preds = %for.cond.cleanup23.loopexit, %for.cond.cleanup10
%7 = phi i64 [ %.pre, %for.cond.cleanup23.loopexit ], [ %.lcssa104, %for.cond.cleanup10 ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %7, i64 noundef 40, ptr noundef nonnull @compare) #9
call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %tmp) #9
%8 = load i64, ptr %m, align 8, !tbaa !5
%cmp72122 = icmp sgt i64 %8, 0
br i1 %cmp72122, label %for.body75, label %for.cond.cleanup74
for.body24: ; preds = %for.cond.cleanup10, %for.cond.cleanup56
%indvars.iv138 = phi i64 [ %indvars.iv.next139, %for.cond.cleanup56 ], [ 0, %for.cond.cleanup10 ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #9
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %x)
%9 = load i64, ptr %x, align 8, !tbaa !5
%cmp29111 = icmp sgt i64 %9, 0
br i1 %cmp29111, label %for.body32, label %for.cond.cleanup56
for.cond52.preheader: ; preds = %for.body32
%cmp54117 = icmp sgt i64 %13, 0
br i1 %cmp54117, label %for.body57.preheader, label %for.cond.cleanup56
for.body57.preheader: ; preds = %for.cond52.preheader
%xtraiter = and i64 %13, 3
%10 = icmp ult i64 %13, 4
br i1 %10, label %for.cond.cleanup56.loopexit.unr-lcssa, label %for.body57.preheader.new
for.body57.preheader.new: ; preds = %for.body57.preheader
%unroll_iter = and i64 %13, -4
br label %for.body57
for.body32: ; preds = %for.body24, %for.body32
%indvars.iv132 = phi i64 [ %indvars.iv.next133, %for.body32 ], [ 0, %for.body24 ]
%min.0112 = phi i64 [ %min.1, %for.body32 ], [ -1, %for.body24 ]
%arrayidx34 = getelementptr inbounds i32, ptr %vla18, i64 %indvars.iv132
%call35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx34)
%11 = load i32, ptr %arrayidx34, align 4, !tbaa !15
%dec = add nsw i32 %11, -1
store i32 %dec, ptr %arrayidx34, align 4, !tbaa !15
%idxprom41 = sext i32 %dec to i64
%cost43 = getelementptr inbounds %struct.word_s, ptr %vla, i64 %idxprom41, i32 1
%12 = load i64, ptr %cost43, align 8, !tbaa !16
%cmp44 = icmp slt i64 %min.0112, 0
%cmp46 = icmp slt i64 %12, %min.0112
%or.cond = select i1 %cmp44, i1 true, i1 %cmp46
%min.1 = select i1 %or.cond, i64 %12, i64 %min.0112
%indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
%13 = load i64, ptr %x, align 8, !tbaa !5
%cmp29 = icmp sgt i64 %13, %indvars.iv.next133
br i1 %cmp29, label %for.body32, label %for.cond52.preheader, !llvm.loop !17
for.cond.cleanup56.loopexit.unr-lcssa: ; preds = %for.body57, %for.body57.preheader
%indvars.iv135.unr = phi i64 [ 0, %for.body57.preheader ], [ %indvars.iv.next136.3, %for.body57 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup56, label %for.body57.epil
for.body57.epil: ; preds = %for.cond.cleanup56.loopexit.unr-lcssa, %for.body57.epil
%indvars.iv135.epil = phi i64 [ %indvars.iv.next136.epil, %for.body57.epil ], [ %indvars.iv135.unr, %for.cond.cleanup56.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body57.epil ], [ 0, %for.cond.cleanup56.loopexit.unr-lcssa ]
%arrayidx59.epil = getelementptr inbounds i32, ptr %vla18, i64 %indvars.iv135.epil
%14 = load i32, ptr %arrayidx59.epil, align 4, !tbaa !15
%idxprom60.epil = sext i32 %14 to i64
%cost62.epil = getelementptr inbounds %struct.word_s, ptr %vla, i64 %idxprom60.epil, i32 1
store i64 %min.1, ptr %cost62.epil, align 8, !tbaa !16
%indvars.iv.next136.epil = add nuw nsw i64 %indvars.iv135.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.cond.cleanup56, label %for.body57.epil, !llvm.loop !18
for.cond.cleanup56: ; preds = %for.cond.cleanup56.loopexit.unr-lcssa, %for.body57.epil, %for.body24, %for.cond52.preheader
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #9
%indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
%15 = load i64, ptr %k, align 8, !tbaa !5
%cmp21 = icmp sgt i64 %15, %indvars.iv.next139
br i1 %cmp21, label %for.body24, label %for.cond.cleanup23.loopexit, !llvm.loop !20
for.body57: ; preds = %for.body57, %for.body57.preheader.new
%indvars.iv135 = phi i64 [ 0, %for.body57.preheader.new ], [ %indvars.iv.next136.3, %for.body57 ]
%niter = phi i64 [ 0, %for.body57.preheader.new ], [ %niter.next.3, %for.body57 ]
%arrayidx59 = getelementptr inbounds i32, ptr %vla18, i64 %indvars.iv135
%16 = load i32, ptr %arrayidx59, align 16, !tbaa !15
%idxprom60 = sext i32 %16 to i64
%cost62 = getelementptr inbounds %struct.word_s, ptr %vla, i64 %idxprom60, i32 1
store i64 %min.1, ptr %cost62, align 8, !tbaa !16
%indvars.iv.next136 = or i64 %indvars.iv135, 1
%arrayidx59.1 = getelementptr inbounds i32, ptr %vla18, i64 %indvars.iv.next136
%17 = load i32, ptr %arrayidx59.1, align 4, !tbaa !15
%idxprom60.1 = sext i32 %17 to i64
%cost62.1 = getelementptr inbounds %struct.word_s, ptr %vla, i64 %idxprom60.1, i32 1
store i64 %min.1, ptr %cost62.1, align 8, !tbaa !16
%indvars.iv.next136.1 = or i64 %indvars.iv135, 2
%arrayidx59.2 = getelementptr inbounds i32, ptr %vla18, i64 %indvars.iv.next136.1
%18 = load i32, ptr %arrayidx59.2, align 8, !tbaa !15
%idxprom60.2 = sext i32 %18 to i64
%cost62.2 = getelementptr inbounds %struct.word_s, ptr %vla, i64 %idxprom60.2, i32 1
store i64 %min.1, ptr %cost62.2, align 8, !tbaa !16
%indvars.iv.next136.2 = or i64 %indvars.iv135, 3
%arrayidx59.3 = getelementptr inbounds i32, ptr %vla18, i64 %indvars.iv.next136.2
%19 = load i32, ptr %arrayidx59.3, align 4, !tbaa !15
%idxprom60.3 = sext i32 %19 to i64
%cost62.3 = getelementptr inbounds %struct.word_s, ptr %vla, i64 %idxprom60.3, i32 1
store i64 %min.1, ptr %cost62.3, align 8, !tbaa !16
%indvars.iv.next136.3 = add nuw nsw i64 %indvars.iv135, 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.cond.cleanup56.loopexit.unr-lcssa, label %for.body57, !llvm.loop !21
for.cond.cleanup74: ; preds = %bsearch.exit, %for.cond.cleanup23
%cur.0.lcssa = phi i64 [ 0, %for.cond.cleanup23 ], [ %add, %bsearch.exit ]
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %cur.0.lcssa)
call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %tmp) #9
call void @llvm.stackrestore.p0(ptr %1)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #9
ret i32 0
for.body75: ; preds = %for.cond.cleanup23, %bsearch.exit
%indvars.iv141 = phi i64 [ %indvars.iv.next142, %bsearch.exit ], [ 0, %for.cond.cleanup23 ]
%cur.0123 = phi i64 [ %add, %bsearch.exit ], [ 0, %for.cond.cleanup23 ]
%call77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tmp)
%20 = load i64, ptr %n, align 8, !tbaa !5
%cmp18.not.i = icmp ne i64 %20, 0
br label %while.body.i
while.body.i: ; preds = %if.end6.i, %for.body75
%cmp.i.sink = phi i1 [ %cmp.i, %if.end6.i ], [ %cmp18.not.i, %for.body75 ]
%__l.020.i = phi i64 [ %__l.1.i, %if.end6.i ], [ 0, %for.body75 ]
%__u.019.i = phi i64 [ %__u.1.i, %if.end6.i ], [ %20, %for.body75 ]
call void @llvm.assume(i1 %cmp.i.sink)
%add.i = add i64 %__u.019.i, %__l.020.i
%div17.i = lshr i64 %add.i, 1
%mul.i = mul i64 %div17.i, 40
%add.ptr.i = getelementptr inbounds i8, ptr %vla, i64 %mul.i
%call.i103 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %tmp, ptr noundef nonnull dereferenceable(1) %add.ptr.i) #8
%cmp1.i = icmp slt i32 %call.i103, 0
br i1 %cmp1.i, label %if.end6.i, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp2.not.i = icmp eq i32 %call.i103, 0
br i1 %cmp2.not.i, label %bsearch.exit, label %if.then3.i
if.then3.i: ; preds = %if.else.i
%add4.i = add nuw i64 %div17.i, 1
br label %if.end6.i
if.end6.i: ; preds = %if.then3.i, %while.body.i
%__u.1.i = phi i64 [ %__u.019.i, %if.then3.i ], [ %div17.i, %while.body.i ]
%__l.1.i = phi i64 [ %add4.i, %if.then3.i ], [ %__l.020.i, %while.body.i ]
%cmp.i = icmp ult i64 %__l.1.i, %__u.1.i
br label %while.body.i
bsearch.exit: ; preds = %if.else.i
%cost80 = getelementptr inbounds %struct.word_s, ptr %add.ptr.i, i64 0, i32 1
%21 = load i64, ptr %cost80, align 8, !tbaa !16
%add = add nsw i64 %21, %cur.0123
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%22 = load i64, ptr %m, align 8, !tbaa !5
%cmp72 = icmp sgt i64 %22, %indvars.iv.next142
br i1 %cmp72, label %for.body75, label %for.cond.cleanup74, !llvm.loop !22
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #7
attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
attributes #8 = { nounwind willreturn memory(read) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 32}
!10 = !{!"word_s", !7, i64 0, !6, i64 24, !11, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !6, i64 24}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
|
#include <stdio.h>
#define Max(a,b) (a>b?a:b)
#define T 3
#define Bignum 114514
int ThreeMax(int a,int b,int c){
int max = Max(a,b);
max = Max(max,c);
return max;
}
int main(void){
int n;
scanf("%d",&n);
int hap[Bignum][T],dp[Bignum][T];
for(int i=0;i<Bignum;i++)
{
for(int j=0;j<T;j++)
{
hap[i][j] = dp[i][j] = 0;
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<T;j++)
{
scanf("%d",&hap[i][j]);
}
}
for(int i=0;i<n;i++)
{
if(!i)
{
for(int j=0;j<T;j++)
{
dp[i][j] = hap[i][j];
}
continue;
}
for(int j=0;j<T;j++)
{
dp[i][j]=Max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+hap[i][j];
}
}
int maxhap = ThreeMax(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
printf("%d\n",maxhap);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257050/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ThreeMax(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%cond5 = tail call i32 @llvm.smax.i32(i32 %cond, i32 %c)
ret i32 %cond5
}
; 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
%hap = alloca [114514 x [3 x i32]], align 16
%dp = alloca [114514 x [3 x i32]], align 16
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)
call void @llvm.lifetime.start.p0(i64 1374168, ptr nonnull %hap) #7
call void @llvm.lifetime.start.p0(i64 1374168, ptr nonnull %dp) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1374168) %dp, i8 0, i64 1374168, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1374168) %hap, i8 0, i64 1374168, i1 false), !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16153 = icmp sgt i32 %0, 0
br i1 %cmp16153, label %for.cond20.preheader, label %for.cond.cleanup38
for.cond20.preheader: ; preds = %entry, %for.cond20.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond20.preheader ], [ 0, %entry ]
%arrayidx27 = getelementptr inbounds [114514 x [3 x i32]], ptr %hap, i64 0, i64 %indvars.iv, i64 0
%call28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx27)
%arrayidx27.1 = getelementptr inbounds [114514 x [3 x i32]], ptr %hap, i64 0, i64 %indvars.iv, i64 1
%call28.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx27.1)
%arrayidx27.2 = getelementptr inbounds [114514 x [3 x i32]], ptr %hap, i64 0, i64 %indvars.iv, i64 2
%call28.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx27.2)
%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
%cmp16 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp16, label %for.cond20.preheader, label %for.cond36.preheader, !llvm.loop !9
for.cond36.preheader: ; preds = %for.cond20.preheader
%cmp37157 = icmp sgt i32 %1, 0
br i1 %cmp37157, label %for.inc99.peel, label %for.cond.cleanup38
for.inc99.peel: ; preds = %for.cond36.preheader
%wide.trip.count = zext i32 %1 to i64
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) %dp, ptr noundef nonnull align 16 dereferenceable(12) %hap, i64 12, i1 false), !tbaa !5
%exitcond.peel.not = icmp eq i32 %1, 1
br i1 %exitcond.peel.not, label %for.cond.cleanup38, label %for.inc99
for.cond.cleanup38: ; preds = %for.inc99, %entry, %for.inc99.peel, %for.cond36.preheader
%.lcssa181 = phi i32 [ %1, %for.cond36.preheader ], [ 1, %for.inc99.peel ], [ %0, %entry ], [ %1, %for.inc99 ]
%sub102 = add nsw i32 %.lcssa181, -1
%idxprom103 = sext i32 %sub102 to i64
%arrayidx104 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %idxprom103
%3 = load i32, ptr %arrayidx104, align 4, !tbaa !5
%arrayidx109 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %idxprom103, i64 1
%4 = load i32, ptr %arrayidx109, align 4, !tbaa !5
%arrayidx113 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %idxprom103, i64 2
%5 = load i32, ptr %arrayidx113, align 4, !tbaa !5
%cond.i = call i32 @llvm.smax.i32(i32 %3, i32 %4)
%cond5.i = call i32 @llvm.smax.i32(i32 %cond.i, i32 %5)
%call115 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cond5.i)
call void @llvm.lifetime.end.p0(i64 1374168, ptr nonnull %dp) #7
call void @llvm.lifetime.end.p0(i64 1374168, ptr nonnull %hap) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.inc99: ; preds = %for.inc99.peel, %for.inc99
%indvars.iv174 = phi i64 [ %indvars.iv.next175, %for.inc99 ], [ 1, %for.inc99.peel ]
%6 = add nsw i64 %indvars.iv174, -1
%arrayidx64 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %6, i64 1
%7 = load i32, ptr %arrayidx64, align 4, !tbaa !5
%arrayidx71 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %6, i64 2
%8 = load i32, ptr %arrayidx71, align 4, !tbaa !5
%. = call i32 @llvm.smax.i32(i32 %7, i32 %8)
%arrayidx90 = getelementptr inbounds [114514 x [3 x i32]], ptr %hap, i64 0, i64 %indvars.iv174, i64 0
%9 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%add91 = add nsw i32 %., %9
%arrayidx95 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %indvars.iv174, i64 0
store i32 %add91, ptr %arrayidx95, align 4, !tbaa !5
%arrayidx71.1 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %6, i64 0
%10 = load i32, ptr %arrayidx71.1, align 4, !tbaa !5
%..1 = call i32 @llvm.smax.i32(i32 %8, i32 %10)
%arrayidx90.1 = getelementptr inbounds [114514 x [3 x i32]], ptr %hap, i64 0, i64 %indvars.iv174, i64 1
%11 = load i32, ptr %arrayidx90.1, align 4, !tbaa !5
%add91.1 = add nsw i32 %..1, %11
%arrayidx95.1 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %indvars.iv174, i64 1
store i32 %add91.1, ptr %arrayidx95.1, align 4, !tbaa !5
%..2 = call i32 @llvm.smax.i32(i32 %10, i32 %7)
%arrayidx90.2 = getelementptr inbounds [114514 x [3 x i32]], ptr %hap, i64 0, i64 %indvars.iv174, i64 2
%12 = load i32, ptr %arrayidx90.2, align 4, !tbaa !5
%add91.2 = add nsw i32 %..2, %12
%arrayidx95.2 = getelementptr inbounds [114514 x [3 x i32]], ptr %dp, i64 0, i64 %indvars.iv174, i64 2
store i32 %add91.2, ptr %arrayidx95.2, align 4, !tbaa !5
%indvars.iv.next175 = add nuw nsw i64 %indvars.iv174, 1
%exitcond.not = icmp eq i64 %indvars.iv.next175, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup38, label %for.inc99, !llvm.loop !11
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree 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 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 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
char s[5];
scanf("%s", s);
int A = s[0] - '0', B = s[1] - '0', C = s[2] - '0', D = s[3] - '0';
int sgn, b, c, d;
for (sgn = 0; sgn <= 7; sgn++) {
b = (sgn / 4) * 2 - 1;
c = ((sgn / 2) % 2) * 2 - 1;
d = (sgn % 2) * 2 - 1;
if (A + B * b + C * c + D * d == 7) {
printf("%d", A);
if (b == 1) printf("+%d", B);
else printf("-%d", B);
if (c == 1) printf("+%d", C);
else printf("-%d", C);
if (d == 1) printf("+%d=7", D);
else printf("-%d=7", D);
break;
}
}
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257100/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257100/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"+%d\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"-%d\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"+%d=7\00", align 1
@.str.5 = private unnamed_addr constant [6 x i8] c"-%d=7\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:
%s = alloca [5 x i8], align 1
call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%sub = add nsw i32 %conv, -48
%arrayidx1 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 1
%1 = load i8, ptr %arrayidx1, align 1, !tbaa !5
%conv2 = sext i8 %1 to i32
%sub3 = add nsw i32 %conv2, -48
%arrayidx4 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 2
%2 = load i8, ptr %arrayidx4, align 1, !tbaa !5
%conv5 = sext i8 %2 to i32
%sub6 = add nsw i32 %conv5, -48
%arrayidx7 = getelementptr inbounds [5 x i8], ptr %s, i64 0, i64 3
%3 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%conv8 = sext i8 %3 to i32
%sub9 = add nsw i32 %conv8, -48
%mul18 = sub nsw i32 48, %conv2
%mul21 = sub nsw i32 48, %conv8
%4 = sub nsw i32 %conv, %conv5
%add20 = add nsw i32 %4, %mul18
%add22 = add nsw i32 %add20, %mul21
%cmp23 = icmp eq i32 %add22, 7
br i1 %cmp23, label %if.else, label %for.cond
for.cond: ; preds = %entry
%add22.1 = add nsw i32 %add20, %sub9
%cmp23.1 = icmp eq i32 %add22.1, 7
br i1 %cmp23.1, label %if.else, label %for.cond.1
for.cond.1: ; preds = %for.cond
%add.2 = add nsw i32 %sub6, %sub
%add20.2 = add nsw i32 %add.2, %mul18
%add22.2 = add nsw i32 %add20.2, %mul21
%cmp23.2 = icmp eq i32 %add22.2, 7
br i1 %cmp23.2, label %if.else, label %for.cond.2
for.cond.2: ; preds = %for.cond.1
%add22.3 = add nsw i32 %add20.2, %sub9
%cmp23.3 = icmp eq i32 %add22.3, 7
br i1 %cmp23.3, label %if.else, label %for.cond.3
for.cond.3: ; preds = %for.cond.2
%add20.4 = add nsw i32 %4, %sub3
%add22.4 = add nsw i32 %add20.4, %mul21
%cmp23.4 = icmp eq i32 %add22.4, 7
br i1 %cmp23.4, label %if.end, label %for.cond.4
for.cond.4: ; preds = %for.cond.3
%add22.5 = add nsw i32 %add20.4, %sub9
%cmp23.5 = icmp eq i32 %add22.5, 7
br i1 %cmp23.5, label %if.end, label %for.cond.5
for.cond.5: ; preds = %for.cond.4
%add20.6 = add nsw i32 %add.2, %sub3
%add22.6 = add nsw i32 %add20.6, %mul21
%cmp23.6 = icmp eq i32 %add22.6, 7
br i1 %cmp23.6, label %if.end, label %for.cond.6
for.cond.6: ; preds = %for.cond.5
%add22.7 = add nsw i32 %add20.6, %sub9
%cmp23.7 = icmp eq i32 %add22.7, 7
br i1 %cmp23.7, label %if.end, label %for.end
if.else: ; preds = %entry, %for.cond, %for.cond.1, %for.cond.2
%cmp31 = phi i1 [ false, %entry ], [ false, %for.cond ], [ true, %for.cond.1 ], [ true, %for.cond.2 ]
%cmp38 = phi i1 [ false, %entry ], [ true, %for.cond ], [ false, %for.cond.1 ], [ true, %for.cond.2 ]
%call25 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub3)
br i1 %cmp31, label %if.end37, label %if.else35
if.end: ; preds = %for.cond.6, %for.cond.5, %for.cond.4, %for.cond.3
%cmp31.ph = phi i1 [ true, %for.cond.6 ], [ true, %for.cond.5 ], [ false, %for.cond.4 ], [ false, %for.cond.3 ]
%cmp38.ph = phi i1 [ true, %for.cond.6 ], [ false, %for.cond.5 ], [ true, %for.cond.4 ], [ false, %for.cond.3 ]
%call2570 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub3)
br i1 %cmp31.ph, label %if.end37, label %if.else35
if.else35: ; preds = %if.else, %if.end
%cmp387376 = phi i1 [ %cmp38, %if.else ], [ %cmp38.ph, %if.end ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %sub6)
br i1 %cmp387376, label %for.end.sink.split, label %if.else42
if.end37: ; preds = %if.end, %if.else
%cmp387377 = phi i1 [ %cmp38, %if.else ], [ %cmp38.ph, %if.end ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub6)
br i1 %cmp387377, label %for.end.sink.split, label %if.else42
if.else42: ; preds = %if.else35, %if.end37
br label %for.end.sink.split
for.end.sink.split: ; preds = %if.end37, %if.else35, %if.else42
%.str.4.sink = phi ptr [ @.str.5, %if.else42 ], [ @.str.4, %if.else35 ], [ @.str.4, %if.end37 ]
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink, i32 noundef %sub9)
br label %for.end
for.end: ; preds = %for.end.sink.split, %for.cond.6
%5 = load ptr, ptr @stdout, align 8, !tbaa !8
%call46 = call i32 @fflush(ptr noundef %5)
call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
|
#include <stdio.h>
int main()
{
int a,b,c,d,i,j,k,n,m,x,y,z;
scanf("%d",&n);
d=n%10;
x=n/10;
c=x%10;
y=x/10;
b=y%10;
a=y/10;
if(a+b+c+d==7)
{
printf("%d+%d+%d+%d=7",a,b,c,d);
}
else if(a+b+c-d==7)
{
printf("%d+%d+%d-%d=7",a,b,c,d);
}
else if(a+b-c-d==7)
{
printf("%d+%d-%d-%d=7",a,b,c,d);
}
else if(a-b-c-d==7)
{
printf("%d-%d-%d-%d=7",a,b,c,d);
}
else if(a+b-c+d==7)
{
printf("%d+%d-%d+%d=7",a,b,c,d);
}
else if(a-b+c+d==7)
{
printf("%d-%d+%d+%d=7",a,b,c,d);
}
else if(a-b-c+d==7)
{
printf("%d-%d-%d+%d=7",a,b,c,d);
}
else if(a-b+c-d==7)
{
printf("%d-%d+%d-%d=7",a,b,c,d);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257151/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257151/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [14 x i8] c"%d+%d+%d+%d=7\00", align 1
@.str.2 = private unnamed_addr constant [14 x i8] c"%d+%d+%d-%d=7\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"%d+%d-%d-%d=7\00", align 1
@.str.4 = private unnamed_addr constant [14 x i8] c"%d-%d-%d-%d=7\00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"%d+%d-%d+%d=7\00", align 1
@.str.6 = private unnamed_addr constant [14 x i8] c"%d-%d+%d+%d=7\00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"%d-%d-%d+%d=7\00", align 1
@.str.8 = private unnamed_addr constant [14 x i8] c"%d-%d+%d-%d=7\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
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%rem1 = srem i32 %div, 10
%div2 = sdiv i32 %0, 100
%rem3 = srem i32 %div2, 10
%div4 = sdiv i32 %0, 1000
%add = add nsw i32 %rem3, %div4
%add5 = add nsw i32 %add, %rem1
%add6 = add nsw i32 %add5, %rem
%cmp = icmp eq i32 %add6, 7
br i1 %cmp, label %if.end61.sink.split, label %if.else
if.else: ; preds = %entry
%sub = sub nsw i32 %add5, %rem
%cmp10 = icmp eq i32 %sub, 7
br i1 %cmp10, label %if.end61.sink.split, label %if.else13
if.else13: ; preds = %if.else
%sub15 = sub nsw i32 %add, %rem1
%sub16 = sub nsw i32 %sub15, %rem
%cmp17 = icmp eq i32 %sub16, 7
br i1 %cmp17, label %if.end61.sink.split, label %if.else20
if.else20: ; preds = %if.else13
%sub21 = sub nsw i32 %div4, %rem3
%sub22 = sub nsw i32 %sub21, %rem1
%sub23 = sub nsw i32 %sub22, %rem
%cmp24 = icmp eq i32 %sub23, 7
br i1 %cmp24, label %if.end61.sink.split, label %if.else27
if.else27: ; preds = %if.else20
%add30 = add nsw i32 %sub15, %rem
%cmp31 = icmp eq i32 %add30, 7
br i1 %cmp31, label %if.end61.sink.split, label %if.else34
if.else34: ; preds = %if.else27
%add36 = add nsw i32 %sub21, %rem1
%add37 = add nsw i32 %add36, %rem
%cmp38 = icmp eq i32 %add37, 7
br i1 %cmp38, label %if.end61.sink.split, label %if.else41
if.else41: ; preds = %if.else34
%add44 = add nsw i32 %sub22, %rem
%cmp45 = icmp eq i32 %add44, 7
br i1 %cmp45, label %if.end61.sink.split, label %if.else48
if.else48: ; preds = %if.else41
%sub51 = sub nsw i32 %add36, %rem
%cmp52 = icmp eq i32 %sub51, 7
br i1 %cmp52, label %if.end61.sink.split, label %if.end61
if.end61.sink.split: ; preds = %if.else48, %if.else41, %if.else34, %if.else27, %if.else20, %if.else13, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.3, %if.else13 ], [ @.str.4, %if.else20 ], [ @.str.5, %if.else27 ], [ @.str.6, %if.else34 ], [ @.str.7, %if.else41 ], [ @.str.8, %if.else48 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink, i32 noundef %div4, i32 noundef %rem3, i32 noundef %rem1, i32 noundef %rem)
br label %if.end61
if.end61: ; preds = %if.end61.sink.split, %if.else48
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"}
|
#include<stdio.h>
#include<stdlib.h>
int main(void){
int N,A,B,C,D;
scanf("%d",&N);
A = N / 1000;
B = N % 1000 / 100;
C = N % 1000 % 100 / 10;
D = N % 1000 % 100 % 10 /1;
// printf("%d+%d+%d-%d=%d",A,B,C,D,A+B+C-D);
if(A+B+C+D == 7){
printf("%d+%d+%d+%d=7",A,B,C,D);
return 0;
}
if(A+B+C-D == 7){
printf("%d+%d+%d-%d=7",A,B,C,D);
return 0;
}
if(A+B-C+D == 7){
printf("%d+%d-%d+%d=7",A,B,C,D);
return 0;
}
if(A+B-C-D == 7){
printf("%d+%d-%d-%d=7",A,B,C,D);
return 0;
}
if(A-B+C+D == 7){
printf("%d-%d+%d+%d=7",A,B,C,D);
return 0;
}
if(A-B+C-D == 7){
printf("%d-%d+%d-%d=7",A,B,C,D);
return 0;
}
if(A-B-C+D == 7){
printf("%d-%d-%d+%d=7",A,B,C,D);
return 0;
}
if(A-B-C-D == 7){
printf("%d-%d-%d-%d=7",A,B,C,D);
return 0;
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257201/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257201/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [14 x i8] c"%d+%d+%d+%d=7\00", align 1
@.str.2 = private unnamed_addr constant [14 x i8] c"%d+%d+%d-%d=7\00", align 1
@.str.3 = private unnamed_addr constant [14 x i8] c"%d+%d-%d+%d=7\00", align 1
@.str.4 = private unnamed_addr constant [14 x i8] c"%d+%d-%d-%d=7\00", align 1
@.str.5 = private unnamed_addr constant [14 x i8] c"%d-%d+%d+%d=7\00", align 1
@.str.6 = private unnamed_addr constant [14 x i8] c"%d-%d+%d-%d=7\00", align 1
@.str.7 = private unnamed_addr constant [14 x i8] c"%d-%d-%d+%d=7\00", align 1
@.str.8 = private unnamed_addr constant [14 x i8] c"%d-%d-%d-%d=7\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, 1000
%rem = srem i32 %0, 1000
%div1.lhs.trunc = trunc i32 %rem to i16
%div1124 = sdiv i16 %div1.lhs.trunc, 100
%div1.sext = sext i16 %div1124 to i32
%rem3125 = srem i16 %div1.lhs.trunc, 100
%div4.lhs.trunc = trunc i16 %rem3125 to i8
%div4126 = sdiv i8 %div4.lhs.trunc, 10
%div4.sext = sext i8 %div4126 to i32
%rem7127 = srem i8 %div4.lhs.trunc, 10
%rem7.sext = sext i8 %rem7127 to i32
%add = add nsw i32 %div, %div1.sext
%add9 = add nsw i32 %add, %div4.sext
%add10 = add nsw i32 %add9, %rem7.sext
%cmp = icmp eq i32 %add10, 7
br i1 %cmp, label %cleanup.sink.split, label %if.end
if.end: ; preds = %entry
%sub = sub nsw i32 %add9, %rem7.sext
%cmp14 = icmp eq i32 %sub, 7
br i1 %cmp14, label %cleanup.sink.split, label %if.end17
if.end17: ; preds = %if.end
%sub19 = sub nsw i32 %add, %div4.sext
%add20 = add nsw i32 %sub19, %rem7.sext
%cmp21 = icmp eq i32 %add20, 7
br i1 %cmp21, label %cleanup.sink.split, label %if.end24
if.end24: ; preds = %if.end17
%sub27 = sub nsw i32 %sub19, %rem7.sext
%cmp28 = icmp eq i32 %sub27, 7
br i1 %cmp28, label %cleanup.sink.split, label %if.end31
if.end31: ; preds = %if.end24
%sub32 = sub nsw i32 %div, %div1.sext
%add33 = add nsw i32 %sub32, %div4.sext
%add34 = add nsw i32 %add33, %rem7.sext
%cmp35 = icmp eq i32 %add34, 7
br i1 %cmp35, label %cleanup.sink.split, label %if.end38
if.end38: ; preds = %if.end31
%sub41 = sub nsw i32 %add33, %rem7.sext
%cmp42 = icmp eq i32 %sub41, 7
br i1 %cmp42, label %cleanup.sink.split, label %if.end45
if.end45: ; preds = %if.end38
%sub47 = sub nsw i32 %sub32, %div4.sext
%add48 = add nsw i32 %sub47, %rem7.sext
%cmp49 = icmp eq i32 %add48, 7
br i1 %cmp49, label %cleanup.sink.split, label %if.end52
if.end52: ; preds = %if.end45
%sub55 = sub nsw i32 %sub47, %rem7.sext
%cmp56 = icmp eq i32 %sub55, 7
br i1 %cmp56, label %cleanup.sink.split, label %cleanup
cleanup.sink.split: ; preds = %if.end52, %if.end45, %if.end38, %if.end31, %if.end24, %if.end17, %if.end, %entry
%.str.8.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.end ], [ @.str.3, %if.end17 ], [ @.str.4, %if.end24 ], [ @.str.5, %if.end31 ], [ @.str.6, %if.end38 ], [ @.str.7, %if.end45 ], [ @.str.8, %if.end52 ]
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.8.sink, i32 noundef %div, i32 noundef %div1.sext, i32 noundef %div4.sext, i32 noundef %rem7.sext)
br label %cleanup
cleanup: ; preds = %cleanup.sink.split, %if.end52
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"}
|
#include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
int a,b,c,d;
d=n%10;
c=(n/10)%10;
b=(n/100)%10;
a=n/1000;
if(a+b+c+d==7)printf("%d+%d+%d+%d=7\n",a,b,c,d);
else if(a-b+c+d==7)printf("%d-%d+%d+%d=7\n",a,b,c,d);
else if(a+b-c+d==7)printf("%d+%d-%d+%d=7\n",a,b,c,d);
else if(a+b+c-d==7)printf("%d+%d+%d-%d=7\n",a,b,c,d);
else if(a-b-c+d==7)printf("%d-%d-%d+%d=7\n",a,b,c,d);
else if(a-b+c-d==7)printf("%d-%d+%d-%d=7\n",a,b,c,d);
else if(a+b-c-d==7)printf("%d+%d-%d-%d=7\n",a,b,c,d);
else if(a-b-c-d==7)printf("%d-%d-%d-%d=7\n",a,b,c,d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257245/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257245/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [15 x i8] c"%d+%d+%d+%d=7\0A\00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"%d-%d+%d+%d=7\0A\00", align 1
@.str.3 = private unnamed_addr constant [15 x i8] c"%d+%d-%d+%d=7\0A\00", align 1
@.str.4 = private unnamed_addr constant [15 x i8] c"%d+%d+%d-%d=7\0A\00", align 1
@.str.5 = private unnamed_addr constant [15 x i8] c"%d-%d-%d+%d=7\0A\00", align 1
@.str.6 = private unnamed_addr constant [15 x i8] c"%d-%d+%d-%d=7\0A\00", align 1
@.str.7 = private unnamed_addr constant [15 x i8] c"%d+%d-%d-%d=7\0A\00", align 1
@.str.8 = private unnamed_addr constant [15 x i8] c"%d-%d-%d-%d=7\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
%rem = srem i32 %0, 10
%div = sdiv i32 %0, 10
%rem1 = srem i32 %div, 10
%div2 = sdiv i32 %0, 100
%rem3 = srem i32 %div2, 10
%div4 = sdiv i32 %0, 1000
%add = add nsw i32 %rem3, %div4
%add5 = add nsw i32 %add, %rem1
%add6 = add nsw i32 %add5, %rem
%cmp = icmp eq i32 %add6, 7
br i1 %cmp, label %if.end61.sink.split, label %if.else
if.else: ; preds = %entry
%sub = sub nsw i32 %div4, %rem3
%add8 = add nsw i32 %sub, %rem1
%add9 = add nsw i32 %add8, %rem
%cmp10 = icmp eq i32 %add9, 7
br i1 %cmp10, label %if.end61.sink.split, label %if.else13
if.else13: ; preds = %if.else
%sub15 = sub nsw i32 %add, %rem1
%add16 = add nsw i32 %sub15, %rem
%cmp17 = icmp eq i32 %add16, 7
br i1 %cmp17, label %if.end61.sink.split, label %if.else20
if.else20: ; preds = %if.else13
%sub23 = sub nsw i32 %add5, %rem
%cmp24 = icmp eq i32 %sub23, 7
br i1 %cmp24, label %if.end61.sink.split, label %if.else27
if.else27: ; preds = %if.else20
%sub29 = sub nsw i32 %sub, %rem1
%add30 = add nsw i32 %sub29, %rem
%cmp31 = icmp eq i32 %add30, 7
br i1 %cmp31, label %if.end61.sink.split, label %if.else34
if.else34: ; preds = %if.else27
%sub37 = sub nsw i32 %add8, %rem
%cmp38 = icmp eq i32 %sub37, 7
br i1 %cmp38, label %if.end61.sink.split, label %if.else41
if.else41: ; preds = %if.else34
%sub44 = sub nsw i32 %sub15, %rem
%cmp45 = icmp eq i32 %sub44, 7
br i1 %cmp45, label %if.end61.sink.split, label %if.else48
if.else48: ; preds = %if.else41
%sub51 = sub nsw i32 %sub29, %rem
%cmp52 = icmp eq i32 %sub51, 7
br i1 %cmp52, label %if.end61.sink.split, label %if.end61
if.end61.sink.split: ; preds = %if.else48, %if.else41, %if.else34, %if.else27, %if.else20, %if.else13, %if.else, %entry
%.str.2.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else ], [ @.str.3, %if.else13 ], [ @.str.4, %if.else20 ], [ @.str.5, %if.else27 ], [ @.str.6, %if.else34 ], [ @.str.7, %if.else41 ], [ @.str.8, %if.else48 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink, i32 noundef %div4, i32 noundef %rem3, i32 noundef %rem1, i32 noundef %rem)
br label %if.end61
if.end61: ; preds = %if.end61.sink.split, %if.else48
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"}
|
#include <stdio.h>
#include <stdlib.h>
void Lucas(char a, char b, char c, char d);
void Lucas(char a, char b, char c, char d)
{
int x1, x2, x3, x4, x5, x6, x7, x8;
a -= 48;
b -= 48;
c -= 48;
d -= 48;
x1 = a+b+c+d;
x2 = a+b+c-d;
x3 = a+b-c+d;
x4 = a-b+c+d;
x5 = a+b-c-d;
x6 = a-b+c-d;
x7 = a-b-c+d;
x8 = a-b-c-d;
if (x1==7)
{
printf("%d+%d+%d+%d=7\n",a,b,c,d);
}
else if (x2==7)
{
printf("%d+%d+%d-%d=7\n",a,b,c,d);
}
else if (x3==7)
{
printf("%d+%d-%d+%d=7\n",a,b,c,d);
}
else if (x4==7)
{
printf("%d-%d+%d+%d=7\n",a,b,c,d);
}
else if (x5==7)
{
printf("%d+%d-%d-%d=7\n",a,b,c,d);
}
else if (x6==7)
{
printf("%d-%d+%d-%d=7\n",a,b,c,d);
}
else if (x7==7)
{
printf("%d-%d-%d+%d=7\n",a,b,c,d);
}
else if (x8==7)
{
printf("%d-%d-%d-%d=7\n",a,b,c,d);
}
}
int main()
{
char a, b, c, d;
scanf("%c%c%c%c",&a,&b,&c,&d);
Lucas(a,b,c,d);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257296/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257296/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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=7\0A\00", align 1
@.str.1 = private unnamed_addr constant [15 x i8] c"%d+%d+%d-%d=7\0A\00", align 1
@.str.2 = private unnamed_addr constant [15 x i8] c"%d+%d-%d+%d=7\0A\00", align 1
@.str.3 = private unnamed_addr constant [15 x i8] c"%d-%d+%d+%d=7\0A\00", align 1
@.str.4 = private unnamed_addr constant [15 x i8] c"%d+%d-%d-%d=7\0A\00", align 1
@.str.5 = private unnamed_addr constant [15 x i8] c"%d-%d+%d-%d=7\0A\00", align 1
@.str.6 = private unnamed_addr constant [15 x i8] c"%d-%d-%d+%d=7\0A\00", align 1
@.str.7 = private unnamed_addr constant [15 x i8] c"%d-%d-%d-%d=7\0A\00", align 1
@.str.8 = private unnamed_addr constant [9 x i8] c"%c%c%c%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @Lucas(i8 noundef signext %a, i8 noundef signext %b, i8 noundef signext %c, i8 noundef signext %d) local_unnamed_addr #0 {
entry:
%sub = add i8 %a, -48
%sub3 = add i8 %b, -48
%sub6 = add i8 %c, -48
%sub9 = add i8 %d, -48
%conv11 = sext i8 %sub to i32
%conv12 = sext i8 %sub3 to i32
%add = add nsw i32 %conv12, %conv11
%conv13 = sext i8 %sub6 to i32
%add14 = add nsw i32 %add, %conv13
%conv15 = sext i8 %sub9 to i32
%add16 = add nsw i32 %add14, %conv15
%sub28 = sub nsw i32 %add, %conv13
%add30 = add nsw i32 %sub28, %conv15
%sub33 = sub nsw i32 %conv11, %conv12
%add35 = add nsw i32 %sub33, %conv13
%add37 = add nsw i32 %add35, %conv15
%sub44 = sub nsw i32 %sub28, %conv15
%sub51 = sub nsw i32 %add35, %conv15
%sub56 = sub nsw i32 %sub33, %conv13
%add58 = add nsw i32 %sub56, %conv15
%sub65 = sub nsw i32 %sub56, %conv15
%cmp = icmp eq i32 %add16, 7
br i1 %cmp, label %if.end139.sink.split, label %if.else
if.else: ; preds = %entry
%sub23 = sub nsw i32 %add14, %conv15
%cmp71 = icmp eq i32 %sub23, 7
br i1 %cmp71, label %if.end139.sink.split, label %if.else79
if.else79: ; preds = %if.else
%cmp80 = icmp eq i32 %add30, 7
br i1 %cmp80, label %if.end139.sink.split, label %if.else88
if.else88: ; preds = %if.else79
%cmp89 = icmp eq i32 %add37, 7
br i1 %cmp89, label %if.end139.sink.split, label %if.else97
if.else97: ; preds = %if.else88
%cmp98 = icmp eq i32 %sub44, 7
br i1 %cmp98, label %if.end139.sink.split, label %if.else106
if.else106: ; preds = %if.else97
%cmp107 = icmp eq i32 %sub51, 7
br i1 %cmp107, label %if.end139.sink.split, label %if.else115
if.else115: ; preds = %if.else106
%cmp116 = icmp eq i32 %add58, 7
br i1 %cmp116, label %if.end139.sink.split, label %if.else124
if.else124: ; preds = %if.else115
%cmp125 = icmp eq i32 %sub65, 7
br i1 %cmp125, label %if.end139.sink.split, label %if.end139
if.end139.sink.split: ; preds = %if.else124, %if.else115, %if.else106, %if.else97, %if.else88, %if.else79, %if.else, %entry
%.str.1.sink = phi ptr [ @.str, %entry ], [ @.str.1, %if.else ], [ @.str.2, %if.else79 ], [ @.str.3, %if.else88 ], [ @.str.4, %if.else97 ], [ @.str.5, %if.else106 ], [ @.str.6, %if.else115 ], [ @.str.7, %if.else124 ]
%call78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink, i32 noundef %conv11, i32 noundef %conv12, i32 noundef %conv13, i32 noundef %conv15)
br label %if.end139
if.end139: ; preds = %if.end139.sink.split, %if.else124
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i8, align 1
%b = alloca i8, align 1
%c = alloca i8, align 1
%d = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %d) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.8, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i8, ptr %a, align 1, !tbaa !5
%1 = load i8, ptr %b, align 1, !tbaa !5
%2 = load i8, ptr %c, align 1, !tbaa !5
%3 = load i8, ptr %d, align 1, !tbaa !5
%sub.i = add i8 %0, -48
%sub3.i = add i8 %1, -48
%sub6.i = add i8 %2, -48
%sub9.i = add i8 %3, -48
%conv11.i = sext i8 %sub.i to i32
%conv12.i = sext i8 %sub3.i to i32
%add.i = add nsw i32 %conv12.i, %conv11.i
%conv13.i = sext i8 %sub6.i to i32
%add14.i = add nsw i32 %add.i, %conv13.i
%conv15.i = sext i8 %sub9.i to i32
%add16.i = add nsw i32 %add14.i, %conv15.i
%sub28.i = sub nsw i32 %add.i, %conv13.i
%add30.i = add nsw i32 %sub28.i, %conv15.i
%sub33.i = sub nsw i32 %conv11.i, %conv12.i
%add35.i = add nsw i32 %sub33.i, %conv13.i
%add37.i = add nsw i32 %add35.i, %conv15.i
%sub44.i = sub nsw i32 %sub28.i, %conv15.i
%sub51.i = sub nsw i32 %add35.i, %conv15.i
%sub56.i = sub nsw i32 %sub33.i, %conv13.i
%add58.i = add nsw i32 %sub56.i, %conv15.i
%sub65.i = sub nsw i32 %sub56.i, %conv15.i
%cmp.i = icmp eq i32 %add16.i, 7
br i1 %cmp.i, label %if.end139.sink.split.i, label %if.else.i
if.else.i: ; preds = %entry
%sub23.i = sub nsw i32 %add14.i, %conv15.i
%cmp71.i = icmp eq i32 %sub23.i, 7
br i1 %cmp71.i, label %if.end139.sink.split.i, label %if.else79.i
if.else79.i: ; preds = %if.else.i
%cmp80.i = icmp eq i32 %add30.i, 7
br i1 %cmp80.i, label %if.end139.sink.split.i, label %if.else88.i
if.else88.i: ; preds = %if.else79.i
%cmp89.i = icmp eq i32 %add37.i, 7
br i1 %cmp89.i, label %if.end139.sink.split.i, label %if.else97.i
if.else97.i: ; preds = %if.else88.i
%cmp98.i = icmp eq i32 %sub44.i, 7
br i1 %cmp98.i, label %if.end139.sink.split.i, label %if.else106.i
if.else106.i: ; preds = %if.else97.i
%cmp107.i = icmp eq i32 %sub51.i, 7
br i1 %cmp107.i, label %if.end139.sink.split.i, label %if.else115.i
if.else115.i: ; preds = %if.else106.i
%cmp116.i = icmp eq i32 %add58.i, 7
br i1 %cmp116.i, label %if.end139.sink.split.i, label %if.else124.i
if.else124.i: ; preds = %if.else115.i
%cmp125.i = icmp eq i32 %sub65.i, 7
br i1 %cmp125.i, label %if.end139.sink.split.i, label %Lucas.exit
if.end139.sink.split.i: ; preds = %if.else124.i, %if.else115.i, %if.else106.i, %if.else97.i, %if.else88.i, %if.else79.i, %if.else.i, %entry
%.str.1.sink.i = phi ptr [ @.str, %entry ], [ @.str.1, %if.else.i ], [ @.str.2, %if.else79.i ], [ @.str.3, %if.else88.i ], [ @.str.4, %if.else97.i ], [ @.str.5, %if.else106.i ], [ @.str.6, %if.else115.i ], [ @.str.7, %if.else124.i ]
%call78.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink.i, i32 noundef %conv11.i, i32 noundef %conv12.i, i32 noundef %conv13.i, i32 noundef %conv15.i)
br label %Lucas.exit
Lucas.exit: ; preds = %if.else124.i, %if.end139.sink.split.i
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n,s=0,a,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a);
s+=a;
}
s-=n;
printf("%d\n",s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257339/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257339/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, 0
br i1 %cmp6, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%s.07 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%add = add nsw i32 %1, %s.07
%inc = add nuw nsw i32 %i.08, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%s.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%.lcssa = phi i32 [ %0, %entry ], [ %2, %for.body ]
%sub = sub nsw i32 %s.0.lcssa, %.lcssa
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n;
scanf("%d", &n);
int f = 0;
int a;
for(int i = 0; i < n; i++){
scanf("%d", &a);
f += a - 1;
}
printf("%d", f);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257382/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257382/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%a = alloca 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)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%f.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %f.0.lcssa)
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
for.body: ; preds = %entry, %for.body
%i.07 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%f.06 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = add i32 %f.06, -1
%add = add i32 %sub, %1
%inc = add nuw nsw i32 %i.07, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int N, rep;
int res = 0;
int a[N];
scanf("%d", &N);
for (rep=0; rep < N; rep++)
{
scanf("%d", &a[rep]);
res = res + a[rep] - 1;
}
printf("%d", res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257425/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257425/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%vla13 = alloca [0 x i32], align 16
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
%0 = tail call ptr @llvm.stacksave.p0()
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp9 = icmp sgt i32 %1, 0
br i1 %cmp9, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%res.010 = phi i32 [ %sub, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla13, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %vla13, align 16, !tbaa !5
%add = add i32 %res.010, -1
%sub = add i32 %add, %2
%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, %entry
%res.0.lcssa = phi i32 [ 0, %entry ], [ %sub, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %res.0.lcssa)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n, a, i, s=0;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &a);
s += a - 1;
}
printf("%d\n", s);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257469/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257469/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%s.07 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%i.06 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = add i32 %s.07, -1
%add = add i32 %sub, %1
%inc = add nuw nsw i32 %i.06, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%s.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %s.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main()
{
int n = 0;
scanf("%d",&n);
int a[n],sum=0;
for(int i = 0;i<n;i++)
{
scanf("%d",&a[i]);
sum += a[i]-1;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257511/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257511/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #4
store i32 0, ptr %n, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%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
%cmp9 = icmp sgt i32 %3, 0
br i1 %cmp9, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.010 = phi i32 [ %add, %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)
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = add i32 %sum.010, -1
%add = add i32 %sub, %4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
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 <stdio.h>
#include <stdlib.h>
#define MAX(x,y) ((x)<(y)?(y):(x))
typedef long long ll;
const ll INF = 1LL << 60;
int main(){
int N;
scanf("%d",&N);
ll A[N];
for(int i = 0;i<N;i++) scanf("%lld",&A[i]);
ll dp[4][N/2];
for(int i = 0;i<N/2;i++) dp[0][i] = (0LL-INF);
for(int j = 0;j<N/2;j++){
for(int i = 1;i<4;i++){
if(j==0) dp[i][j]=MAX(dp[i-1][j],A[i-1]);
else if(j>0) dp[i][j]=MAX(dp[i-1][j],dp[i][j-1]+A[2*j+i-1]);
}
}
if(!(N & 1))printf("%lld\n",dp[2][N/2-1]);
else printf("%lld\n",dp[3][N/2-1]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257562/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257562/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@INF = dso_local local_unnamed_addr constant i64 1152921504606846976, align 8
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca 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 i64, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp142 = icmp sgt i32 %3, 0
br i1 %cmp142, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%.nonneg = sub i32 0, %3
%div176190192 = lshr i32 %.nonneg, 1
%div176190.neg = sub nsw i32 0, %div176190192
%4 = zext i32 %div176190.neg to i64
%5 = shl nuw nsw i64 %4, 2
%vla2177 = alloca i64, i64 %5, align 16
br label %for.cond.cleanup18
for.cond.cleanup: ; preds = %for.body
%div = sdiv i32 %11, 2
%6 = zext i32 %div to i64
%7 = shl nuw nsw i64 %6, 2
%vla2 = alloca i64, i64 %7, align 16
%cmp6144 = icmp sgt i32 %11, 1
br i1 %cmp6144, label %for.body8.preheader, label %for.cond.cleanup18
for.body8.preheader: ; preds = %for.cond.cleanup
%min.iters.check = icmp ult i32 %div, 4
br i1 %min.iters.check, label %for.body8.preheader197, label %vector.ph
vector.ph: ; preds = %for.body8.preheader
%n.vec = and i64 %6, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%8 = getelementptr inbounds i64, ptr %vla2, i64 %index
store <2 x i64> <i64 -1152921504606846976, i64 -1152921504606846976>, ptr %8, align 16, !tbaa !9
%9 = getelementptr inbounds i64, ptr %8, i64 2
store <2 x i64> <i64 -1152921504606846976, i64 -1152921504606846976>, ptr %9, align 16, !tbaa !9
%index.next = add nuw i64 %index, 4
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %6
br i1 %cmp.n, label %for.cond15.preheader, label %for.body8.preheader197
for.body8.preheader197: ; preds = %for.body8.preheader, %middle.block
%indvars.iv152.ph = phi i64 [ 0, %for.body8.preheader ], [ %n.vec, %middle.block ]
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, 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
%11 = load i32, ptr %N, align 4, !tbaa !5
%12 = sext i32 %11 to i64
%cmp = icmp slt i64 %indvars.iv.next, %12
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !15
for.cond15.preheader: ; preds = %for.body8, %middle.block
br i1 %cmp6144, label %for.cond.cleanup23.peel, label %for.cond.cleanup18
for.cond.cleanup23.peel: ; preds = %for.cond15.preheader
%13 = load i64, ptr %vla2, align 16, !tbaa !9
%14 = load i64, ptr %vla, align 16, !tbaa !9
%..us.peel = call i64 @llvm.smax.i64(i64 %13, i64 %14)
%arrayidx43.us.peel = getelementptr inbounds i64, ptr %vla2, i64 %6
store i64 %..us.peel, ptr %arrayidx43.us.peel, align 8, !tbaa !9
%arrayidx32.us.1.peel = getelementptr inbounds i64, ptr %vla, i64 1
%15 = load i64, ptr %arrayidx32.us.1.peel, align 8, !tbaa !9
%..us.1.peel = call i64 @llvm.smax.i64(i64 %..us.peel, i64 %15)
%16 = shl nuw nsw i64 %6, 1
%arrayidx43.us.1.peel = getelementptr inbounds i64, ptr %vla2, i64 %16
store i64 %..us.1.peel, ptr %arrayidx43.us.1.peel, align 16, !tbaa !9
%arrayidx32.us.2.peel = getelementptr inbounds i64, ptr %vla, i64 2
%17 = load i64, ptr %arrayidx32.us.2.peel, align 16, !tbaa !9
%..us.2.peel = call i64 @llvm.smax.i64(i64 %..us.1.peel, i64 %17)
%18 = mul nuw nsw i64 %6, 3
%arrayidx43.us.2.peel = getelementptr inbounds i64, ptr %vla2, i64 %18
store i64 %..us.2.peel, ptr %arrayidx43.us.2.peel, align 8, !tbaa !9
%19 = and i32 %11, -2
%exitcond173.peel.not = icmp eq i32 %19, 2
br i1 %exitcond173.peel.not, label %for.cond.cleanup18, label %for.cond21.preheader.peel.next
for.cond21.preheader.peel.next: ; preds = %for.cond.cleanup23.peel
%arrayidx54 = getelementptr inbounds i64, ptr %vla2, i64 %6
%20 = shl nuw nsw i64 %6, 1
%arrayidx54.1 = getelementptr inbounds i64, ptr %vla2, i64 %20
%21 = mul nuw nsw i64 %6, 3
%arrayidx54.2 = getelementptr inbounds i64, ptr %vla2, i64 %21
%invariant.gep191 = getelementptr i64, ptr %vla, i64 2
%load_initial = load i64, ptr %arrayidx54, align 8
%load_initial193 = load i64, ptr %arrayidx54.1, align 16
%load_initial195 = load i64, ptr %arrayidx54.2, align 8
br label %for.cond.cleanup23
for.body8: ; preds = %for.body8.preheader197, %for.body8
%indvars.iv152 = phi i64 [ %indvars.iv.next153, %for.body8 ], [ %indvars.iv152.ph, %for.body8.preheader197 ]
%arrayidx11 = getelementptr inbounds i64, ptr %vla2, i64 %indvars.iv152
store i64 -1152921504606846976, ptr %arrayidx11, align 8, !tbaa !9
%indvars.iv.next153 = add nuw nsw i64 %indvars.iv152, 1
%exitcond.not = icmp eq i64 %indvars.iv.next153, %6
br i1 %exitcond.not, label %for.cond15.preheader, label %for.body8, !llvm.loop !16
for.cond.cleanup18: ; preds = %for.cond.cleanup23, %for.cond.cleanup, %for.cond.cleanup.thread, %for.cond.cleanup23.peel, %for.cond15.preheader
%.lcssa179189 = phi i32 [ %11, %for.cond15.preheader ], [ %11, %for.cond.cleanup23.peel ], [ %11, %for.cond.cleanup ], [ %3, %for.cond.cleanup.thread ], [ %11, %for.cond.cleanup23 ]
%div180188 = phi i32 [ %div, %for.cond15.preheader ], [ %div, %for.cond.cleanup23.peel ], [ %div, %for.cond.cleanup ], [ %div176190.neg, %for.cond.cleanup.thread ], [ %div, %for.cond.cleanup23 ]
%22 = phi i64 [ %6, %for.cond15.preheader ], [ %6, %for.cond.cleanup23.peel ], [ %6, %for.cond.cleanup ], [ %4, %for.cond.cleanup.thread ], [ %6, %for.cond.cleanup23 ]
%vla2182 = phi ptr [ %vla2, %for.cond15.preheader ], [ %vla2, %for.cond.cleanup23.peel ], [ %vla2, %for.cond.cleanup ], [ %vla2177, %for.cond.cleanup.thread ], [ %vla2, %for.cond.cleanup23 ]
%and = and i32 %.lcssa179189, 1
%tobool.not = icmp eq i32 %and, 0
%sub97 = add nsw i32 %div180188, -1
%idxprom98 = sext i32 %sub97 to i64
%23 = mul nuw nsw i64 %22, 3
%24 = shl nuw nsw i64 %22, 1
%.sink = select i1 %tobool.not, i64 %24, i64 %23
%arrayidx102 = getelementptr inbounds i64, ptr %vla2182, i64 %.sink
%arrayidx106 = getelementptr inbounds i64, ptr %arrayidx102, i64 %idxprom98
%25 = load i64, ptr %arrayidx106, align 8, !tbaa !9
%call107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %25)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
for.cond.cleanup23: ; preds = %for.cond21.preheader.peel.next, %for.cond.cleanup23
%store_forwarded196 = phi i64 [ %load_initial195, %for.cond21.preheader.peel.next ], [ %add61..2, %for.cond.cleanup23 ]
%store_forwarded194 = phi i64 [ %load_initial193, %for.cond21.preheader.peel.next ], [ %add61..1, %for.cond.cleanup23 ]
%store_forwarded = phi i64 [ %load_initial, %for.cond21.preheader.peel.next ], [ %add61., %for.cond.cleanup23 ]
%indvars.iv166 = phi i64 [ 1, %for.cond21.preheader.peel.next ], [ %indvars.iv.next167, %for.cond.cleanup23 ]
%26 = shl nuw nsw i64 %indvars.iv166, 1
%invariant.gep = getelementptr i64, ptr %vla2, i64 %indvars.iv166
%27 = load i64, ptr %invariant.gep, align 8, !tbaa !9
%arrayidx60 = getelementptr inbounds i64, ptr %vla, i64 %26
%28 = load i64, ptr %arrayidx60, align 16, !tbaa !9
%add61 = add nsw i64 %28, %store_forwarded
%add61. = call i64 @llvm.smax.i64(i64 %27, i64 %add61)
%arrayidx86 = getelementptr inbounds i64, ptr %arrayidx54, i64 %indvars.iv166
store i64 %add61., ptr %arrayidx86, align 8, !tbaa !9
%29 = or i64 %26, 1
%arrayidx60.1 = getelementptr inbounds i64, ptr %vla, i64 %29
%30 = load i64, ptr %arrayidx60.1, align 8, !tbaa !9
%add61.1 = add nsw i64 %30, %store_forwarded194
%add61..1 = call i64 @llvm.smax.i64(i64 %add61., i64 %add61.1)
%arrayidx86.1 = getelementptr inbounds i64, ptr %arrayidx54.1, i64 %indvars.iv166
store i64 %add61..1, ptr %arrayidx86.1, align 8, !tbaa !9
%gep = getelementptr i64, ptr %invariant.gep191, i64 %26
%31 = load i64, ptr %gep, align 16, !tbaa !9
%add61.2 = add nsw i64 %31, %store_forwarded196
%add61..2 = call i64 @llvm.smax.i64(i64 %add61..1, i64 %add61.2)
%arrayidx86.2 = getelementptr inbounds i64, ptr %arrayidx54.2, i64 %indvars.iv166
store i64 %add61..2, ptr %arrayidx86.2, align 8, !tbaa !9
%indvars.iv.next167 = add nuw nsw i64 %indvars.iv166, 1
%exitcond173.not = icmp eq i64 %indvars.iv.next167, %6
br i1 %exitcond173.not, label %for.cond.cleanup18, label %for.cond.cleanup23, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 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 = { nofree nounwind "no-trapping-math"="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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
|
#include<stdio.h>
int main( ){
int a, b, c, d;
scanf("%d %d %d %d", &a, &b, &c, &d);
if(a == b && c == d)
printf("yes\n");
else if(a == c && b == d)
printf("yes\n");
else if(a == d && b == c)
printf("yes\n");
else printf("no\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257605/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257605/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"no\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %d)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp eq i32 %0, %1
%.pre = load i32, ptr %c, align 4, !tbaa !5
%.pre22 = load i32, ptr %d, align 4
%cmp1 = icmp eq i32 %.pre, %.pre22
%or.cond23 = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond23, label %if.end17, label %if.else
if.else: ; preds = %entry
%cmp3 = icmp eq i32 %0, %.pre
%cmp5 = icmp eq i32 %1, %.pre22
%or.cond = select i1 %cmp3, i1 %cmp5, i1 false
br i1 %or.cond, label %if.end17, label %if.else8
if.else8: ; preds = %if.else
%cmp9 = icmp eq i32 %0, %.pre22
%cmp11 = icmp eq i32 %1, %.pre
%or.cond21 = and i1 %cmp11, %cmp9
%str.3.str = select i1 %or.cond21, ptr @str.5, ptr @str
br label %if.end17
if.end17: ; preds = %if.else8, %if.else, %entry
%str.4.sink = phi ptr [ @str.5, %entry ], [ @str.5, %if.else ], [ %str.3.str, %if.else8 ]
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) %str.4.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
// AOJ 2135 Reverse a Road
// 2018.2.26 bal4u
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define QMAX 15000
typedef struct { short t, s, r; } QUE;
QUE que[QMAX]; int qsize;
#define PARENT(i) ((i)>>1)
#define LEFT(i) ((i)<<1)
#define RIGHT(i) (((i)<<1)+1)
void min_heapify(int i)
{
int l, r, min;
QUE qt;
l = LEFT(i), r = RIGHT(i);
if (l < qsize && (que[l].t < que[i].t ||
que[l].t == que[i].t && que[l].r < que[i].r)) min = l; else min = i;
if (r < qsize && (que[r].t < que[min].t ||
que[r].t == que[min].t && que[r].r < que[min].r)) min = r;
if (min != i) {
qt = que[i], que[i] = que[min], que[min] = qt;
min_heapify(min);
}
}
void deq()
{
que[0] = que[--qsize];
min_heapify(0);
}
void enq(int s, int t, int r)
{
int i, min;
QUE qt;
i = qsize++;
que[i].s = s, que[i].t = t, que[i].r = r;
while (i > 0 && (que[min = PARENT(i)].t > que[i].t ||
que[min].t == que[i].t && que[min].r > que[i].r)) {
qt = que[i], que[i] = que[min], que[min] = qt;
i = min;
}
}
short hi[1002], *to[1002], *no[1002];
char mk[1002][1002][2];
//#define getchar_unlocked() getchar()
int in()
{
int n = 0;
int c = getchar_unlocked();
do n = 10*n + (c & 0xf), c = getchar_unlocked();
while (c >= '0');
return n;
}
int dijkstra(int *rno, int start, int goal)
{
int i, s, t, r, e, k;
memset(mk, 0, sizeof(mk));
qsize = 0;
enq(start, 0, 0);
while (qsize) {
s = que[0].s, t = que[0].t, r = que[0].r, deq();
if (s == goal) { *rno = r; return t; }
if (r == 0) {
for (i = 0; i < hi[s]; i++) {
e = to[s][i], k = no[s][i];
if (k > 0) {
if (!mk[e][k][0]) mk[e][k][0] = 1, enq(e, t+1, 0);
} else {
if (!mk[s][-k][1]) mk[s][-k][1] = 1, enq(e, t+1, -k);
}
}
} else {
for (i = 0; i < hi[s]; i++) {
e = to[s][i], k = no[s][i];
if (k > 0 && !mk[e][k][1]) mk[e][k][1] = 1, enq(e, t+1, r);
}
}
}
return -1;
}
int main()
{
int N, S, T, M, a, b, i, j, k, ans;
short *memo;
while (N = in()) {
N++, S = in(), T = in();
M = in();
memo = malloc(M << 2);
memset(hi, 0, N << 1);
j = 0, i = M; while (i--) {
memo[j++] = a = in(), memo[j++] = b = in();
hi[a]++, hi[b]++;
}
for (a = 0; a < N; a++) if (hi[a]) {
to[a] = malloc(hi[a] << 1);
no[a] = malloc(hi[a] << 1);
}
memset(hi, 0, N << 1);
j = 0; for (i = 1; i <= M; i++) {
a = memo[j++], b = memo[j++];
k = hi[a]++, to[a][k] = b, no[a][k] = i;
k = hi[b]++, to[b][k] = a, no[b][k] = -i;
}
free(memo);
ans = dijkstra(&k, S, T);
printf("%d %d\n", ans, k);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257649/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257649/source.c"
target datalayout = "e-m:e-p270: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.QUE = type { i16, i16, i16 }
%struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
@qsize = dso_local local_unnamed_addr global i32 0, align 4
@que = dso_local local_unnamed_addr global [15000 x %struct.QUE] zeroinitializer, align 16
@mk = dso_local local_unnamed_addr global [1002 x [1002 x [2 x i8]]] zeroinitializer, align 16
@hi = dso_local local_unnamed_addr global [1002 x i16] zeroinitializer, align 16
@to = dso_local local_unnamed_addr global [1002 x ptr] zeroinitializer, align 16
@no = dso_local local_unnamed_addr global [1002 x ptr] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @min_heapify(i32 noundef %i) local_unnamed_addr #0 {
entry:
%qt = alloca %struct.QUE, align 2
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %qt)
%shl = shl i32 %i, 1
%add = or i32 %shl, 1
%0 = load i32, ptr @qsize, align 4, !tbaa !5
%cmp = icmp slt i32 %shl, %0
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%idxprom = sext i32 %shl to i64
%arrayidx = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom
%1 = load i16, ptr %arrayidx, align 4, !tbaa !9
%idxprom2 = sext i32 %i to i64
%arrayidx3 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2
%2 = load i16, ptr %arrayidx3, align 2, !tbaa !9
%cmp6 = icmp slt i16 %1, %2
br i1 %cmp6, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %land.lhs.true
%cmp16 = icmp eq i16 %1, %2
br i1 %cmp16, label %land.lhs.true18, label %if.else
land.lhs.true18: ; preds = %lor.lhs.false
%r21 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 2
%3 = load i16, ptr %r21, align 4, !tbaa !12
%r25 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2, i32 2
%4 = load i16, ptr %r25, align 2, !tbaa !12
%cmp27 = icmp slt i16 %3, %4
br i1 %cmp27, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true18, %lor.lhs.false, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %land.lhs.true18, %if.else
%min.0 = phi i32 [ %i, %if.else ], [ %shl, %land.lhs.true18 ], [ %shl, %land.lhs.true ]
%cmp29 = icmp slt i32 %add, %0
br i1 %cmp29, label %land.lhs.true31, label %if.end65
land.lhs.true31: ; preds = %if.end
%idxprom32 = sext i32 %add to i64
%arrayidx33 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom32
%5 = load i16, ptr %arrayidx33, align 2, !tbaa !9
%idxprom36 = sext i32 %min.0 to i64
%arrayidx37 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom36
%6 = load i16, ptr %arrayidx37, align 2, !tbaa !9
%cmp40 = icmp slt i16 %5, %6
br i1 %cmp40, label %if.then64, label %lor.lhs.false42
lor.lhs.false42: ; preds = %land.lhs.true31
%cmp51 = icmp eq i16 %5, %6
br i1 %cmp51, label %land.lhs.true53, label %if.end65
land.lhs.true53: ; preds = %lor.lhs.false42
%r56 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom32, i32 2
%7 = load i16, ptr %r56, align 2, !tbaa !12
%r60 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom36, i32 2
%8 = load i16, ptr %r60, align 2, !tbaa !12
%cmp62 = icmp slt i16 %7, %8
br i1 %cmp62, label %if.then64, label %if.end65
if.then64: ; preds = %land.lhs.true53, %land.lhs.true31
br label %if.end65
if.end65: ; preds = %if.then64, %land.lhs.true53, %lor.lhs.false42, %if.end
%min.1 = phi i32 [ %add, %if.then64 ], [ %min.0, %land.lhs.true53 ], [ %min.0, %lor.lhs.false42 ], [ %min.0, %if.end ]
%cmp66.not = icmp eq i32 %min.1, %i
br i1 %cmp66.not, label %if.end77, label %if.then68
if.then68: ; preds = %if.end65
%idxprom69 = sext i32 %i to i64
%arrayidx70 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom69
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %qt, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx70, i64 6, i1 false), !tbaa.struct !13
%idxprom73 = sext i32 %min.1 to i64
%arrayidx74 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom73
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx70, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx74, i64 6, i1 false), !tbaa.struct !13
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx74, ptr noundef nonnull align 2 dereferenceable(6) %qt, i64 6, i1 false), !tbaa.struct !13
tail call void @min_heapify(i32 noundef %min.1)
br label %if.end77
if.end77: ; preds = %if.then68, %if.end65
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %qt)
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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @deq() local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @qsize, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @qsize, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(6) @que, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx, i64 6, i1 false), !tbaa.struct !13
tail call void @min_heapify(i32 noundef 0)
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enq(i32 noundef %s, i32 noundef %t, i32 noundef %r) local_unnamed_addr #0 {
entry:
%qt = alloca %struct.QUE, align 2
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %qt)
%0 = load i32, ptr @qsize, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @qsize, align 4, !tbaa !5
%conv = trunc i32 %s to i16
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom
%s1 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 1
store i16 %conv, ptr %s1, align 2, !tbaa !15
%conv2 = trunc i32 %t to i16
store i16 %conv2, ptr %arrayidx, align 2, !tbaa !9
%conv6 = trunc i32 %r to i16
%r9 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 2
store i16 %conv6, ptr %r9, align 2, !tbaa !12
%cmp64 = icmp sgt i32 %0, 0
br i1 %cmp64, label %land.rhs, label %while.end
land.rhs: ; preds = %entry, %while.body
%i.065 = phi i32 [ %shr, %while.body ], [ %0, %entry ]
%shr = lshr i32 %i.065, 1
%idxprom11 = zext i32 %shr to i64
%arrayidx12 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11
%1 = load i16, ptr %arrayidx12, align 2, !tbaa !9
%idxprom15 = zext i32 %i.065 to i64
%arrayidx16 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15
%2 = load i16, ptr %arrayidx16, align 2, !tbaa !9
%cmp19 = icmp sgt i16 %1, %2
br i1 %cmp19, label %while.body, label %lor.rhs
lor.rhs: ; preds = %land.rhs
%cmp29 = icmp eq i16 %1, %2
br i1 %cmp29, label %land.rhs31, label %while.end
land.rhs31: ; preds = %lor.rhs
%r34 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11, i32 2
%3 = load i16, ptr %r34, align 2, !tbaa !12
%r38 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15, i32 2
%4 = load i16, ptr %r38, align 2, !tbaa !12
%cmp40 = icmp sgt i16 %3, %4
br i1 %cmp40, label %while.body, label %while.end
while.body: ; preds = %land.rhs, %land.rhs31
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %qt, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16, i64 6, i1 false), !tbaa.struct !13
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12, i64 6, i1 false), !tbaa.struct !13
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12, ptr noundef nonnull align 2 dereferenceable(6) %qt, i64 6, i1 false), !tbaa.struct !13
%cmp.not = icmp ult i32 %i.065, 2
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !16
while.end: ; preds = %land.rhs31, %lor.rhs, %while.body, %entry
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %qt)
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !18
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !20
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !23
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !24
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #10
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.preheader
cond.false.i: ; preds = %entry
%incdec.ptr.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i, ptr %_IO_read_ptr.i, align 8, !tbaa !20
%3 = load i8, ptr %1, align 1, !tbaa !25
%conv3.i = zext i8 %3 to i32
br label %do.body.preheader
do.body.preheader: ; preds = %cond.true.i, %cond.false.i
%.ph = phi ptr [ %0, %cond.false.i ], [ %.pre14.pre, %cond.true.i ]
%c.0.ph = phi i32 [ %conv3.i, %cond.false.i ], [ %call.i, %cond.true.i ]
br label %do.body
do.body: ; preds = %do.body.preheader, %getchar_unlocked.exit13
%4 = phi ptr [ %8, %getchar_unlocked.exit13 ], [ %.ph, %do.body.preheader ]
%n.0 = phi i32 [ %add, %getchar_unlocked.exit13 ], [ 0, %do.body.preheader ]
%c.0 = phi i32 [ %cond.i9, %getchar_unlocked.exit13 ], [ %c.0.ph, %do.body.preheader ]
%mul = mul nsw i32 %n.0, 10
%and = and i32 %c.0, 15
%add = add nsw i32 %and, %mul
%_IO_read_ptr.i4 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4, align 8, !tbaa !20
%_IO_read_end.i5 = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5, align 8, !tbaa !23
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !24
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #10
%.pre = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13
cond.false.i10: ; preds = %do.body
%incdec.ptr.i11 = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11, ptr %_IO_read_ptr.i4, align 8, !tbaa !20
%7 = load i8, ptr %5, align 1, !tbaa !25
%conv3.i12 = zext i8 %7 to i32
br label %getchar_unlocked.exit13
getchar_unlocked.exit13: ; preds = %cond.true.i7, %cond.false.i10
%8 = phi ptr [ %.pre, %cond.true.i7 ], [ %4, %cond.false.i10 ]
%cond.i9 = phi i32 [ %call.i8, %cond.true.i7 ], [ %conv3.i12, %cond.false.i10 ]
%cmp = icmp sgt i32 %cond.i9, 47
br i1 %cmp, label %do.body, label %do.end, !llvm.loop !26
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local i32 @dijkstra(ptr nocapture noundef writeonly %rno, i32 noundef %start, i32 noundef %goal) local_unnamed_addr #3 {
while.body.preheader:
%qt.i181 = alloca %struct.QUE, align 2
%qt.i156 = alloca %struct.QUE, align 2
%qt.i132 = alloca %struct.QUE, align 2
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2008008) @mk, i8 0, i64 2008008, i1 false)
%conv.i = trunc i32 %start to i16
store i16 %conv.i, ptr getelementptr inbounds ([15000 x %struct.QUE], ptr @que, i64 0, i64 0, i32 1), align 2, !tbaa !15
store i16 0, ptr @que, align 16, !tbaa !9
store i16 0, ptr getelementptr inbounds ([15000 x %struct.QUE], ptr @que, i64 0, i64 0, i32 2), align 4, !tbaa !12
%sext = shl i32 %start, 16
%conv238 = ashr exact i32 %sext, 16
store i32 0, ptr @qsize, align 4, !tbaa !5
tail call void @min_heapify(i32 noundef 0)
%cmp239 = icmp eq i32 %conv238, %goal
br i1 %cmp239, label %if.then, label %if.end
while.bodythread-pre-split: ; preds = %if.end90
%.pr = load i16, ptr getelementptr inbounds ([15000 x %struct.QUE], ptr @que, i64 0, i64 0, i32 2), align 4, !tbaa !12
%0 = load i16, ptr getelementptr inbounds ([15000 x %struct.QUE], ptr @que, i64 0, i64 0, i32 1), align 2, !tbaa !15
%conv = sext i16 %0 to i32
%1 = load i16, ptr @que, align 16, !tbaa !9
%dec.i = add nsw i32 %31, -1
store i32 %dec.i, ptr @qsize, align 4, !tbaa !5
%idxprom.i130 = sext i32 %dec.i to i64
%arrayidx.i131 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i130
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(6) @que, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx.i131, i64 6, i1 false), !tbaa.struct !13
tail call void @min_heapify(i32 noundef 0)
%cmp = icmp eq i32 %conv, %goal
br i1 %cmp, label %while.body.if.then_crit_edge, label %if.end
while.body.if.then_crit_edge: ; preds = %while.bodythread-pre-split
%2 = sext i16 %1 to i32
%3 = sext i16 %.pr to i32
br label %if.then
if.then: ; preds = %while.body.if.then_crit_edge, %while.body.preheader
%.lcssa236 = phi i32 [ %3, %while.body.if.then_crit_edge ], [ 0, %while.body.preheader ]
%.lcssa = phi i32 [ %2, %while.body.if.then_crit_edge ], [ 0, %while.body.preheader ]
store i32 %.lcssa236, ptr %rno, align 4, !tbaa !5
br label %cleanup
if.end: ; preds = %while.body.preheader, %while.bodythread-pre-split
%4 = phi i16 [ %1, %while.bodythread-pre-split ], [ 0, %while.body.preheader ]
%5 = phi i16 [ %0, %while.bodythread-pre-split ], [ %conv.i, %while.body.preheader ]
%6 = phi i16 [ %.pr, %while.bodythread-pre-split ], [ 0, %while.body.preheader ]
%cmp4 = icmp eq i16 %6, 0
%idxprom = sext i16 %5 to i64
%arrayidx = getelementptr inbounds [1002 x i16], ptr @hi, i64 0, i64 %idxprom
%7 = load i16, ptr %arrayidx, align 2, !tbaa !14
%cmp8216 = icmp sgt i16 %7, 0
br i1 %cmp4, label %for.cond.preheader, label %for.cond54.preheader
for.cond54.preheader: ; preds = %if.end
br i1 %cmp8216, label %for.body60.lr.ph, label %if.end90
for.body60.lr.ph: ; preds = %for.cond54.preheader
%conv57 = zext i16 %7 to i64
%qsize.promoted = load i32, ptr @qsize, align 4, !tbaa !5
%arrayidx62 = getelementptr inbounds [1002 x ptr], ptr @to, i64 0, i64 %idxprom
%8 = load ptr, ptr %arrayidx62, align 8, !tbaa !18
%arrayidx67 = getelementptr inbounds [1002 x ptr], ptr @no, i64 0, i64 %idxprom
%9 = load ptr, ptr %arrayidx67, align 8, !tbaa !18
%add85 = add i16 %4, 1
br label %for.body60
for.cond.preheader: ; preds = %if.end
br i1 %cmp8216, label %for.body.lr.ph, label %if.end90
for.body.lr.ph: ; preds = %for.cond.preheader
%conv7 = zext i16 %7 to i64
%qsize.promoted213 = load i32, ptr @qsize, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [1002 x ptr], ptr @to, i64 0, i64 %idxprom
%10 = load ptr, ptr %arrayidx11, align 8, !tbaa !18
%arrayidx16 = getelementptr inbounds [1002 x ptr], ptr @no, i64 0, i64 %idxprom
%11 = load ptr, ptr %arrayidx16, align 8, !tbaa !18
%add49 = add i16 %4, 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv225 = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next226, %for.inc ]
%inc.i157215217 = phi i32 [ %qsize.promoted213, %for.body.lr.ph ], [ %inc.i157214, %for.inc ]
%arrayidx13 = getelementptr inbounds i16, ptr %10, i64 %indvars.iv225
%12 = load i16, ptr %arrayidx13, align 2, !tbaa !14
%arrayidx18 = getelementptr inbounds i16, ptr %11, i64 %indvars.iv225
%13 = load i16, ptr %arrayidx18, align 2, !tbaa !14
%conv19 = sext i16 %13 to i32
%cmp20 = icmp sgt i16 %13, 0
br i1 %cmp20, label %if.then22, label %if.else
if.then22: ; preds = %for.body
%idxprom23 = sext i16 %12 to i64
%idxprom25 = zext i32 %conv19 to i64
%arrayidx26 = getelementptr inbounds [1002 x [1002 x [2 x i8]]], ptr @mk, i64 0, i64 %idxprom23, i64 %idxprom25
%14 = load i8, ptr %arrayidx26, align 2, !tbaa !25
%tobool28.not = icmp eq i8 %14, 0
br i1 %tobool28.not, label %if.then29, label %for.inc
if.then29: ; preds = %if.then22
store i8 1, ptr %arrayidx26, align 2, !tbaa !25
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %qt.i132)
%inc.i133 = add nsw i32 %inc.i157215217, 1
store i32 %inc.i133, ptr @qsize, align 4, !tbaa !5
%idxprom.i134 = sext i32 %inc.i157215217 to i64
%arrayidx.i135 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i134
%s1.i136 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i134, i32 1
store i16 %12, ptr %s1.i136, align 2, !tbaa !15
store i16 %add49, ptr %arrayidx.i135, align 2, !tbaa !9
%r9.i137 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i134, i32 2
store i16 0, ptr %r9.i137, align 2, !tbaa !12
%cmp64.i138 = icmp sgt i32 %inc.i157215217, 0
br i1 %cmp64.i138, label %land.rhs.i139, label %enq.exit155
land.rhs.i139: ; preds = %if.then29, %while.body.i153
%i.065.i140 = phi i32 [ %shr.i141, %while.body.i153 ], [ %inc.i157215217, %if.then29 ]
%shr.i141 = lshr i32 %i.065.i140, 1
%idxprom11.i142 = zext i32 %shr.i141 to i64
%arrayidx12.i143 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11.i142
%15 = load i16, ptr %arrayidx12.i143, align 2, !tbaa !9
%idxprom15.i144 = zext i32 %i.065.i140 to i64
%arrayidx16.i145 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15.i144
%16 = load i16, ptr %arrayidx16.i145, align 2, !tbaa !9
%cmp19.i146 = icmp sgt i16 %15, %16
br i1 %cmp19.i146, label %while.body.i153, label %lor.rhs.i147
lor.rhs.i147: ; preds = %land.rhs.i139
%cmp29.i148 = icmp eq i16 %15, %16
br i1 %cmp29.i148, label %land.rhs31.i149, label %enq.exit155
land.rhs31.i149: ; preds = %lor.rhs.i147
%r34.i150 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11.i142, i32 2
%17 = load i16, ptr %r34.i150, align 2, !tbaa !12
%r38.i151 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15.i144, i32 2
%18 = load i16, ptr %r38.i151, align 2, !tbaa !12
%cmp40.i152 = icmp sgt i16 %17, %18
br i1 %cmp40.i152, label %while.body.i153, label %enq.exit155
while.body.i153: ; preds = %land.rhs31.i149, %land.rhs.i139
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %qt.i132, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16.i145, i64 6, i1 false), !tbaa.struct !13
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16.i145, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12.i143, i64 6, i1 false), !tbaa.struct !13
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12.i143, ptr noundef nonnull align 2 dereferenceable(6) %qt.i132, i64 6, i1 false), !tbaa.struct !13
%cmp.not.i154 = icmp ult i32 %i.065.i140, 2
br i1 %cmp.not.i154, label %enq.exit155, label %land.rhs.i139, !llvm.loop !16
enq.exit155: ; preds = %lor.rhs.i147, %land.rhs31.i149, %while.body.i153, %if.then29
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %qt.i132)
br label %for.inc
if.else: ; preds = %for.body
%sub = sub nsw i32 0, %conv19
%idxprom38 = zext i32 %sub to i64
%arrayidx40 = getelementptr inbounds [1002 x [1002 x [2 x i8]]], ptr @mk, i64 0, i64 %idxprom, i64 %idxprom38, i64 1
%19 = load i8, ptr %arrayidx40, align 1, !tbaa !25
%tobool41.not = icmp eq i8 %19, 0
br i1 %tobool41.not, label %if.then42, label %for.inc
if.then42: ; preds = %if.else
store i8 1, ptr %arrayidx40, align 1, !tbaa !25
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %qt.i156)
%inc.i157 = add nsw i32 %inc.i157215217, 1
store i32 %inc.i157, ptr @qsize, align 4, !tbaa !5
%idxprom.i158 = sext i32 %inc.i157215217 to i64
%arrayidx.i159 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i158
%s1.i160 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i158, i32 1
store i16 %12, ptr %s1.i160, align 2, !tbaa !15
store i16 %add49, ptr %arrayidx.i159, align 2, !tbaa !9
%conv6.i = trunc i32 %sub to i16
%r9.i162 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i158, i32 2
store i16 %conv6.i, ptr %r9.i162, align 2, !tbaa !12
%cmp64.i163 = icmp sgt i32 %inc.i157215217, 0
br i1 %cmp64.i163, label %land.rhs.i164, label %enq.exit180
land.rhs.i164: ; preds = %if.then42, %while.body.i178
%i.065.i165 = phi i32 [ %shr.i166, %while.body.i178 ], [ %inc.i157215217, %if.then42 ]
%shr.i166 = lshr i32 %i.065.i165, 1
%idxprom11.i167 = zext i32 %shr.i166 to i64
%arrayidx12.i168 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11.i167
%20 = load i16, ptr %arrayidx12.i168, align 2, !tbaa !9
%idxprom15.i169 = zext i32 %i.065.i165 to i64
%arrayidx16.i170 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15.i169
%21 = load i16, ptr %arrayidx16.i170, align 2, !tbaa !9
%cmp19.i171 = icmp sgt i16 %20, %21
br i1 %cmp19.i171, label %while.body.i178, label %lor.rhs.i172
lor.rhs.i172: ; preds = %land.rhs.i164
%cmp29.i173 = icmp eq i16 %20, %21
br i1 %cmp29.i173, label %land.rhs31.i174, label %enq.exit180
land.rhs31.i174: ; preds = %lor.rhs.i172
%r34.i175 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11.i167, i32 2
%22 = load i16, ptr %r34.i175, align 2, !tbaa !12
%r38.i176 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15.i169, i32 2
%23 = load i16, ptr %r38.i176, align 2, !tbaa !12
%cmp40.i177 = icmp sgt i16 %22, %23
br i1 %cmp40.i177, label %while.body.i178, label %enq.exit180
while.body.i178: ; preds = %land.rhs31.i174, %land.rhs.i164
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %qt.i156, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16.i170, i64 6, i1 false), !tbaa.struct !13
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16.i170, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12.i168, i64 6, i1 false), !tbaa.struct !13
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12.i168, ptr noundef nonnull align 2 dereferenceable(6) %qt.i156, i64 6, i1 false), !tbaa.struct !13
%cmp.not.i179 = icmp ult i32 %i.065.i165, 2
br i1 %cmp.not.i179, label %enq.exit180, label %land.rhs.i164, !llvm.loop !16
enq.exit180: ; preds = %lor.rhs.i172, %land.rhs31.i174, %while.body.i178, %if.then42
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %qt.i156)
br label %for.inc
for.inc: ; preds = %enq.exit155, %if.then22, %enq.exit180, %if.else
%inc.i157214 = phi i32 [ %inc.i133, %enq.exit155 ], [ %inc.i157215217, %if.then22 ], [ %inc.i157, %enq.exit180 ], [ %inc.i157215217, %if.else ]
%indvars.iv.next226 = add nuw nsw i64 %indvars.iv225, 1
%exitcond229.not = icmp eq i64 %indvars.iv.next226, %conv7
br i1 %exitcond229.not, label %if.end90, label %for.body, !llvm.loop !27
for.body60: ; preds = %for.body60.lr.ph, %for.inc87
%indvars.iv = phi i64 [ 0, %for.body60.lr.ph ], [ %indvars.iv.next, %for.inc87 ]
%inc.i182209211 = phi i32 [ %qsize.promoted, %for.body60.lr.ph ], [ %inc.i182208, %for.inc87 ]
%arrayidx64 = getelementptr inbounds i16, ptr %8, i64 %indvars.iv
%24 = load i16, ptr %arrayidx64, align 2, !tbaa !14
%arrayidx69 = getelementptr inbounds i16, ptr %9, i64 %indvars.iv
%25 = load i16, ptr %arrayidx69, align 2, !tbaa !14
%cmp71 = icmp sgt i16 %25, 0
br i1 %cmp71, label %land.lhs.true, label %for.inc87
land.lhs.true: ; preds = %for.body60
%conv70 = zext i16 %25 to i64
%idxprom73 = sext i16 %24 to i64
%arrayidx77 = getelementptr inbounds [1002 x [1002 x [2 x i8]]], ptr @mk, i64 0, i64 %idxprom73, i64 %conv70, i64 1
%26 = load i8, ptr %arrayidx77, align 1, !tbaa !25
%tobool78.not = icmp eq i8 %26, 0
br i1 %tobool78.not, label %if.then79, label %for.inc87
if.then79: ; preds = %land.lhs.true
store i8 1, ptr %arrayidx77, align 1, !tbaa !25
call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %qt.i181)
%inc.i182 = add nsw i32 %inc.i182209211, 1
store i32 %inc.i182, ptr @qsize, align 4, !tbaa !5
%idxprom.i183 = sext i32 %inc.i182209211 to i64
%arrayidx.i184 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i183
%s1.i185 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i183, i32 1
store i16 %24, ptr %s1.i185, align 2, !tbaa !15
store i16 %add85, ptr %arrayidx.i184, align 2, !tbaa !9
%r9.i187 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i183, i32 2
store i16 %6, ptr %r9.i187, align 2, !tbaa !12
%cmp64.i188 = icmp sgt i32 %inc.i182209211, 0
br i1 %cmp64.i188, label %land.rhs.i189, label %enq.exit205
land.rhs.i189: ; preds = %if.then79, %while.body.i203
%i.065.i190 = phi i32 [ %shr.i191, %while.body.i203 ], [ %inc.i182209211, %if.then79 ]
%shr.i191 = lshr i32 %i.065.i190, 1
%idxprom11.i192 = zext i32 %shr.i191 to i64
%arrayidx12.i193 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11.i192
%27 = load i16, ptr %arrayidx12.i193, align 2, !tbaa !9
%idxprom15.i194 = zext i32 %i.065.i190 to i64
%arrayidx16.i195 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15.i194
%28 = load i16, ptr %arrayidx16.i195, align 2, !tbaa !9
%cmp19.i196 = icmp sgt i16 %27, %28
br i1 %cmp19.i196, label %while.body.i203, label %lor.rhs.i197
lor.rhs.i197: ; preds = %land.rhs.i189
%cmp29.i198 = icmp eq i16 %27, %28
br i1 %cmp29.i198, label %land.rhs31.i199, label %enq.exit205
land.rhs31.i199: ; preds = %lor.rhs.i197
%r34.i200 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom11.i192, i32 2
%29 = load i16, ptr %r34.i200, align 2, !tbaa !12
%r38.i201 = getelementptr inbounds [15000 x %struct.QUE], ptr @que, i64 0, i64 %idxprom15.i194, i32 2
%30 = load i16, ptr %r38.i201, align 2, !tbaa !12
%cmp40.i202 = icmp sgt i16 %29, %30
br i1 %cmp40.i202, label %while.body.i203, label %enq.exit205
while.body.i203: ; preds = %land.rhs31.i199, %land.rhs.i189
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %qt.i181, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16.i195, i64 6, i1 false), !tbaa.struct !13
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx16.i195, ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12.i193, i64 6, i1 false), !tbaa.struct !13
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 2 dereferenceable(6) %arrayidx12.i193, ptr noundef nonnull align 2 dereferenceable(6) %qt.i181, i64 6, i1 false), !tbaa.struct !13
%cmp.not.i204 = icmp ult i32 %i.065.i190, 2
br i1 %cmp.not.i204, label %enq.exit205, label %land.rhs.i189, !llvm.loop !16
enq.exit205: ; preds = %lor.rhs.i197, %land.rhs31.i199, %while.body.i203, %if.then79
call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %qt.i181)
br label %for.inc87
for.inc87: ; preds = %for.body60, %land.lhs.true, %enq.exit205
%inc.i182208 = phi i32 [ %inc.i182209211, %for.body60 ], [ %inc.i182209211, %land.lhs.true ], [ %inc.i182, %enq.exit205 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %conv57
br i1 %exitcond.not, label %if.end90, label %for.body60, !llvm.loop !28
if.end90: ; preds = %for.inc87, %for.inc, %for.cond54.preheader, %for.cond.preheader
%31 = load i32, ptr @qsize, align 4, !tbaa !5
%tobool.not = icmp eq i32 %31, 0
br i1 %tobool.not, label %cleanup, label %while.bodythread-pre-split, !llvm.loop !29
cleanup: ; preds = %if.end90, %if.then
%retval.0 = phi i32 [ %.lcssa, %if.then ], [ -1, %if.end90 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #10
br label %while.cond
while.cond: ; preds = %for.end89, %entry
%k.promoted = phi i32 [ %74, %for.end89 ], [ undef, %entry ]
%0 = load ptr, ptr @stdin, align 8, !tbaa !18
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !20
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !23
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !24
cond.true.i.i: ; preds = %while.cond
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #10
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.i.preheader
cond.false.i.i: ; preds = %while.cond
%incdec.ptr.i.i = getelementptr inbounds i8, ptr %1, i64 1
store ptr %incdec.ptr.i.i, ptr %_IO_read_ptr.i.i, align 8, !tbaa !20
%3 = load i8, ptr %1, align 1, !tbaa !25
%conv3.i.i = zext i8 %3 to i32
br label %do.body.i.preheader
do.body.i.preheader: ; preds = %cond.false.i.i, %cond.true.i.i
%.ph319 = phi ptr [ %0, %cond.false.i.i ], [ %.pre14.pre.i, %cond.true.i.i ]
%c.0.i.ph = phi i32 [ %conv3.i.i, %cond.false.i.i ], [ %call.i.i, %cond.true.i.i ]
br label %do.body.i
do.body.i: ; preds = %do.body.i.preheader, %getchar_unlocked.exit13.i
%4 = phi ptr [ %8, %getchar_unlocked.exit13.i ], [ %.ph319, %do.body.i.preheader ]
%n.0.i = phi i32 [ %add.i, %getchar_unlocked.exit13.i ], [ 0, %do.body.i.preheader ]
%c.0.i = phi i32 [ %cond.i9.i, %getchar_unlocked.exit13.i ], [ %c.0.i.ph, %do.body.i.preheader ]
%mul.i = mul i32 %n.0.i, 10
%and.i = and i32 %c.0.i, 15
%add.i = add nsw i32 %and.i, %mul.i
%_IO_read_ptr.i4.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 1
%5 = load ptr, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !20
%_IO_read_end.i5.i = getelementptr inbounds %struct._IO_FILE, ptr %4, i64 0, i32 2
%6 = load ptr, ptr %_IO_read_end.i5.i, align 8, !tbaa !23
%cmp.not.i6.i = icmp ult ptr %5, %6
br i1 %cmp.not.i6.i, label %cond.false.i10.i, label %cond.true.i7.i, !prof !24
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #10
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13.i
cond.false.i10.i: ; preds = %do.body.i
%incdec.ptr.i11.i = getelementptr inbounds i8, ptr %5, i64 1
store ptr %incdec.ptr.i11.i, ptr %_IO_read_ptr.i4.i, align 8, !tbaa !20
%7 = load i8, ptr %5, align 1, !tbaa !25
%conv3.i12.i = zext i8 %7 to i32
br label %getchar_unlocked.exit13.i
getchar_unlocked.exit13.i: ; preds = %cond.false.i10.i, %cond.true.i7.i
%8 = phi ptr [ %.pre.i, %cond.true.i7.i ], [ %4, %cond.false.i10.i ]
%cond.i9.i = phi i32 [ %call.i8.i, %cond.true.i7.i ], [ %conv3.i12.i, %cond.false.i10.i ]
%cmp.i = icmp sgt i32 %cond.i9.i, 47
br i1 %cmp.i, label %do.body.i, label %in.exit, !llvm.loop !26
in.exit: ; preds = %getchar_unlocked.exit13.i
%tobool.not = icmp eq i32 %add.i, 0
br i1 %tobool.not, label %while.end92, label %while.body
while.body: ; preds = %in.exit
%_IO_read_ptr.i.i124 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 1
%9 = load ptr, ptr %_IO_read_ptr.i.i124, align 8, !tbaa !20
%_IO_read_end.i.i125 = getelementptr inbounds %struct._IO_FILE, ptr %8, i64 0, i32 2
%10 = load ptr, ptr %_IO_read_end.i.i125, align 8, !tbaa !23
%cmp.not.i.i126 = icmp ult ptr %9, %10
br i1 %cmp.not.i.i126, label %cond.false.i.i151, label %cond.true.i.i127, !prof !24
cond.true.i.i127: ; preds = %while.body
%call.i.i128 = tail call i32 @__uflow(ptr noundef nonnull %8) #10
%.pre14.pre.i129 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.i133.preheader
cond.false.i.i151: ; preds = %while.body
%incdec.ptr.i.i152 = getelementptr inbounds i8, ptr %9, i64 1
store ptr %incdec.ptr.i.i152, ptr %_IO_read_ptr.i.i124, align 8, !tbaa !20
%11 = load i8, ptr %9, align 1, !tbaa !25
%conv3.i.i153 = zext i8 %11 to i32
br label %do.body.i133.preheader
do.body.i133.preheader: ; preds = %cond.false.i.i151, %cond.true.i.i127
%.ph318 = phi ptr [ %8, %cond.false.i.i151 ], [ %.pre14.pre.i129, %cond.true.i.i127 ]
%c.0.i135.ph = phi i32 [ %conv3.i.i153, %cond.false.i.i151 ], [ %call.i.i128, %cond.true.i.i127 ]
br label %do.body.i133
do.body.i133: ; preds = %do.body.i133.preheader, %getchar_unlocked.exit13.i145
%12 = phi ptr [ %16, %getchar_unlocked.exit13.i145 ], [ %.ph318, %do.body.i133.preheader ]
%n.0.i134 = phi i32 [ %add.i138, %getchar_unlocked.exit13.i145 ], [ 0, %do.body.i133.preheader ]
%c.0.i135 = phi i32 [ %cond.i9.i146, %getchar_unlocked.exit13.i145 ], [ %c.0.i135.ph, %do.body.i133.preheader ]
%mul.i136 = mul nsw i32 %n.0.i134, 10
%and.i137 = and i32 %c.0.i135, 15
%add.i138 = add nsw i32 %and.i137, %mul.i136
%_IO_read_ptr.i4.i139 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 1
%13 = load ptr, ptr %_IO_read_ptr.i4.i139, align 8, !tbaa !20
%_IO_read_end.i5.i140 = getelementptr inbounds %struct._IO_FILE, ptr %12, i64 0, i32 2
%14 = load ptr, ptr %_IO_read_end.i5.i140, align 8, !tbaa !23
%cmp.not.i6.i141 = icmp ult ptr %13, %14
br i1 %cmp.not.i6.i141, label %cond.false.i10.i148, label %cond.true.i7.i142, !prof !24
cond.true.i7.i142: ; preds = %do.body.i133
%call.i8.i143 = tail call i32 @__uflow(ptr noundef nonnull %12) #10
%.pre.i144 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13.i145
cond.false.i10.i148: ; preds = %do.body.i133
%incdec.ptr.i11.i149 = getelementptr inbounds i8, ptr %13, i64 1
store ptr %incdec.ptr.i11.i149, ptr %_IO_read_ptr.i4.i139, align 8, !tbaa !20
%15 = load i8, ptr %13, align 1, !tbaa !25
%conv3.i12.i150 = zext i8 %15 to i32
br label %getchar_unlocked.exit13.i145
getchar_unlocked.exit13.i145: ; preds = %cond.false.i10.i148, %cond.true.i7.i142
%16 = phi ptr [ %.pre.i144, %cond.true.i7.i142 ], [ %12, %cond.false.i10.i148 ]
%cond.i9.i146 = phi i32 [ %call.i8.i143, %cond.true.i7.i142 ], [ %conv3.i12.i150, %cond.false.i10.i148 ]
%cmp.i147 = icmp sgt i32 %cond.i9.i146, 47
br i1 %cmp.i147, label %do.body.i133, label %in.exit154, !llvm.loop !26
in.exit154: ; preds = %getchar_unlocked.exit13.i145
%_IO_read_ptr.i.i155 = getelementptr inbounds %struct._IO_FILE, ptr %16, i64 0, i32 1
%17 = load ptr, ptr %_IO_read_ptr.i.i155, align 8, !tbaa !20
%_IO_read_end.i.i156 = getelementptr inbounds %struct._IO_FILE, ptr %16, i64 0, i32 2
%18 = load ptr, ptr %_IO_read_end.i.i156, align 8, !tbaa !23
%cmp.not.i.i157 = icmp ult ptr %17, %18
br i1 %cmp.not.i.i157, label %cond.false.i.i182, label %cond.true.i.i158, !prof !24
cond.true.i.i158: ; preds = %in.exit154
%call.i.i159 = tail call i32 @__uflow(ptr noundef nonnull %16) #10
%.pre14.pre.i160 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.i164.preheader
cond.false.i.i182: ; preds = %in.exit154
%incdec.ptr.i.i183 = getelementptr inbounds i8, ptr %17, i64 1
store ptr %incdec.ptr.i.i183, ptr %_IO_read_ptr.i.i155, align 8, !tbaa !20
%19 = load i8, ptr %17, align 1, !tbaa !25
%conv3.i.i184 = zext i8 %19 to i32
br label %do.body.i164.preheader
do.body.i164.preheader: ; preds = %cond.false.i.i182, %cond.true.i.i158
%.ph317 = phi ptr [ %16, %cond.false.i.i182 ], [ %.pre14.pre.i160, %cond.true.i.i158 ]
%c.0.i166.ph = phi i32 [ %conv3.i.i184, %cond.false.i.i182 ], [ %call.i.i159, %cond.true.i.i158 ]
br label %do.body.i164
do.body.i164: ; preds = %do.body.i164.preheader, %getchar_unlocked.exit13.i176
%20 = phi ptr [ %24, %getchar_unlocked.exit13.i176 ], [ %.ph317, %do.body.i164.preheader ]
%n.0.i165 = phi i32 [ %add.i169, %getchar_unlocked.exit13.i176 ], [ 0, %do.body.i164.preheader ]
%c.0.i166 = phi i32 [ %cond.i9.i177, %getchar_unlocked.exit13.i176 ], [ %c.0.i166.ph, %do.body.i164.preheader ]
%mul.i167 = mul nsw i32 %n.0.i165, 10
%and.i168 = and i32 %c.0.i166, 15
%add.i169 = add nsw i32 %and.i168, %mul.i167
%_IO_read_ptr.i4.i170 = getelementptr inbounds %struct._IO_FILE, ptr %20, i64 0, i32 1
%21 = load ptr, ptr %_IO_read_ptr.i4.i170, align 8, !tbaa !20
%_IO_read_end.i5.i171 = getelementptr inbounds %struct._IO_FILE, ptr %20, i64 0, i32 2
%22 = load ptr, ptr %_IO_read_end.i5.i171, align 8, !tbaa !23
%cmp.not.i6.i172 = icmp ult ptr %21, %22
br i1 %cmp.not.i6.i172, label %cond.false.i10.i179, label %cond.true.i7.i173, !prof !24
cond.true.i7.i173: ; preds = %do.body.i164
%call.i8.i174 = tail call i32 @__uflow(ptr noundef nonnull %20) #10
%.pre.i175 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13.i176
cond.false.i10.i179: ; preds = %do.body.i164
%incdec.ptr.i11.i180 = getelementptr inbounds i8, ptr %21, i64 1
store ptr %incdec.ptr.i11.i180, ptr %_IO_read_ptr.i4.i170, align 8, !tbaa !20
%23 = load i8, ptr %21, align 1, !tbaa !25
%conv3.i12.i181 = zext i8 %23 to i32
br label %getchar_unlocked.exit13.i176
getchar_unlocked.exit13.i176: ; preds = %cond.false.i10.i179, %cond.true.i7.i173
%24 = phi ptr [ %.pre.i175, %cond.true.i7.i173 ], [ %20, %cond.false.i10.i179 ]
%cond.i9.i177 = phi i32 [ %call.i8.i174, %cond.true.i7.i173 ], [ %conv3.i12.i181, %cond.false.i10.i179 ]
%cmp.i178 = icmp sgt i32 %cond.i9.i177, 47
br i1 %cmp.i178, label %do.body.i164, label %in.exit185, !llvm.loop !26
in.exit185: ; preds = %getchar_unlocked.exit13.i176
%_IO_read_ptr.i.i186 = getelementptr inbounds %struct._IO_FILE, ptr %24, i64 0, i32 1
%25 = load ptr, ptr %_IO_read_ptr.i.i186, align 8, !tbaa !20
%_IO_read_end.i.i187 = getelementptr inbounds %struct._IO_FILE, ptr %24, i64 0, i32 2
%26 = load ptr, ptr %_IO_read_end.i.i187, align 8, !tbaa !23
%cmp.not.i.i188 = icmp ult ptr %25, %26
br i1 %cmp.not.i.i188, label %cond.false.i.i213, label %cond.true.i.i189, !prof !24
cond.true.i.i189: ; preds = %in.exit185
%call.i.i190 = tail call i32 @__uflow(ptr noundef nonnull %24) #10
%.pre14.pre.i191 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.i195.preheader
cond.false.i.i213: ; preds = %in.exit185
%incdec.ptr.i.i214 = getelementptr inbounds i8, ptr %25, i64 1
store ptr %incdec.ptr.i.i214, ptr %_IO_read_ptr.i.i186, align 8, !tbaa !20
%27 = load i8, ptr %25, align 1, !tbaa !25
%conv3.i.i215 = zext i8 %27 to i32
br label %do.body.i195.preheader
do.body.i195.preheader: ; preds = %cond.false.i.i213, %cond.true.i.i189
%.ph316 = phi ptr [ %24, %cond.false.i.i213 ], [ %.pre14.pre.i191, %cond.true.i.i189 ]
%c.0.i197.ph = phi i32 [ %conv3.i.i215, %cond.false.i.i213 ], [ %call.i.i190, %cond.true.i.i189 ]
br label %do.body.i195
do.body.i195: ; preds = %do.body.i195.preheader, %getchar_unlocked.exit13.i207
%28 = phi ptr [ %32, %getchar_unlocked.exit13.i207 ], [ %.ph316, %do.body.i195.preheader ]
%n.0.i196 = phi i32 [ %add.i200, %getchar_unlocked.exit13.i207 ], [ 0, %do.body.i195.preheader ]
%c.0.i197 = phi i32 [ %cond.i9.i208, %getchar_unlocked.exit13.i207 ], [ %c.0.i197.ph, %do.body.i195.preheader ]
%mul.i198 = mul i32 %n.0.i196, 10
%and.i199 = and i32 %c.0.i197, 15
%add.i200 = add nsw i32 %and.i199, %mul.i198
%_IO_read_ptr.i4.i201 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 1
%29 = load ptr, ptr %_IO_read_ptr.i4.i201, align 8, !tbaa !20
%_IO_read_end.i5.i202 = getelementptr inbounds %struct._IO_FILE, ptr %28, i64 0, i32 2
%30 = load ptr, ptr %_IO_read_end.i5.i202, align 8, !tbaa !23
%cmp.not.i6.i203 = icmp ult ptr %29, %30
br i1 %cmp.not.i6.i203, label %cond.false.i10.i210, label %cond.true.i7.i204, !prof !24
cond.true.i7.i204: ; preds = %do.body.i195
%call.i8.i205 = tail call i32 @__uflow(ptr noundef nonnull %28) #10
%.pre.i206 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13.i207
cond.false.i10.i210: ; preds = %do.body.i195
%incdec.ptr.i11.i211 = getelementptr inbounds i8, ptr %29, i64 1
store ptr %incdec.ptr.i11.i211, ptr %_IO_read_ptr.i4.i201, align 8, !tbaa !20
%31 = load i8, ptr %29, align 1, !tbaa !25
%conv3.i12.i212 = zext i8 %31 to i32
br label %getchar_unlocked.exit13.i207
getchar_unlocked.exit13.i207: ; preds = %cond.false.i10.i210, %cond.true.i7.i204
%32 = phi ptr [ %.pre.i206, %cond.true.i7.i204 ], [ %28, %cond.false.i10.i210 ]
%cond.i9.i208 = phi i32 [ %call.i8.i205, %cond.true.i7.i204 ], [ %conv3.i12.i212, %cond.false.i10.i210 ]
%cmp.i209 = icmp sgt i32 %cond.i9.i208, 47
br i1 %cmp.i209, label %do.body.i195, label %in.exit216, !llvm.loop !26
in.exit216: ; preds = %getchar_unlocked.exit13.i207
%shl = shl i32 %add.i200, 2
%conv = sext i32 %shl to i64
%call4 = tail call noalias ptr @malloc(i64 noundef %conv) #11
%inc = shl i32 %add.i, 1
%shl5 = add i32 %inc, 2
%conv6 = sext i32 %shl5 to i64
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @hi, i8 0, i64 %conv6, i1 false)
%tobool8.not279 = icmp eq i32 %add.i200, 0
br i1 %tobool8.not279, label %for.cond.preheader, label %while.body9
for.cond.preheader: ; preds = %in.exit278, %in.exit216
%cmp.not282 = icmp slt i32 %add.i, 0
br i1 %cmp.not282, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%33 = or i32 %mul.i, 1
%34 = and i32 %c.0.i, 15
%35 = add i32 %33, %34
%wide.trip.count = zext i32 %35 to i64
br label %for.body
while.body9: ; preds = %in.exit216, %in.exit278
%36 = phi ptr [ %57, %in.exit278 ], [ %32, %in.exit216 ]
%37 = phi ptr [ %58, %in.exit278 ], [ %32, %in.exit216 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %in.exit278 ], [ 0, %in.exit216 ]
%i.0280 = phi i32 [ %dec, %in.exit278 ], [ %add.i200, %in.exit216 ]
%dec = add nsw i32 %i.0280, -1
%_IO_read_ptr.i.i217 = getelementptr inbounds %struct._IO_FILE, ptr %37, i64 0, i32 1
%38 = load ptr, ptr %_IO_read_ptr.i.i217, align 8, !tbaa !20
%_IO_read_end.i.i218 = getelementptr inbounds %struct._IO_FILE, ptr %37, i64 0, i32 2
%39 = load ptr, ptr %_IO_read_end.i.i218, align 8, !tbaa !23
%cmp.not.i.i219 = icmp ult ptr %38, %39
br i1 %cmp.not.i.i219, label %cond.false.i.i244, label %cond.true.i.i220, !prof !24
cond.true.i.i220: ; preds = %while.body9
%call.i.i221 = tail call i32 @__uflow(ptr noundef nonnull %37) #10
%.pre14.pre.i222 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.i226.preheader
cond.false.i.i244: ; preds = %while.body9
%incdec.ptr.i.i245 = getelementptr inbounds i8, ptr %38, i64 1
store ptr %incdec.ptr.i.i245, ptr %_IO_read_ptr.i.i217, align 8, !tbaa !20
%40 = load i8, ptr %38, align 1, !tbaa !25
%conv3.i.i246 = zext i8 %40 to i32
br label %do.body.i226.preheader
do.body.i226.preheader: ; preds = %cond.false.i.i244, %cond.true.i.i220
%.ph314 = phi ptr [ %36, %cond.false.i.i244 ], [ %.pre14.pre.i222, %cond.true.i.i220 ]
%.ph315 = phi ptr [ %37, %cond.false.i.i244 ], [ %.pre14.pre.i222, %cond.true.i.i220 ]
%c.0.i228.ph = phi i32 [ %conv3.i.i246, %cond.false.i.i244 ], [ %call.i.i221, %cond.true.i.i220 ]
br label %do.body.i226
do.body.i226: ; preds = %do.body.i226.preheader, %getchar_unlocked.exit13.i238
%41 = phi ptr [ %46, %getchar_unlocked.exit13.i238 ], [ %.ph314, %do.body.i226.preheader ]
%42 = phi ptr [ %47, %getchar_unlocked.exit13.i238 ], [ %.ph315, %do.body.i226.preheader ]
%n.0.i227 = phi i32 [ %add.i231, %getchar_unlocked.exit13.i238 ], [ 0, %do.body.i226.preheader ]
%c.0.i228 = phi i32 [ %cond.i9.i239, %getchar_unlocked.exit13.i238 ], [ %c.0.i228.ph, %do.body.i226.preheader ]
%mul.i229 = mul nsw i32 %n.0.i227, 10
%and.i230 = and i32 %c.0.i228, 15
%add.i231 = add nsw i32 %and.i230, %mul.i229
%_IO_read_ptr.i4.i232 = getelementptr inbounds %struct._IO_FILE, ptr %42, i64 0, i32 1
%43 = load ptr, ptr %_IO_read_ptr.i4.i232, align 8, !tbaa !20
%_IO_read_end.i5.i233 = getelementptr inbounds %struct._IO_FILE, ptr %42, i64 0, i32 2
%44 = load ptr, ptr %_IO_read_end.i5.i233, align 8, !tbaa !23
%cmp.not.i6.i234 = icmp ult ptr %43, %44
br i1 %cmp.not.i6.i234, label %cond.false.i10.i241, label %cond.true.i7.i235, !prof !24
cond.true.i7.i235: ; preds = %do.body.i226
%call.i8.i236 = tail call i32 @__uflow(ptr noundef nonnull %42) #10
%.pre.i237 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13.i238
cond.false.i10.i241: ; preds = %do.body.i226
%incdec.ptr.i11.i242 = getelementptr inbounds i8, ptr %43, i64 1
store ptr %incdec.ptr.i11.i242, ptr %_IO_read_ptr.i4.i232, align 8, !tbaa !20
%45 = load i8, ptr %43, align 1, !tbaa !25
%conv3.i12.i243 = zext i8 %45 to i32
br label %getchar_unlocked.exit13.i238
getchar_unlocked.exit13.i238: ; preds = %cond.false.i10.i241, %cond.true.i7.i235
%46 = phi ptr [ %.pre.i237, %cond.true.i7.i235 ], [ %41, %cond.false.i10.i241 ]
%47 = phi ptr [ %.pre.i237, %cond.true.i7.i235 ], [ %42, %cond.false.i10.i241 ]
%cond.i9.i239 = phi i32 [ %call.i8.i236, %cond.true.i7.i235 ], [ %conv3.i12.i243, %cond.false.i10.i241 ]
%cmp.i240 = icmp sgt i32 %cond.i9.i239, 47
br i1 %cmp.i240, label %do.body.i226, label %in.exit247, !llvm.loop !26
in.exit247: ; preds = %getchar_unlocked.exit13.i238
%conv11 = trunc i32 %add.i231 to i16
%48 = or i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds i16, ptr %call4, i64 %indvars.iv
store i16 %conv11, ptr %arrayidx, align 2, !tbaa !14
%_IO_read_ptr.i.i248 = getelementptr inbounds %struct._IO_FILE, ptr %46, i64 0, i32 1
%49 = load ptr, ptr %_IO_read_ptr.i.i248, align 8, !tbaa !20
%_IO_read_end.i.i249 = getelementptr inbounds %struct._IO_FILE, ptr %46, i64 0, i32 2
%50 = load ptr, ptr %_IO_read_end.i.i249, align 8, !tbaa !23
%cmp.not.i.i250 = icmp ult ptr %49, %50
br i1 %cmp.not.i.i250, label %cond.false.i.i275, label %cond.true.i.i251, !prof !24
cond.true.i.i251: ; preds = %in.exit247
%call.i.i252 = tail call i32 @__uflow(ptr noundef nonnull %46) #10
%.pre14.pre.i253 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %do.body.i257.preheader
cond.false.i.i275: ; preds = %in.exit247
%incdec.ptr.i.i276 = getelementptr inbounds i8, ptr %49, i64 1
store ptr %incdec.ptr.i.i276, ptr %_IO_read_ptr.i.i248, align 8, !tbaa !20
%51 = load i8, ptr %49, align 1, !tbaa !25
%conv3.i.i277 = zext i8 %51 to i32
br label %do.body.i257.preheader
do.body.i257.preheader: ; preds = %cond.false.i.i275, %cond.true.i.i251
%.ph313 = phi ptr [ %46, %cond.false.i.i275 ], [ %.pre14.pre.i253, %cond.true.i.i251 ]
%c.0.i259.ph = phi i32 [ %conv3.i.i277, %cond.false.i.i275 ], [ %call.i.i252, %cond.true.i.i251 ]
br label %do.body.i257
do.body.i257: ; preds = %do.body.i257.preheader, %getchar_unlocked.exit13.i269
%52 = phi ptr [ %57, %getchar_unlocked.exit13.i269 ], [ %.ph313, %do.body.i257.preheader ]
%53 = phi ptr [ %58, %getchar_unlocked.exit13.i269 ], [ %.ph313, %do.body.i257.preheader ]
%n.0.i258 = phi i32 [ %add.i262, %getchar_unlocked.exit13.i269 ], [ 0, %do.body.i257.preheader ]
%c.0.i259 = phi i32 [ %cond.i9.i270, %getchar_unlocked.exit13.i269 ], [ %c.0.i259.ph, %do.body.i257.preheader ]
%mul.i260 = mul nsw i32 %n.0.i258, 10
%and.i261 = and i32 %c.0.i259, 15
%add.i262 = add nsw i32 %and.i261, %mul.i260
%_IO_read_ptr.i4.i263 = getelementptr inbounds %struct._IO_FILE, ptr %53, i64 0, i32 1
%54 = load ptr, ptr %_IO_read_ptr.i4.i263, align 8, !tbaa !20
%_IO_read_end.i5.i264 = getelementptr inbounds %struct._IO_FILE, ptr %53, i64 0, i32 2
%55 = load ptr, ptr %_IO_read_end.i5.i264, align 8, !tbaa !23
%cmp.not.i6.i265 = icmp ult ptr %54, %55
br i1 %cmp.not.i6.i265, label %cond.false.i10.i272, label %cond.true.i7.i266, !prof !24
cond.true.i7.i266: ; preds = %do.body.i257
%call.i8.i267 = tail call i32 @__uflow(ptr noundef nonnull %53) #10
%.pre.i268 = load ptr, ptr @stdin, align 8, !tbaa !18
br label %getchar_unlocked.exit13.i269
cond.false.i10.i272: ; preds = %do.body.i257
%incdec.ptr.i11.i273 = getelementptr inbounds i8, ptr %54, i64 1
store ptr %incdec.ptr.i11.i273, ptr %_IO_read_ptr.i4.i263, align 8, !tbaa !20
%56 = load i8, ptr %54, align 1, !tbaa !25
%conv3.i12.i274 = zext i8 %56 to i32
br label %getchar_unlocked.exit13.i269
getchar_unlocked.exit13.i269: ; preds = %cond.false.i10.i272, %cond.true.i7.i266
%57 = phi ptr [ %.pre.i268, %cond.true.i7.i266 ], [ %52, %cond.false.i10.i272 ]
%58 = phi ptr [ %.pre.i268, %cond.true.i7.i266 ], [ %53, %cond.false.i10.i272 ]
%cond.i9.i270 = phi i32 [ %call.i8.i267, %cond.true.i7.i266 ], [ %conv3.i12.i274, %cond.false.i10.i272 ]
%cmp.i271 = icmp sgt i32 %cond.i9.i270, 47
br i1 %cmp.i271, label %do.body.i257, label %in.exit278, !llvm.loop !26
in.exit278: ; preds = %getchar_unlocked.exit13.i269
%conv14 = trunc i32 %add.i262 to i16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%arrayidx17 = getelementptr inbounds i16, ptr %call4, i64 %48
store i16 %conv14, ptr %arrayidx17, align 2, !tbaa !14
%idxprom18 = sext i32 %add.i231 to i64
%arrayidx19 = getelementptr inbounds [1002 x i16], ptr @hi, i64 0, i64 %idxprom18
%59 = load i16, ptr %arrayidx19, align 2, !tbaa !14
%inc20 = add i16 %59, 1
store i16 %inc20, ptr %arrayidx19, align 2, !tbaa !14
%idxprom21 = sext i32 %add.i262 to i64
%arrayidx22 = getelementptr inbounds [1002 x i16], ptr @hi, i64 0, i64 %idxprom21
%60 = load i16, ptr %arrayidx22, align 2, !tbaa !14
%inc23 = add i16 %60, 1
store i16 %inc23, ptr %arrayidx22, align 2, !tbaa !14
%tobool8.not = icmp eq i32 %dec, 0
br i1 %tobool8.not, label %for.cond.preheader, label %while.body9, !llvm.loop !30
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv290 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next291, %for.inc ]
%arrayidx26 = getelementptr inbounds [1002 x i16], ptr @hi, i64 0, i64 %indvars.iv290
%61 = load i16, ptr %arrayidx26, align 2, !tbaa !14
%tobool27.not = icmp eq i16 %61, 0
br i1 %tobool27.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%conv30 = sext i16 %61 to i32
%shl31 = shl nsw i32 %conv30, 1
%conv32 = sext i32 %shl31 to i64
%call33 = tail call noalias ptr @malloc(i64 noundef %conv32) #11
%arrayidx35 = getelementptr inbounds [1002 x ptr], ptr @to, i64 0, i64 %indvars.iv290
store ptr %call33, ptr %arrayidx35, align 8, !tbaa !18
%call41 = tail call noalias ptr @malloc(i64 noundef %conv32) #11
%arrayidx43 = getelementptr inbounds [1002 x ptr], ptr @no, i64 0, i64 %indvars.iv290
store ptr %call41, ptr %arrayidx43, align 8, !tbaa !18
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next291 = add nuw nsw i64 %indvars.iv290, 1
%exitcond.not = icmp eq i64 %indvars.iv.next291, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !31
for.end: ; preds = %for.inc, %for.cond.preheader
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @hi, i8 0, i64 %conv6, i1 false)
%cmp48.not285 = icmp slt i32 %add.i200, 1
br i1 %cmp48.not285, label %for.end89, label %for.body50.preheader
for.body50.preheader: ; preds = %for.end
%62 = or i32 %mul.i198, 1
%63 = and i32 %c.0.i197, 15
%64 = add i32 %62, %63
br label %for.body50
for.body50: ; preds = %for.body50.preheader, %for.body50
%indvars.iv293 = phi i64 [ 0, %for.body50.preheader ], [ %indvars.iv.next294, %for.body50 ]
%i.1286 = phi i32 [ 1, %for.body50.preheader ], [ %inc88, %for.body50 ]
%65 = or i64 %indvars.iv293, 1
%arrayidx53 = getelementptr inbounds i16, ptr %call4, i64 %indvars.iv293
%66 = load i16, ptr %arrayidx53, align 2, !tbaa !14
%indvars.iv.next294 = add nuw nsw i64 %indvars.iv293, 2
%arrayidx57 = getelementptr inbounds i16, ptr %call4, i64 %65
%67 = load i16, ptr %arrayidx57, align 2, !tbaa !14
%idxprom59 = sext i16 %66 to i64
%arrayidx60 = getelementptr inbounds [1002 x i16], ptr @hi, i64 0, i64 %idxprom59
%68 = load i16, ptr %arrayidx60, align 2, !tbaa !14
%inc61 = add i16 %68, 1
store i16 %inc61, ptr %arrayidx60, align 2, !tbaa !14
%arrayidx65 = getelementptr inbounds [1002 x ptr], ptr @to, i64 0, i64 %idxprom59
%69 = load ptr, ptr %arrayidx65, align 8, !tbaa !18
%idxprom66 = sext i16 %68 to i64
%arrayidx67 = getelementptr inbounds i16, ptr %69, i64 %idxprom66
store i16 %67, ptr %arrayidx67, align 2, !tbaa !14
%conv68 = trunc i32 %i.1286 to i16
%arrayidx70 = getelementptr inbounds [1002 x ptr], ptr @no, i64 0, i64 %idxprom59
%70 = load ptr, ptr %arrayidx70, align 8, !tbaa !18
%arrayidx72 = getelementptr inbounds i16, ptr %70, i64 %idxprom66
store i16 %conv68, ptr %arrayidx72, align 2, !tbaa !14
%idxprom73 = sext i16 %67 to i64
%arrayidx74 = getelementptr inbounds [1002 x i16], ptr @hi, i64 0, i64 %idxprom73
%71 = load i16, ptr %arrayidx74, align 2, !tbaa !14
%inc75 = add i16 %71, 1
store i16 %inc75, ptr %arrayidx74, align 2, !tbaa !14
%arrayidx79 = getelementptr inbounds [1002 x ptr], ptr @to, i64 0, i64 %idxprom73
%72 = load ptr, ptr %arrayidx79, align 8, !tbaa !18
%idxprom80 = sext i16 %71 to i64
%arrayidx81 = getelementptr inbounds i16, ptr %72, i64 %idxprom80
store i16 %66, ptr %arrayidx81, align 2, !tbaa !14
%conv82 = sub i16 0, %conv68
%arrayidx84 = getelementptr inbounds [1002 x ptr], ptr @no, i64 0, i64 %idxprom73
%73 = load ptr, ptr %arrayidx84, align 8, !tbaa !18
%arrayidx86 = getelementptr inbounds i16, ptr %73, i64 %idxprom80
store i16 %conv82, ptr %arrayidx86, align 2, !tbaa !14
%inc88 = add nuw i32 %i.1286, 1
%exitcond297.not = icmp eq i32 %inc88, %64
br i1 %exitcond297.not, label %for.cond47.for.end89_crit_edge, label %for.body50, !llvm.loop !32
for.cond47.for.end89_crit_edge: ; preds = %for.body50
%conv76.le = sext i16 %71 to i32
br label %for.end89
for.end89: ; preds = %for.cond47.for.end89_crit_edge, %for.end
%conv76284.lcssa = phi i32 [ %conv76.le, %for.cond47.for.end89_crit_edge ], [ %k.promoted, %for.end ]
store i32 %conv76284.lcssa, ptr %k, align 4, !tbaa !5
tail call void @free(ptr noundef %call4) #10
%call90 = call i32 @dijkstra(ptr noundef nonnull %k, i32 noundef %add.i138, i32 noundef %add.i169), !range !33
%74 = load i32, ptr %k, align 4, !tbaa !5
%call91 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %call90, i32 noundef %74)
br label %while.cond, !llvm.loop !34
while.end92: ; preds = %in.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #10
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
declare i32 @__uflow(ptr noundef) local_unnamed_addr #9
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nounwind }
attributes #11 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 2, !11, i64 4}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{i64 0, i64 2, !14, i64 2, i64 2, !14, i64 4, i64 2, !14}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !11, i64 2}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!21, !19, i64 8}
!21 = !{!"_IO_FILE", !6, i64 0, !19, i64 8, !19, i64 16, !19, i64 24, !19, i64 32, !19, i64 40, !19, i64 48, !19, i64 56, !19, i64 64, !19, i64 72, !19, i64 80, !19, i64 88, !19, i64 96, !19, i64 104, !6, i64 112, !6, i64 116, !22, i64 120, !11, i64 128, !7, i64 130, !7, i64 131, !19, i64 136, !22, i64 144, !19, i64 152, !19, i64 160, !19, i64 168, !19, i64 176, !22, i64 184, !6, i64 192, !7, i64 196}
!22 = !{!"long", !7, i64 0}
!23 = !{!21, !19, i64 16}
!24 = !{!"branch_weights", i32 2000, i32 1}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !17}
!28 = distinct !{!28, !17}
!29 = distinct !{!29, !17}
!30 = distinct !{!30, !17}
!31 = distinct !{!31, !17}
!32 = distinct !{!32, !17}
!33 = !{i32 -32768, i32 32768}
!34 = distinct !{!34, !17}
|
#include <stdio.h>
#include <stdlib.h>
#define Min(a, b) ((a) > (b) ? (b) : (a))
typedef struct {int a, b;} war;
int war_sort(const void *x, const void *y){
war *X = (war *)x, *Y = (war *)y;
return X->a - Y->a;
}
int
main(int argc, char *argv[])
{
int n, m;
scanf("%d %d", &n, &m);
war w[100001];
for(int i = 0; i < m; i++){
scanf("%d %d", &w[i].a, &w[i].b);
}
qsort(w, m, sizeof(war), war_sort);
int ans = 1;
int min = w[0].a, max = w[0].b;
for(int i = 1; i < m; i++){
if(w[i].a < max){
max = Min(max, w[i].b);
}else{
max = w[i].b;
ans++;
}
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257692/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257692/source.c"
target datalayout = "e-m:e-p270: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.war = type { i32, i32 }
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @war_sort(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
%w = alloca [100001 x %struct.war], 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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
call void @llvm.lifetime.start.p0(i64 800008, ptr nonnull %w) #6
%0 = load i32, ptr %m, align 4, !tbaa !10
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, 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 ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %w, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @war_sort) #6
%1 = load i32, ptr %m, align 4, !tbaa !10
%cmp1049 = icmp sgt i32 %1, 1
br i1 %cmp1049, label %for.body13.preheader, label %for.cond.cleanup12
for.body13.preheader: ; preds = %for.cond.cleanup
%b7 = getelementptr inbounds %struct.war, ptr %w, i64 0, i32 1
%2 = load i32, ptr %b7, align 4, !tbaa !11
%wide.trip.count = zext i32 %1 to i64
%3 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %3, 1
%4 = icmp eq i32 %1, 2
br i1 %4, label %for.cond.cleanup12.loopexit.unr-lcssa, label %for.body13.preheader.new
for.body13.preheader.new: ; preds = %for.body13.preheader
%unroll_iter = and i64 %3, -2
br label %for.body13
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x %struct.war], ptr %w, i64 0, i64 %indvars.iv
%b = getelementptr inbounds [100001 x %struct.war], ptr %w, 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
%5 = load i32, ptr %m, align 4, !tbaa !10
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !12
for.cond.cleanup12.loopexit.unr-lcssa: ; preds = %for.body13, %for.body13.preheader
%ans.1.lcssa.ph = phi i32 [ undef, %for.body13.preheader ], [ %ans.1.1, %for.body13 ]
%indvars.iv56.unr = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next57.1, %for.body13 ]
%max.051.unr = phi i32 [ %2, %for.body13.preheader ], [ %max.1.1, %for.body13 ]
%ans.050.unr = phi i32 [ 1, %for.body13.preheader ], [ %ans.1.1, %for.body13 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup12, label %for.body13.epil
for.body13.epil: ; preds = %for.cond.cleanup12.loopexit.unr-lcssa
%arrayidx15.epil = getelementptr inbounds [100001 x %struct.war], ptr %w, i64 0, i64 %indvars.iv56.unr
%7 = load i32, ptr %arrayidx15.epil, align 8, !tbaa !5
%cmp17.epil = icmp sge i32 %7, %max.051.unr
%inc30.epil = zext i1 %cmp17.epil to i32
%ans.1.epil = add nuw nsw i32 %ans.050.unr, %inc30.epil
br label %for.cond.cleanup12
for.cond.cleanup12: ; preds = %for.body13.epil, %for.cond.cleanup12.loopexit.unr-lcssa, %for.cond.cleanup
%ans.0.lcssa = phi i32 [ 1, %for.cond.cleanup ], [ %ans.1.lcssa.ph, %for.cond.cleanup12.loopexit.unr-lcssa ], [ %ans.1.epil, %for.body13.epil ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 800008, ptr nonnull %w) #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
for.body13: ; preds = %for.body13, %for.body13.preheader.new
%indvars.iv56 = phi i64 [ 1, %for.body13.preheader.new ], [ %indvars.iv.next57.1, %for.body13 ]
%max.051 = phi i32 [ %2, %for.body13.preheader.new ], [ %max.1.1, %for.body13 ]
%ans.050 = phi i32 [ 1, %for.body13.preheader.new ], [ %ans.1.1, %for.body13 ]
%niter = phi i64 [ 0, %for.body13.preheader.new ], [ %niter.next.1, %for.body13 ]
%arrayidx15 = getelementptr inbounds [100001 x %struct.war], ptr %w, i64 0, i64 %indvars.iv56
%8 = load i32, ptr %arrayidx15, align 8, !tbaa !5
%cmp17 = icmp sge i32 %8, %max.051
%b21 = getelementptr inbounds [100001 x %struct.war], ptr %w, i64 0, i64 %indvars.iv56, i32 1
%9 = load i32, ptr %b21, align 4, !tbaa !11
%.max.0 = call i32 @llvm.smin.i32(i32 %max.051, i32 %9)
%inc30 = zext i1 %cmp17 to i32
%ans.1 = add nuw nsw i32 %ans.050, %inc30
%max.1 = select i1 %cmp17, i32 %9, i32 %.max.0
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%arrayidx15.1 = getelementptr inbounds [100001 x %struct.war], ptr %w, i64 0, i64 %indvars.iv.next57
%10 = load i32, ptr %arrayidx15.1, align 8, !tbaa !5
%cmp17.1 = icmp sge i32 %10, %max.1
%b21.1 = getelementptr inbounds [100001 x %struct.war], ptr %w, i64 0, i64 %indvars.iv.next57, i32 1
%11 = load i32, ptr %b21.1, align 4, !tbaa !11
%.max.0.1 = call i32 @llvm.smin.i32(i32 %max.1, i32 %11)
%inc30.1 = zext i1 %cmp17.1 to i32
%ans.1.1 = add nuw nsw i32 %ans.1, %inc30.1
%max.1.1 = select i1 %cmp17.1, i32 %11, i32 %.max.0.1
%indvars.iv.next57.1 = add nuw nsw i64 %indvars.iv56, 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.cleanup12.loopexit.unr-lcssa, label %for.body13, !llvm.loop !14
}
; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
int main(){
int taka,aoki;
int n,i;
scanf("%d %d %d",&taka,&aoki,&n);
for(i=0;i<n;i++){
if(i%2==0){
taka/=2;
aoki+=taka;
} else {
aoki/=2;
taka+=aoki;
}
}
printf("%d %d",taka,aoki);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257735/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257735/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%taka = alloca i32, align 4
%aoki = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %taka) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %aoki) #3
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 %taka, ptr noundef nonnull %aoki, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%aoki.promoted = load i32, ptr %aoki, align 4, !tbaa !5
%taka.promoted = load i32, ptr %taka, align 4, !tbaa !5
%cmp11 = icmp sgt i32 %0, 0
br i1 %cmp11, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.014 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%div2713 = phi i32 [ %div2.sink, %for.inc ], [ %aoki.promoted, %entry ]
%add3912 = phi i32 [ %add3.sink, %for.inc ], [ %taka.promoted, %entry ]
%rem = and i32 %i.014, 1
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %for.body
%div = sdiv i32 %add3912, 2
%add = add nsw i32 %div2713, %div
br label %for.inc
if.else: ; preds = %for.body
%div2 = sdiv i32 %div2713, 2
%add3 = add nsw i32 %add3912, %div2
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%add3.sink = phi i32 [ %div, %if.then ], [ %add3, %if.else ]
%div2.sink = phi i32 [ %add, %if.then ], [ %div2, %if.else ]
%inc = add nuw nsw i32 %i.014, 1
%exitcond.not = icmp eq i32 %inc, %0
br i1 %exitcond.not, label %for.end.loopexit, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
store i32 %add3.sink, ptr %taka, align 4
store i32 %div2.sink, ptr %aoki, align 4
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%1 = phi i32 [ %aoki.promoted, %entry ], [ %div2.sink, %for.end.loopexit ]
%2 = phi i32 [ %taka.promoted, %entry ], [ %add3.sink, %for.end.loopexit ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2, i32 noundef %1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %aoki) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %taka) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int A,B,K,i=0;
scanf("%d %d %d",&A,&B,&K);
while(1){
if(A%2==1) A-=1;
B+=A/2;
A/=2;
i++;
if(i==K) break;
if(B%2==1) B-=1;
A+=B/2;
B/=2;
i++;
if(i==K) break;
}
printf("%d %d",A,B);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257821/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257821/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; 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
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B, ptr noundef nonnull %K)
%0 = load i32, ptr %K, align 4, !tbaa !5
%A.promoted = load i32, ptr %A, align 4, !tbaa !5
%B.promoted = load i32, ptr %B, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %if.end4, %entry
%div1025 = phi i32 [ %B.promoted, %entry ], [ %div10, %if.end4 ]
%add1121 = phi i32 [ %A.promoted, %entry ], [ %add11, %if.end4 ]
%i.0 = phi i32 [ 0, %entry ], [ %inc13, %if.end4 ]
%1 = and i32 %add1121, -2147483647
%cmp = icmp eq i32 %1, 1
%sub = sext i1 %cmp to i32
%spec.select = add nsw i32 %add1121, %sub
%div = sdiv i32 %spec.select, 2
%add = add nsw i32 %div1025, %div
%inc = or i32 %i.0, 1
%cmp2 = icmp eq i32 %inc, %0
br i1 %cmp2, label %while.end, label %if.end4
if.end4: ; preds = %while.cond
%2 = and i32 %add, -2147483647
%cmp6 = icmp eq i32 %2, 1
%sub8 = sext i1 %cmp6 to i32
%spec.select27 = add nsw i32 %add, %sub8
%div10 = sdiv i32 %spec.select27, 2
%add11 = add nsw i32 %div10, %div
%inc13 = add nuw nsw i32 %i.0, 2
%cmp14 = icmp eq i32 %inc13, %0
br i1 %cmp14, label %while.end, label %while.cond
while.end: ; preds = %if.end4, %while.cond
%div1026 = phi i32 [ %div10, %if.end4 ], [ %add, %while.cond ]
%add1123 = phi i32 [ %add11, %if.end4 ], [ %div, %while.cond ]
store i32 %add1123, ptr %A, align 4, !tbaa !5
store i32 %div1026, ptr %B, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add1123, i32 noundef %div1026)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1){
res *= a; if(mod>=1) res %= mod;
}
a *= a; if(mod>=1) a %= mod;
n >>= 1;
}
return res;
}
void initialize(){
}
int main(void){
initialize();
ll n,m,i,j,k,result=0,x,y,z;
int a[LIMIT2]={0};
ll s;
scanf("%lld %lld",&k,&s);
for(x=0;x<=k;x++){
for(y=0;y<=k;y++){
z = s-x-y;
if(0<=z && z<=k) result++;
}
}
printf("%lld\n",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257865/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257865/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@dx = dso_local local_unnamed_addr global [8 x i32] [i32 1, i32 0, i32 -1, i32 0, i32 1, i32 -1, i32 -1, i32 1], align 16
@dy = dso_local local_unnamed_addr global [8 x i32] [i32 0, i32 1, i32 0, i32 -1, i32 1, i32 1, i32 -1, i32 -1], align 16
@.str = private unnamed_addr constant [10 x i8] c"%lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%tobool.not4 = icmp eq i64 %b, 0
br i1 %tobool.not4, label %cond.end, label %cond.true
cond.true: ; preds = %entry, %cond.true
%b.tr6 = phi i64 [ %rem, %cond.true ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %cond.true ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %cond.end, label %cond.true
cond.end: ; preds = %cond.true, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %cond.true ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @nPr(i32 noundef %n, i32 noundef %r) local_unnamed_addr #0 {
entry:
%conv = sext i32 %r to i64
%cmp6 = icmp sgt i32 %r, 0
br i1 %cmp6, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%conv2 = sext i32 %n to i64
%xtraiter = and i64 %conv, 7
%0 = icmp ult i32 %r, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %conv, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %mul.7, %for.body ]
%i.07 = phi i64 [ 0, %for.body.lr.ph.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.7, %for.body ]
%sub = sub nsw i64 %conv2, %i.07
%mul = mul nsw i64 %result.08, %sub
%inc.neg = xor i64 %i.07, -1
%sub.1 = add i64 %inc.neg, %conv2
%mul.1 = mul nsw i64 %mul, %sub.1
%inc.1 = or i64 %i.07, 2
%sub.2 = sub nsw i64 %conv2, %inc.1
%mul.2 = mul nsw i64 %mul.1, %sub.2
%inc.2 = or i64 %i.07, 3
%sub.3 = sub nsw i64 %conv2, %inc.2
%mul.3 = mul nsw i64 %mul.2, %sub.3
%inc.3 = or i64 %i.07, 4
%sub.4 = sub nsw i64 %conv2, %inc.3
%mul.4 = mul nsw i64 %mul.3, %sub.4
%inc.4 = or i64 %i.07, 5
%sub.5 = sub nsw i64 %conv2, %inc.4
%mul.5 = mul nsw i64 %mul.4, %sub.5
%inc.5 = or i64 %i.07, 6
%sub.6 = sub nsw i64 %conv2, %inc.5
%mul.6 = mul nsw i64 %mul.5, %sub.6
%inc.6 = or i64 %i.07, 7
%sub.7 = sub nsw i64 %conv2, %inc.6
%mul.7 = mul nsw i64 %mul.6, %sub.7
%inc.7 = add nuw nsw i64 %i.07, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !5
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%mul.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %mul.7, %for.body ]
%result.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %mul.7, %for.body ]
%i.07.unr = phi i64 [ 0, %for.body.lr.ph ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%result.08.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %result.08.unr, %for.end.loopexit.unr-lcssa ]
%i.07.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.07.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%sub.epil = sub nsw i64 %conv2, %i.07.epil
%mul.epil = mul nsw i64 %result.08.epil, %sub.epil
%inc.epil = add nuw nsw i64 %i.07.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !7
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @nCr(i32 noundef %n, i32 noundef %r) local_unnamed_addr #2 {
entry:
%cmp = icmp slt i32 %n, %r
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%sub = sub nsw i32 %n, %r
%cond = tail call i32 @llvm.smin.i32(i32 %sub, i32 %r)
%conv = sext i32 %cond to i64
%cmp320 = icmp sgt i32 %cond, 0
br i1 %cmp320, label %for.body.lr.ph, label %cleanup
for.body.lr.ph: ; preds = %for.cond.preheader
%conv5 = sext i32 %n to i64
%xtraiter = and i64 %conv, 1
%0 = icmp eq i32 %cond, 1
br i1 %0, label %cleanup.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %conv, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%result.022 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.021 = phi i64 [ 0, %for.body.lr.ph.new ], [ %add.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub6 = sub nsw i64 %conv5, %i.021
%mul = mul nsw i64 %result.022, %sub6
%add = or i64 %i.021, 1
%div = sdiv i64 %mul, %add
%sub6.1 = sub nsw i64 %conv5, %add
%mul.1 = mul nsw i64 %div, %sub6.1
%add.1 = add nuw nsw i64 %i.021, 2
%div.1 = sdiv i64 %mul.1, %add.1
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %cleanup.loopexit.unr-lcssa, label %for.body, !llvm.loop !9
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 ]
%result.022.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.021.unr = phi i64 [ 0, %for.body.lr.ph ], [ %add.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %cleanup, label %for.body.epil
for.body.epil: ; preds = %cleanup.loopexit.unr-lcssa
%sub6.epil = sub nsw i64 %conv5, %i.021.unr
%mul.epil = mul nsw i64 %result.022.unr, %sub6.epil
%add.epil = add nuw nsw i64 %i.021.unr, 1
%div.epil = sdiv i64 %mul.epil, %add.epil
br label %cleanup
cleanup: ; preds = %for.body.epil, %cleanup.loopexit.unr-lcssa, %for.cond.preheader, %entry
%retval.0 = phi i64 [ 0, %entry ], [ 1, %for.cond.preheader ], [ %div.lcssa.ph, %cleanup.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !10
%1 = load i32, ptr %b, align 4, !tbaa !10
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = zext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 -1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downint(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !10
%1 = load i32, ptr %b, align 4, !tbaa !10
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%cond = sext i1 %cmp1 to i32
%cond2 = select i1 %cmp, i32 1, i32 %cond
ret i32 %cond2
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @upchar(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %left, ptr noundef nonnull dereferenceable(1) %right) #11
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @downchar(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %right, ptr noundef nonnull dereferenceable(1) %left) #11
ret i32 %call
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: write) uwtable
define dso_local void @tmpInit(ptr nocapture noundef writeonly %c, i64 noundef %m) local_unnamed_addr #6 {
entry:
%cmp4 = icmp sgt i64 %m, 0
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i64 %m, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %m, -8
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 %c, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !10
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 4, !tbaa !10
%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 !14
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %m
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%i.05.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%i.05 = phi i64 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader7 ]
%conv = trunc i64 %i.05 to i32
%arrayidx = getelementptr inbounds i32, ptr %c, i64 %i.05
store i32 %conv, ptr %arrayidx, align 4, !tbaa !10
%inc = add nuw nsw i64 %i.05, 1
%exitcond.not = icmp eq i64 %inc, %m
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !17
for.end: ; preds = %for.body, %middle.block, %entry
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @modpow(i64 noundef %a, i64 noundef %n, i64 noundef %mod) local_unnamed_addr #0 {
entry:
%cmp29 = icmp sgt i64 %n, 0
br i1 %cmp29, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%cmp1 = icmp sgt i64 %mod, 0
br i1 %cmp1, label %while.body.us.us, label %while.body
while.body.us.us: ; preds = %while.body.lr.ph, %if.then6.us.us
%res.032.us.us = phi i64 [ %res.123.us.us, %if.then6.us.us ], [ 1, %while.body.lr.ph ]
%a.addr.031.us.us = phi i64 [ %rem7.us.us, %if.then6.us.us ], [ %a, %while.body.lr.ph ]
%n.addr.030.us.us = phi i64 [ %shr.us.us, %if.then6.us.us ], [ %n, %while.body.lr.ph ]
%and.us.us = and i64 %n.addr.030.us.us, 1
%tobool.not.us.us = icmp eq i64 %and.us.us, 0
br i1 %tobool.not.us.us, label %if.then6.us.us, label %if.then.us.us
if.then.us.us: ; preds = %while.body.us.us
%mul.us.us = mul nsw i64 %res.032.us.us, %a.addr.031.us.us
%rem.us.us = srem i64 %mul.us.us, %mod
br label %if.then6.us.us
if.then6.us.us: ; preds = %while.body.us.us, %if.then.us.us
%res.123.us.us = phi i64 [ %rem.us.us, %if.then.us.us ], [ %res.032.us.us, %while.body.us.us ]
%mul424.us.us = mul nsw i64 %a.addr.031.us.us, %a.addr.031.us.us
%rem7.us.us = srem i64 %mul424.us.us, %mod
%shr.us.us = lshr i64 %n.addr.030.us.us, 1
%cmp.us.us.not = icmp ult i64 %n.addr.030.us.us, 2
br i1 %cmp.us.us.not, label %while.end, label %while.body.us.us, !llvm.loop !18
while.body: ; preds = %while.body.lr.ph, %while.body
%res.032 = phi i64 [ %spec.select, %while.body ], [ 1, %while.body.lr.ph ]
%a.addr.031 = phi i64 [ %a.addr.1, %while.body ], [ %a, %while.body.lr.ph ]
%n.addr.030 = phi i64 [ %shr, %while.body ], [ %n, %while.body.lr.ph ]
%and = and i64 %n.addr.030, 1
%tobool.not = icmp eq i64 %and, 0
%mul = select i1 %tobool.not, i64 1, i64 %a.addr.031
%spec.select = mul nsw i64 %res.032, %mul
%a.addr.1 = mul nsw i64 %a.addr.031, %a.addr.031
%shr = lshr i64 %n.addr.030, 1
%cmp.not = icmp ult i64 %n.addr.030, 2
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %while.body, %if.then6.us.us, %entry
%res.0.lcssa = phi i64 [ 1, %entry ], [ %res.123.us.us, %if.then6.us.us ], [ %spec.select, %while.body ]
ret i64 %res.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local void @initialize() local_unnamed_addr #7 {
entry:
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #8 {
entry:
%k = alloca i64, align 8
%s = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %k) #12
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %s) #12
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i64, ptr %k, align 8, !tbaa !19
%cmp.not21 = icmp slt i64 %0, 0
br i1 %cmp.not21, label %for.end10, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i64, ptr %s, align 8
%2 = add i64 %0, 1
%xtraiter = and i64 %2, 1
%3 = icmp eq i64 %0, 0
%unroll_iter = and i64 %2, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.inc8_crit_edge
%result.023 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %result.2.lcssa, %for.cond1.for.inc8_crit_edge ]
%x.022 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %inc9, %for.cond1.for.inc8_crit_edge ]
br i1 %3, label %for.cond1.for.inc8_crit_edge.unr-lcssa, label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.body3
%result.120 = phi i64 [ %result.2.1, %for.body3 ], [ %result.023, %for.cond1.preheader ]
%y.019 = phi i64 [ %inc7.1, %for.body3 ], [ 0, %for.cond1.preheader ]
%niter = phi i64 [ %niter.next.1, %for.body3 ], [ 0, %for.cond1.preheader ]
%4 = add nuw i64 %y.019, %x.022
%sub4 = sub i64 %1, %4
%cmp5 = icmp sgt i64 %sub4, -1
%cmp6.not = icmp sle i64 %sub4, %0
%or.cond.not = and i1 %cmp5, %cmp6.not
%inc = zext i1 %or.cond.not to i64
%result.2 = add nsw i64 %result.120, %inc
%inc7 = or i64 %y.019, 1
%5 = add nuw i64 %inc7, %x.022
%sub4.1 = sub i64 %1, %5
%cmp5.1 = icmp sgt i64 %sub4.1, -1
%cmp6.not.1 = icmp sle i64 %sub4.1, %0
%or.cond.not.1 = and i1 %cmp5.1, %cmp6.not.1
%inc.1 = zext i1 %or.cond.not.1 to i64
%result.2.1 = add nsw i64 %result.2, %inc.1
%inc7.1 = add nuw i64 %y.019, 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.inc8_crit_edge.unr-lcssa, label %for.body3, !llvm.loop !21
for.cond1.for.inc8_crit_edge.unr-lcssa: ; preds = %for.body3, %for.cond1.preheader
%result.2.lcssa.ph = phi i64 [ undef, %for.cond1.preheader ], [ %result.2.1, %for.body3 ]
%result.120.unr = phi i64 [ %result.023, %for.cond1.preheader ], [ %result.2.1, %for.body3 ]
%y.019.unr = phi i64 [ 0, %for.cond1.preheader ], [ %inc7.1, %for.body3 ]
br i1 %lcmp.mod.not, label %for.cond1.for.inc8_crit_edge, label %for.body3.epil
for.body3.epil: ; preds = %for.cond1.for.inc8_crit_edge.unr-lcssa
%6 = add nuw i64 %y.019.unr, %x.022
%sub4.epil = sub i64 %1, %6
%cmp5.epil = icmp sgt i64 %sub4.epil, -1
%cmp6.not.epil = icmp sle i64 %sub4.epil, %0
%or.cond.not.epil = and i1 %cmp5.epil, %cmp6.not.epil
%inc.epil = zext i1 %or.cond.not.epil to i64
%result.2.epil = add nsw i64 %result.120.unr, %inc.epil
br label %for.cond1.for.inc8_crit_edge
for.cond1.for.inc8_crit_edge: ; preds = %for.cond1.for.inc8_crit_edge.unr-lcssa, %for.body3.epil
%result.2.lcssa = phi i64 [ %result.2.lcssa.ph, %for.cond1.for.inc8_crit_edge.unr-lcssa ], [ %result.2.epil, %for.body3.epil ]
%inc9 = add nuw i64 %x.022, 1
%exitcond25.not = icmp eq i64 %x.022, %0
br i1 %exitcond25.not, label %for.end10, label %for.cond1.preheader, !llvm.loop !22
for.end10: ; preds = %for.cond1.for.inc8_crit_edge, %entry
%result.0.lcssa = phi i64 [ 0, %entry ], [ %result.2.lcssa, %for.cond1.for.inc8_crit_edge ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %result.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %s) #12
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %k) #12
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #9
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #10
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.unroll.disable"}
!9 = distinct !{!9, !6}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C/C++ TBAA"}
!14 = distinct !{!14, !6, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !6, !16, !15}
!18 = distinct !{!18, !6}
!19 = !{!20, !20, i64 0}
!20 = !{!"long long", !12, i64 0}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
|
#include<stdio.h>
int main(){
int k,s,count=0;
scanf("%d%d",&k,&s);
for(int i=0;i<=k;i++){
for(int j=0;j<=k;j++){
int l=s-i-j;
if(l>=0&&l<=k){
count++;
}
}
}
printf("%d",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257908/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257908/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 0
br i1 %cmp.not22, label %for.cond.cleanup, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert29 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat30 = shufflevector <4 x i32> %broadcast.splatinsert29, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.cond.cleanup3_crit_edge
%i.024 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc10, %for.cond1.for.cond.cleanup3_crit_edge ]
%count.023 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %count.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.023, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i.024, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = add nuw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw <4 x i32> %step.add, %broadcast.splat
%6 = sub <4 x i32> %broadcast.splat30, %4
%7 = sub <4 x i32> %broadcast.splat30, %5
%8 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sle <4 x i32> %6, %broadcast.splat32
%11 = icmp sle <4 x i32> %7, %broadcast.splat32
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi28, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
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)
br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader, %middle.block
%j.021.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
%count.120.ph = phi i32 [ %count.023, %for.cond1.preheader ], [ %19, %middle.block ]
br label %for.body4
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
for.cond1.for.cond.cleanup3_crit_edge: ; preds = %for.body4, %middle.block
%count.2.lcssa = phi i32 [ %19, %middle.block ], [ %count.2, %for.body4 ]
%inc10 = add nuw i32 %i.024, 1
%exitcond26.not = icmp eq i32 %i.024, %0
br i1 %exitcond26.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.021 = phi i32 [ %inc8, %for.body4 ], [ %j.021.ph, %for.body4.preheader ]
%count.120 = phi i32 [ %count.2, %for.body4 ], [ %count.120.ph, %for.body4.preheader ]
%20 = add nuw i32 %j.021, %i.024
%sub5 = sub i32 %1, %20
%cmp6 = icmp sgt i32 %sub5, -1
%cmp7.not = icmp sle i32 %sub5, %0
%or.cond.not = and i1 %cmp6, %cmp7.not
%inc = zext i1 %or.cond.not to i32
%count.2 = add nsw i32 %count.120, %inc
%inc8 = add nuw i32 %j.021, 1
%exitcond.not = icmp eq i32 %j.021, %0
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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.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, !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>
int main()
{
int sum;
int count;
int in_s, in_k;
int z;
count = 0;
scanf("%d %d", &in_k, &in_s);
// printf("s = %d k = %d \n", in_k, in_s);
for (int i = 0; i <= in_k; i++) {
for(int j = 0; j <= in_k; j++) {
// for (int k = 0; k <= in_k; k++) {
// if (i <= in_k && j <= in_k && k <= in_k) {
// sum = i + j + k;
// printf("x = %d y = %d z = %d sum = %d\n", i, j, k, sum);
// if (sum == in_s) {
// count++;
// }
z = in_s - i -j;
if (z >= 0 && z <= in_k) {
count++;
}
}
}
printf("%d\n", count);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257951/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257951/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%in_s = alloca i32, align 4
%in_k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in_s) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %in_k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %in_k, ptr noundef nonnull %in_s)
%0 = load i32, ptr %in_k, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 0
br i1 %cmp.not22, label %for.cond.cleanup, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %in_s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert29 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat30 = shufflevector <4 x i32> %broadcast.splatinsert29, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.cond.cleanup3_crit_edge
%i.024 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc10, %for.cond1.for.cond.cleanup3_crit_edge ]
%count.023 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %count.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %count.023, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i.024, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = add nuw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw <4 x i32> %step.add, %broadcast.splat
%6 = sub <4 x i32> %broadcast.splat30, %4
%7 = sub <4 x i32> %broadcast.splat30, %5
%8 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sle <4 x i32> %6, %broadcast.splat32
%11 = icmp sle <4 x i32> %7, %broadcast.splat32
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi28, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
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)
br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader, %middle.block
%j.021.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
%count.120.ph = phi i32 [ %count.023, %for.cond1.preheader ], [ %19, %middle.block ]
br label %for.body4
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %count.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in_k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %in_s) #4
ret i32 0
for.cond1.for.cond.cleanup3_crit_edge: ; preds = %for.body4, %middle.block
%count.2.lcssa = phi i32 [ %19, %middle.block ], [ %count.2, %for.body4 ]
%inc10 = add nuw i32 %i.024, 1
%exitcond26.not = icmp eq i32 %i.024, %0
br i1 %exitcond26.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%j.021 = phi i32 [ %inc8, %for.body4 ], [ %j.021.ph, %for.body4.preheader ]
%count.120 = phi i32 [ %count.2, %for.body4 ], [ %count.120.ph, %for.body4.preheader ]
%20 = add nuw i32 %j.021, %i.024
%sub5 = sub i32 %1, %20
%cmp6 = icmp sgt i32 %sub5, -1
%cmp7.not = icmp sle i32 %sub5, %0
%or.cond.not = and i1 %cmp6, %cmp7.not
%inc = zext i1 %or.cond.not to i32
%count.2 = add nsw i32 %count.120, %inc
%inc8 = add nuw i32 %j.021, 1
%exitcond.not = icmp eq i32 %j.021, %0
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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.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, !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 <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
int main(int argc, char const *argv[])
{
int k,s;
int cnt = 0,z;
scanf("%d%d",&k,&s);
for (int x = 0; x <= k ; ++x)
{
for (int y = 0; y <= k; ++y){
z = s - x - y;
if(0 <= z && z <= k) ++cnt;
}
}
printf("%d\n",cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_257995/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_257995/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not22 = icmp slt i32 %0, 0
br i1 %cmp.not22, label %for.cond.cleanup, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert29 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat30 = shufflevector <4 x i32> %broadcast.splatinsert29, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert31 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat32 = shufflevector <4 x i32> %broadcast.splatinsert31, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.cond.cleanup3_crit_edge
%x.024 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc10, %for.cond1.for.cond.cleanup3_crit_edge ]
%cnt.023 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %cnt.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %cnt.023, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %x.024, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%4 = add nuw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw <4 x i32> %step.add, %broadcast.splat
%6 = sub <4 x i32> %broadcast.splat30, %4
%7 = sub <4 x i32> %broadcast.splat30, %5
%8 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sle <4 x i32> %6, %broadcast.splat32
%11 = icmp sle <4 x i32> %7, %broadcast.splat32
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi28, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
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)
br i1 %cmp.n, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond1.preheader, %middle.block
%y.021.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
%cnt.120.ph = phi i32 [ %cnt.023, %for.cond1.preheader ], [ %19, %middle.block ]
br label %for.body4
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %cnt.2.lcssa, %for.cond1.for.cond.cleanup3_crit_edge ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
for.cond1.for.cond.cleanup3_crit_edge: ; preds = %for.body4, %middle.block
%cnt.2.lcssa = phi i32 [ %19, %middle.block ], [ %cnt.2, %for.body4 ]
%inc10 = add nuw i32 %x.024, 1
%exitcond26.not = icmp eq i32 %x.024, %0
br i1 %exitcond26.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !13
for.body4: ; preds = %for.body4.preheader, %for.body4
%y.021 = phi i32 [ %inc8, %for.body4 ], [ %y.021.ph, %for.body4.preheader ]
%cnt.120 = phi i32 [ %cnt.2, %for.body4 ], [ %cnt.120.ph, %for.body4.preheader ]
%20 = add nuw i32 %y.021, %x.024
%sub5 = sub i32 %1, %20
%cmp6 = icmp sgt i32 %sub5, -1
%cmp7.not = icmp sle i32 %sub5, %0
%or.cond.not = and i1 %cmp6, %cmp7.not
%inc = zext i1 %or.cond.not to i32
%cnt.2 = add nsw i32 %cnt.120, %inc
%inc8 = add nuw i32 %y.021, 1
%exitcond.not = icmp eq i32 %y.021, %0
br i1 %exitcond.not, label %for.cond1.for.cond.cleanup3_crit_edge, label %for.body4, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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.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, !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>
int main()
{
int k,s;
scanf("%d %d",&k,&s);
int x,y,z;
int ans=0;
for(x=0;x<=k;x++)
{
for(y=0;y<=k;y++)
{
z=s-x-y;
if(0<=z && z<=k)
ans++;
}
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258037/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258037/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not21 = icmp slt i32 %0, 0
br i1 %cmp.not21, label %for.end10, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %s, align 4
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert28 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat29 = shufflevector <4 x i32> %broadcast.splatinsert28, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert30 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat31 = shufflevector <4 x i32> %broadcast.splatinsert30, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.inc8_crit_edge
%ans.023 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %ans.2.lcssa, %for.cond1.for.inc8_crit_edge ]
%x.022 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc9, %for.cond1.for.inc8_crit_edge ]
br i1 %min.iters.check, label %for.body3.preheader, label %vector.ph
vector.ph: ; preds = %for.cond1.preheader
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %ans.023, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %x.022, 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> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi26 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %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>
%4 = add nuw <4 x i32> %vec.ind, %broadcast.splat
%5 = add nuw <4 x i32> %step.add, %broadcast.splat
%6 = sub <4 x i32> %broadcast.splat29, %4
%7 = sub <4 x i32> %broadcast.splat29, %5
%8 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sle <4 x i32> %6, %broadcast.splat31
%11 = icmp sle <4 x i32> %7, %broadcast.splat31
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi26, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !9
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)
br i1 %cmp.n, label %for.cond1.for.inc8_crit_edge, label %for.body3.preheader
for.body3.preheader: ; preds = %for.cond1.preheader, %middle.block
%ans.120.ph = phi i32 [ %ans.023, %for.cond1.preheader ], [ %19, %middle.block ]
%y.019.ph = phi i32 [ 0, %for.cond1.preheader ], [ %n.vec, %middle.block ]
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.body3
%ans.120 = phi i32 [ %ans.2, %for.body3 ], [ %ans.120.ph, %for.body3.preheader ]
%y.019 = phi i32 [ %inc7, %for.body3 ], [ %y.019.ph, %for.body3.preheader ]
%20 = add nuw i32 %y.019, %x.022
%sub4 = sub i32 %1, %20
%cmp5 = icmp sgt i32 %sub4, -1
%cmp6.not = icmp sle i32 %sub4, %0
%or.cond.not = and i1 %cmp5, %cmp6.not
%inc = zext i1 %or.cond.not to i32
%ans.2 = add nsw i32 %ans.120, %inc
%inc7 = add nuw i32 %y.019, 1
%exitcond.not = icmp eq i32 %y.019, %0
br i1 %exitcond.not, label %for.cond1.for.inc8_crit_edge, label %for.body3, !llvm.loop !13
for.cond1.for.inc8_crit_edge: ; preds = %for.body3, %middle.block
%ans.2.lcssa = phi i32 [ %19, %middle.block ], [ %ans.2, %for.body3 ]
%inc9 = add nuw i32 %x.022, 1
%exitcond25.not = icmp eq i32 %x.022, %0
br i1 %exitcond25.not, label %for.end10, label %for.cond1.preheader, !llvm.loop !14
for.end10: ; preds = %for.cond1.for.inc8_crit_edge, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.2.lcssa, %for.cond1.for.inc8_crit_edge ]
%call11 = 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 %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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, !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}
|
#include<stdio.h>
int sum(int a,int b)
{
int i,j,l;
int c=0;
if(3*a==b) return 1;
for(i=0;i<=a;i++){
for(j=0;j<=a;j++){
l=b-i-j;
if(l>=0 && l<=a) c++;
}
}
return c;
}
int main(void)
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d\n",sum(a,b));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258080/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258080/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @sum(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%mul = mul nsw i32 %a, 3
%cmp = icmp eq i32 %mul, %b
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp1.not30 = icmp slt i32 %a, 0
br i1 %cmp1.not30, label %cleanup, label %for.cond2.preheader.preheader
for.cond2.preheader.preheader: ; preds = %for.cond.preheader
%0 = add i32 %a, 1
%min.iters.check = icmp ult i32 %0, 8
%n.vec = and i32 %0, -8
%broadcast.splatinsert37 = insertelement <4 x i32> poison, i32 %b, i64 0
%broadcast.splat38 = shufflevector <4 x i32> %broadcast.splatinsert37, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert39 = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat40 = shufflevector <4 x i32> %broadcast.splatinsert39, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %0, %n.vec
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.cond2.preheader.preheader, %for.cond2.for.inc11_crit_edge
%c.032 = phi i32 [ %c.2.lcssa, %for.cond2.for.inc11_crit_edge ], [ 0, %for.cond2.preheader.preheader ]
%i.031 = phi i32 [ %inc12, %for.cond2.for.inc11_crit_edge ], [ 0, %for.cond2.preheader.preheader ]
br i1 %min.iters.check, label %for.body4.preheader, label %vector.ph
vector.ph: ; preds = %for.cond2.preheader
%1 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.032, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i.031, 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> [ %1, %vector.ph ], [ %14, %vector.body ]
%vec.phi35 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %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>
%2 = add nuw <4 x i32> %broadcast.splat, %vec.ind
%3 = add nuw <4 x i32> %broadcast.splat, %step.add
%4 = sub <4 x i32> %broadcast.splat38, %2
%5 = sub <4 x i32> %broadcast.splat38, %3
%6 = icmp sgt <4 x i32> %4, <i32 -1, i32 -1, i32 -1, i32 -1>
%7 = icmp sgt <4 x i32> %5, <i32 -1, i32 -1, i32 -1, i32 -1>
%8 = icmp sle <4 x i32> %4, %broadcast.splat40
%9 = icmp sle <4 x i32> %5, %broadcast.splat40
%10 = and <4 x i1> %6, %8
%11 = and <4 x i1> %7, %9
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = zext <4 x i1> %11 to <4 x i32>
%14 = add <4 x i32> %vec.phi, %12
%15 = add <4 x i32> %vec.phi35, %13
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%16 = icmp eq i32 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !5
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %15, %14
%17 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond2.for.inc11_crit_edge, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond2.preheader, %middle.block
%c.129.ph = phi i32 [ %c.032, %for.cond2.preheader ], [ %17, %middle.block ]
%j.028.ph = phi i32 [ 0, %for.cond2.preheader ], [ %n.vec, %middle.block ]
br label %for.body4
for.body4: ; preds = %for.body4.preheader, %for.body4
%c.129 = phi i32 [ %c.2, %for.body4 ], [ %c.129.ph, %for.body4.preheader ]
%j.028 = phi i32 [ %inc10, %for.body4 ], [ %j.028.ph, %for.body4.preheader ]
%18 = add nuw i32 %i.031, %j.028
%sub5 = sub i32 %b, %18
%cmp6 = icmp sgt i32 %sub5, -1
%cmp7.not = icmp sle i32 %sub5, %a
%or.cond.not = and i1 %cmp6, %cmp7.not
%inc = zext i1 %or.cond.not to i32
%c.2 = add nsw i32 %c.129, %inc
%inc10 = add nuw i32 %j.028, 1
%exitcond.not = icmp eq i32 %j.028, %a
br i1 %exitcond.not, label %for.cond2.for.inc11_crit_edge, label %for.body4, !llvm.loop !9
for.cond2.for.inc11_crit_edge: ; preds = %for.body4, %middle.block
%c.2.lcssa = phi i32 [ %17, %middle.block ], [ %c.2, %for.body4 ]
%inc12 = add nuw i32 %i.031, 1
%exitcond34.not = icmp eq i32 %i.031, %a
br i1 %exitcond34.not, label %cleanup, label %for.cond2.preheader, !llvm.loop !10
cleanup: ; preds = %for.cond2.for.inc11_crit_edge, %for.cond.preheader, %entry
%retval.0 = phi i32 [ 1, %entry ], [ 0, %for.cond.preheader ], [ %c.2.lcssa, %for.cond2.for.inc11_crit_edge ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !11
%1 = load i32, ptr %b, align 4, !tbaa !11
%mul.i = mul nsw i32 %0, 3
%cmp.i = icmp eq i32 %mul.i, %1
br i1 %cmp.i, label %sum.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %entry
%cmp1.not30.i = icmp slt i32 %0, 0
br i1 %cmp1.not30.i, label %sum.exit, label %for.cond2.preheader.i.preheader
for.cond2.preheader.i.preheader: ; preds = %for.cond.preheader.i
%2 = add i32 %0, 1
%min.iters.check = icmp ult i32 %2, 8
%n.vec = and i32 %2, -8
%broadcast.splatinsert5 = insertelement <4 x i32> poison, i32 %1, i64 0
%broadcast.splat6 = shufflevector <4 x i32> %broadcast.splatinsert5, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert7 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat8 = shufflevector <4 x i32> %broadcast.splatinsert7, <4 x i32> poison, <4 x i32> zeroinitializer
%cmp.n = icmp eq i32 %2, %n.vec
br label %for.cond2.preheader.i
for.cond2.preheader.i: ; preds = %for.cond2.preheader.i.preheader, %for.cond2.for.inc11_crit_edge.i
%c.032.i = phi i32 [ %c.2.i.lcssa, %for.cond2.for.inc11_crit_edge.i ], [ 0, %for.cond2.preheader.i.preheader ]
%i.031.i = phi i32 [ %inc12.i, %for.cond2.for.inc11_crit_edge.i ], [ 0, %for.cond2.preheader.i.preheader ]
br i1 %min.iters.check, label %for.body4.i.preheader, label %vector.ph
vector.ph: ; preds = %for.cond2.preheader.i
%3 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %c.032.i, i64 0
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i.031.i, 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> [ %3, %vector.ph ], [ %16, %vector.body ]
%vec.phi3 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %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>
%4 = add nuw <4 x i32> %broadcast.splat, %vec.ind
%5 = add nuw <4 x i32> %broadcast.splat, %step.add
%6 = sub <4 x i32> %broadcast.splat6, %4
%7 = sub <4 x i32> %broadcast.splat6, %5
%8 = icmp sgt <4 x i32> %6, <i32 -1, i32 -1, i32 -1, i32 -1>
%9 = icmp sgt <4 x i32> %7, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sle <4 x i32> %6, %broadcast.splat8
%11 = icmp sle <4 x i32> %7, %broadcast.splat8
%12 = and <4 x i1> %8, %10
%13 = and <4 x i1> %9, %11
%14 = zext <4 x i1> %12 to <4 x i32>
%15 = zext <4 x i1> %13 to <4 x i32>
%16 = add <4 x i32> %vec.phi, %14
%17 = add <4 x i32> %vec.phi3, %15
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%18 = icmp eq i32 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !15
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)
br i1 %cmp.n, label %for.cond2.for.inc11_crit_edge.i, label %for.body4.i.preheader
for.body4.i.preheader: ; preds = %for.cond2.preheader.i, %middle.block
%c.129.i.ph = phi i32 [ %c.032.i, %for.cond2.preheader.i ], [ %19, %middle.block ]
%j.028.i.ph = phi i32 [ 0, %for.cond2.preheader.i ], [ %n.vec, %middle.block ]
br label %for.body4.i
for.body4.i: ; preds = %for.body4.i.preheader, %for.body4.i
%c.129.i = phi i32 [ %c.2.i, %for.body4.i ], [ %c.129.i.ph, %for.body4.i.preheader ]
%j.028.i = phi i32 [ %inc10.i, %for.body4.i ], [ %j.028.i.ph, %for.body4.i.preheader ]
%20 = add nuw i32 %i.031.i, %j.028.i
%sub5.i = sub i32 %1, %20
%cmp6.i = icmp sgt i32 %sub5.i, -1
%cmp7.not.i = icmp sle i32 %sub5.i, %0
%or.cond.not.i = and i1 %cmp6.i, %cmp7.not.i
%inc.i = zext i1 %or.cond.not.i to i32
%c.2.i = add nsw i32 %c.129.i, %inc.i
%inc10.i = add nuw i32 %j.028.i, 1
%exitcond.not.i = icmp eq i32 %j.028.i, %0
br i1 %exitcond.not.i, label %for.cond2.for.inc11_crit_edge.i, label %for.body4.i, !llvm.loop !16
for.cond2.for.inc11_crit_edge.i: ; preds = %for.body4.i, %middle.block
%c.2.i.lcssa = phi i32 [ %19, %middle.block ], [ %c.2.i, %for.body4.i ]
%inc12.i = add nuw i32 %i.031.i, 1
%exitcond34.not.i = icmp eq i32 %i.031.i, %0
br i1 %exitcond34.not.i, label %sum.exit, label %for.cond2.preheader.i, !llvm.loop !10
sum.exit: ; preds = %for.cond2.for.inc11_crit_edge.i, %entry, %for.cond.preheader.i
%retval.0.i = phi i32 [ 1, %entry ], [ 0, %for.cond.preheader.i ], [ %c.2.i.lcssa, %for.cond2.for.inc11_crit_edge.i ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %retval.0.i)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!5, !6, !7, !8}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.isvectorized", i32 1}
!8 = !{!"llvm.loop.unroll.runtime.disable"}
!9 = distinct !{!9, !6, !8, !7}
!10 = distinct !{!10, !6}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C/C++ TBAA"}
!15 = distinct !{!15, !6, !7, !8}
!16 = distinct !{!16, !6, !8, !7}
|
#include<stdio.h>
#define min(a,b) ((a)<(b)?(a):(b))
int main(){
int k,s,a,i,j;
long ans=0;
scanf("%d %d",&k,&s);
a=(s+2)/3;
for(i=a;i<=min(k,s);i++){
if(s==i*3){
ans++;
continue;
}
j=0;
if(s>=2*i) j++;
if((s-i)%2==0) j++;
ans+=3*j+6*(min(i,s-i)-(s-i+1)/2-j+1);
}
printf("%ld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258130/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258130/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%s = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k, ptr noundef nonnull %s)
%0 = load i32, ptr %s, align 4
%add = add nsw i32 %0, 2
%div = sdiv i32 %add, 3
%1 = load i32, ptr %k, align 4
%cond = call i32 @llvm.smin.i32(i32 %1, i32 %0)
%cmp1.not45 = icmp sgt i32 %div, %cond
br i1 %cmp1.not45, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%ans.047 = phi i64 [ %add28, %for.inc ], [ 0, %entry ]
%i.046 = phi i32 [ %inc29, %for.inc ], [ %div, %entry ]
%mul = mul nsw i32 %i.046, 3
%cmp2 = icmp eq i32 %0, %mul
br i1 %cmp2, label %for.inc, label %if.end
if.end: ; preds = %for.body
%mul3 = shl nsw i32 %i.046, 1
%cmp4.not = icmp sge i32 %0, %mul3
%spec.select = zext i1 %cmp4.not to i32
%sub = sub nsw i32 %0, %i.046
%2 = and i32 %sub, 1
%cmp8 = icmp eq i32 %2, 0
%inc10 = select i1 %cmp4.not, i32 2, i32 1
%j.1 = select i1 %cmp8, i32 %inc10, i32 %spec.select
%mul12 = mul nuw nsw i32 %j.1, 3
%cond19 = call i32 @llvm.smin.i32(i32 %i.046, i32 %sub)
%add21 = add nsw i32 %sub, 1
%div22.neg = sdiv i32 %add21, -2
%sub23 = add i32 %div22.neg, %cond19
%sub24 = sub i32 %sub23, %j.1
%3 = mul i32 %sub24, 6
%mul26 = add nuw nsw i32 %mul12, 6
%add27 = add i32 %mul26, %3
%conv = sext i32 %add27 to i64
br label %for.inc
for.inc: ; preds = %for.body, %if.end
%conv.sink = phi i64 [ %conv, %if.end ], [ 1, %for.body ]
%add28 = add nsw i64 %ans.047, %conv.sink
%inc29 = add i32 %i.046, 1
%exitcond.not = icmp eq i32 %i.046, %cond
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !5
for.end: ; preds = %for.inc, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %add28, %for.inc ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void)
{
int in[1000];
int out[1000];
int q;
int n1 = 0;
int n2 = 0;
int i;
while (scanf("%d", &q) != EOF) {
if (q > 0 && q <= 10) {
in[n1] = q;
n1++;
}
else if(q == 0) {
n1--;
out[n2] = in[n1];
n2++;
}
}
for (i = 0; i < n2; i++) {
printf("%d\n", out[i]);
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258181/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258181/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%in = alloca [1000 x i32], align 16
%out = alloca [1000 x i32], align 16
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %in) #3
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %out) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%cmp.not24 = icmp eq i32 %call23, -1
br i1 %cmp.not24, label %for.end, label %while.body
for.cond.preheader: ; preds = %if.end10
%cmp1127 = icmp sgt i32 %n2.1, 0
br i1 %cmp1127, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %n2.1 to i64
br label %for.body
while.body: ; preds = %entry, %if.end10
%n2.026 = phi i32 [ %n2.1, %if.end10 ], [ 0, %entry ]
%n1.025 = phi i32 [ %n1.1, %if.end10 ], [ 0, %entry ]
%0 = load i32, ptr %q, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 10
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom = sext i32 %n1.025 to i64
%arrayidx = getelementptr inbounds [1000 x i32], ptr %in, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %n1.025, 1
br label %if.end10
if.else: ; preds = %while.body
%cmp3 = icmp eq i32 %0, 0
br i1 %cmp3, label %if.then4, label %if.end10
if.then4: ; preds = %if.else
%dec = add nsw i32 %n1.025, -1
%idxprom5 = sext i32 %dec to i64
%arrayidx6 = getelementptr inbounds [1000 x i32], ptr %in, i64 0, i64 %idxprom5
%2 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%idxprom7 = sext i32 %n2.026 to i64
%arrayidx8 = getelementptr inbounds [1000 x i32], ptr %out, i64 0, i64 %idxprom7
store i32 %2, ptr %arrayidx8, align 4, !tbaa !5
%inc9 = add nsw i32 %n2.026, 1
br label %if.end10
if.end10: ; preds = %if.else, %if.then4, %if.then
%n1.1 = phi i32 [ %inc, %if.then ], [ %dec, %if.then4 ], [ %n1.025, %if.else ]
%n2.1 = phi i32 [ %n2.026, %if.then ], [ %inc9, %if.then4 ], [ %n2.026, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %for.cond.preheader, label %while.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx13 = getelementptr inbounds [1000 x i32], ptr %out, i64 0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %entry, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %out) #3
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %in) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int n,s[100] = {},q[100] = {},i,l = 0,k = 0,e = 0;
while(scanf("%d",&n) != EOF){
if(n > 0){
s[k] = n;
k++;
}else if(n == 0){
k = k - 1;
q[l] = s[k];
l++;
s[k] = 0;
}
}
for(i = 0;i < l;i++){
printf("%d\n",q[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258231/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258231/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%s = alloca [100 x i32], align 16
%q = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %s, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %q) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %q, i8 0, i64 400, i1 false)
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not26 = icmp eq i32 %call25, -1
br i1 %cmp.not26, label %for.end, label %while.body
for.cond.preheader: ; preds = %if.end11
%cmp1229 = icmp sgt i32 %l.1, 0
br i1 %cmp1229, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %l.1 to i64
br label %for.body
while.body: ; preds = %entry, %if.end11
%k.028 = phi i32 [ %k.1, %if.end11 ], [ 0, %entry ]
%l.027 = phi i32 [ %l.1, %if.end11 ], [ 0, %entry ]
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%idxprom = sext i32 %k.028 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %k.028, 1
br label %if.end11
if.else: ; preds = %while.body
%cmp2 = icmp eq i32 %0, 0
br i1 %cmp2, label %if.then3, label %if.end11
if.then3: ; preds = %if.else
%sub = add nsw i32 %k.028, -1
%idxprom4 = sext i32 %sub to i64
%arrayidx5 = getelementptr inbounds [100 x i32], ptr %s, i64 0, i64 %idxprom4
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%idxprom6 = sext i32 %l.027 to i64
%arrayidx7 = getelementptr inbounds [100 x i32], ptr %q, i64 0, i64 %idxprom6
store i32 %1, ptr %arrayidx7, align 4, !tbaa !5
%inc8 = add nsw i32 %l.027, 1
store i32 0, ptr %arrayidx5, align 4, !tbaa !5
br label %if.end11
if.end11: ; preds = %if.else, %if.then3, %if.then
%l.1 = phi i32 [ %l.027, %if.then ], [ %inc8, %if.then3 ], [ %l.027, %if.else ]
%k.1 = phi i32 [ %inc, %if.then ], [ %sub, %if.then3 ], [ %k.028, %if.else ]
%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 %for.cond.preheader, label %while.body, !llvm.loop !9
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%arrayidx14 = getelementptr inbounds [100 x i32], ptr %q, i64 0, i64 %indvars.iv
%2 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %entry, %for.cond.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main() {
int a[10];
int d, n = 0;
while ( scanf("%d", &d) != EOF ) {
if ( d ) {
a[n++] = d;
} else {
printf("%d\n", a[--n]);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258275/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258275/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [10 x i32], align 16
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #3
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%cmp.not6 = icmp eq i32 %call5, -1
br i1 %cmp.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%n.07 = phi i32 [ %n.1, %if.end ], [ 0, %entry ]
%0 = load i32, ptr %d, align 4, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%inc = add nsw i32 %n.07, 1
%idxprom = sext i32 %n.07 to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%dec = add nsw i32 %n.07, -1
%idxprom1 = sext i32 %dec to i64
%arrayidx2 = getelementptr inbounds [10 x i32], ptr %a, i64 0, i64 %idxprom1
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end
if.end: ; preds = %if.else, %if.then
%n.1 = phi i32 [ %inc, %if.then ], [ %dec, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #3
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int data[100];
int sp=0;
int top(){
return data[sp-1];
}
void pop(){
sp--;
}
void push(int n){
if(n>0){
data[sp]=n;
sp++;
}
}
int main(){
int n;
while(scanf("%d",&n)!=EOF){
if(n==0){
printf("%d\n",top());
pop();
}else{
push(n);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258318/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258318/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@sp = dso_local local_unnamed_addr global i32 0, align 4
@data = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @top() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @sp, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @data, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
ret i32 %1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @pop() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @sp, align 4, !tbaa !5
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @sp, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %n) local_unnamed_addr #1 {
entry:
%cmp = icmp sgt i32 %n, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load i32, ptr @sp, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @data, i64 0, i64 %idxprom
store i32 %n, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @sp, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not7 = icmp eq i32 %call6, -1
br i1 %cmp.not7, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%1 = load i32, ptr @sp, align 4, !tbaa !5
%sub.i = add nsw i32 %1, -1
%idxprom.i = sext i32 %sub.i to i64
%arrayidx.i = getelementptr inbounds [100 x i32], ptr @data, i64 0, i64 %idxprom.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
%3 = load i32, ptr @sp, align 4, !tbaa !5
%dec.i = add nsw i32 %3, -1
br label %if.end.sink.split
if.else: ; preds = %while.body
%cmp.i = icmp sgt i32 %0, 0
br i1 %cmp.i, label %if.then.i, label %if.end
if.then.i: ; preds = %if.else
%4 = load i32, ptr @sp, align 4, !tbaa !5
%idxprom.i4 = sext i32 %4 to i64
%arrayidx.i5 = getelementptr inbounds [100 x i32], ptr @data, i64 0, i64 %idxprom.i4
store i32 %0, ptr %arrayidx.i5, align 4, !tbaa !5
%inc.i = add nsw i32 %4, 1
br label %if.end.sink.split
if.end.sink.split: ; preds = %if.then, %if.then.i
%inc.i.sink = phi i32 [ %inc.i, %if.then.i ], [ %dec.i, %if.then ]
store i32 %inc.i.sink, ptr @sp, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.end.sink.split, %if.else
%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 %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
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) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
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 norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int i;
int station[10];
int input_data;
i = 0;
while (scanf("%d", &input_data) != EOF){
if (input_data != 0){
station[i] = input_data;
i++;
}
else {
printf("%d\n", station[i - 1]);
i--;
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258369/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258369/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%station = alloca [10 x i32], align 16
%input_data = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %station) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input_data) #3
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input_data)
%cmp.not9 = icmp eq i32 %call8, -1
br i1 %cmp.not9, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%i.010 = phi i32 [ %i.1, %if.end ], [ 0, %entry ]
%0 = load i32, ptr %input_data, align 4, !tbaa !5
%cmp1.not = icmp eq i32 %0, 0
br i1 %cmp1.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%idxprom = sext i32 %i.010 to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr %station, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %i.010, 1
br label %if.end
if.else: ; preds = %while.body
%sub = add nsw i32 %i.010, -1
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %station, i64 0, i64 %idxprom2
%1 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
br label %if.end
if.end: ; preds = %if.else, %if.then
%i.1 = phi i32 [ %inc, %if.then ], [ %sub, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input_data)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input_data) #3
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %station) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int t,ts;
int train[10];
ts = 0;
while(scanf("%d",&t) != EOF){
if(t == 0){
printf("%d\n",train[ts-1]);
train[ts-1] = 0;
ts--;
}else{
train[ts] = t;
ts++;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258419/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258419/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%t = alloca i32, align 4
%train = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %train) #3
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%cmp.not13 = icmp eq i32 %call12, -1
br i1 %cmp.not13, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%ts.014 = phi i32 [ %ts.1, %if.end ], [ 0, %entry ]
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, 0
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%sub = add nsw i32 %ts.014, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr %train, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %1)
store i32 0, ptr %arrayidx, align 4, !tbaa !5
br label %if.end
if.else: ; preds = %while.body
%idxprom6 = sext i32 %ts.014 to i64
%arrayidx7 = getelementptr inbounds [10 x i32], ptr %train, i64 0, i64 %idxprom6
store i32 %0, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nsw i32 %ts.014, 1
br label %if.end
if.end: ; preds = %if.else, %if.then
%ts.1 = phi i32 [ %sub, %if.then ], [ %inc, %if.else ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %train) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int x, s[11] = {0};
while (scanf("%d", &x) != EOF) {
if (x == 0)
printf("%d\n", s[s[0]--]);
else
s[++s[0]] = x;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258462/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258462/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%x = alloca i32, align 4
%s = alloca [11 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 44, ptr nonnull %s) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(44) %s, i8 0, i64 44, i1 false)
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not8 = icmp eq i32 %call7, -1
br i1 %cmp.not8, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%0 = load i32, ptr %x, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, 0
%1 = load i32, ptr %s, align 16, !tbaa !5
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%dec = add nsw i32 %1, -1
store i32 %dec, ptr %s, align 16, !tbaa !5
%idxprom = sext i32 %1 to i64
%arrayidx2 = getelementptr inbounds [11 x i32], ptr %s, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %2)
br label %if.end
if.else: ; preds = %while.body
%inc = add nsw i32 %1, 1
store i32 %inc, ptr %s, align 16, !tbaa !5
%idxprom5 = sext i32 %inc to i64
%arrayidx6 = getelementptr inbounds [11 x i32], ptr %s, i64 0, i64 %idxprom5
store i32 %0, ptr %arrayidx6, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.else, %if.then
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end, %entry
call void @llvm.lifetime.end.p0(i64 44, ptr nonnull %s) #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: 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n,m,x,f;
scanf("%d %d",&n,&m);
if(n%2==0)
x=n/2;
else
x=n/2+1;
f=0;
while(1)
{
if(x%m==0)
{
f=1;break;
}
else
x=x+1;
if(x>n)
{
f=0;break;
}
}
if(f==1)
printf("%d\n",x);
else
printf("-1\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25852/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25852/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = 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 %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = and i32 %0, 1
%div = sdiv i32 %0, 2
%x.0 = add nsw i32 %div, %1
%2 = load i32, ptr %m, align 4, !tbaa !5
%smax = call i32 @llvm.smax.i32(i32 %x.0, i32 %0)
br label %while.cond
while.cond: ; preds = %if.else5, %entry
%x.1 = phi i32 [ %x.0, %entry ], [ %add6, %if.else5 ]
%rem2 = srem i32 %x.1, %2
%cmp3 = icmp eq i32 %rem2, 0
br i1 %cmp3, label %if.then12, label %if.else5
if.else5: ; preds = %while.cond
%add6 = add i32 %x.1, 1
%exitcond.not = icmp eq i32 %x.1, %smax
br i1 %exitcond.not, label %if.else14, label %while.cond
if.then12: ; preds = %while.cond
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.1)
br label %if.end16
if.else14: ; preds = %if.else5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end16
if.end16: ; preds = %if.else14, %if.then12
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include<stdio.h>
int main(){
char s[1025];
int i,w=0,f=0;
for(i=0;s[i]=getchar(),s[i]+1;i++){
if(s[i]==' '||s[i]=='.'||s[i]==','){
if(i-w>=3 && i-w<=6){
s[i]=0;
if(f)
putchar(' ');
printf("%s",s+w);
f=1;
}
w=i+1;
}
}
puts("");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258563/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258563/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [1025 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1025, ptr nonnull %s) #3
br label %for.cond.outer
for.cond.outer: ; preds = %if.end31, %entry
%indvars.iv.ph = phi i64 [ %5, %if.end31 ], [ 0, %entry ]
%w.0.ph = phi i32 [ %6, %if.end31 ], [ 0, %entry ]
%f.0.ph = phi i32 [ %f.1, %if.end31 ], [ 0, %entry ]
br label %for.cond
for.cond: ; preds = %for.cond.outer, %for.cond.for.inc_crit_edge
%indvars.iv = phi i64 [ %.pre, %for.cond.for.inc_crit_edge ], [ %indvars.iv.ph, %for.cond.outer ]
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 @getc(ptr noundef %0)
%conv = trunc i32 %call.i to i8
%arrayidx = getelementptr inbounds [1025 x i8], ptr %s, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !9
%sext = shl i32 %call.i, 24
switch i32 %sext, label %for.cond.for.inc_crit_edge [
i32 -16777216, label %for.end
i32 536870912, label %if.then
i32 771751936, label %if.then
i32 738197504, label %if.then
]
for.cond.for.inc_crit_edge: ; preds = %for.cond
%.pre = add nuw i64 %indvars.iv, 1
br label %for.cond, !llvm.loop !10
if.then: ; preds = %for.cond, %for.cond, %for.cond
%arrayidx.le = getelementptr inbounds [1025 x i8], ptr %s, i64 0, i64 %indvars.iv
%1 = trunc i64 %indvars.iv to i32
%2 = add i32 %1, -3
%3 = sub i32 %2, %w.0.ph
%or.cond = icmp ult i32 %3, 4
br i1 %or.cond, label %if.then24, label %if.end31
if.then24: ; preds = %if.then
store i8 0, ptr %arrayidx.le, align 1, !tbaa !9
%tobool27.not = icmp eq i32 %f.0.ph, 0
br i1 %tobool27.not, label %if.end, label %if.then28
if.then28: ; preds = %if.then24
%4 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i46 = call noundef i32 @putc(i32 noundef 32, ptr noundef %4)
br label %if.end
if.end: ; preds = %if.then28, %if.then24
%idx.ext = sext i32 %w.0.ph to i64
%add.ptr = getelementptr inbounds i8, ptr %s, i64 %idx.ext
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %add.ptr)
br label %if.end31
if.end31: ; preds = %if.end, %if.then
%f.1 = phi i32 [ 1, %if.end ], [ %f.0.ph, %if.then ]
%5 = add nuw i64 %indvars.iv, 1
%6 = trunc i64 %5 to i32
br label %for.cond.outer, !llvm.loop !10
for.end: ; preds = %for.cond
%7 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i47 = call noundef i32 @putc(i32 noundef 10, ptr noundef %7)
call void @llvm.lifetime.end.p0(i64 1025, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 @getc(ptr nocapture noundef) 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
int a,cnt;
scanf("%d",&a);
cnt = 0;
cnt+=a/25;
a = a%25;
cnt += a/10;
a = a%10;
cnt += a/5;
a = a%5;
cnt += a;
printf("%d\n",cnt);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258613/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258613/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%div = sdiv i32 %0, 25
%rem = srem i32 %0, 25
%div1.lhs.trunc = trunc i32 %rem to i8
%div113 = sdiv i8 %div1.lhs.trunc, 10
%div1.sext = sext i8 %div113 to i32
%add2 = add nsw i32 %div, %div1.sext
%rem314 = srem i8 %div1.lhs.trunc, 10
%div415 = sdiv i8 %rem314, 5
%div4.sext = sext i8 %div415 to i32
%add5 = add nsw i32 %add2, %div4.sext
%rem616 = srem i8 %rem314, 5
%rem6.sext = sext i8 %rem616 to i32
store i32 %rem6.sext, ptr %a, align 4, !tbaa !5
%add7 = add nsw i32 %add5, %rem6.sext
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add7)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int d;
scanf("%d",&d);
for ( int i=0; i < d; i++){
printf("ACL");
}
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258657/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258657/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"ACL\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%0 = load i32, ptr %d, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %0, 0
br i1 %cmp4, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #4
ret i32 0
for.body: ; preds = %entry, %for.body
%i.05 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc = add nuw nsw i32 %i.05, 1
%1 = load i32, ptr %d, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %1
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
long n;
int m;
long max=0;
long min=0;
scanf("%ld %d",&n,&m);
max=n;
if(n%2!=0)
{
min=(n/2)+1;
}
else
{
min=(n/2);
}
if(max<m)
{
printf("-1\n");
return 0;
}
while(1)
{
if(min%m==0)
{
break;
}
else
{
min++;
}
}
printf("%ld\n",min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_25870/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_25870/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld %d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i64, ptr %n, align 8, !tbaa !5
%1 = load i32, ptr %m, align 4, !tbaa !9
%conv = sext i32 %1 to i64
%cmp2 = icmp slt i64 %0, %conv
br i1 %cmp2, label %if.then4, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%div1 = sdiv i64 %0, 2
%2 = and i64 %0, 1
%min.0 = add nsw i64 %div1, %2
br label %while.cond
if.then4: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
while.cond: ; preds = %while.cond.preheader, %while.cond
%min.1 = phi i64 [ %inc, %while.cond ], [ %min.0, %while.cond.preheader ]
%rem8 = srem i64 %min.1, %conv
%cmp9 = icmp eq i64 %rem8, 0
%inc = add nsw i64 %min.1, 1
br i1 %cmp9, label %while.end, label %while.cond
while.end: ; preds = %while.cond
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %min.1)
br label %cleanup
cleanup: ; preds = %while.end, %if.then4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
|
#include<stdio.h>
int main(){
int k;
scanf("%d",&k);
for (int i=1;i<=k;i++)
printf("ACL");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258743/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258743/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"ACL\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not3 = icmp slt i32 %0, 1
br i1 %cmp.not3, label %for.cond.cleanup, label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
ret i32 0
for.body: ; preds = %entry, %for.body
%i.04 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
%inc = add nuw nsw i32 %i.04, 1
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.04, %1
br i1 %cmp.not.not, 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: 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>
long long int absh(long long int x);
int main(void)
{
int n,i;
scanf("%d",&n);
long long int a[n],sum=0;
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
sum+=a[i];
}
long long int x=a[0],abs=absh(sum-2*a[0]);
for(i=1;i<n-1;i++){
x+=a[i];
if(absh(sum-2*x)<abs)
abs=absh(sum-2*x);
}
printf("%lld",abs);
return 0;
}
long long int absh(long long int x)
{
if(x<0)
return -x;
else
return x;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258808/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%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 i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %3, 0
br i1 %cmp39, label %for.body, label %for.end23
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.041 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load i64, ptr %arrayidx, align 8, !tbaa !9
%add = add nsw i64 %4, %sum.041
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body
%.pre = load i64, ptr %vla, align 16, !tbaa !9
%mul = shl nsw i64 %.pre, 1
%sub = sub nsw i64 %add, %mul
%retval.0.i = call i64 @llvm.abs.i64(i64 %sub, i1 true)
%cmp943 = icmp sgt i32 %5, 2
br i1 %cmp943, label %for.body10.preheader, label %for.end23
for.body10.preheader: ; preds = %for.end
%sub8 = add nsw i32 %5, -1
%wide.trip.count = zext i32 %sub8 to i64
%7 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %7, 1
%8 = icmp eq i32 %sub8, 2
br i1 %8, label %for.end23.loopexit.unr-lcssa, label %for.body10.preheader.new
for.body10.preheader.new: ; preds = %for.body10.preheader
%unroll_iter = and i64 %7, -2
%invariant.gep = getelementptr i64, ptr %vla, i64 1
br label %for.body10
for.body10: ; preds = %for.body10, %for.body10.preheader.new
%indvars.iv50 = phi i64 [ 1, %for.body10.preheader.new ], [ %indvars.iv.next51.1, %for.body10 ]
%abs.046 = phi i64 [ %retval.0.i, %for.body10.preheader.new ], [ %spec.select.1, %for.body10 ]
%x.045 = phi i64 [ %.pre, %for.body10.preheader.new ], [ %add13.1, %for.body10 ]
%niter = phi i64 [ 0, %for.body10.preheader.new ], [ %niter.next.1, %for.body10 ]
%arrayidx12 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv50
%9 = load i64, ptr %arrayidx12, align 8, !tbaa !9
%add13 = add nsw i64 %9, %x.045
%mul14 = shl nsw i64 %add13, 1
%sub15 = sub nsw i64 %add, %mul14
%retval.0.i37 = call i64 @llvm.abs.i64(i64 %sub15, i1 true)
%spec.select = call i64 @llvm.smin.i64(i64 %retval.0.i37, i64 %abs.046)
%gep = getelementptr i64, ptr %invariant.gep, i64 %indvars.iv50
%10 = load i64, ptr %gep, align 8, !tbaa !9
%add13.1 = add nsw i64 %10, %add13
%mul14.1 = shl nsw i64 %add13.1, 1
%sub15.1 = sub nsw i64 %add, %mul14.1
%retval.0.i37.1 = call i64 @llvm.abs.i64(i64 %sub15.1, i1 true)
%spec.select.1 = call i64 @llvm.smin.i64(i64 %retval.0.i37.1, i64 %spec.select)
%indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 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.end23.loopexit.unr-lcssa, label %for.body10, !llvm.loop !13
for.end23.loopexit.unr-lcssa: ; preds = %for.body10, %for.body10.preheader
%spec.select.lcssa.ph = phi i64 [ undef, %for.body10.preheader ], [ %spec.select.1, %for.body10 ]
%indvars.iv50.unr = phi i64 [ 1, %for.body10.preheader ], [ %indvars.iv.next51.1, %for.body10 ]
%abs.046.unr = phi i64 [ %retval.0.i, %for.body10.preheader ], [ %spec.select.1, %for.body10 ]
%x.045.unr = phi i64 [ %.pre, %for.body10.preheader ], [ %add13.1, %for.body10 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end23, label %for.body10.epil
for.body10.epil: ; preds = %for.end23.loopexit.unr-lcssa
%arrayidx12.epil = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv50.unr
%11 = load i64, ptr %arrayidx12.epil, align 8, !tbaa !9
%add13.epil = add nsw i64 %11, %x.045.unr
%mul14.epil = shl nsw i64 %add13.epil, 1
%sub15.epil = sub nsw i64 %add, %mul14.epil
%retval.0.i37.epil = call i64 @llvm.abs.i64(i64 %sub15.epil, i1 true)
%spec.select.epil = call i64 @llvm.smin.i64(i64 %retval.0.i37.epil, i64 %abs.046.unr)
br label %for.end23
for.end23: ; preds = %for.body10.epil, %for.end23.loopexit.unr-lcssa, %entry, %for.end
%abs.0.lcssa = phi i64 [ %retval.0.i, %for.end ], [ 0, %entry ], [ %spec.select.lcssa.ph, %for.end23.loopexit.unr-lcssa ], [ %spec.select.epil, %for.body10.epil ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %abs.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @absh(i64 noundef %x) local_unnamed_addr #4 {
entry:
%retval.0 = tail call i64 @llvm.abs.i64(i64 %x, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
int main(){
int n,i;
double h,m,ang_h,ang_m,ang_d;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%lf:%lf",&h,&m);
ang_m=(m/60)*360;
ang_h=(h/12)*360+(m/60)*30;
if(ang_m>ang_h)ang_d=ang_m-ang_h;
else ang_d=ang_h-ang_m;
if(ang_d>180)ang_d=360-ang_d;
if(ang_d>=0.0&&ang_d<30.0)printf("alert\n");
else if(ang_d>=90.0&&ang_d<=180.0)printf("safe\n");
else printf("warning\n");
}
return 0;} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_258851/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_258851/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [8 x i8] c"%lf:%lf\00", align 1
@str = private unnamed_addr constant [8 x i8] c"warning\00", align 1
@str.5 = private unnamed_addr constant [5 x i8] c"safe\00", align 1
@str.6 = private unnamed_addr constant [6 x i8] c"alert\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%h = alloca double, align 8
%m = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %m) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.040 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h, ptr noundef nonnull %m)
%1 = load double, ptr %m, align 8, !tbaa !9
%div = fdiv double %1, 6.000000e+01
%mul = fmul double %div, 3.600000e+02
%2 = load double, ptr %h, align 8, !tbaa !9
%div2 = fdiv double %2, 1.200000e+01
%mul5 = fmul double %div, 3.000000e+01
%3 = call double @llvm.fmuladd.f64(double %div2, double 3.600000e+02, double %mul5)
%cmp6 = fcmp ogt double %mul, %3
%sub = fsub double %mul, %3
%sub7 = fsub double %3, %mul
%ang_d.0 = select i1 %cmp6, double %sub, double %sub7
%cmp8 = fcmp ogt double %ang_d.0, 1.800000e+02
%sub10 = fsub double 3.600000e+02, %ang_d.0
%ang_d.1 = select i1 %cmp8, double %sub10, double %ang_d.0
%cmp12 = fcmp oge double %ang_d.1, 0.000000e+00
%cmp13 = fcmp olt double %ang_d.1, 3.000000e+01
%or.cond = and i1 %cmp12, %cmp13
%cmp17 = fcmp oge double %ang_d.1, 9.000000e+01
%cmp19 = fcmp ole double %ang_d.1, 1.800000e+02
%or.cond26 = and i1 %cmp17, %cmp19
%str.5.str = select i1 %or.cond26, ptr @str.5, ptr @str
%str.6.sink = select i1 %or.cond, ptr @str.6, ptr %str.5.str
%puts38 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
%inc = add nuw nsw i32 %i.040, 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 !11
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.