Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
double x1, x2, y1, y2;
scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
double x, y, xx, yy, zz;
if (x2 - x1)
x = x2 - x1;
else
x = x1 - x2;
if (y2 - y1)
y = y2 - y1;
else
y = y1 - y2;
xx = x * x;
yy = y * y;
zz = xx + yy;
printf("%f\n", sqrt(zz));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180688/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180688/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%lf %lf %lf %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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2)
%0 = load double, ptr %x2, align 8, !tbaa !5
%1 = load double, ptr %x1, align 8, !tbaa !5
%2 = load double, ptr %y2, align 8, !tbaa !5
%3 = load double, ptr %y1, align 8, !tbaa !5
%4 = insertelement <2 x double> poison, double %0, i64 0
%5 = insertelement <2 x double> %4, double %2, i64 1
%6 = insertelement <2 x double> poison, double %1, i64 0
%7 = insertelement <2 x double> %6, double %3, i64 1
%8 = fsub <2 x double> %5, %7
%9 = fcmp une <2 x double> %8, zeroinitializer
%10 = fsub <2 x double> %7, %5
%11 = select <2 x i1> %9, <2 x double> %8, <2 x double> %10
%12 = fmul <2 x double> %11, %11
%shift = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%13 = fadd <2 x double> %12, %shift
%add = extractelement <2 x double> %13, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add)
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %sqrt)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 double @llvm.sqrt.f64(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"}
|
// AOJ 1283 Most Distant Point from the Sea
// 2018.3.3 bal4u
#include <stdio.h>
#include <string.h>
#include <math.h>
#define LIM 40
#define EPS 1e-8
typedef struct { double x, y; } PP;
typedef struct { PP s, e; } SEG;
PP p[101], po[2][500];
//#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 dcmp(double x) { if (fabs(x) < EPS) return 0; return x <= 0 ? -1 : 1; }
PP vadd(PP p1, PP p2) { PP r; r.x = p1.x + p2.x, r.y = p1.y + p2.y; return r; }
PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
PP vsmul(PP p, double k) { PP r; r.x = p.x * k, r.y = p.y * k; return r; }
PP vsdiv(PP p, double k) { PP r; r.x = p.x / k, r.y = p.y / k; return r; }
PP vmul(PP p1, PP p2) { PP r;
r.x = p1.x * p2.x - p1.y * p2.y, r.y = p1.x * p2.y + p1.y * p2.x; return r; }
double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }
double dot(PP a, PP b) { return a.x * b.x + a.y * b.y; }
double norm(PP a) { return a.x * a.x + a.y * a.y; }
double vabs(PP a) { return hypot(a.x, a.y); }
int ccw(PP p0, PP p1, PP p2) { PP a, b; double t;
a = vsub(p1, p0), b = vsub(p2, p0), t = cross(a, b);
if (t > EPS) return 1; if (t < -EPS) return -1;
if (dot(a, b) < -EPS) return 2; if (norm(a) < norm(b)) return -2;
return 0;
}
// 線分と点の距離
double getDistanceSP(SEG s, PP p) {
if (dot(vsub(s.e, s.s), vsub(p, s.s)) < -EPS) return vabs(vsub(p, s.s));
if (dot(vsub(s.s, s.e), vsub(p, s.e)) < -EPS) return vabs(vsub(p, s.e));
return fabs(cross(vsub(s.e, s.s), vsub(p, s.s))) / vabs(vsub(s.e, s.s));
}
// 2線分間の交点
PP crossPointS2P(SEG a, PP bs, PP be) { double a1, a2; PP r;
a1 = cross(vsub(be, bs), vsub(a.s, bs));
a2 = cross(vsub(be, bs), vsub(a.e, bs));
r.x = (a.s.x*a2 - a.e.x*a1) / (a2-a1);
r.y = (a.s.y*a2 - a.e.y*a1) / (a2-a1);
return r;
}
PP crossPointSS(SEG a, SEG b) { return crossPointS2P(a, b.s, b.e); }
// 凸包を直線で切断して左側をpo[]に残す
int convex_cut(SEG u, int n, PP *p, PP *po) // p --> po
{
int i, d1, d2, top = 0;
for (i = 0; i < n; i++) {
d1 = dcmp(cross(vsub(u.e, u.s), vsub(p[i], u.s)));
d2 = dcmp(cross(vsub(u.e, u.s), vsub(p[i+1], u.s)));
if (d1 >= 0) po[top++] = p[i];
if (d1*d2 < 0) po[top++] = crossPointS2P(u, p[i], p[i+1]);
}
po[top] = po[0];
return top;
}
//直線の単位法線ベクトル
void unitnormalv(SEG *ans, SEG a) {
PP t; double k = vabs(vsub(a.e, a.s));
t.x = 0, t.y = 1; ans->s = vsdiv(vmul(vsub(a.e, a.s), t), k);
t.x = 0, t.y = -1; ans->e = vsdiv(vmul(vsub(a.e, a.s), t), k);
}
//線分を距離dだけ平行移動
void parallelShift(SEG *ans, SEG a, double d) {
SEG r; unitnormalv(&r, a);
ans[0].s = vadd(a.s, vsmul(r.s, d));
ans[0].e = vadd(a.e, vsmul(r.s, d));
ans[1].s = vadd(a.s, vsmul(r.e, d));
ans[1].e = vadd(a.e, vsmul(r.e, d));
}
int main()
{
int n, i, j, k, k1, k2;
double lo, hi, mi;
SEG a, sft[2];
while(n = in()) {
for (i = 0; i < n; i++) p[i].x = in(), p[i].y = in();
p[n] = p[0];
lo = 0, hi = 10000;
for (i = 0; i < LIM; i++) {
mi = 0.5*(lo + hi);
memcpy(po[0], p, sizeof(PP)*(n+1));
k = n, k1 = 0, k2 = 1;
for (j = 0; j < n; j++) {
a.s = p[j], a.e = p[j+1];
parallelShift(sft, a, mi);
if (ccw(p[j], p[j+1], sft[0].s) == 1)
k = convex_cut(sft[0], k, po[k1], po[k2]);
else k = convex_cut(sft[1], k, po[k1], po[k2]);
if (!k) break;
k1 = k2, k2 = !k2;
}
if (!k) hi = mi; else lo = mi;
}
printf("%.6lf\n", hi);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180745/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180745/source.c"
target datalayout = "e-m:e-p270: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.PP = type { double, double }
%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] }
%struct.SEG = type { %struct.PP, %struct.PP }
@p = dso_local local_unnamed_addr global [101 x %struct.PP] zeroinitializer, align 16
@po = dso_local local_unnamed_addr global [2 x [500 x %struct.PP]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%.6lf\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i, align 8, !tbaa !9
%_IO_read_end.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i, align 8, !tbaa !14
%cmp.not.i = icmp ult ptr %1, %2
br i1 %cmp.not.i, label %cond.false.i, label %cond.true.i, !prof !15
cond.true.i: ; preds = %entry
%call.i = tail call i32 @__uflow(ptr noundef nonnull %0) #11
%.pre14.pre = load ptr, ptr @stdin, align 8, !tbaa !5
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 !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%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 !9
%_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 !14
%cmp.not.i6 = icmp ult ptr %5, %6
br i1 %cmp.not.i6, label %cond.false.i10, label %cond.true.i7, !prof !15
cond.true.i7: ; preds = %do.body
%call.i8 = tail call i32 @__uflow(ptr noundef nonnull %4) #11
%.pre = load ptr, ptr @stdin, align 8, !tbaa !5
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 !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%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 !17
do.end: ; preds = %getchar_unlocked.exit13
ret i32 %add
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @dcmp(double noundef %x) local_unnamed_addr #1 {
entry:
%0 = tail call double @llvm.fabs.f64(double %x)
%cmp = fcmp olt double %0, 1.000000e-08
%cmp1 = fcmp ole double %x, 0.000000e+00
%cond = select i1 %cmp1, i32 -1, i32 1
%retval.0 = select i1 %cmp, i32 0, i32 %cond
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local { double, double } @vadd(double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1) local_unnamed_addr #3 {
entry:
%add = fadd double %p1.coerce0, %p2.coerce0
%add4 = fadd double %p1.coerce1, %p2.coerce1
%.fca.0.insert = insertvalue { double, double } poison, double %add, 0
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %add4, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local { double, double } @vsub(double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1) local_unnamed_addr #3 {
entry:
%sub = fsub double %p1.coerce0, %p2.coerce0
%sub4 = fsub double %p1.coerce1, %p2.coerce1
%.fca.0.insert = insertvalue { double, double } poison, double %sub, 0
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %sub4, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local { double, double } @vsmul(double %p.coerce0, double %p.coerce1, double noundef %k) local_unnamed_addr #3 {
entry:
%mul = fmul double %p.coerce0, %k
%mul2 = fmul double %p.coerce1, %k
%.fca.0.insert = insertvalue { double, double } poison, double %mul, 0
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %mul2, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local { double, double } @vsdiv(double %p.coerce0, double %p.coerce1, double noundef %k) local_unnamed_addr #3 {
entry:
%0 = insertelement <2 x double> poison, double %p.coerce0, i64 0
%1 = insertelement <2 x double> %0, double %p.coerce1, i64 1
%2 = insertelement <2 x double> poison, double %k, i64 0
%3 = shufflevector <2 x double> %2, <2 x double> poison, <2 x i32> zeroinitializer
%4 = fdiv <2 x double> %1, %3
%5 = extractelement <2 x double> %4, i64 0
%.fca.0.insert = insertvalue { double, double } poison, double %5, 0
%6 = extractelement <2 x double> %4, i64 1
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %6, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local { double, double } @vmul(double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1) local_unnamed_addr #1 {
entry:
%0 = fneg double %p1.coerce1
%1 = insertelement <2 x double> poison, double %0, i64 0
%2 = insertelement <2 x double> %1, double %p1.coerce1, i64 1
%3 = insertelement <2 x double> poison, double %p2.coerce1, i64 0
%4 = insertelement <2 x double> %3, double %p2.coerce0, i64 1
%5 = fmul <2 x double> %2, %4
%6 = insertelement <2 x double> poison, double %p1.coerce0, i64 0
%7 = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> zeroinitializer
%8 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%9 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %7, <2 x double> %8, <2 x double> %5)
%10 = extractelement <2 x double> %9, i64 0
%.fca.0.insert = insertvalue { double, double } poison, double %10, 0
%11 = extractelement <2 x double> %9, i64 1
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %11, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @cross(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) local_unnamed_addr #1 {
entry:
%0 = fneg double %a.coerce1
%neg = fmul double %0, %b.coerce0
%1 = tail call double @llvm.fmuladd.f64(double %a.coerce0, double %b.coerce1, double %neg)
ret double %1
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @dot(double %a.coerce0, double %a.coerce1, double %b.coerce0, double %b.coerce1) local_unnamed_addr #1 {
entry:
%mul3 = fmul double %a.coerce1, %b.coerce1
%0 = tail call double @llvm.fmuladd.f64(double %a.coerce0, double %b.coerce0, double %mul3)
ret double %0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local double @norm(double %a.coerce0, double %a.coerce1) local_unnamed_addr #1 {
entry:
%mul3 = fmul double %a.coerce1, %a.coerce1
%0 = tail call double @llvm.fmuladd.f64(double %a.coerce0, double %a.coerce0, double %mul3)
ret double %0
}
; Function Attrs: nounwind uwtable
define dso_local double @vabs(double %a.coerce0, double %a.coerce1) local_unnamed_addr #0 {
entry:
%call = tail call double @hypot(double noundef %a.coerce0, double noundef %a.coerce1) #11
ret double %call
}
; Function Attrs: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ccw(double %p0.coerce0, double %p0.coerce1, double %p1.coerce0, double %p1.coerce1, double %p2.coerce0, double %p2.coerce1) local_unnamed_addr #1 {
entry:
%0 = insertelement <2 x double> poison, double %p1.coerce0, i64 0
%1 = insertelement <2 x double> %0, double %p2.coerce0, i64 1
%2 = insertelement <2 x double> poison, double %p0.coerce0, i64 0
%3 = shufflevector <2 x double> %2, <2 x double> poison, <2 x i32> zeroinitializer
%4 = fsub <2 x double> %1, %3
%5 = insertelement <2 x double> poison, double %p1.coerce1, i64 0
%6 = insertelement <2 x double> %5, double %p2.coerce1, i64 1
%7 = insertelement <2 x double> poison, double %p0.coerce1, i64 0
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%9 = fsub <2 x double> %6, %8
%10 = extractelement <2 x double> %9, i64 0
%11 = fneg double %10
%12 = extractelement <2 x double> %4, i64 1
%neg.i = fmul double %12, %11
%13 = extractelement <2 x double> %4, i64 0
%14 = extractelement <2 x double> %9, i64 1
%15 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %neg.i)
%cmp = fcmp ogt double %15, 1.000000e-08
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = fcmp olt double %15, -1.000000e-08
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%mul3.i = fmul double %10, %14
%16 = tail call double @llvm.fmuladd.f64(double %13, double %12, double %mul3.i)
%cmp8 = fcmp olt double %16, -1.000000e-08
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%17 = fmul <2 x double> %9, %9
%18 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %4, <2 x double> %4, <2 x double> %17)
%19 = extractelement <2 x double> %18, i64 0
%20 = extractelement <2 x double> %18, i64 1
%cmp13 = fcmp olt double %19, %20
%. = select i1 %cmp13, i32 -2, i32 0
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ 1, %entry ], [ -1, %if.end ], [ 2, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; 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) #5
; Function Attrs: nounwind uwtable
define dso_local double @getDistanceSP(ptr nocapture noundef readonly byval(%struct.SEG) align 8 %s, double %p.coerce0, double %p.coerce1) local_unnamed_addr #0 {
entry:
%e = getelementptr inbounds %struct.SEG, ptr %s, i64 0, i32 1
%0 = load double, ptr %e, align 8
%1 = getelementptr inbounds %struct.SEG, ptr %s, i64 0, i32 1, i32 1
%2 = load double, ptr %1, align 8
%3 = load double, ptr %s, align 8
%4 = getelementptr inbounds { double, double }, ptr %s, i64 0, i32 1
%5 = load double, ptr %4, align 8
%sub.i = fsub double %0, %3
%sub4.i = fsub double %2, %5
%sub.i46 = fsub double %p.coerce0, %3
%sub4.i47 = fsub double %p.coerce1, %5
%mul3.i = fmul double %sub4.i, %sub4.i47
%6 = tail call double @llvm.fmuladd.f64(double %sub.i, double %sub.i46, double %mul3.i)
%cmp = fcmp olt double %6, -1.000000e-08
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%call.i = tail call double @hypot(double noundef %sub.i46, double noundef %sub4.i47) #11
br label %return
if.end: ; preds = %entry
%sub.i54 = fsub double %3, %0
%sub4.i55 = fsub double %5, %2
%sub.i58 = fsub double %p.coerce0, %0
%sub4.i59 = fsub double %p.coerce1, %2
%mul3.i62 = fmul double %sub4.i59, %sub4.i55
%7 = tail call double @llvm.fmuladd.f64(double %sub.i54, double %sub.i58, double %mul3.i62)
%cmp18 = fcmp olt double %7, -1.000000e-08
br i1 %cmp18, label %if.then19, label %if.end24
if.then19: ; preds = %if.end
%call.i67 = tail call double @hypot(double noundef %sub.i58, double noundef %sub4.i59) #11
br label %return
if.end24: ; preds = %if.end
%8 = fneg double %sub4.i
%neg.i = fmul double %sub.i46, %8
%9 = tail call double @llvm.fmuladd.f64(double %sub.i, double %sub4.i47, double %neg.i)
%10 = tail call double @llvm.fabs.f64(double %9)
%call.i80 = tail call double @hypot(double noundef %sub.i, double noundef %sub4.i) #11
%div = fdiv double %10, %call.i80
br label %return
return: ; preds = %if.end24, %if.then19, %if.then
%retval.0 = phi double [ %call.i, %if.then ], [ %call.i67, %if.then19 ], [ %div, %if.end24 ]
ret double %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local { double, double } @crossPointS2P(ptr nocapture noundef readonly byval(%struct.SEG) align 8 %a, double %bs.coerce0, double %bs.coerce1, double %be.coerce0, double %be.coerce1) local_unnamed_addr #6 {
entry:
%sub.i = fsub double %be.coerce0, %bs.coerce0
%sub4.i = fsub double %be.coerce1, %bs.coerce1
%0 = fneg double %sub4.i
%e = getelementptr inbounds %struct.SEG, ptr %a, i64 0, i32 1
%1 = load <2 x double>, ptr %a, align 8
%2 = load <2 x double>, ptr %e, align 8
%3 = shufflevector <2 x double> %2, <2 x double> %1, <2 x i32> <i32 0, i32 2>
%4 = insertelement <2 x double> poison, double %bs.coerce0, i64 0
%5 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> zeroinitializer
%6 = fsub <2 x double> %3, %5
%7 = shufflevector <2 x double> %2, <2 x double> %1, <2 x i32> <i32 1, i32 3>
%8 = insertelement <2 x double> poison, double %bs.coerce1, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%10 = fsub <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 = fmul <2 x double> %6, %12
%14 = insertelement <2 x double> poison, double %sub.i, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> %10, <2 x double> %13)
%shift = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%17 = fsub <2 x double> %16, %shift
%18 = fneg <2 x double> %2
%19 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%20 = fmul <2 x double> %19, %18
%21 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%22 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %1, <2 x double> %21, <2 x double> %20)
%23 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%24 = fdiv <2 x double> %22, %23
%25 = extractelement <2 x double> %24, i64 0
%.fca.0.insert = insertvalue { double, double } poison, double %25, 0
%26 = extractelement <2 x double> %24, i64 1
%.fca.1.insert = insertvalue { double, double } %.fca.0.insert, double %26, 1
ret { double, double } %.fca.1.insert
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local { double, double } @crossPointSS(ptr nocapture noundef readonly byval(%struct.SEG) align 8 %a, ptr nocapture noundef readonly byval(%struct.SEG) align 8 %b) local_unnamed_addr #6 {
entry:
%e = getelementptr inbounds %struct.SEG, ptr %b, i64 0, i32 1
%0 = load double, ptr %b, align 8
%1 = getelementptr inbounds { double, double }, ptr %b, i64 0, i32 1
%2 = load double, ptr %1, align 8
%3 = load double, ptr %e, align 8
%4 = getelementptr inbounds %struct.SEG, ptr %b, i64 0, i32 1, i32 1
%5 = load double, ptr %4, align 8
%sub.i.i = fsub double %3, %0
%sub4.i.i = fsub double %5, %2
%6 = fneg double %sub4.i.i
%e.i = getelementptr inbounds %struct.SEG, ptr %a, i64 0, i32 1
%7 = load <2 x double>, ptr %a, align 8
%8 = load <2 x double>, ptr %e.i, align 8
%9 = shufflevector <2 x double> %8, <2 x double> %7, <2 x i32> <i32 0, i32 2>
%10 = insertelement <2 x double> poison, double %0, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = fsub <2 x double> %9, %11
%13 = shufflevector <2 x double> %8, <2 x double> %7, <2 x i32> <i32 1, i32 3>
%14 = insertelement <2 x double> poison, double %2, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = fsub <2 x double> %13, %15
%17 = insertelement <2 x double> poison, double %6, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = fmul <2 x double> %12, %18
%20 = insertelement <2 x double> poison, double %sub.i.i, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %16, <2 x double> %19)
%shift = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%23 = fsub <2 x double> %22, %shift
%24 = fneg <2 x double> %8
%25 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%26 = fmul <2 x double> %25, %24
%27 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%28 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %7, <2 x double> %27, <2 x double> %26)
%29 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%30 = fdiv <2 x double> %28, %29
%31 = extractelement <2 x double> %30, i64 0
%.fca.0.insert.i = insertvalue { double, double } poison, double %31, 0
%32 = extractelement <2 x double> %30, i64 1
%.fca.1.insert.i = insertvalue { double, double } %.fca.0.insert.i, double %32, 1
ret { double, double } %.fca.1.insert.i
}
; Function Attrs: nofree nosync nounwind memory(argmem: readwrite) uwtable
define dso_local i32 @convex_cut(ptr nocapture noundef readonly byval(%struct.SEG) align 8 %u, i32 noundef %n, ptr nocapture noundef readonly %p, ptr nocapture noundef %po) local_unnamed_addr #7 {
entry:
%cmp76 = icmp sgt i32 %n, 0
br i1 %cmp76, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%e = getelementptr inbounds %struct.SEG, ptr %u, i64 0, i32 1
%0 = load <2 x double>, ptr %e, align 8
%1 = load <2 x double>, ptr %u, align 8
%2 = fsub <2 x double> %0, %1
%3 = fsub <2 x double> %0, %1
%sub4.i = extractelement <2 x double> %3, i64 1
%4 = fneg double %sub4.i
%5 = fneg <2 x double> %0
%wide.trip.count = zext i32 %n to i64
%6 = shufflevector <2 x double> %0, <2 x double> %1, <2 x i32> <i32 1, i32 3>
%7 = shufflevector <2 x double> %0, <2 x double> %1, <2 x i32> <i32 0, i32 2>
%8 = shufflevector <2 x double> %2, <2 x double> poison, <2 x i32> zeroinitializer
%9 = shufflevector <2 x double> %1, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%10 = shufflevector <2 x double> %1, <2 x double> poison, <2 x i32> zeroinitializer
%11 = insertelement <2 x double> poison, double %4, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc ]
%top.077 = phi i32 [ 0, %for.body.lr.ph ], [ %top.2, %for.inc ]
%arrayidx = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv
%13 = load double, ptr %arrayidx, align 8
%14 = getelementptr inbounds { double, double }, ptr %arrayidx, i64 0, i32 1
%15 = load double, ptr %14, align 8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx12 = getelementptr inbounds %struct.PP, ptr %p, i64 %indvars.iv.next
%16 = load double, ptr %arrayidx12, align 8
%17 = getelementptr inbounds { double, double }, ptr %arrayidx12, i64 0, i32 1
%18 = load double, ptr %17, align 8
%19 = insertelement <2 x double> poison, double %16, i64 0
%20 = insertelement <2 x double> %19, double %13, i64 1
%21 = fsub <2 x double> %20, %10
%22 = insertelement <2 x double> poison, double %18, i64 0
%23 = insertelement <2 x double> %22, double %15, i64 1
%24 = fsub <2 x double> %23, %9
%25 = fmul <2 x double> %21, %12
%26 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %8, <2 x double> %24, <2 x double> %25)
%27 = extractelement <2 x double> %26, i64 1
%cmp1.i = fcmp ole double %27, 0.000000e+00
%cond.i = select i1 %cmp1.i, i32 -1, i32 1
%28 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %26)
%29 = fcmp olt <2 x double> %28, <double 1.000000e-08, double 1.000000e-08>
%30 = extractelement <2 x i1> %29, i64 1
%retval.0.i = select i1 %30, i32 0, i32 %cond.i
%31 = extractelement <2 x double> %26, i64 0
%cmp1.i69 = fcmp ole double %31, 0.000000e+00
%cond.i70 = select i1 %cmp1.i69, i32 -1, i32 1
%32 = extractelement <2 x i1> %29, i64 0
%retval.0.i71 = select i1 %32, i32 0, i32 %cond.i70
%cmp17 = icmp sgt i32 %retval.0.i, -1
br i1 %cmp17, label %if.then, label %if.end
if.then: ; preds = %for.body
%inc = add nsw i32 %top.077, 1
%idxprom18 = sext i32 %top.077 to i64
%arrayidx19 = getelementptr inbounds %struct.PP, ptr %po, i64 %idxprom18
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %arrayidx19, ptr noundef nonnull align 8 dereferenceable(16) %arrayidx, i64 16, i1 false), !tbaa.struct !19
br label %if.end
if.end: ; preds = %if.then, %for.body
%top.1 = phi i32 [ %inc, %if.then ], [ %top.077, %for.body ]
%mul = mul nsw i32 %retval.0.i71, %retval.0.i
%cmp22 = icmp slt i32 %mul, 0
br i1 %cmp22, label %if.then23, label %for.inc
if.then23: ; preds = %if.end
%inc24 = add nsw i32 %top.1, 1
%idxprom25 = sext i32 %top.1 to i64
%arrayidx26 = getelementptr inbounds %struct.PP, ptr %po, i64 %idxprom25
%33 = load double, ptr %arrayidx, align 8
%34 = load double, ptr %14, align 8
%35 = load double, ptr %arrayidx12, align 8
%36 = load double, ptr %17, align 8
%sub.i.i = fsub double %35, %33
%sub4.i.i = fsub double %36, %34
%37 = fneg double %sub4.i.i
%38 = insertelement <2 x double> poison, double %33, i64 0
%39 = shufflevector <2 x double> %38, <2 x double> poison, <2 x i32> zeroinitializer
%40 = fsub <2 x double> %7, %39
%41 = insertelement <2 x double> poison, double %34, i64 0
%42 = shufflevector <2 x double> %41, <2 x double> poison, <2 x i32> zeroinitializer
%43 = fsub <2 x double> %6, %42
%44 = insertelement <2 x double> poison, double %37, i64 0
%45 = shufflevector <2 x double> %44, <2 x double> poison, <2 x i32> zeroinitializer
%46 = fmul <2 x double> %40, %45
%47 = insertelement <2 x double> poison, double %sub.i.i, i64 0
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%49 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> %43, <2 x double> %46)
%shift = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%50 = fsub <2 x double> %49, %shift
%51 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%52 = fmul <2 x double> %51, %5
%53 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
%54 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %1, <2 x double> %53, <2 x double> %52)
%55 = shufflevector <2 x double> %50, <2 x double> poison, <2 x i32> zeroinitializer
%56 = fdiv <2 x double> %54, %55
store <2 x double> %56, ptr %arrayidx26, align 8
br label %for.inc
for.inc: ; preds = %if.end, %if.then23
%top.2 = phi i32 [ %inc24, %if.then23 ], [ %top.1, %if.end ]
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !22
for.end: ; preds = %for.inc, %entry
%top.0.lcssa = phi i32 [ 0, %entry ], [ %top.2, %for.inc ]
%idxprom35 = sext i32 %top.0.lcssa to i64
%arrayidx36 = getelementptr inbounds %struct.PP, ptr %po, i64 %idxprom35
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %arrayidx36, ptr noundef nonnull align 8 dereferenceable(16) %po, i64 16, i1 false), !tbaa.struct !19
ret i32 %top.0.lcssa
}
; Function Attrs: nounwind uwtable
define dso_local void @unitnormalv(ptr nocapture noundef writeonly %ans, ptr nocapture noundef readonly byval(%struct.SEG) align 8 %a) local_unnamed_addr #0 {
entry:
%e = getelementptr inbounds %struct.SEG, ptr %a, i64 0, i32 1
%0 = load double, ptr %e, align 8
%1 = getelementptr inbounds %struct.SEG, ptr %a, i64 0, i32 1, i32 1
%2 = load double, ptr %1, align 8
%3 = load double, ptr %a, align 8
%4 = getelementptr inbounds { double, double }, ptr %a, i64 0, i32 1
%5 = load double, ptr %4, align 8
%sub.i = fsub double %0, %3
%sub4.i = fsub double %2, %5
%call.i = tail call double @hypot(double noundef %sub.i, double noundef %sub4.i) #11
%6 = fneg double %sub4.i
%7 = tail call double @llvm.fmuladd.f64(double %sub.i, double 0.000000e+00, double %6)
%mul9.i = fmul double %sub4.i, 0.000000e+00
%8 = fadd double %sub.i, %mul9.i
%9 = insertelement <2 x double> poison, double %7, i64 0
%10 = insertelement <2 x double> %9, double %8, i64 1
%11 = insertelement <2 x double> poison, double %call.i, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
store <2 x double> %13, ptr %ans, align 8
%e12 = getelementptr inbounds %struct.SEG, ptr %ans, i64 0, i32 1
%14 = insertelement <2 x double> poison, double %sub.i, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
%16 = insertelement <2 x double> poison, double %sub4.i, i64 0
%17 = insertelement <2 x double> %16, double %mul9.i, i64 1
%18 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> <double 0.000000e+00, double -1.000000e+00>, <2 x double> %17)
%19 = fdiv <2 x double> %18, %12
store <2 x double> %19, ptr %e12, align 8
ret void
}
; Function Attrs: nounwind uwtable
define dso_local void @parallelShift(ptr nocapture noundef writeonly %ans, ptr nocapture noundef readonly byval(%struct.SEG) align 8 %a, double noundef %d) local_unnamed_addr #0 {
entry:
%a33.sroa.5.0.a.sroa_idx = getelementptr inbounds i8, ptr %a, i64 16
%0 = load <2 x double>, ptr %a, align 8
%1 = insertelement <2 x double> poison, double %d, i64 0
%2 = shufflevector <2 x double> %1, <2 x double> poison, <2 x i32> zeroinitializer
%e = getelementptr inbounds %struct.SEG, ptr %ans, i64 0, i32 1
%3 = load <2 x double>, ptr %a33.sroa.5.0.a.sroa_idx, align 8
%4 = fsub <2 x double> %3, %0
%sub.i.i = extractelement <2 x double> %4, i64 0
%5 = fsub <2 x double> %3, %0
%sub4.i.i = extractelement <2 x double> %5, i64 1
%call.i.i = tail call double @hypot(double noundef %sub.i.i, double noundef %sub4.i.i) #11
%6 = fneg double %sub4.i.i
%7 = tail call double @llvm.fmuladd.f64(double %sub.i.i, double 0.000000e+00, double %6)
%mul9.i.i = fmul double %sub4.i.i, 0.000000e+00
%8 = fadd double %sub.i.i, %mul9.i.i
%9 = insertelement <2 x double> poison, double %7, i64 0
%10 = insertelement <2 x double> %9, double %8, i64 1
%11 = insertelement <2 x double> poison, double %call.i.i, i64 0
%12 = shufflevector <2 x double> %11, <2 x double> poison, <2 x i32> zeroinitializer
%13 = fdiv <2 x double> %10, %12
%14 = fmul <2 x double> %13, %2
%15 = fadd <2 x double> %0, %14
store <2 x double> %15, ptr %ans, align 8
%16 = fadd <2 x double> %3, %14
store <2 x double> %16, ptr %e, align 8
%arrayidx11 = getelementptr inbounds %struct.SEG, ptr %ans, i64 1
%17 = shufflevector <2 x double> %4, <2 x double> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x double> poison, double %sub4.i.i, i64 0
%19 = insertelement <2 x double> %18, double %mul9.i.i, i64 1
%20 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %17, <2 x double> <double 0.000000e+00, double -1.000000e+00>, <2 x double> %19)
%21 = fdiv <2 x double> %20, %12
%22 = fmul <2 x double> %21, %2
%23 = fadd <2 x double> %0, %22
store <2 x double> %23, ptr %arrayidx11, align 8
%e20 = getelementptr inbounds %struct.SEG, ptr %ans, i64 1, i32 1
%24 = fadd <2 x double> %3, %22
store <2 x double> %24, ptr %e20, align 8
ret void
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
br label %while.cond
while.cond: ; preds = %for.end63, %entry
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 1
%1 = load ptr, ptr %_IO_read_ptr.i.i, align 8, !tbaa !9
%_IO_read_end.i.i = getelementptr inbounds %struct._IO_FILE, ptr %0, i64 0, i32 2
%2 = load ptr, ptr %_IO_read_end.i.i, align 8, !tbaa !14
%cmp.not.i.i = icmp ult ptr %1, %2
br i1 %cmp.not.i.i, label %cond.false.i.i, label %cond.true.i.i, !prof !15
cond.true.i.i: ; preds = %while.cond
%call.i.i = tail call i32 @__uflow(ptr noundef nonnull %0) #11
%.pre14.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
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 !9
%3 = load i8, ptr %1, align 1, !tbaa !16
%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
%.ph262 = 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 ], [ %.ph262, %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 nsw 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 !9
%_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 !14
%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 !15
cond.true.i7.i: ; preds = %do.body.i
%call.i8.i = tail call i32 @__uflow(ptr noundef nonnull %4) #11
%.pre.i = load ptr, ptr @stdin, align 8, !tbaa !5
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 !9
%7 = load i8, ptr %5, align 1, !tbaa !16
%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 !17
in.exit: ; preds = %getchar_unlocked.exit13.i
%tobool.not = icmp eq i32 %add.i, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %in.exit
%cmp226 = icmp sgt i32 %add.i, 0
br i1 %cmp226, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %add.i to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %in.exit150
%9 = phi ptr [ %8, %for.body.preheader ], [ %29, %in.exit150 ]
%10 = phi ptr [ %8, %for.body.preheader ], [ %30, %in.exit150 ]
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %in.exit150 ]
%_IO_read_ptr.i.i89 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 1
%11 = load ptr, ptr %_IO_read_ptr.i.i89, align 8, !tbaa !9
%_IO_read_end.i.i90 = getelementptr inbounds %struct._IO_FILE, ptr %10, i64 0, i32 2
%12 = load ptr, ptr %_IO_read_end.i.i90, align 8, !tbaa !14
%cmp.not.i.i91 = icmp ult ptr %11, %12
br i1 %cmp.not.i.i91, label %cond.false.i.i116, label %cond.true.i.i92, !prof !15
cond.true.i.i92: ; preds = %for.body
%call.i.i93 = tail call i32 @__uflow(ptr noundef nonnull %10) #11
%.pre14.pre.i94 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i98.preheader
cond.false.i.i116: ; preds = %for.body
%incdec.ptr.i.i117 = getelementptr inbounds i8, ptr %11, i64 1
store ptr %incdec.ptr.i.i117, ptr %_IO_read_ptr.i.i89, align 8, !tbaa !9
%13 = load i8, ptr %11, align 1, !tbaa !16
%conv3.i.i118 = zext i8 %13 to i32
br label %do.body.i98.preheader
do.body.i98.preheader: ; preds = %cond.false.i.i116, %cond.true.i.i92
%.ph260 = phi ptr [ %9, %cond.false.i.i116 ], [ %.pre14.pre.i94, %cond.true.i.i92 ]
%.ph261 = phi ptr [ %10, %cond.false.i.i116 ], [ %.pre14.pre.i94, %cond.true.i.i92 ]
%c.0.i100.ph = phi i32 [ %conv3.i.i118, %cond.false.i.i116 ], [ %call.i.i93, %cond.true.i.i92 ]
br label %do.body.i98
do.body.i98: ; preds = %do.body.i98.preheader, %getchar_unlocked.exit13.i110
%14 = phi ptr [ %19, %getchar_unlocked.exit13.i110 ], [ %.ph260, %do.body.i98.preheader ]
%15 = phi ptr [ %20, %getchar_unlocked.exit13.i110 ], [ %.ph261, %do.body.i98.preheader ]
%n.0.i99 = phi i32 [ %add.i103, %getchar_unlocked.exit13.i110 ], [ 0, %do.body.i98.preheader ]
%c.0.i100 = phi i32 [ %cond.i9.i111, %getchar_unlocked.exit13.i110 ], [ %c.0.i100.ph, %do.body.i98.preheader ]
%mul.i101 = mul nsw i32 %n.0.i99, 10
%and.i102 = and i32 %c.0.i100, 15
%add.i103 = add nsw i32 %and.i102, %mul.i101
%_IO_read_ptr.i4.i104 = getelementptr inbounds %struct._IO_FILE, ptr %15, i64 0, i32 1
%16 = load ptr, ptr %_IO_read_ptr.i4.i104, align 8, !tbaa !9
%_IO_read_end.i5.i105 = getelementptr inbounds %struct._IO_FILE, ptr %15, i64 0, i32 2
%17 = load ptr, ptr %_IO_read_end.i5.i105, align 8, !tbaa !14
%cmp.not.i6.i106 = icmp ult ptr %16, %17
br i1 %cmp.not.i6.i106, label %cond.false.i10.i113, label %cond.true.i7.i107, !prof !15
cond.true.i7.i107: ; preds = %do.body.i98
%call.i8.i108 = tail call i32 @__uflow(ptr noundef nonnull %15) #11
%.pre.i109 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i110
cond.false.i10.i113: ; preds = %do.body.i98
%incdec.ptr.i11.i114 = getelementptr inbounds i8, ptr %16, i64 1
store ptr %incdec.ptr.i11.i114, ptr %_IO_read_ptr.i4.i104, align 8, !tbaa !9
%18 = load i8, ptr %16, align 1, !tbaa !16
%conv3.i12.i115 = zext i8 %18 to i32
br label %getchar_unlocked.exit13.i110
getchar_unlocked.exit13.i110: ; preds = %cond.false.i10.i113, %cond.true.i7.i107
%19 = phi ptr [ %.pre.i109, %cond.true.i7.i107 ], [ %14, %cond.false.i10.i113 ]
%20 = phi ptr [ %.pre.i109, %cond.true.i7.i107 ], [ %15, %cond.false.i10.i113 ]
%cond.i9.i111 = phi i32 [ %call.i8.i108, %cond.true.i7.i107 ], [ %conv3.i12.i115, %cond.false.i10.i113 ]
%cmp.i112 = icmp sgt i32 %cond.i9.i111, 47
br i1 %cmp.i112, label %do.body.i98, label %in.exit119, !llvm.loop !17
in.exit119: ; preds = %getchar_unlocked.exit13.i110
%conv = sitofp i32 %add.i103 to double
%arrayidx = getelementptr inbounds [101 x %struct.PP], ptr @p, i64 0, i64 %indvars.iv
store double %conv, ptr %arrayidx, align 16, !tbaa !23
%_IO_read_ptr.i.i120 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 1
%21 = load ptr, ptr %_IO_read_ptr.i.i120, align 8, !tbaa !9
%_IO_read_end.i.i121 = getelementptr inbounds %struct._IO_FILE, ptr %19, i64 0, i32 2
%22 = load ptr, ptr %_IO_read_end.i.i121, align 8, !tbaa !14
%cmp.not.i.i122 = icmp ult ptr %21, %22
br i1 %cmp.not.i.i122, label %cond.false.i.i147, label %cond.true.i.i123, !prof !15
cond.true.i.i123: ; preds = %in.exit119
%call.i.i124 = tail call i32 @__uflow(ptr noundef nonnull %19) #11
%.pre14.pre.i125 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %do.body.i129.preheader
cond.false.i.i147: ; preds = %in.exit119
%incdec.ptr.i.i148 = getelementptr inbounds i8, ptr %21, i64 1
store ptr %incdec.ptr.i.i148, ptr %_IO_read_ptr.i.i120, align 8, !tbaa !9
%23 = load i8, ptr %21, align 1, !tbaa !16
%conv3.i.i149 = zext i8 %23 to i32
br label %do.body.i129.preheader
do.body.i129.preheader: ; preds = %cond.false.i.i147, %cond.true.i.i123
%.ph259 = phi ptr [ %19, %cond.false.i.i147 ], [ %.pre14.pre.i125, %cond.true.i.i123 ]
%c.0.i131.ph = phi i32 [ %conv3.i.i149, %cond.false.i.i147 ], [ %call.i.i124, %cond.true.i.i123 ]
br label %do.body.i129
do.body.i129: ; preds = %do.body.i129.preheader, %getchar_unlocked.exit13.i141
%24 = phi ptr [ %29, %getchar_unlocked.exit13.i141 ], [ %.ph259, %do.body.i129.preheader ]
%25 = phi ptr [ %30, %getchar_unlocked.exit13.i141 ], [ %.ph259, %do.body.i129.preheader ]
%n.0.i130 = phi i32 [ %add.i134, %getchar_unlocked.exit13.i141 ], [ 0, %do.body.i129.preheader ]
%c.0.i131 = phi i32 [ %cond.i9.i142, %getchar_unlocked.exit13.i141 ], [ %c.0.i131.ph, %do.body.i129.preheader ]
%mul.i132 = mul nsw i32 %n.0.i130, 10
%and.i133 = and i32 %c.0.i131, 15
%add.i134 = add nsw i32 %and.i133, %mul.i132
%_IO_read_ptr.i4.i135 = getelementptr inbounds %struct._IO_FILE, ptr %25, i64 0, i32 1
%26 = load ptr, ptr %_IO_read_ptr.i4.i135, align 8, !tbaa !9
%_IO_read_end.i5.i136 = getelementptr inbounds %struct._IO_FILE, ptr %25, i64 0, i32 2
%27 = load ptr, ptr %_IO_read_end.i5.i136, align 8, !tbaa !14
%cmp.not.i6.i137 = icmp ult ptr %26, %27
br i1 %cmp.not.i6.i137, label %cond.false.i10.i144, label %cond.true.i7.i138, !prof !15
cond.true.i7.i138: ; preds = %do.body.i129
%call.i8.i139 = tail call i32 @__uflow(ptr noundef nonnull %25) #11
%.pre.i140 = load ptr, ptr @stdin, align 8, !tbaa !5
br label %getchar_unlocked.exit13.i141
cond.false.i10.i144: ; preds = %do.body.i129
%incdec.ptr.i11.i145 = getelementptr inbounds i8, ptr %26, i64 1
store ptr %incdec.ptr.i11.i145, ptr %_IO_read_ptr.i4.i135, align 8, !tbaa !9
%28 = load i8, ptr %26, align 1, !tbaa !16
%conv3.i12.i146 = zext i8 %28 to i32
br label %getchar_unlocked.exit13.i141
getchar_unlocked.exit13.i141: ; preds = %cond.false.i10.i144, %cond.true.i7.i138
%29 = phi ptr [ %.pre.i140, %cond.true.i7.i138 ], [ %24, %cond.false.i10.i144 ]
%30 = phi ptr [ %.pre.i140, %cond.true.i7.i138 ], [ %25, %cond.false.i10.i144 ]
%cond.i9.i142 = phi i32 [ %call.i8.i139, %cond.true.i7.i138 ], [ %conv3.i12.i146, %cond.false.i10.i144 ]
%cmp.i143 = icmp sgt i32 %cond.i9.i142, 47
br i1 %cmp.i143, label %do.body.i129, label %in.exit150, !llvm.loop !17
in.exit150: ; preds = %getchar_unlocked.exit13.i141
%conv3 = sitofp i32 %add.i134 to double
%y = getelementptr inbounds [101 x %struct.PP], ptr @p, i64 0, i64 %indvars.iv, i32 1
store double %conv3, ptr %y, align 8, !tbaa !25
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !26
for.end: ; preds = %in.exit150, %for.cond.preheader
%idxprom6 = sext i32 %add.i to i64
%arrayidx7 = getelementptr inbounds [101 x %struct.PP], ptr @p, i64 0, i64 %idxprom6
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx7, ptr noundef nonnull align 16 dereferenceable(16) @p, i64 16, i1 false), !tbaa.struct !19
%add12 = add nsw i32 %add.i, 1
%conv13 = sext i32 %add12 to i64
%mul14 = shl nsw i64 %conv13, 4
br i1 %cmp226, label %for.body11.us.preheader, label %for.body11.preheader
for.body11.preheader: ; preds = %for.end
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @po, ptr nonnull align 16 @p, i64 %mul14, i1 false)
br label %for.end63
for.body11.us.preheader: ; preds = %for.end
%wide.trip.count245 = zext i32 %add.i to i64
br label %for.body11.us
for.body11.us: ; preds = %for.body11.us.preheader, %for.end56.us
%i.1238.us = phi i32 [ %inc62.us, %for.end56.us ], [ 0, %for.body11.us.preheader ]
%hi.0237.us = phi double [ %mul.hi.0.us, %for.end56.us ], [ 1.000000e+04, %for.body11.us.preheader ]
%lo.0236.us = phi double [ %lo.0.mul.us, %for.end56.us ], [ 0.000000e+00, %for.body11.us.preheader ]
%add.us = fadd double %lo.0236.us, %hi.0237.us
%mul.us = fmul double %add.us, 5.000000e-01
tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @po, ptr nonnull align 16 @p, i64 %mul14, i1 false)
%31 = load <2 x double>, ptr @p, align 16
%32 = insertelement <2 x double> poison, double %mul.us, i64 0
%33 = shufflevector <2 x double> %32, <2 x double> poison, <2 x i32> zeroinitializer
br label %for.body18.us
for.cond15.us: ; preds = %if.end.us
%lnot.ext.us = xor i32 %k2.0232.us, 1
%exitcond246.not = icmp eq i64 %indvars.iv.next243, %wide.trip.count245
br i1 %exitcond246.not, label %for.end56.us, label %for.body18.us, !llvm.loop !27
for.body18.us: ; preds = %for.body11.us, %for.cond15.us
%indvars.iv242 = phi i64 [ 0, %for.body11.us ], [ %indvars.iv.next243, %for.cond15.us ]
%k2.0232.us = phi i32 [ 1, %for.body11.us ], [ %lnot.ext.us, %for.cond15.us ]
%k1.0231.us = phi i32 [ 0, %for.body11.us ], [ %k2.0232.us, %for.cond15.us ]
%k.0230.us = phi i32 [ %add.i, %for.body11.us ], [ %top.0.lcssa.i.us.sink, %for.cond15.us ]
%34 = phi <2 x double> [ %31, %for.body11.us ], [ %59, %for.cond15.us ]
%arrayidx20.us = getelementptr inbounds [101 x %struct.PP], ptr @p, i64 0, i64 %indvars.iv242
%a.sroa.4.0.arrayidx20.sroa_idx.us = getelementptr inbounds i8, ptr %arrayidx20.us, i64 8
%indvars.iv.next243 = add nuw nsw i64 %indvars.iv242, 1
%arrayidx23.us = getelementptr inbounds [101 x %struct.PP], ptr @p, i64 0, i64 %indvars.iv.next243
%35 = load <2 x double>, ptr %arrayidx23.us, align 16
%36 = fsub <2 x double> %35, %34
%sub.i.i.i.us = extractelement <2 x double> %36, i64 0
%37 = fsub <2 x double> %35, %34
%sub4.i.i.i.us = extractelement <2 x double> %37, i64 1
%call.i.i.i.us = tail call double @hypot(double noundef %sub.i.i.i.us, double noundef %sub4.i.i.i.us) #11
%38 = fneg double %sub4.i.i.i.us
%39 = tail call double @llvm.fmuladd.f64(double %sub.i.i.i.us, double 0.000000e+00, double %38)
%mul9.i.i.i.us = fmul double %sub4.i.i.i.us, 0.000000e+00
%40 = fadd double %sub.i.i.i.us, %mul9.i.i.i.us
%41 = insertelement <2 x double> poison, double %39, i64 0
%42 = insertelement <2 x double> %41, double %40, i64 1
%43 = insertelement <2 x double> poison, double %call.i.i.i.us, i64 0
%44 = shufflevector <2 x double> %43, <2 x double> poison, <2 x i32> zeroinitializer
%45 = fdiv <2 x double> %42, %44
%46 = fmul <2 x double> %33, %45
%47 = fadd <2 x double> %34, %46
%48 = fadd <2 x double> %35, %46
%49 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%50 = insertelement <2 x double> poison, double %sub4.i.i.i.us, i64 0
%51 = insertelement <2 x double> %50, double %mul9.i.i.i.us, i64 1
%52 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %49, <2 x double> <double 0.000000e+00, double -1.000000e+00>, <2 x double> %51)
%53 = fdiv <2 x double> %52, %44
%54 = fmul <2 x double> %33, %53
%55 = fadd <2 x double> %34, %54
%56 = fadd <2 x double> %35, %54
%57 = load double, ptr %arrayidx20.us, align 16
%58 = load double, ptr %a.sroa.4.0.arrayidx20.sroa_idx.us, align 8
%59 = load <2 x double>, ptr %arrayidx23.us, align 16
%60 = extractelement <2 x double> %59, i64 0
%sub.i.i.us = fsub double %60, %57
%61 = extractelement <2 x double> %59, i64 1
%sub4.i.i.us = fsub double %61, %58
%62 = extractelement <2 x double> %47, i64 0
%sub.i29.i.us = fsub double %62, %57
%63 = extractelement <2 x double> %47, i64 1
%sub4.i30.i.us = fsub double %63, %58
%64 = fneg double %sub4.i.i.us
%neg.i.i.us = fmul double %sub.i29.i.us, %64
%65 = tail call double @llvm.fmuladd.f64(double %sub.i.i.us, double %sub4.i30.i.us, double %neg.i.i.us)
%cmp.i152.us = fcmp ogt double %65, 1.000000e-08
%idxprom35.us = zext i32 %k1.0231.us to i64
%arrayidx36.us = getelementptr inbounds [2 x [500 x %struct.PP]], ptr @po, i64 0, i64 %idxprom35.us
%idxprom38.us = zext i32 %k2.0232.us to i64
%arrayidx39.us = getelementptr inbounds [2 x [500 x %struct.PP]], ptr @po, i64 0, i64 %idxprom38.us
%cmp76.i.us = icmp sgt i32 %k.0230.us, 0
br i1 %cmp.i152.us, label %if.then.us, label %if.end.i.us
if.end.i.us: ; preds = %for.body18.us
br i1 %cmp76.i.us, label %for.body.lr.ph.i168.us, label %if.end.us
for.body.lr.ph.i168.us: ; preds = %if.end.i.us
%66 = fsub <2 x double> %56, %55
%67 = fsub <2 x double> %56, %55
%sub4.i.i171.us = extractelement <2 x double> %67, i64 1
%68 = fneg double %sub4.i.i171.us
%69 = fneg <2 x double> %56
%wide.trip.count.i172.us = zext i32 %k.0230.us to i64
%70 = shufflevector <2 x double> %56, <2 x double> %55, <2 x i32> <i32 1, i32 3>
%71 = shufflevector <2 x double> %56, <2 x double> %55, <2 x i32> <i32 0, i32 2>
%72 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> zeroinitializer
%73 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%74 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%75 = insertelement <2 x double> poison, double %68, i64 0
%76 = shufflevector <2 x double> %75, <2 x double> poison, <2 x i32> zeroinitializer
br label %for.body.i173.us
for.body.i173.us: ; preds = %for.inc.i198.us, %for.body.lr.ph.i168.us
%indvars.iv.i174.us = phi i64 [ 0, %for.body.lr.ph.i168.us ], [ %indvars.iv.next.i184.us, %for.inc.i198.us ]
%top.077.i175.us = phi i32 [ 0, %for.body.lr.ph.i168.us ], [ %top.2.i199.us, %for.inc.i198.us ]
%arrayidx.i176.us = getelementptr inbounds %struct.PP, ptr %arrayidx36.us, i64 %indvars.iv.i174.us
%77 = load double, ptr %arrayidx.i176.us, align 16
%78 = getelementptr inbounds { double, double }, ptr %arrayidx.i176.us, i64 0, i32 1
%79 = load double, ptr %78, align 8
%indvars.iv.next.i184.us = add nuw nsw i64 %indvars.iv.i174.us, 1
%arrayidx12.i185.us = getelementptr inbounds %struct.PP, ptr %arrayidx36.us, i64 %indvars.iv.next.i184.us
%80 = load double, ptr %arrayidx12.i185.us, align 16
%81 = getelementptr inbounds { double, double }, ptr %arrayidx12.i185.us, i64 0, i32 1
%82 = load double, ptr %81, align 8
%83 = insertelement <2 x double> poison, double %80, i64 0
%84 = insertelement <2 x double> %83, double %77, i64 1
%85 = fsub <2 x double> %84, %74
%86 = insertelement <2 x double> poison, double %82, i64 0
%87 = insertelement <2 x double> %86, double %79, i64 1
%88 = fsub <2 x double> %87, %73
%89 = fmul <2 x double> %85, %76
%90 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %72, <2 x double> %88, <2 x double> %89)
%91 = extractelement <2 x double> %90, i64 1
%cmp1.i.i181.us = fcmp ole double %91, 0.000000e+00
%cond.i.i182.us = select i1 %cmp1.i.i181.us, i32 -1, i32 1
%92 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %90)
%93 = fcmp olt <2 x double> %92, <double 1.000000e-08, double 1.000000e-08>
%94 = extractelement <2 x i1> %93, i64 1
%retval.0.i.i183.us = select i1 %94, i32 0, i32 %cond.i.i182.us
%95 = extractelement <2 x double> %90, i64 0
%cmp1.i69.i190.us = fcmp ole double %95, 0.000000e+00
%cond.i70.i191.us = select i1 %cmp1.i69.i190.us, i32 -1, i32 1
%96 = extractelement <2 x i1> %93, i64 0
%retval.0.i71.i192.us = select i1 %96, i32 0, i32 %cond.i70.i191.us
%cmp17.i193.us = icmp sgt i32 %retval.0.i.i183.us, -1
br i1 %cmp17.i193.us, label %if.then.i219.us, label %if.end.i194.us
if.then.i219.us: ; preds = %for.body.i173.us
%inc.i220.us = add nsw i32 %top.077.i175.us, 1
%idxprom18.i221.us = sext i32 %top.077.i175.us to i64
%arrayidx19.i222.us = getelementptr inbounds %struct.PP, ptr %arrayidx39.us, i64 %idxprom18.i221.us
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx19.i222.us, ptr noundef nonnull align 16 dereferenceable(16) %arrayidx.i176.us, i64 16, i1 false), !tbaa.struct !19
br label %if.end.i194.us
if.end.i194.us: ; preds = %if.then.i219.us, %for.body.i173.us
%top.1.i195.us = phi i32 [ %inc.i220.us, %if.then.i219.us ], [ %top.077.i175.us, %for.body.i173.us ]
%mul.i196.us = mul nsw i32 %retval.0.i71.i192.us, %retval.0.i.i183.us
%cmp22.i197.us = icmp slt i32 %mul.i196.us, 0
br i1 %cmp22.i197.us, label %if.then23.i201.us, label %for.inc.i198.us
if.then23.i201.us: ; preds = %if.end.i194.us
%inc24.i202.us = add nsw i32 %top.1.i195.us, 1
%idxprom25.i203.us = sext i32 %top.1.i195.us to i64
%arrayidx26.i204.us = getelementptr inbounds %struct.PP, ptr %arrayidx39.us, i64 %idxprom25.i203.us
%97 = load double, ptr %arrayidx.i176.us, align 16
%98 = load double, ptr %78, align 8
%99 = load double, ptr %arrayidx12.i185.us, align 16
%100 = load double, ptr %81, align 8
%sub.i.i.i205.us = fsub double %99, %97
%sub4.i.i.i206.us = fsub double %100, %98
%101 = fneg double %sub4.i.i.i206.us
%102 = insertelement <2 x double> poison, double %97, i64 0
%103 = shufflevector <2 x double> %102, <2 x double> poison, <2 x i32> zeroinitializer
%104 = fsub <2 x double> %71, %103
%105 = insertelement <2 x double> poison, double %98, i64 0
%106 = shufflevector <2 x double> %105, <2 x double> poison, <2 x i32> zeroinitializer
%107 = fsub <2 x double> %70, %106
%108 = insertelement <2 x double> poison, double %101, i64 0
%109 = shufflevector <2 x double> %108, <2 x double> poison, <2 x i32> zeroinitializer
%110 = fmul <2 x double> %104, %109
%111 = insertelement <2 x double> poison, double %sub.i.i.i205.us, i64 0
%112 = shufflevector <2 x double> %111, <2 x double> poison, <2 x i32> zeroinitializer
%113 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %112, <2 x double> %107, <2 x double> %110)
%shift = shufflevector <2 x double> %113, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%114 = fsub <2 x double> %113, %shift
%115 = shufflevector <2 x double> %113, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%116 = fmul <2 x double> %115, %69
%117 = shufflevector <2 x double> %113, <2 x double> poison, <2 x i32> zeroinitializer
%118 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %55, <2 x double> %117, <2 x double> %116)
%119 = shufflevector <2 x double> %114, <2 x double> poison, <2 x i32> zeroinitializer
%120 = fdiv <2 x double> %118, %119
store <2 x double> %120, ptr %arrayidx26.i204.us, align 16
br label %for.inc.i198.us
for.inc.i198.us: ; preds = %if.then23.i201.us, %if.end.i194.us
%top.2.i199.us = phi i32 [ %inc24.i202.us, %if.then23.i201.us ], [ %top.1.i195.us, %if.end.i194.us ]
%exitcond.not.i200.us = icmp eq i64 %indvars.iv.next.i184.us, %wide.trip.count.i172.us
br i1 %exitcond.not.i200.us, label %if.end.us, label %for.body.i173.us, !llvm.loop !22
if.then.us: ; preds = %for.body18.us
br i1 %cmp76.i.us, label %for.body.lr.ph.i.us, label %if.end.us
for.body.lr.ph.i.us: ; preds = %if.then.us
%121 = fsub <2 x double> %48, %47
%122 = fsub <2 x double> %48, %47
%sub4.i.i156.us = extractelement <2 x double> %122, i64 1
%123 = fneg double %sub4.i.i156.us
%124 = fneg <2 x double> %48
%wide.trip.count.i.us = zext i32 %k.0230.us to i64
%125 = shufflevector <2 x double> %48, <2 x double> %47, <2 x i32> <i32 1, i32 3>
%126 = shufflevector <2 x double> %48, <2 x double> %47, <2 x i32> <i32 0, i32 2>
%127 = shufflevector <2 x double> %121, <2 x double> poison, <2 x i32> zeroinitializer
%128 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%129 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%130 = insertelement <2 x double> poison, double %123, i64 0
%131 = shufflevector <2 x double> %130, <2 x double> poison, <2 x i32> zeroinitializer
br label %for.body.i.us
for.body.i.us: ; preds = %for.inc.i.us, %for.body.lr.ph.i.us
%indvars.iv.i.us = phi i64 [ 0, %for.body.lr.ph.i.us ], [ %indvars.iv.next.i.us, %for.inc.i.us ]
%top.077.i.us = phi i32 [ 0, %for.body.lr.ph.i.us ], [ %top.2.i.us, %for.inc.i.us ]
%arrayidx.i.us = getelementptr inbounds %struct.PP, ptr %arrayidx36.us, i64 %indvars.iv.i.us
%132 = load double, ptr %arrayidx.i.us, align 16
%133 = getelementptr inbounds { double, double }, ptr %arrayidx.i.us, i64 0, i32 1
%134 = load double, ptr %133, align 8
%indvars.iv.next.i.us = add nuw nsw i64 %indvars.iv.i.us, 1
%arrayidx12.i.us = getelementptr inbounds %struct.PP, ptr %arrayidx36.us, i64 %indvars.iv.next.i.us
%135 = load double, ptr %arrayidx12.i.us, align 16
%136 = getelementptr inbounds { double, double }, ptr %arrayidx12.i.us, i64 0, i32 1
%137 = load double, ptr %136, align 8
%138 = insertelement <2 x double> poison, double %135, i64 0
%139 = insertelement <2 x double> %138, double %132, i64 1
%140 = fsub <2 x double> %139, %129
%141 = insertelement <2 x double> poison, double %137, i64 0
%142 = insertelement <2 x double> %141, double %134, i64 1
%143 = fsub <2 x double> %142, %128
%144 = fmul <2 x double> %140, %131
%145 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %127, <2 x double> %143, <2 x double> %144)
%146 = extractelement <2 x double> %145, i64 1
%cmp1.i.i.us = fcmp ole double %146, 0.000000e+00
%cond.i.i158.us = select i1 %cmp1.i.i.us, i32 -1, i32 1
%147 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %145)
%148 = fcmp olt <2 x double> %147, <double 1.000000e-08, double 1.000000e-08>
%149 = extractelement <2 x i1> %148, i64 1
%retval.0.i.i.us = select i1 %149, i32 0, i32 %cond.i.i158.us
%150 = extractelement <2 x double> %145, i64 0
%cmp1.i69.i.us = fcmp ole double %150, 0.000000e+00
%cond.i70.i.us = select i1 %cmp1.i69.i.us, i32 -1, i32 1
%151 = extractelement <2 x i1> %148, i64 0
%retval.0.i71.i.us = select i1 %151, i32 0, i32 %cond.i70.i.us
%cmp17.i.us = icmp sgt i32 %retval.0.i.i.us, -1
br i1 %cmp17.i.us, label %if.then.i.us, label %if.end.i159.us
if.then.i.us: ; preds = %for.body.i.us
%inc.i.us = add nsw i32 %top.077.i.us, 1
%idxprom18.i.us = sext i32 %top.077.i.us to i64
%arrayidx19.i.us = getelementptr inbounds %struct.PP, ptr %arrayidx39.us, i64 %idxprom18.i.us
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx19.i.us, ptr noundef nonnull align 16 dereferenceable(16) %arrayidx.i.us, i64 16, i1 false), !tbaa.struct !19
br label %if.end.i159.us
if.end.i159.us: ; preds = %if.then.i.us, %for.body.i.us
%top.1.i.us = phi i32 [ %inc.i.us, %if.then.i.us ], [ %top.077.i.us, %for.body.i.us ]
%mul.i160.us = mul nsw i32 %retval.0.i71.i.us, %retval.0.i.i.us
%cmp22.i.us = icmp slt i32 %mul.i160.us, 0
br i1 %cmp22.i.us, label %if.then23.i.us, label %for.inc.i.us
if.then23.i.us: ; preds = %if.end.i159.us
%inc24.i.us = add nsw i32 %top.1.i.us, 1
%idxprom25.i.us = sext i32 %top.1.i.us to i64
%arrayidx26.i.us = getelementptr inbounds %struct.PP, ptr %arrayidx39.us, i64 %idxprom25.i.us
%152 = load double, ptr %arrayidx.i.us, align 16
%153 = load double, ptr %133, align 8
%154 = load double, ptr %arrayidx12.i.us, align 16
%155 = load double, ptr %136, align 8
%sub.i.i.i161.us = fsub double %154, %152
%sub4.i.i.i162.us = fsub double %155, %153
%156 = fneg double %sub4.i.i.i162.us
%157 = insertelement <2 x double> poison, double %152, i64 0
%158 = shufflevector <2 x double> %157, <2 x double> poison, <2 x i32> zeroinitializer
%159 = fsub <2 x double> %126, %158
%160 = insertelement <2 x double> poison, double %153, i64 0
%161 = shufflevector <2 x double> %160, <2 x double> poison, <2 x i32> zeroinitializer
%162 = fsub <2 x double> %125, %161
%163 = insertelement <2 x double> poison, double %156, i64 0
%164 = shufflevector <2 x double> %163, <2 x double> poison, <2 x i32> zeroinitializer
%165 = fmul <2 x double> %159, %164
%166 = insertelement <2 x double> poison, double %sub.i.i.i161.us, i64 0
%167 = shufflevector <2 x double> %166, <2 x double> poison, <2 x i32> zeroinitializer
%168 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %167, <2 x double> %162, <2 x double> %165)
%shift257 = shufflevector <2 x double> %168, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%169 = fsub <2 x double> %168, %shift257
%170 = shufflevector <2 x double> %168, <2 x double> poison, <2 x i32> <i32 1, i32 1>
%171 = fmul <2 x double> %170, %124
%172 = shufflevector <2 x double> %168, <2 x double> poison, <2 x i32> zeroinitializer
%173 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %47, <2 x double> %172, <2 x double> %171)
%174 = shufflevector <2 x double> %169, <2 x double> poison, <2 x i32> zeroinitializer
%175 = fdiv <2 x double> %173, %174
store <2 x double> %175, ptr %arrayidx26.i.us, align 16
br label %for.inc.i.us
for.inc.i.us: ; preds = %if.then23.i.us, %if.end.i159.us
%top.2.i.us = phi i32 [ %inc24.i.us, %if.then23.i.us ], [ %top.1.i.us, %if.end.i159.us ]
%exitcond.not.i.us = icmp eq i64 %indvars.iv.next.i.us, %wide.trip.count.i.us
br i1 %exitcond.not.i.us, label %if.end.us, label %for.body.i.us, !llvm.loop !22
if.end.us: ; preds = %for.inc.i198.us, %for.inc.i.us, %if.then.us, %if.end.i.us
%top.0.lcssa.i.us.sink = phi i32 [ 0, %if.end.i.us ], [ 0, %if.then.us ], [ %top.2.i.us, %for.inc.i.us ], [ %top.2.i199.us, %for.inc.i198.us ]
%idxprom35.i.us = sext i32 %top.0.lcssa.i.us.sink to i64
%arrayidx36.i.us = getelementptr inbounds %struct.PP, ptr %arrayidx39.us, i64 %idxprom35.i.us
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %arrayidx36.i.us, ptr noundef nonnull align 16 dereferenceable(16) %arrayidx39.us, i64 16, i1 false)
%tobool50.not.us = icmp eq i32 %top.0.lcssa.i.us.sink, 0
br i1 %tobool50.not.us, label %for.end56.us, label %for.cond15.us
for.end56.us: ; preds = %for.cond15.us, %if.end.us
%mul.hi.0.us = phi double [ %mul.us, %if.end.us ], [ %hi.0237.us, %for.cond15.us ]
%lo.0.mul.us = phi double [ %lo.0236.us, %if.end.us ], [ %mul.us, %for.cond15.us ]
%inc62.us = add nuw nsw i32 %i.1238.us, 1
%exitcond247.not = icmp eq i32 %inc62.us, 40
br i1 %exitcond247.not, label %for.end63, label %for.body11.us, !llvm.loop !28
for.end63: ; preds = %for.end56.us, %for.body11.preheader
%.us-phi = phi double [ 1.000000e+04, %for.body11.preheader ], [ %mul.hi.0.us, %for.end56.us ]
%call64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %.us-phi)
br label %while.cond, !llvm.loop !29
while.end: ; preds = %in.exit
ret i32 0
}
; 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
; 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>) #10
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #10
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-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: readwrite) }
attributes #6 = { mustprogress nofree 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 nosync nounwind memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_IO_FILE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !12, i64 120, !13, i64 128, !7, i64 130, !7, i64 131, !6, i64 136, !12, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !11, i64 192, !7, i64 196}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!"branch_weights", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{i64 0, i64 8, !20, i64 8, i64 8, !20}
!20 = !{!21, !21, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = distinct !{!22, !18}
!23 = !{!24, !21, i64 0}
!24 = !{!"", !21, i64 0, !21, i64 8}
!25 = !{!24, !21, i64 8}
!26 = distinct !{!26, !18}
!27 = distinct !{!27, !18}
!28 = distinct !{!28, !18}
!29 = distinct !{!29, !18}
|
#include <stdio.h>
#include <string.h>
void sw(char* line);
int A[4]={0,0,0,0};
int main(void) {
int i;
char str[100],*line;
for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
line=strtok(str," ,\n");
line=strtok(NULL," ,\n");
if(strcmp("A",line)==0)
A[0]+=1;
if(strcmp("B",line)==0)
A[1]+=1;
if(strcmp("AB",line)==0)
A[2]+=1;
if(strcmp("O",line)==0)
A[3]+=1;
}
for(i=0;i<4;i++){
printf("%d\n",A[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180789/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180789/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@A = dso_local local_unnamed_addr global [4 x i32] zeroinitializer, align 16
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [4 x i8] c" ,\0A\00", align 1
@.str.1 = private unnamed_addr constant [2 x i8] c"A\00", align 1
@.str.2 = private unnamed_addr constant [2 x i8] c"B\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"AB\00", align 1
@.str.4 = private unnamed_addr constant [2 x i8] c"O\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %str) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call31 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 100, ptr noundef %0)
%cmp.not32 = icmp eq ptr %call31, null
br i1 %cmp.not32, label %for.cond21.preheader, label %for.body
for.cond21.preheader: ; preds = %if.end20, %entry
%1 = load i32, ptr @A, align 16, !tbaa !9
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %1)
%2 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 1), align 4, !tbaa !9
%call24.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %2)
%3 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 2), align 8, !tbaa !9
%call24.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %3)
%4 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 3), align 4, !tbaa !9
%call24.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %4)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %str) #5
ret i32 0
for.body: ; preds = %entry, %if.end20
%call2 = call ptr @strtok(ptr noundef nonnull %str, ptr noundef nonnull @.str) #5
%call3 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str) #5
%call4 = call i32 @strcmp(ptr noundef nonnull dereferenceable(2) @.str.1, ptr noundef nonnull dereferenceable(1) %call3) #6
%cmp5 = icmp eq i32 %call4, 0
br i1 %cmp5, label %if.then, label %if.end
if.then: ; preds = %for.body
%5 = load i32, ptr @A, align 16, !tbaa !9
%add = add nsw i32 %5, 1
store i32 %add, ptr @A, align 16, !tbaa !9
br label %if.end
if.end: ; preds = %if.then, %for.body
%call6 = call i32 @strcmp(ptr noundef nonnull dereferenceable(2) @.str.2, ptr noundef nonnull dereferenceable(1) %call3) #6
%cmp7 = icmp eq i32 %call6, 0
br i1 %cmp7, label %if.then8, label %if.end10
if.then8: ; preds = %if.end
%6 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 1), align 4, !tbaa !9
%add9 = add nsw i32 %6, 1
store i32 %add9, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 1), align 4, !tbaa !9
br label %if.end10
if.end10: ; preds = %if.then8, %if.end
%call11 = call i32 @strcmp(ptr noundef nonnull dereferenceable(3) @.str.3, ptr noundef nonnull dereferenceable(1) %call3) #6
%cmp12 = icmp eq i32 %call11, 0
br i1 %cmp12, label %if.then13, label %if.end15
if.then13: ; preds = %if.end10
%7 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 2), align 8, !tbaa !9
%add14 = add nsw i32 %7, 1
store i32 %add14, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 2), align 8, !tbaa !9
br label %if.end15
if.end15: ; preds = %if.then13, %if.end10
%call16 = call i32 @strcmp(ptr noundef nonnull dereferenceable(2) @.str.4, ptr noundef nonnull dereferenceable(1) %call3) #6
%cmp17 = icmp eq i32 %call16, 0
br i1 %cmp17, label %if.then18, label %if.end20
if.then18: ; preds = %if.end15
%8 = load i32, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 3), align 4, !tbaa !9
%add19 = add nsw i32 %8, 1
store i32 %add19, ptr getelementptr inbounds ([4 x i32], ptr @A, i64 0, i64 3), align 4, !tbaa !9
br label %if.end20
if.end20: ; preds = %if.then18, %if.end15
%9 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 100, ptr noundef %9)
%cmp.not = icmp eq ptr %call, null
br i1 %cmp.not, label %for.cond21.preheader, label %for.body, !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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void)
{
int i, n;
char t[4];
int c[4];
for (i=0; i<4; ++i) c[i]=0;
while (scanf("%d,%s", &n, t) != EOF) {
switch (t[0]) {
case 'A': if (t[1]=='B') c[2]++; else c[0]++; break;
case 'B': c[1]++; break;
case 'O': c[3]++; break;
}
}
if (c[0] == 11) return 1;
for (i=0; i<4; ++i) printf("%d\n", c[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180853/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180853/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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,%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%t = alloca [4 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t)
%cmp1.not42 = icmp eq i32 %call41, -1
br i1 %cmp1.not42, label %for.body25.preheader, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [4 x i8], ptr %t, i64 0, i64 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %sw.epilog
%inc848 = phi i32 [ 0, %while.body.lr.ph ], [ %inc847, %sw.epilog ]
%inc1346 = phi i32 [ 0, %while.body.lr.ph ], [ %inc1345, %sw.epilog ]
%inc1644 = phi i32 [ 0, %while.body.lr.ph ], [ %inc1643, %sw.epilog ]
%0 = phi i32 [ 0, %while.body.lr.ph ], [ %3, %sw.epilog ]
%1 = load i8, ptr %t, align 1, !tbaa !5
%conv = sext i8 %1 to i32
switch i32 %conv, label %sw.epilog [
i32 65, label %sw.bb
i32 66, label %sw.bb11
i32 79, label %sw.bb14
]
sw.bb: ; preds = %while.body
%2 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5 = icmp eq i8 %2, 66
br i1 %cmp5, label %if.then, label %if.else
if.then: ; preds = %sw.bb
%inc8 = add nsw i32 %inc848, 1
br label %sw.epilog
if.else: ; preds = %sw.bb
%inc10 = add nsw i32 %0, 1
br label %sw.epilog
sw.bb11: ; preds = %while.body
%inc13 = add nsw i32 %inc1346, 1
br label %sw.epilog
sw.bb14: ; preds = %while.body
%inc16 = add nsw i32 %inc1644, 1
br label %sw.epilog
sw.epilog: ; preds = %if.then, %if.else, %while.body, %sw.bb14, %sw.bb11
%inc847 = phi i32 [ %inc8, %if.then ], [ %inc848, %if.else ], [ %inc848, %while.body ], [ %inc848, %sw.bb14 ], [ %inc848, %sw.bb11 ]
%inc1345 = phi i32 [ %inc1346, %if.then ], [ %inc1346, %if.else ], [ %inc1346, %while.body ], [ %inc1346, %sw.bb14 ], [ %inc13, %sw.bb11 ]
%inc1643 = phi i32 [ %inc1644, %if.then ], [ %inc1644, %if.else ], [ %inc1644, %while.body ], [ %inc16, %sw.bb14 ], [ %inc1644, %sw.bb11 ]
%3 = phi i32 [ %0, %if.then ], [ %inc10, %if.else ], [ %0, %while.body ], [ %0, %sw.bb14 ], [ %0, %sw.bb11 ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %t)
%cmp1.not = icmp eq i32 %call, -1
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !8
while.end: ; preds = %sw.epilog
%cmp18 = icmp eq i32 %3, 11
br i1 %cmp18, label %cleanup, label %for.body25.preheader
for.body25.preheader: ; preds = %entry, %while.end
%.lcssa65 = phi i32 [ %3, %while.end ], [ 0, %entry ]
%c.sroa.12.064 = phi i32 [ %inc1643, %while.end ], [ 0, %entry ]
%c.sroa.9.063 = phi i32 [ %inc847, %while.end ], [ 0, %entry ]
%c.sroa.6.062 = phi i32 [ %inc1345, %while.end ], [ 0, %entry ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa65)
%call28.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.sroa.6.062)
%call28.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.sroa.9.063)
%call28.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.sroa.12.064)
br label %cleanup
cleanup: ; preds = %for.body25.preheader, %while.end
%retval.0 = phi i32 [ 1, %while.end ], [ 0, %for.body25.preheader ]
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 %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: 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 <math.h>
#include<string.h>
int main(){
int a[4], i, num;
for(i = 0; i < 4; i++) a[i] = 0;
char str[2] = "kk";
while(scanf("%d,%s", &num, str) != EOF){
if(str[0] == 'A'){
if(str[1] == 'B') a[2]++;
else a[0]++;
}
if(str[0] == 'B') a[1]++;
if(str[0] == 'O') a[3]++;
str[1] = 'k';
}
for(i = 0; i < 4; i++) printf("%d\n", a[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180910/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180910/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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,%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%str = alloca [2 x i8], align 2
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %str) #3
store i16 27499, ptr %str, align 2
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %str)
%cmp1.not51 = icmp eq i32 %call50, -1
br i1 %cmp1.not51, label %for.cond32.preheader, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx5 = getelementptr inbounds [2 x i8], ptr %str, i64 0, i64 1
br label %while.body
for.cond32.preheader: ; preds = %if.end30, %entry
%a.sroa.6.0 = phi i32 [ 0, %entry ], [ %inc2154, %if.end30 ]
%a.sroa.9.0 = phi i32 [ 0, %entry ], [ %inc1156, %if.end30 ]
%a.sroa.12.0 = phi i32 [ 0, %entry ], [ %inc2952, %if.end30 ]
%.lcssa = phi i32 [ 0, %entry ], [ %3, %if.end30 ]
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa)
%call38.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.sroa.6.0)
%call38.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.sroa.9.0)
%call38.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.sroa.12.0)
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %str) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #3
ret i32 0
while.body: ; preds = %while.body.lr.ph, %if.end30
%inc1157 = phi i32 [ 0, %while.body.lr.ph ], [ %inc1156, %if.end30 ]
%inc2155 = phi i32 [ 0, %while.body.lr.ph ], [ %inc2154, %if.end30 ]
%inc2953 = phi i32 [ 0, %while.body.lr.ph ], [ %inc2952, %if.end30 ]
%0 = phi i32 [ 0, %while.body.lr.ph ], [ %3, %if.end30 ]
%1 = load i8, ptr %str, align 2, !tbaa !5
switch i8 %1, label %if.end30 [
i8 65, label %if.then
i8 66, label %if.then19
i8 79, label %if.then27
]
if.then: ; preds = %while.body
%2 = load i8, ptr %arrayidx5, align 1, !tbaa !5
%cmp7 = icmp eq i8 %2, 66
br i1 %cmp7, label %if.then9, label %if.else
if.then9: ; preds = %if.then
%inc11 = add nsw i32 %inc1157, 1
br label %if.end30
if.else: ; preds = %if.then
%inc13 = add nsw i32 %0, 1
br label %if.end30
if.then19: ; preds = %while.body
%inc21 = add nsw i32 %inc2155, 1
br label %if.end30
if.then27: ; preds = %while.body
%inc29 = add nsw i32 %inc2953, 1
br label %if.end30
if.end30: ; preds = %while.body, %if.else, %if.then9, %if.then19, %if.then27
%inc1156 = phi i32 [ %inc1157, %while.body ], [ %inc1157, %if.else ], [ %inc11, %if.then9 ], [ %inc1157, %if.then19 ], [ %inc1157, %if.then27 ]
%inc2154 = phi i32 [ %inc2155, %while.body ], [ %inc2155, %if.else ], [ %inc2155, %if.then9 ], [ %inc21, %if.then19 ], [ %inc2155, %if.then27 ]
%inc2952 = phi i32 [ %inc2953, %while.body ], [ %inc2953, %if.else ], [ %inc2953, %if.then9 ], [ %inc2953, %if.then19 ], [ %inc29, %if.then27 ]
%3 = phi i32 [ %0, %while.body ], [ %inc13, %if.else ], [ %0, %if.then9 ], [ %0, %if.then19 ], [ %0, %if.then27 ]
store i8 107, ptr %arrayidx5, align 1, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %str)
%cmp1.not = icmp eq i32 %call, -1
br i1 %cmp1.not, label %for.cond32.preheader, label %while.body, !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: 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>
int main(){
int i,n,count = 0,prime[10001]={2};
long x;
for( x = 3; count < 10000; x += 2 ){
for( i = 0; prime[i] < x; i++ ){
if( prime[i] == 0 ){
prime[i] = x;
count++;
break;
}
if( x % prime[i] == 0 ) break;
}
}
while( scanf("%d", &n), n != 0 ){
long total = 0;
for( i = 0; i < n; i++ ) total += prime[i];
printf("%ld\n", total);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_180954/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_180954/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%prime = alloca [10001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 40004, ptr nonnull %prime) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) %prime, i8 0, i64 40004, i1 false)
store i32 2, ptr %prime, align 16
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.inc20
%x.055 = phi i64 [ 3, %entry ], [ %add, %for.inc20 ]
%count.054 = phi i32 [ 0, %entry ], [ %count.1, %for.inc20 ]
%0 = load i32, ptr %prime, align 16, !tbaa !5
%conv49 = sext i32 %0 to i64
%cmp250 = icmp sgt i64 %x.055, %conv49
br i1 %cmp250, label %for.body4, label %for.inc20
while.cond.preheader: ; preds = %for.inc20
%call60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp22.not61 = icmp eq i32 %1, 0
br i1 %cmp22.not61, label %while.end, label %for.cond24.preheader
for.cond1: ; preds = %if.end
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv.next
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sext i32 %2 to i64
%cmp2 = icmp sgt i64 %x.055, %conv
br i1 %cmp2, label %for.body4, label %for.inc20, !llvm.loop !9
for.body4: ; preds = %for.cond1.preheader, %for.cond1
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1 ], [ 0, %for.cond1.preheader ]
%conv53 = phi i64 [ %conv, %for.cond1 ], [ %conv49, %for.cond1.preheader ]
%3 = phi i32 [ %2, %for.cond1 ], [ %0, %for.cond1.preheader ]
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %if.then, label %if.end
if.then: ; preds = %for.body4
%arrayidx.le = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv
%conv9 = trunc i64 %x.055 to i32
store i32 %conv9, ptr %arrayidx.le, align 4, !tbaa !5
%inc = add nsw i32 %count.054, 1
br label %for.inc20
if.end: ; preds = %for.body4
%rem = srem i64 %x.055, %conv53
%cmp15 = icmp eq i64 %rem, 0
br i1 %cmp15, label %for.inc20, label %for.cond1
for.inc20: ; preds = %if.end, %for.cond1, %for.cond1.preheader, %if.then
%count.1 = phi i32 [ %inc, %if.then ], [ %count.054, %for.cond1.preheader ], [ %count.054, %for.cond1 ], [ %count.054, %if.end ]
%add = add nuw nsw i64 %x.055, 2
%cmp = icmp slt i32 %count.1, 10000
br i1 %cmp, label %for.cond1.preheader, label %while.cond.preheader, !llvm.loop !11
for.cond24.preheader: ; preds = %while.cond.preheader, %for.end34
%4 = phi i32 [ %14, %for.end34 ], [ %1, %while.cond.preheader ]
%cmp2557 = icmp sgt i32 %4, 0
br i1 %cmp2557, label %for.body27.preheader, label %for.end34
for.body27.preheader: ; preds = %for.cond24.preheader
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 4
br i1 %min.iters.check, label %for.body27.preheader71, label %vector.ph
vector.ph: ; preds = %for.body27.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%vec.phi69 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%5 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %index
%wide.load = load <2 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 2
%wide.load70 = load <2 x i32>, ptr %6, align 8, !tbaa !5
%7 = sext <2 x i32> %wide.load to <2 x i64>
%8 = sext <2 x i32> %wide.load70 to <2 x i64>
%9 = add <2 x i64> %vec.phi, %7
%10 = add <2 x i64> %vec.phi69, %8
%index.next = add nuw i64 %index, 4
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %10, %9
%12 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end34, label %for.body27.preheader71
for.body27.preheader71: ; preds = %for.body27.preheader, %middle.block
%indvars.iv64.ph = phi i64 [ 0, %for.body27.preheader ], [ %n.vec, %middle.block ]
%total.059.ph = phi i64 [ 0, %for.body27.preheader ], [ %12, %middle.block ]
br label %for.body27
for.body27: ; preds = %for.body27.preheader71, %for.body27
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.body27 ], [ %indvars.iv64.ph, %for.body27.preheader71 ]
%total.059 = phi i64 [ %add31, %for.body27 ], [ %total.059.ph, %for.body27.preheader71 ]
%arrayidx29 = getelementptr inbounds [10001 x i32], ptr %prime, i64 0, i64 %indvars.iv64
%13 = load i32, ptr %arrayidx29, align 4, !tbaa !5
%conv30 = sext i32 %13 to i64
%add31 = add nsw i64 %total.059, %conv30
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
br i1 %exitcond.not, label %for.end34, label %for.body27, !llvm.loop !15
for.end34: ; preds = %for.body27, %middle.block, %for.cond24.preheader
%total.0.lcssa = phi i64 [ 0, %for.cond24.preheader ], [ %12, %middle.block ], [ %add31, %for.body27 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %total.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%14 = load i32, ptr %n, align 4, !tbaa !5
%cmp22.not = icmp eq i32 %14, 0
br i1 %cmp22.not, label %while.end, label %for.cond24.preheader, !llvm.loop !16
while.end: ; preds = %for.end34, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 40004, ptr nonnull %prime) #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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main(void){
int i,j,k;
int prime[10000];
int n;
int ans;
i = 1;
k = 3;
prime[0] = 2;
while(i<10000){
for(j=0;j<i;j++){
if( !(k%prime[j]) )break;
}
if(j==i){
prime[i] = k;
i++;
}
k++;
}
while(1){
scanf("%d",&n);
if(!n)break;
ans = 0;
for(i=0;i<n;i++)ans += prime[i];
printf("%d\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181003/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181003/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%prime = alloca [10000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %prime) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
store i32 2, ptr %prime, align 16, !tbaa !5
br label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %if.end8
%k.042 = phi i32 [ 3, %entry ], [ %inc9, %if.end8 ]
%i.041 = phi i32 [ 1, %entry ], [ %i.1, %if.end8 ]
%cmp138 = icmp sgt i32 %i.041, 0
br i1 %cmp138, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %i.041 to i64
br label %for.body
while.cond10.preheader: ; preds = %if.end8
%call47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%tobool12.not48 = icmp eq i32 %0, 0
br i1 %tobool12.not48, label %while.end24, label %for.cond15.preheader
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx2 = getelementptr inbounds [10000 x i32], ptr %prime, i64 0, i64 %indvars.iv
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%rem = srem i32 %k.042, %1
%tobool.not = icmp eq i32 %rem, 0
br i1 %tobool.not, label %for.end.loopexit, label %for.inc
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.then4, label %for.body, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%2 = trunc i64 %indvars.iv to i32
br label %for.end
for.end: ; preds = %for.end.loopexit, %for.cond.preheader
%j.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %2, %for.end.loopexit ]
%cmp3 = icmp eq i32 %j.0.lcssa, %i.041
br i1 %cmp3, label %if.then4, label %if.end8
if.then4: ; preds = %for.inc, %for.end
%idxprom5 = sext i32 %i.041 to i64
%arrayidx6 = getelementptr inbounds [10000 x i32], ptr %prime, i64 0, i64 %idxprom5
store i32 %k.042, ptr %arrayidx6, align 4, !tbaa !5
%inc7 = add nsw i32 %i.041, 1
br label %if.end8
if.end8: ; preds = %if.then4, %for.end
%i.1 = phi i32 [ %inc7, %if.then4 ], [ %i.041, %for.end ]
%inc9 = add nuw nsw i32 %k.042, 1
%cmp = icmp slt i32 %i.1, 10000
br i1 %cmp, label %for.cond.preheader, label %while.cond10.preheader, !llvm.loop !11
for.cond15.preheader: ; preds = %while.cond10.preheader, %for.end22
%3 = phi i32 [ %11, %for.end22 ], [ %0, %while.cond10.preheader ]
%cmp1643 = icmp sgt i32 %3, 0
br i1 %cmp1643, label %for.body17.preheader, label %for.end22
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count53 = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %for.body17.preheader61, label %vector.ph
vector.ph: ; preds = %for.body17.preheader
%n.vec = and i64 %wide.trip.count53, 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 ], [ %6, %vector.body ]
%vec.phi59 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%4 = getelementptr inbounds [10000 x i32], ptr %prime, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
%wide.load60 = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = add <4 x i32> %wide.load, %vec.phi
%7 = add <4 x i32> %wide.load60, %vec.phi59
%index.next = add nuw i64 %index, 8
%8 = icmp eq i64 %index.next, %n.vec
br i1 %8, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count53
br i1 %cmp.n, label %for.end22, label %for.body17.preheader61
for.body17.preheader61: ; preds = %for.body17.preheader, %middle.block
%indvars.iv50.ph = phi i64 [ 0, %for.body17.preheader ], [ %n.vec, %middle.block ]
%ans.045.ph = phi i32 [ 0, %for.body17.preheader ], [ %9, %middle.block ]
br label %for.body17
for.body17: ; preds = %for.body17.preheader61, %for.body17
%indvars.iv50 = phi i64 [ %indvars.iv.next51, %for.body17 ], [ %indvars.iv50.ph, %for.body17.preheader61 ]
%ans.045 = phi i32 [ %add, %for.body17 ], [ %ans.045.ph, %for.body17.preheader61 ]
%arrayidx19 = getelementptr inbounds [10000 x i32], ptr %prime, i64 0, i64 %indvars.iv50
%10 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%add = add nsw i32 %10, %ans.045
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
br i1 %exitcond54.not, label %for.end22, label %for.body17, !llvm.loop !15
for.end22: ; preds = %for.body17, %middle.block, %for.cond15.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond15.preheader ], [ %9, %middle.block ], [ %add, %for.body17 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%11 = load i32, ptr %n, align 4, !tbaa !5
%tobool12.not = icmp eq i32 %11, 0
br i1 %tobool12.not, label %while.end24, label %for.cond15.preheader
while.end24: ; preds = %for.end22, %while.cond10.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %prime) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
|
#include <stdio.h>
#define MAX 150000
void makePrime( int * prime, int * sum )
{
int i = 0, num = 0, tmp = 0, j;
for ( i = 0 ; i < MAX+1 ; i++ ) {
prime[i] = 1;
sum[i] = 0;
}
prime[0] = 0;
prime[1] = 0;
for ( i = 2 ; i < MAX+1 ; i++ ) {
if ( prime[i] == 1 )
{
num++;
for ( j = i + i ; j < MAX+1 ; j = i + j ) {
prime[j] = 0;
}
sum[num] = sum[num-1] + i;
}
}
}
int main()
{
int prime[MAX] = {};
int sum[MAX] = {};
int num;
makePrime( prime, sum );
while( 1 ) {
scanf( "%d", &num );
if ( num == 0 ) break;
printf( "%d\n", sum[num] );
num = 0;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181061/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181061/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @makePrime(ptr nocapture noundef %prime, ptr nocapture noundef %sum) local_unnamed_addr #0 {
entry:
%sum63 = ptrtoint ptr %sum to i64
%prime64 = ptrtoint ptr %prime to i64
%0 = sub i64 %sum63, %prime64
%diff.check = icmp ugt i64 %0, 31
br i1 %diff.check, label %vector.body, label %for.body.prol.preheader
vector.body: ; preds = %entry, %vector.body
%index = phi i64 [ %index.next.2, %vector.body ], [ 0, %entry ]
%1 = getelementptr inbounds i32, ptr %prime, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %sum, i64 %index
store <4 x i32> zeroinitializer, ptr %3, align 4, !tbaa !5
%4 = getelementptr inbounds i32, ptr %3, i64 4
store <4 x i32> zeroinitializer, ptr %4, align 4, !tbaa !5
%index.next = add nuw nsw i64 %index, 8
%5 = getelementptr inbounds i32, ptr %prime, i64 %index.next
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 4, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds i32, ptr %sum, i64 %index.next
store <4 x i32> zeroinitializer, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> zeroinitializer, ptr %8, align 4, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 16
%9 = getelementptr inbounds i32, ptr %prime, i64 %index.next.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %sum, i64 %index.next.1
store <4 x i32> zeroinitializer, ptr %11, align 4, !tbaa !5
%12 = getelementptr inbounds i32, ptr %11, i64 4
store <4 x i32> zeroinitializer, ptr %12, align 4, !tbaa !5
%index.next.2 = add nuw nsw i64 %index, 24
%13 = icmp eq i64 %index.next.2, 150000
br i1 %13, label %for.body.prol.preheader, label %vector.body, !llvm.loop !9
for.body.prol.preheader: ; preds = %entry, %vector.body
%indvars.iv.ph = phi i64 [ 0, %entry ], [ 150000, %vector.body ]
br label %for.body.prol
for.body.prol: ; preds = %for.body.prol, %for.body.prol.preheader
%indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ %indvars.iv.ph, %for.body.prol.preheader ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.prol.preheader ]
%arrayidx.prol = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv.prol
store i32 1, ptr %arrayidx.prol, align 4, !tbaa !5
%arrayidx2.prol = getelementptr inbounds i32, ptr %sum, i64 %indvars.iv.prol
store i32 0, ptr %arrayidx2.prol, align 4, !tbaa !5
%indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter, 0
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !13
for.body.prol.loopexit: ; preds = %for.body.prol
br i1 %diff.check, label %for.end, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next.3, %for.body ], [ %indvars.iv.next.prol, %for.body.prol.loopexit ]
%arrayidx = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds i32, ptr %sum, i64 %indvars.iv
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv.next
store i32 1, ptr %arrayidx.1, align 4, !tbaa !5
%arrayidx2.1 = getelementptr inbounds i32, ptr %sum, i64 %indvars.iv.next
store i32 0, ptr %arrayidx2.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv.next.1
store i32 1, ptr %arrayidx.2, align 4, !tbaa !5
%arrayidx2.2 = getelementptr inbounds i32, ptr %sum, i64 %indvars.iv.next.1
store i32 0, ptr %arrayidx2.2, align 4, !tbaa !5
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv.next.2
store i32 1, ptr %arrayidx.3, align 4, !tbaa !5
%arrayidx2.3 = getelementptr inbounds i32, ptr %sum, i64 %indvars.iv.next.2
store i32 0, ptr %arrayidx2.3, align 4, !tbaa !5
%indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
%exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, 150001
br i1 %exitcond.not.3, label %for.end, label %for.body, !llvm.loop !15
for.end: ; preds = %for.body, %for.body.prol.loopexit
store i32 0, ptr %prime, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds i32, ptr %prime, i64 1
store i32 0, ptr %arrayidx4, align 4, !tbaa !5
br label %for.body7
for.body7: ; preds = %for.end, %for.inc25
%indvars.iv56 = phi i64 [ 2, %for.end ], [ %indvars.iv.next57, %for.inc25 ]
%indvars.iv54 = phi i64 [ 4, %for.end ], [ %indvars.iv.next55, %for.inc25 ]
%num.051 = phi i32 [ 0, %for.end ], [ %num.1, %for.inc25 ]
%arrayidx9 = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv56
%14 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %14, 1
br i1 %cmp10, label %if.then, label %for.inc25
if.then: ; preds = %for.body7
%inc11 = add nsw i32 %num.051, 1
%cmp1349 = icmp ult i64 %indvars.iv56, 75001
br i1 %cmp1349, label %for.body14, label %for.end19
for.body14: ; preds = %if.then, %for.body14
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.body14 ], [ %indvars.iv54, %if.then ]
%arrayidx16 = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv58
store i32 0, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, %indvars.iv56
%cmp13 = icmp ult i64 %indvars.iv.next59, 150001
br i1 %cmp13, label %for.body14, label %for.end19, !llvm.loop !16
for.end19: ; preds = %for.body14, %if.then
%idxprom20 = sext i32 %num.051 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %sum, i64 %idxprom20
%15 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%16 = trunc i64 %indvars.iv56 to i32
%add22 = add nsw i32 %15, %16
%idxprom23 = sext i32 %inc11 to i64
%arrayidx24 = getelementptr inbounds i32, ptr %sum, i64 %idxprom23
store i32 %add22, ptr %arrayidx24, align 4, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %for.body7, %for.end19
%num.1 = phi i32 [ %inc11, %for.end19 ], [ %num.051, %for.body7 ]
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 2
%exitcond62.not = icmp eq i64 %indvars.iv.next57, 150001
br i1 %exitcond62.not, label %for.end27, label %for.body7, !llvm.loop !17
for.end27: ; preds = %for.inc25
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:
%prime = alloca [150000 x i32], align 16
%sum = alloca [150000 x i32], align 16
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 600000, ptr nonnull %prime) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(600000) %prime, i8 0, i64 600000, i1 false)
call void @llvm.lifetime.start.p0(i64 600000, ptr nonnull %sum) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(600000) %sum, i8 0, i64 600000, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.5, %vector.body ]
%0 = getelementptr inbounds i32, ptr %prime, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
%index.next = or i64 %index, 8
%2 = getelementptr inbounds i32, ptr %prime, i64 %index.next
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
%4 = getelementptr i32, ptr %prime, i64 %index
%5 = getelementptr i32, ptr %4, i64 16
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5
%6 = getelementptr i32, ptr %4, i64 20
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5
%7 = getelementptr i32, ptr %prime, i64 %index
%8 = getelementptr i32, ptr %7, i64 24
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5
%9 = getelementptr i32, ptr %7, i64 28
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5
%10 = getelementptr i32, ptr %prime, i64 %index
%11 = getelementptr i32, ptr %10, i64 32
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %11, align 16, !tbaa !5
%12 = getelementptr i32, ptr %10, i64 36
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 16, !tbaa !5
%13 = getelementptr i32, ptr %prime, i64 %index
%14 = getelementptr i32, ptr %13, i64 40
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %14, align 16, !tbaa !5
%15 = getelementptr i32, ptr %13, i64 44
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %15, align 16, !tbaa !5
%index.next.5 = add nuw nsw i64 %index, 48
%16 = icmp eq i64 %index.next.5, 150000
br i1 %16, label %for.body.i, label %vector.body, !llvm.loop !18
for.body.i: ; preds = %vector.body
%arrayidx.i = getelementptr inbounds i32, ptr %prime, i64 150000
store i32 1, ptr %arrayidx.i, align 16, !tbaa !5
%arrayidx4.i = getelementptr inbounds i32, ptr %prime, i64 1
store i32 0, ptr %arrayidx4.i, align 4, !tbaa !5
br label %for.body7.i
for.body7.i: ; preds = %for.inc25.i, %for.body.i
%indvars.iv56.i = phi i64 [ 2, %for.body.i ], [ %indvars.iv.next57.i, %for.inc25.i ]
%indvars.iv54.i = phi i64 [ 4, %for.body.i ], [ %indvars.iv.next55.i, %for.inc25.i ]
%num.051.i = phi i32 [ 0, %for.body.i ], [ %num.1.i, %for.inc25.i ]
%arrayidx9.i = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv56.i
%17 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%cmp10.i = icmp eq i32 %17, 1
br i1 %cmp10.i, label %if.then.i, label %for.inc25.i
if.then.i: ; preds = %for.body7.i
%inc11.i = add nsw i32 %num.051.i, 1
%cmp1349.i = icmp ult i64 %indvars.iv56.i, 75001
br i1 %cmp1349.i, label %for.body14.i, label %for.end19.i
for.body14.i: ; preds = %if.then.i, %for.body14.i
%indvars.iv58.i = phi i64 [ %indvars.iv.next59.i, %for.body14.i ], [ %indvars.iv54.i, %if.then.i ]
%arrayidx16.i = getelementptr inbounds i32, ptr %prime, i64 %indvars.iv58.i
store i32 0, ptr %arrayidx16.i, align 4, !tbaa !5
%indvars.iv.next59.i = add nuw nsw i64 %indvars.iv58.i, %indvars.iv56.i
%cmp13.i = icmp ult i64 %indvars.iv.next59.i, 150001
br i1 %cmp13.i, label %for.body14.i, label %for.end19.i, !llvm.loop !16
for.end19.i: ; preds = %for.body14.i, %if.then.i
%idxprom20.i = sext i32 %num.051.i to i64
%arrayidx21.i = getelementptr inbounds i32, ptr %sum, i64 %idxprom20.i
%18 = load i32, ptr %arrayidx21.i, align 4, !tbaa !5
%19 = trunc i64 %indvars.iv56.i to i32
%add22.i = add nsw i32 %18, %19
%idxprom23.i = sext i32 %inc11.i to i64
%arrayidx24.i = getelementptr inbounds i32, ptr %sum, i64 %idxprom23.i
store i32 %add22.i, ptr %arrayidx24.i, align 4, !tbaa !5
br label %for.inc25.i
for.inc25.i: ; preds = %for.end19.i, %for.body7.i
%num.1.i = phi i32 [ %inc11.i, %for.end19.i ], [ %num.051.i, %for.body7.i ]
%indvars.iv.next57.i = add nuw nsw i64 %indvars.iv56.i, 1
%indvars.iv.next55.i = add nuw nsw i64 %indvars.iv54.i, 2
%exitcond62.not.i = icmp eq i64 %indvars.iv.next57.i, 150001
br i1 %exitcond62.not.i, label %while.cond.preheader, label %for.body7.i, !llvm.loop !17
while.cond.preheader: ; preds = %for.inc25.i
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%20 = load i32, ptr %num, align 4, !tbaa !5
%cmp4 = icmp eq i32 %20, 0
br i1 %cmp4, label %while.end, label %if.end
if.end: ; preds = %while.cond.preheader, %if.end
%21 = phi i32 [ %23, %if.end ], [ %20, %while.cond.preheader ]
%idxprom = sext i32 %21 to i64
%arrayidx = getelementptr inbounds [150000 x i32], ptr %sum, i64 0, i64 %idxprom
%22 = load i32, ptr %arrayidx, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %22)
store i32 0, ptr %num, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%23 = load i32, ptr %num, align 4, !tbaa !5
%cmp = icmp eq i32 %23, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %if.end, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.end.p0(i64 600000, ptr nonnull %sum) #5
call void @llvm.lifetime.end.p0(i64 600000, ptr nonnull %prime) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !11, !12}
|
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int n,i,j,k,c=0,l,h=0,height=-1,height0=-1;
scanf("%d",&n);
int a[n][3];
for(i=0;i<n;i++)
scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
for(i=0;i<=100;i++){
for(j=0;j<=100;j++){
for(k=0;k<n;k++){
h=abs(i-a[k][0])+abs(j-a[k][1])+a[k][2];
if(a[k][2]!=0 && height ==-1)
height=h;
if(h!=height && a[k][2]!=0)
break;
if(a[k][2]==0 && height0 ==-1)
height0=h;
if(a[k][2]==0 && height0>h)
height0=h;
c++;
}
if(c==n){
if(height==-1){
printf("%d %d %d",i,j,height0);
return 0;
}
else if(height <= height0 || height0==-1){
printf("%d %d %d",i,j,height);
return 0;
}
}
height=-1;
height0=-1;
c=0;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181119/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181119/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.2 = private unnamed_addr constant [9 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
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 [3 x i32], i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp134 = icmp sgt i32 %3, 0
br i1 %cmp134, label %for.body, label %for.cond9.preheader.split
for.cond9.preheader: ; preds = %for.body
%cmp16136 = icmp sgt i32 %9, 0
br i1 %cmp16136, label %for.cond12.preheader.us.preheader, label %for.cond9.preheader.split
for.cond12.preheader.us.preheader: ; preds = %for.cond9.preheader
%wide.trip.count = zext i32 %9 to i64
br label %for.cond12.preheader.us
for.cond12.preheader.us: ; preds = %for.cond12.preheader.us.preheader, %for.inc77.split.us.us
%i.1172.us = phi i32 [ %inc78.us, %for.inc77.split.us.us ], [ 0, %for.cond12.preheader.us.preheader ]
br label %for.cond15.preheader.us.us
for.cond15.preheader.us.us: ; preds = %if.end73.us.us, %for.cond12.preheader.us
%j.0147.us.us = phi i32 [ 0, %for.cond12.preheader.us ], [ %inc75.us.us, %if.end73.us.us ]
br label %for.body17.us.us
for.body17.us.us: ; preds = %if.end41.us.us, %for.cond15.preheader.us.us
%indvars.iv201 = phi i64 [ %indvars.iv.next202, %if.end41.us.us ], [ 0, %for.cond15.preheader.us.us ]
%height0.2140.us.us = phi i32 [ %height0.4.us.us, %if.end41.us.us ], [ -1, %for.cond15.preheader.us.us ]
%height.2139.us.us = phi i32 [ %spec.select.us.us, %if.end41.us.us ], [ -1, %for.cond15.preheader.us.us ]
%arrayidx19.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv201
%4 = load i32, ptr %arrayidx19.us.us, align 4, !tbaa !5
%sub.us.us = sub nsw i32 %i.1172.us, %4
%5 = call i32 @llvm.abs.i32(i32 %sub.us.us, i1 true)
%arrayidx23.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv201, i64 1
%6 = load i32, ptr %arrayidx23.us.us, align 4, !tbaa !5
%sub24.us.us = sub nsw i32 %j.0147.us.us, %6
%7 = call i32 @llvm.abs.i32(i32 %sub24.us.us, i1 true)
%arrayidx27.us.us = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv201, i64 2
%8 = load i32, ptr %arrayidx27.us.us, align 4, !tbaa !5
%add.us.us = add i32 %8, %5
%add28.us.us = add i32 %add.us.us, %7
%cmp32.us.us = icmp ne i32 %8, 0
%cmp33.us.us = icmp eq i32 %height.2139.us.us, -1
%or.cond.us.us = and i1 %cmp33.us.us, %cmp32.us.us
%spec.select.us.us = select i1 %or.cond.us.us, i32 %add28.us.us, i32 %height.2139.us.us
%cmp34.not.us.us = icmp eq i32 %add28.us.us, %spec.select.us.us
%cmp39.not.us.us = icmp eq i32 %8, 0
%or.cond127.us.us = or i1 %cmp39.not.us.us, %cmp34.not.us.us
br i1 %or.cond127.us.us, label %if.end41.us.us, label %for.end61.us.us
for.end61.us.us: ; preds = %for.body17.us.us
%indvars203.le = trunc i64 %indvars.iv201 to i32
%cmp62.us.us = icmp eq i32 %9, %indvars203.le
br i1 %cmp62.us.us, label %if.then63.us.us, label %if.end73.us.us
if.then63.us.us: ; preds = %if.end41.us.us, %for.end61.us.us
%height0.2.lcssa.us.us214 = phi i32 [ %height0.2140.us.us, %for.end61.us.us ], [ %height0.4.us.us, %if.end41.us.us ]
%cmp64.us.us = icmp eq i32 %spec.select.us.us, -1
br i1 %cmp64.us.us, label %if.then65, label %if.else.us.us
if.else.us.us: ; preds = %if.then63.us.us
%cmp67.us.us = icmp sle i32 %spec.select.us.us, %height0.2.lcssa.us.us214
%cmp68.us.us = icmp eq i32 %height0.2.lcssa.us.us214, -1
%or.cond90.us.us = or i1 %cmp68.us.us, %cmp67.us.us
br i1 %or.cond90.us.us, label %if.then69, label %if.end73.us.us
if.end73.us.us: ; preds = %if.else.us.us, %for.end61.us.us
%inc75.us.us = add nuw nsw i32 %j.0147.us.us, 1
%exitcond206.not = icmp eq i32 %inc75.us.us, 101
br i1 %exitcond206.not, label %for.inc77.split.us.us, label %for.cond15.preheader.us.us, !llvm.loop !9
if.end41.us.us: ; preds = %for.body17.us.us
%cmp47.us.us = icmp eq i32 %height0.2140.us.us, -1
%or.cond89.us.us = select i1 %cmp39.not.us.us, i1 %cmp47.us.us, i1 false
%spec.select125.us.us = select i1 %or.cond89.us.us, i32 %add28.us.us, i32 %height0.2140.us.us
%cmp55.us.us = icmp sgt i32 %spec.select125.us.us, %add28.us.us
%or.cond126.us.us = select i1 %cmp39.not.us.us, i1 %cmp55.us.us, i1 false
%height0.4.us.us = select i1 %or.cond126.us.us, i32 %add28.us.us, i32 %spec.select125.us.us
%indvars.iv.next202 = add nuw nsw i64 %indvars.iv201, 1
%exitcond.not = icmp eq i64 %indvars.iv.next202, %wide.trip.count
br i1 %exitcond.not, label %if.then63.us.us, label %for.body17.us.us, !llvm.loop !11
for.inc77.split.us.us: ; preds = %if.end73.us.us
%inc78.us = add nuw nsw i32 %i.1172.us, 1
%exitcond207.not = icmp eq i32 %inc78.us, 101
br i1 %exitcond207.not, label %cleanup, label %for.cond12.preheader.us, !llvm.loop !12
for.cond9.preheader.split: ; preds = %entry, %for.cond9.preheader
%.lcssa210 = phi i32 [ %9, %for.cond9.preheader ], [ %3, %entry ]
%cmp62 = icmp eq i32 %.lcssa210, 0
br i1 %cmp62, label %if.then65, label %cleanup
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [3 x i32], ptr %vla, i64 %indvars.iv, i64 1
%arrayidx7 = getelementptr inbounds [3 x i32], ptr %vla, 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
%9 = load i32, ptr %n, align 4, !tbaa !5
%10 = sext i32 %9 to i64
%cmp = icmp slt i64 %indvars.iv.next, %10
br i1 %cmp, label %for.body, label %for.cond9.preheader, !llvm.loop !13
if.then65: ; preds = %if.then63.us.us, %for.cond9.preheader.split
%.us-phi = phi i32 [ 0, %for.cond9.preheader.split ], [ %i.1172.us, %if.then63.us.us ]
%.us-phi148 = phi i32 [ 0, %for.cond9.preheader.split ], [ %j.0147.us.us, %if.then63.us.us ]
%.us-phi149 = phi i32 [ -1, %for.cond9.preheader.split ], [ %height0.2.lcssa.us.us214, %if.then63.us.us ]
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi, i32 noundef %.us-phi148, i32 noundef %.us-phi149)
br label %cleanup
if.then69: ; preds = %if.else.us.us
%call70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %i.1172.us, i32 noundef %j.0147.us.us, i32 noundef %spec.select.us.us)
br label %cleanup
cleanup: ; preds = %for.inc77.split.us.us, %for.cond9.preheader.split, %if.then69, %if.then65
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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #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
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))
int main(void){
int n,i,j,k;
scanf("%d",&n);
int x[n],y[n],h[n];
rep(i,n){
scanf("%d %d %d",&x[i],&y[i],&h[i]);
}
int htmp[n],flag,hmax;
m0(htmp);
for(i=0;i<101;i++){
for(j=0;j<101;j++){
flag=0;
for(k=0;k<n&&h[k]==0;k++);
hmax=h[k]+abs(i-x[k])+abs(j-y[k]);
rep(k,n){
htmp[k]=hmax-abs(i-x[k])-abs(j-y[k]);
if(htmp[k]<0) {
htmp[k]=0;
}
}
rep(k,n){
if(htmp[k]!=h[k]){
flag++;
}
}
if(flag==0) goto end;
}
}
end:
printf("%d %d %d",i,j,hmax );
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181162/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181162/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%vla2 = alloca i32, i64 %4, align 16
%cmp120 = icmp sgt i32 %3, 0
br i1 %cmp120, label %for.body, label %end.loopexit.split
for.cond.cleanup: ; preds = %for.body
%.pre = zext i32 %53 to i64
%vla9 = alloca i32, i64 %.pre, align 16
%5 = shl nuw nsw i64 %.pre, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla9, i8 0, i64 %5, i1 false)
%cmp17122 = icmp sgt i32 %53, 0
br i1 %cmp17122, label %for.cond13.preheader.us.preheader, label %end.loopexit.split
for.cond13.preheader.us.preheader: ; preds = %for.cond.cleanup
%min.iters.check364 = icmp ult i32 %53, 8
%n.vec367 = and i64 %.pre, 4294967288
%cmp.n369 = icmp eq i64 %n.vec367, %.pre
%min.iters.check = icmp ult i32 %53, 8
%n.vec = and i64 %.pre, 4294967288
%cmp.n = icmp eq i64 %n.vec, %.pre
br label %for.cond13.preheader.us
for.cond13.preheader.us: ; preds = %for.cond13.preheader.us.preheader, %for.inc78.split.us.us
%i.0253.us = phi i32 [ %inc79.us, %for.inc78.split.us.us ], [ 0, %for.cond13.preheader.us.preheader ]
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %i.0253.us, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %land.rhs.us.us.preheader
land.rhs.us.us.preheader: ; preds = %for.cond13.preheader.us, %for.inc75.us.us
%j.1132.us.us = phi i32 [ 0, %for.cond13.preheader.us ], [ %inc76.us.us, %for.inc75.us.us ]
br label %land.rhs.us.us
land.rhs.us.us: ; preds = %land.rhs.us.us.preheader, %for.inc22.us.us
%indvars.iv328 = phi i64 [ 0, %land.rhs.us.us.preheader ], [ %indvars.iv.next329, %for.inc22.us.us ]
%arrayidx19.us.us = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv328
%6 = load i32, ptr %arrayidx19.us.us, align 4, !tbaa !5
%cmp20.us.us = icmp eq i32 %6, 0
br i1 %cmp20.us.us, label %for.inc22.us.us, label %for.end24.us.us.split.loop.exit
for.end24.us.us.split.loop.exit: ; preds = %land.rhs.us.us
%7 = trunc i64 %indvars.iv328 to i32
br label %for.end24.us.us
for.end24.us.us: ; preds = %for.inc22.us.us, %for.end24.us.us.split.loop.exit
%k.0.lcssa.us.us.ph = phi i32 [ %7, %for.end24.us.us.split.loop.exit ], [ %53, %for.inc22.us.us ]
%idxprom25.us.us = zext i32 %k.0.lcssa.us.us.ph to i64
%arrayidx26.us.us = getelementptr inbounds i32, ptr %vla2, i64 %idxprom25.us.us
%8 = load i32, ptr %arrayidx26.us.us, align 4, !tbaa !5
%arrayidx28.us.us = getelementptr inbounds i32, ptr %vla, i64 %idxprom25.us.us
%9 = load i32, ptr %arrayidx28.us.us, align 4, !tbaa !5
%sub.us.us = sub nsw i32 %i.0253.us, %9
%10 = call i32 @llvm.abs.i32(i32 %sub.us.us, i1 true)
%add.us.us = add nsw i32 %10, %8
%arrayidx30.us.us = getelementptr inbounds i32, ptr %vla1, i64 %idxprom25.us.us
%11 = load i32, ptr %arrayidx30.us.us, align 4, !tbaa !5
%sub31.us.us = sub nsw i32 %j.1132.us.us, %11
%12 = call i32 @llvm.abs.i32(i32 %sub31.us.us, i1 true)
%add32.us.us = add nsw i32 %add.us.us, %12
br i1 %min.iters.check364, label %for.body37.us.us.preheader, label %vector.ph365
vector.ph365: ; preds = %for.end24.us.us
%broadcast.splatinsert376 = insertelement <4 x i32> poison, i32 %j.1132.us.us, i64 0
%broadcast.splat377 = shufflevector <4 x i32> %broadcast.splatinsert376, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert378 = insertelement <4 x i32> poison, i32 %add32.us.us, i64 0
%broadcast.splat379 = shufflevector <4 x i32> %broadcast.splatinsert378, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body370
vector.body370: ; preds = %vector.body370, %vector.ph365
%index371 = phi i64 [ 0, %vector.ph365 ], [ %index.next380, %vector.body370 ]
%13 = getelementptr inbounds i32, ptr %vla, i64 %index371
%wide.load372 = load <4 x i32>, ptr %13, align 16, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load373 = load <4 x i32>, ptr %14, align 16, !tbaa !5
%15 = sub nsw <4 x i32> %broadcast.splat, %wide.load372
%16 = sub nsw <4 x i32> %broadcast.splat, %wide.load373
%17 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %15, i1 true)
%18 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %16, i1 true)
%19 = getelementptr inbounds i32, ptr %vla1, i64 %index371
%wide.load374 = load <4 x i32>, ptr %19, align 16, !tbaa !5
%20 = getelementptr inbounds i32, ptr %19, i64 4
%wide.load375 = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = sub nsw <4 x i32> %broadcast.splat377, %wide.load374
%22 = sub nsw <4 x i32> %broadcast.splat377, %wide.load375
%23 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %21, i1 true)
%24 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %22, i1 true)
%25 = add nuw <4 x i32> %17, %23
%26 = add nuw <4 x i32> %18, %24
%27 = sub <4 x i32> %broadcast.splat379, %25
%28 = sub <4 x i32> %broadcast.splat379, %26
%29 = getelementptr inbounds i32, ptr %vla9, i64 %index371
%30 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %27, <4 x i32> zeroinitializer)
%31 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %28, <4 x i32> zeroinitializer)
store <4 x i32> %30, ptr %29, align 16, !tbaa !5
%32 = getelementptr inbounds i32, ptr %29, i64 4
store <4 x i32> %31, ptr %32, align 16, !tbaa !5
%index.next380 = add nuw i64 %index371, 8
%33 = icmp eq i64 %index.next380, %n.vec367
br i1 %33, label %middle.block362, label %vector.body370, !llvm.loop !9
middle.block362: ; preds = %vector.body370
br i1 %cmp.n369, label %for.body60.us.us.preheader, label %for.body37.us.us.preheader
for.body37.us.us.preheader: ; preds = %for.end24.us.us, %middle.block362
%indvars.iv331.ph = phi i64 [ 0, %for.end24.us.us ], [ %n.vec367, %middle.block362 ]
br label %for.body37.us.us
for.cond.cleanup59.us.us: ; preds = %for.body60.us.us, %middle.block
%spec.select110.us.us.lcssa = phi i32 [ %52, %middle.block ], [ %spec.select110.us.us, %for.body60.us.us ]
%cmp72.us.us = icmp eq i32 %spec.select110.us.us.lcssa, 0
br i1 %cmp72.us.us, label %end, label %for.inc75.us.us
for.inc75.us.us: ; preds = %for.cond.cleanup59.us.us
%inc76.us.us = add nuw nsw i32 %j.1132.us.us, 1
%exitcond341.not = icmp eq i32 %inc76.us.us, 101
br i1 %exitcond341.not, label %for.inc78.split.us.us, label %land.rhs.us.us.preheader, !llvm.loop !13
for.body60.us.us: ; preds = %for.body60.us.us.preheader381, %for.body60.us.us
%indvars.iv336 = phi i64 [ %indvars.iv.next337, %for.body60.us.us ], [ %indvars.iv336.ph, %for.body60.us.us.preheader381 ]
%flag.0129.us.us = phi i32 [ %spec.select110.us.us, %for.body60.us.us ], [ %flag.0129.us.us.ph, %for.body60.us.us.preheader381 ]
%arrayidx62.us.us = getelementptr inbounds i32, ptr %vla9, i64 %indvars.iv336
%34 = load i32, ptr %arrayidx62.us.us, align 4, !tbaa !5
%arrayidx64.us.us = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv336
%35 = load i32, ptr %arrayidx64.us.us, align 4, !tbaa !5
%cmp65.not.us.us = icmp ne i32 %34, %35
%inc67.us.us = zext i1 %cmp65.not.us.us to i32
%spec.select110.us.us = add nuw nsw i32 %flag.0129.us.us, %inc67.us.us
%indvars.iv.next337 = add nuw nsw i64 %indvars.iv336, 1
%exitcond340.not = icmp eq i64 %indvars.iv.next337, %.pre
br i1 %exitcond340.not, label %for.cond.cleanup59.us.us, label %for.body60.us.us, !llvm.loop !14
for.body37.us.us: ; preds = %for.body37.us.us.preheader, %for.body37.us.us
%indvars.iv331 = phi i64 [ %indvars.iv.next332, %for.body37.us.us ], [ %indvars.iv331.ph, %for.body37.us.us.preheader ]
%arrayidx39.us.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv331
%36 = load i32, ptr %arrayidx39.us.us, align 4, !tbaa !5
%sub40.us.us = sub nsw i32 %i.0253.us, %36
%37 = call i32 @llvm.abs.i32(i32 %sub40.us.us, i1 true)
%arrayidx43.us.us = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv331
%38 = load i32, ptr %arrayidx43.us.us, align 4, !tbaa !5
%sub44.us.us = sub nsw i32 %j.1132.us.us, %38
%39 = call i32 @llvm.abs.i32(i32 %sub44.us.us, i1 true)
%40 = add nuw i32 %37, %39
%sub45.us.us = sub i32 %add32.us.us, %40
%arrayidx47.us.us = getelementptr inbounds i32, ptr %vla9, i64 %indvars.iv331
%spec.select.us.us = call i32 @llvm.smax.i32(i32 %sub45.us.us, i32 0)
store i32 %spec.select.us.us, ptr %arrayidx47.us.us, align 4, !tbaa !5
%indvars.iv.next332 = add nuw nsw i64 %indvars.iv331, 1
%exitcond335.not = icmp eq i64 %indvars.iv.next332, %.pre
br i1 %exitcond335.not, label %for.body60.us.us.preheader, label %for.body37.us.us, !llvm.loop !15
for.body60.us.us.preheader: ; preds = %for.body37.us.us, %middle.block362
br i1 %min.iters.check, label %for.body60.us.us.preheader381, label %vector.body
vector.body: ; preds = %for.body60.us.us.preheader, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body60.us.us.preheader ]
%vec.phi = phi <4 x i32> [ %49, %vector.body ], [ zeroinitializer, %for.body60.us.us.preheader ]
%vec.phi358 = phi <4 x i32> [ %50, %vector.body ], [ zeroinitializer, %for.body60.us.us.preheader ]
%41 = getelementptr inbounds i32, ptr %vla9, i64 %index
%wide.load = load <4 x i32>, ptr %41, align 16, !tbaa !5
%42 = getelementptr inbounds i32, ptr %41, i64 4
%wide.load359 = load <4 x i32>, ptr %42, align 16, !tbaa !5
%43 = getelementptr inbounds i32, ptr %vla2, i64 %index
%wide.load360 = load <4 x i32>, ptr %43, align 16, !tbaa !5
%44 = getelementptr inbounds i32, ptr %43, i64 4
%wide.load361 = load <4 x i32>, ptr %44, align 16, !tbaa !5
%45 = icmp ne <4 x i32> %wide.load, %wide.load360
%46 = icmp ne <4 x i32> %wide.load359, %wide.load361
%47 = zext <4 x i1> %45 to <4 x i32>
%48 = zext <4 x i1> %46 to <4 x i32>
%49 = add <4 x i32> %vec.phi, %47
%50 = add <4 x i32> %vec.phi358, %48
%index.next = add nuw i64 %index, 8
%51 = icmp eq i64 %index.next, %n.vec
br i1 %51, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %50, %49
%52 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond.cleanup59.us.us, label %for.body60.us.us.preheader381
for.body60.us.us.preheader381: ; preds = %for.body60.us.us.preheader, %middle.block
%indvars.iv336.ph = phi i64 [ 0, %for.body60.us.us.preheader ], [ %n.vec, %middle.block ]
%flag.0129.us.us.ph = phi i32 [ 0, %for.body60.us.us.preheader ], [ %52, %middle.block ]
br label %for.body60.us.us
for.inc22.us.us: ; preds = %land.rhs.us.us
%indvars.iv.next329 = add nuw nsw i64 %indvars.iv328, 1
%exitcond.not = icmp eq i64 %indvars.iv.next329, %.pre
br i1 %exitcond.not, label %for.end24.us.us, label %land.rhs.us.us, !llvm.loop !17
for.inc78.split.us.us: ; preds = %for.inc75.us.us
%inc79.us = add nuw nsw i32 %i.0253.us, 1
%exitcond342.not = icmp eq i32 %inc79.us, 101
br i1 %exitcond342.not, label %end, label %for.cond13.preheader.us, !llvm.loop !18
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
%arrayidx5 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv
%arrayidx7 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx7)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%53 = load i32, ptr %n, align 4, !tbaa !5
%54 = sext i32 %53 to i64
%cmp = icmp slt i64 %indvars.iv.next, %54
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !19
end.loopexit.split: ; preds = %entry, %for.cond.cleanup
%55 = load i32, ptr %vla2, align 16, !tbaa !5
%56 = load i32, ptr %vla, align 16, !tbaa !5
%57 = call i32 @llvm.abs.i32(i32 %56, i1 true)
%add.le = add nsw i32 %57, %55
%58 = load i32, ptr %vla1, align 16, !tbaa !5
%59 = call i32 @llvm.abs.i32(i32 %58, i1 true)
%add32.le138 = add nsw i32 %add.le, %59
br label %end
end: ; preds = %for.inc78.split.us.us, %for.cond.cleanup59.us.us, %end.loopexit.split
%i.0118 = phi i32 [ 0, %end.loopexit.split ], [ %i.0253.us, %for.cond.cleanup59.us.us ], [ 101, %for.inc78.split.us.us ]
%j.2 = phi i32 [ 0, %end.loopexit.split ], [ %j.1132.us.us, %for.cond.cleanup59.us.us ], [ 101, %for.inc78.split.us.us ]
%hmax.2 = phi i32 [ %add32.le138, %end.loopexit.split ], [ %add32.us.us, %for.cond.cleanup59.us.us ], [ %add32.us.us, %for.inc78.split.us.us ]
%call81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0118, i32 noundef %j.2, i32 noundef %hmax.2)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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 #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x 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.smax.v4i32(<4 x i32>, <4 x i32>) #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include<stdio.h>
int main()
{
int x,y,z,d,temp,m;
scanf("%d %d %d %d",&x,&y,&z,&d);
if(x<z) m=z-x;
else m=x-z;
if(m<=d){ printf("Yes\n"); return 0; }
if(x>y){ temp=x; x=y; y=temp; }
if(y>z){ temp=y; y=z; z=temp; }
if(x>y){ temp=x; x=y; y=temp; }
if(z-y<=d && y-x<=d) printf("Yes\n");
else printf("No\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181256/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181256/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%y = alloca i32, align 4
%z = alloca i32, align 4
%d = 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 %y) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y, ptr noundef nonnull %z, ptr noundef nonnull %d)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %z, align 4, !tbaa !5
%sub1 = sub nsw i32 %0, %1
%m.0 = call i32 @llvm.abs.i32(i32 %sub1, i1 true)
%2 = load i32, ptr %d, align 4, !tbaa !5
%cmp2.not = icmp sgt i32 %m.0, %2
br i1 %cmp2.not, label %if.end5, label %cleanup
if.end5: ; preds = %entry
%3 = load i32, ptr %y, align 4, !tbaa !5
%cmp6 = icmp sgt i32 %0, %3
br i1 %cmp6, label %if.then7, label %if.end8
if.then7: ; preds = %if.end5
store i32 %3, ptr %x, align 4, !tbaa !5
store i32 %0, ptr %y, align 4, !tbaa !5
br label %if.end8
if.end8: ; preds = %if.then7, %if.end5
%4 = phi i32 [ %3, %if.then7 ], [ %0, %if.end5 ]
%5 = phi i32 [ %0, %if.then7 ], [ %3, %if.end5 ]
%cmp9 = icmp sgt i32 %5, %1
br i1 %cmp9, label %if.then10, label %if.end11
if.then10: ; preds = %if.end8
store i32 %1, ptr %y, align 4, !tbaa !5
store i32 %5, ptr %z, align 4, !tbaa !5
br label %if.end11
if.end11: ; preds = %if.then10, %if.end8
%6 = phi i32 [ %5, %if.then10 ], [ %1, %if.end8 ]
%7 = phi i32 [ %1, %if.then10 ], [ %5, %if.end8 ]
%cmp12 = icmp sgt i32 %4, %7
br i1 %cmp12, label %if.then13, label %if.end14
if.then13: ; preds = %if.end11
store i32 %7, ptr %x, align 4, !tbaa !5
store i32 %4, ptr %y, align 4, !tbaa !5
br label %if.end14
if.end14: ; preds = %if.then13, %if.end11
%8 = phi i32 [ %7, %if.then13 ], [ %4, %if.end11 ]
%9 = phi i32 [ %4, %if.then13 ], [ %7, %if.end11 ]
%sub15 = sub nsw i32 %6, %9
%cmp16.not = icmp sgt i32 %sub15, %2
%sub17 = sub nsw i32 %9, %8
%cmp18.not = icmp sgt i32 %sub17, %2
%or.cond = select i1 %cmp16.not, i1 true, i1 %cmp18.not
%str.str.3 = select i1 %or.cond, ptr @str, ptr @str.4
br label %cleanup
cleanup: ; preds = %if.end14, %entry
%str.3.sink = phi ptr [ @str.4, %entry ], [ %str.str.3, %if.end14 ]
%puts40 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include <stdio.h>
int d;
int abs(int a)
{
return a < 0 ? -a : a;
}
int talkable(int a, int b)
{
return abs(a-b) <= d ? 1 : 0;
}
int main(void)
{
int a, b, c;
scanf("%d%d%d%d", &a, &b, &c, &d);
printf("%s\n", talkable(a, c) || talkable(a, b) && talkable(b, c) ? "Yes" : "No");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181306/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181306/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@d = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @abs(i32 noundef %a) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.abs.i32(i32 %a, i1 true)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @talkable(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%sub = sub nsw i32 %a, %b
%0 = tail call i32 @llvm.abs.i32(i32 %sub, i1 true)
%1 = load i32, ptr @d, align 4, !tbaa !5
%cmp.not = icmp sle i32 %0, %1
%cond = zext i1 %cmp.not to i32
ret i32 %cond
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #7
%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 %c, align 4, !tbaa !5
%sub.i = sub nsw i32 %0, %1
%2 = call i32 @llvm.abs.i32(i32 %sub.i, i1 true)
%3 = load i32, ptr @d, align 4, !tbaa !5
%cmp.not.i.not = icmp sgt i32 %2, %3
br i1 %cmp.not.i.not, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%4 = load i32, ptr %b, align 4, !tbaa !5
%sub.i7 = sub nsw i32 %0, %4
%5 = call i32 @llvm.abs.i32(i32 %sub.i7, i1 true)
%cmp.not.i8.not = icmp sgt i32 %5, %3
br i1 %cmp.not.i8.not, label %lor.end, label %land.rhs
land.rhs: ; preds = %lor.rhs
%sub.i10 = sub nsw i32 %4, %1
%6 = call i32 @llvm.abs.i32(i32 %sub.i10, i1 true)
%cmp.not.i11.not = icmp sgt i32 %6, %3
%7 = select i1 %cmp.not.i11.not, ptr @.str.3, ptr @.str.2
br label %lor.end
lor.end: ; preds = %lor.rhs, %land.rhs, %entry
%cond = phi ptr [ @.str.2, %entry ], [ @.str.3, %lor.rhs ], [ %7, %land.rhs ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int max(int a,int b,int c){
if(a>=b){
if(c<a){
c=a;
}
}
else{
if(c<b){
c=b;
}
}
return c;
}
int main(void){
int t;
scanf("%d",&t);
while(t--){
max(0,0,0);
int e=0;
int n=1;
scanf("%d",&n);
char arr[n];
scanf("%s",arr);
for(int i=0;i<n;i++){
if(arr[i]=='1'){
e= max(n-i,i+1,e);
}
}
if((2*e)==0)
printf("%d\n",n);
else{
printf("%d",2*e);
printf("\n");
}
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18135/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18135/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #0 {
entry:
%minmaxop = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%c.addr.0 = tail call i32 @llvm.smax.i32(i32 %minmaxop, i32 %c)
ret i32 %c.addr.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%t = alloca i32, align 4
%n = 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, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%dec25 = add nsw i32 %0, -1
store i32 %dec25, ptr %t, align 4, !tbaa !5
%tobool.not26 = icmp eq i32 %0, 0
br i1 %tobool.not26, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end14
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
store i32 1, ptr %n, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = zext i32 %1 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i8, i64 %2, align 16
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %vla)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %4, 0
br i1 %cmp21, label %for.body.preheader, label %if.then9
for.body.preheader: ; preds = %while.body
%wide.trip.count = zext i32 %4 to i64
br label %for.body
for.cond.cleanup: ; preds = %for.inc
%cmp7 = icmp eq i32 %e.1, 0
br i1 %cmp7, label %if.then9, label %if.else
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.pre-phi, %for.inc ]
%e.022 = phi i32 [ 0, %for.body.preheader ], [ %e.1, %for.inc ]
%arrayidx = getelementptr inbounds i8, ptr %vla, i64 %indvars.iv
%5 = load i8, ptr %arrayidx, align 1, !tbaa !9
%cmp4 = icmp eq i8 %5, 49
br i1 %cmp4, label %if.then, label %for.body.for.inc_crit_edge
for.body.for.inc_crit_edge: ; preds = %for.body
%.pre = add nuw nsw i64 %indvars.iv, 1
br label %for.inc
if.then: ; preds = %for.body
%6 = trunc i64 %indvars.iv to i32
%sub = sub nsw i32 %4, %6
%7 = add nuw nsw i64 %indvars.iv, 1
%8 = trunc i64 %7 to i32
%minmaxop.i = call i32 @llvm.smax.i32(i32 %sub, i32 %8)
%c.addr.0.i = call i32 @llvm.smax.i32(i32 %minmaxop.i, i32 %e.022)
br label %for.inc
for.inc: ; preds = %for.body.for.inc_crit_edge, %if.then
%indvars.iv.next.pre-phi = phi i64 [ %.pre, %for.body.for.inc_crit_edge ], [ %7, %if.then ]
%e.1 = phi i32 [ %e.022, %for.body.for.inc_crit_edge ], [ %c.addr.0.i, %if.then ]
%exitcond.not = icmp eq i64 %indvars.iv.next.pre-phi, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !10
if.then9: ; preds = %while.body, %for.cond.cleanup
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %4)
br label %if.end14
if.else: ; preds = %for.cond.cleanup
%mul = shl nuw nsw i32 %e.1, 1
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %mul)
%putchar = call i32 @putchar(i32 10)
br label %if.end14
if.end14: ; preds = %if.else, %if.then9
call void @llvm.stackrestore.p0(ptr %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
%9 = load i32, ptr %t, align 4, !tbaa !5
%dec = add nsw i32 %9, -1
store i32 %dec, ptr %t, align 4, !tbaa !5
%tobool.not = icmp eq i32 %9, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end14, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree nounwind }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#include<stdlib.h>
int main() {
int a, b, c, d;
scanf("%d %d %d %d", &a,&b,&c,&d);//とりあえず値を代入
if(abs(c-a)<= d){
printf("Yes\n");
}
else if ((abs(c - b) <= d) && (abs(b - a) <= d)) {
printf("Yes\n");
}
else {
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181414/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181414/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.4 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca 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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%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 %c, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%2 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%3 = load i32, ptr %d, align 4, !tbaa !5
%cmp.not = icmp sgt i32 %2, %3
br i1 %cmp.not, label %if.else, label %if.end10
if.else: ; preds = %entry
%4 = load i32, ptr %b, align 4, !tbaa !5
%sub2 = sub nsw i32 %0, %4
%5 = call i32 @llvm.abs.i32(i32 %sub2, i1 true)
%cmp3.not = icmp sgt i32 %5, %3
br i1 %cmp3.not, label %if.else8, label %land.lhs.true
land.lhs.true: ; preds = %if.else
%sub4 = sub nsw i32 %4, %1
%6 = call i32 @llvm.abs.i32(i32 %sub4, i1 true)
%cmp5.not = icmp sgt i32 %6, %3
br i1 %cmp5.not, label %if.else8, label %if.end10
if.else8: ; preds = %land.lhs.true, %if.else
br label %if.end10
if.end10: ; preds = %land.lhs.true, %entry, %if.else8
%str.3.sink = phi ptr [ @str, %if.else8 ], [ @str.4, %entry ], [ @str.4, %land.lhs.true ]
%puts11 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3
; Function Attrs: 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"}
|
#include<stdio.h>
int main(void){
int a,b,c,d,x,y,z;
scanf("%d%d%d%d",&a,&b,&c,&d);
x=a-c>0?a-c:c-a;
y=a-b>0?a-b:b-a;
z=c-b>0?c-b:c-b;
if(x<=d||(y<=d&&z<=d))
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181487/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181487/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = 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 void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #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)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %c, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
%cond = call i32 @llvm.abs.i32(i32 %sub, i1 false)
%2 = load i32, ptr %d, align 4, !tbaa !5
%cmp19.not = icmp sgt i32 %cond, %2
br i1 %cmp19.not, label %lor.lhs.false, label %if.end
lor.lhs.false: ; preds = %entry
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub11 = sub nsw i32 %1, %3
%sub3 = sub nsw i32 %0, %3
%cond10 = call i32 @llvm.abs.i32(i32 %sub3, i1 false)
%cmp20.not = icmp sgt i32 %cond10, %2
%cmp21.not = icmp sgt i32 %sub11, %2
%or.cond = select i1 %cmp20.not, i1 true, i1 %cmp21.not
%spec.select = select i1 %or.cond, ptr @str, ptr @str.3
br label %if.end
if.end: ; preds = %lor.lhs.false, %entry
%str.sink = phi ptr [ @str.3, %entry ], [ %spec.select, %lor.lhs.false ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include <stdio.h>
#define N_MAX 200
#define GAME 3
short n,p[N_MAX][GAME];
void solve(void){
short i,j,k,flag,answer;
for(j=0;j<GAME;j++){
for(i=0;i<n;i++){
if(!p[i][j])continue;
flag = 0;
for(k=i+1;k<n;k++){
if(p[i][j]==p[k][j])flag=1,p[k][j]=0;
}
if(flag)p[i][j]=0;
}
}
for(i=0;i<n;i++){
answer=0;
for(j=0;j<GAME;j++)answer+=p[i][j];
printf("%hd\n",answer);
}
return;
}
int main(void){
short i;
scanf("%hd",&n);
for(i=0;i<n*GAME;i++){
scanf("%hd",&p[i/GAME][i%GAME]);
}
solve();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181537/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181537/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i16 0, align 2
@p = dso_local global [200 x [3 x i16]] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%hd\0A\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%hd\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @solve() local_unnamed_addr #0 {
entry:
%0 = load i16, ptr @n, align 2, !tbaa !5
%cmp5100 = icmp sgt i16 %0, 0
br i1 %cmp5100, label %for.cond2.preheader.us.preheader, label %for.end74
for.cond2.preheader.us.preheader: ; preds = %entry
%1 = zext i16 %0 to i64
%wide.trip.count = zext i16 %0 to i64
br label %for.body7.us
for.body7.us: ; preds = %for.cond2.preheader.us.preheader, %for.inc43.us
%indvars.iv111 = phi i64 [ 0, %for.cond2.preheader.us.preheader ], [ %.pre, %for.inc43.us ]
%indvars.iv = phi i64 [ 1, %for.cond2.preheader.us.preheader ], [ %indvars.iv.next, %for.inc43.us ]
%arrayidx9.us = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv111, i64 0
%2 = load i16, ptr %arrayidx9.us, align 2, !tbaa !5
%tobool.not.us = icmp ne i16 %2, 0
%.pre = add nuw nsw i64 %indvars.iv111, 1
%cmp1597.us = icmp ult i64 %.pre, %1
%or.cond = select i1 %tobool.not.us, i1 %cmp1597.us, i1 false
br i1 %or.cond, label %for.body17.us, label %for.inc43.us
for.end.us: ; preds = %for.inc.us
%tobool36.not.us = icmp eq i16 %flag.1.us, 0
br i1 %tobool36.not.us, label %for.inc43.us, label %if.then37.us
if.then37.us: ; preds = %for.end.us
store i16 0, ptr %arrayidx9.us, align 2, !tbaa !5
br label %for.inc43.us
for.body17.us: ; preds = %for.body7.us, %for.inc.us
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.inc.us ], [ %indvars.iv, %for.body7.us ]
%flag.098.us = phi i16 [ %flag.1.us, %for.inc.us ], [ 0, %for.body7.us ]
%3 = load i16, ptr %arrayidx9.us, align 2, !tbaa !5
%arrayidx26.us = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv108, i64 0
%4 = load i16, ptr %arrayidx26.us, align 2, !tbaa !5
%cmp28.us = icmp eq i16 %3, %4
br i1 %cmp28.us, label %if.then30.us, label %for.inc.us
if.then30.us: ; preds = %for.body17.us
store i16 0, ptr %arrayidx26.us, align 2, !tbaa !5
br label %for.inc.us
for.inc.us: ; preds = %if.then30.us, %for.body17.us
%flag.1.us = phi i16 [ 1, %if.then30.us ], [ %flag.098.us, %for.body17.us ]
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%cmp15.us = icmp ult i64 %indvars.iv.next109, %1
br i1 %cmp15.us, label %for.body17.us, label %for.end.us, !llvm.loop !9
for.inc43.us: ; preds = %for.body7.us, %if.then37.us, %for.end.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %.pre, %wide.trip.count
br i1 %exitcond.not, label %for.body7.us.1, label %for.body7.us, !llvm.loop !11
for.body7.us.1: ; preds = %for.inc43.us, %for.inc43.us.1
%indvars.iv111.1 = phi i64 [ %.pre126, %for.inc43.us.1 ], [ 0, %for.inc43.us ]
%indvars.iv.1 = phi i64 [ %indvars.iv.next.1, %for.inc43.us.1 ], [ 1, %for.inc43.us ]
%arrayidx9.us.1 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv111.1, i64 1
%5 = load i16, ptr %arrayidx9.us.1, align 2, !tbaa !5
%tobool.not.us.1 = icmp ne i16 %5, 0
%.pre126 = add nuw nsw i64 %indvars.iv111.1, 1
%cmp1597.us.1 = icmp ult i64 %.pre126, %1
%or.cond134 = select i1 %tobool.not.us.1, i1 %cmp1597.us.1, i1 false
br i1 %or.cond134, label %for.body17.us.1, label %for.inc43.us.1
for.body17.us.1: ; preds = %for.body7.us.1, %for.inc.us.1
%indvars.iv108.1 = phi i64 [ %indvars.iv.next109.1, %for.inc.us.1 ], [ %indvars.iv.1, %for.body7.us.1 ]
%flag.098.us.1 = phi i16 [ %flag.1.us.1, %for.inc.us.1 ], [ 0, %for.body7.us.1 ]
%6 = load i16, ptr %arrayidx9.us.1, align 2, !tbaa !5
%arrayidx26.us.1 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv108.1, i64 1
%7 = load i16, ptr %arrayidx26.us.1, align 2, !tbaa !5
%cmp28.us.1 = icmp eq i16 %6, %7
br i1 %cmp28.us.1, label %if.then30.us.1, label %for.inc.us.1
if.then30.us.1: ; preds = %for.body17.us.1
store i16 0, ptr %arrayidx26.us.1, align 2, !tbaa !5
br label %for.inc.us.1
for.inc.us.1: ; preds = %if.then30.us.1, %for.body17.us.1
%flag.1.us.1 = phi i16 [ 1, %if.then30.us.1 ], [ %flag.098.us.1, %for.body17.us.1 ]
%indvars.iv.next109.1 = add nuw nsw i64 %indvars.iv108.1, 1
%cmp15.us.1 = icmp ult i64 %indvars.iv.next109.1, %1
br i1 %cmp15.us.1, label %for.body17.us.1, label %for.end.us.1, !llvm.loop !9
for.end.us.1: ; preds = %for.inc.us.1
%tobool36.not.us.1 = icmp eq i16 %flag.1.us.1, 0
br i1 %tobool36.not.us.1, label %for.inc43.us.1, label %if.then37.us.1
if.then37.us.1: ; preds = %for.end.us.1
store i16 0, ptr %arrayidx9.us.1, align 2, !tbaa !5
br label %for.inc43.us.1
for.inc43.us.1: ; preds = %for.body7.us.1, %if.then37.us.1, %for.end.us.1
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 1
%exitcond.1.not = icmp eq i64 %.pre126, %wide.trip.count
br i1 %exitcond.1.not, label %for.body7.us.2, label %for.body7.us.1, !llvm.loop !11
for.body7.us.2: ; preds = %for.inc43.us.1, %for.inc43.us.2
%indvars.iv111.2 = phi i64 [ %.pre127, %for.inc43.us.2 ], [ 0, %for.inc43.us.1 ]
%indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %for.inc43.us.2 ], [ 1, %for.inc43.us.1 ]
%arrayidx9.us.2 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv111.2, i64 2
%8 = load i16, ptr %arrayidx9.us.2, align 2, !tbaa !5
%tobool.not.us.2 = icmp ne i16 %8, 0
%.pre127 = add nuw nsw i64 %indvars.iv111.2, 1
%cmp1597.us.2 = icmp ult i64 %.pre127, %1
%or.cond135 = select i1 %tobool.not.us.2, i1 %cmp1597.us.2, i1 false
br i1 %or.cond135, label %for.body17.us.2, label %for.inc43.us.2
for.body17.us.2: ; preds = %for.body7.us.2, %for.inc.us.2
%indvars.iv108.2 = phi i64 [ %indvars.iv.next109.2, %for.inc.us.2 ], [ %indvars.iv.2, %for.body7.us.2 ]
%flag.098.us.2 = phi i16 [ %flag.1.us.2, %for.inc.us.2 ], [ 0, %for.body7.us.2 ]
%9 = load i16, ptr %arrayidx9.us.2, align 2, !tbaa !5
%arrayidx26.us.2 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv108.2, i64 2
%10 = load i16, ptr %arrayidx26.us.2, align 2, !tbaa !5
%cmp28.us.2 = icmp eq i16 %9, %10
br i1 %cmp28.us.2, label %if.then30.us.2, label %for.inc.us.2
if.then30.us.2: ; preds = %for.body17.us.2
store i16 0, ptr %arrayidx26.us.2, align 2, !tbaa !5
br label %for.inc.us.2
for.inc.us.2: ; preds = %if.then30.us.2, %for.body17.us.2
%flag.1.us.2 = phi i16 [ 1, %if.then30.us.2 ], [ %flag.098.us.2, %for.body17.us.2 ]
%indvars.iv.next109.2 = add nuw nsw i64 %indvars.iv108.2, 1
%cmp15.us.2 = icmp ult i64 %indvars.iv.next109.2, %1
br i1 %cmp15.us.2, label %for.body17.us.2, label %for.end.us.2, !llvm.loop !9
for.end.us.2: ; preds = %for.inc.us.2
%tobool36.not.us.2 = icmp eq i16 %flag.1.us.2, 0
br i1 %tobool36.not.us.2, label %for.inc43.us.2, label %if.then37.us.2
if.then37.us.2: ; preds = %for.end.us.2
store i16 0, ptr %arrayidx9.us.2, align 2, !tbaa !5
br label %for.inc43.us.2
for.inc43.us.2: ; preds = %for.body7.us.2, %if.then37.us.2, %for.end.us.2
%indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
%exitcond.2.not = icmp eq i64 %.pre127, %wide.trip.count
br i1 %exitcond.2.not, label %for.cond49.preheader, label %for.body7.us.2, !llvm.loop !11
for.cond49.preheader: ; preds = %for.inc43.us.2
br i1 %cmp5100, label %for.cond55.preheader, label %for.end74
for.cond55.preheader: ; preds = %for.cond49.preheader, %for.cond55.preheader
%indvars.iv123 = phi i64 [ %indvars.iv.next124, %for.cond55.preheader ], [ 0, %for.cond49.preheader ]
%arrayidx63 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv123, i64 0
%11 = load i16, ptr %arrayidx63, align 2, !tbaa !5
%arrayidx63.1 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv123, i64 1
%12 = load i16, ptr %arrayidx63.1, align 2, !tbaa !5
%add66.1 = add i16 %12, %11
%arrayidx63.2 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %indvars.iv123, i64 2
%13 = load i16, ptr %arrayidx63.2, align 2, !tbaa !5
%add66.2 = add i16 %13, %add66.1
%conv71 = sext i16 %add66.2 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv71)
%indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
%14 = load i16, ptr @n, align 2, !tbaa !5
%15 = sext i16 %14 to i64
%cmp52 = icmp slt i64 %indvars.iv.next124, %15
br i1 %cmp52, label %for.cond55.preheader, label %for.end74, !llvm.loop !12
for.end74: ; preds = %for.cond55.preheader, %entry, %for.cond49.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i16, ptr @n, align 2, !tbaa !5
%cmp15 = icmp sgt i16 %0, 0
br i1 %cmp15, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.016 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
%div11 = sdiv i16 %i.016, 3
%idxprom = sext i16 %div11 to i64
%rem12 = srem i16 %i.016, 3
%idxprom5 = sext i16 %rem12 to i64
%arrayidx6 = getelementptr inbounds [200 x [3 x i16]], ptr @p, i64 0, i64 %idxprom, i64 %idxprom5
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx6)
%inc = add i16 %i.016, 1
%conv = sext i16 %inc to i32
%1 = load i16, ptr @n, align 2, !tbaa !5
%conv1 = sext i16 %1 to i32
%mul = mul nsw i32 %conv1, 3
%cmp = icmp sgt i32 %mul, %conv
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body, %entry
tail call void @solve()
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"short", !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(){
int n,score[200][3],result[200][3],sum[200]={0},i,j,k;
scanf("%d",&n);
for(i = 0; i < n; i++){
for(j = 0; j < 3; j++){
scanf("%d",&score[i][j]);
result[i][j]=score[i][j];
}
}
for(j = 0; j < 3; j++){
for(i = 0; i < n; i++){
for(k = i+1; k < n; k++){
if(score[i][j] == score[k][j]){
result[i][j]=0;
result[k][j]=0;
}
}
}
}
for(i = 0; i < n; i++){
for(j = 0; j < 3; j++){
sum[i] += result[i][j];
}
printf("%d\n",sum[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181580/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181580/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%score = alloca [200 x [3 x i32]], align 16
%result = alloca [200 x [3 x i32]], align 16
%sum = alloca [200 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 2400, ptr nonnull %score) #4
call void @llvm.lifetime.start.p0(i64 2400, ptr nonnull %result) #4
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %sum) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800) %sum, i8 0, i64 800, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp106 = icmp sgt i32 %0, 0
br i1 %cmp106, label %for.cond1.preheader, label %for.end74
for.cond1.preheader: ; preds = %entry, %for.cond1.preheader
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond1.preheader ], [ 0, %entry ]
%arrayidx5 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv, i64 0
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%1 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%arrayidx14 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv, i64 0
store i32 %1, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx5.1 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv, i64 1
%call6.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.1)
%2 = load i32, ptr %arrayidx5.1, align 4, !tbaa !5
%arrayidx14.1 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv, i64 1
store i32 %2, ptr %arrayidx14.1, align 4, !tbaa !5
%arrayidx5.2 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv, i64 2
%call6.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5.2)
%3 = load i32, ptr %arrayidx5.2, align 4, !tbaa !5
%arrayidx14.2 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv, i64 2
store i32 %3, ptr %arrayidx14.2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.cond1.preheader, label %for.cond18.preheader, !llvm.loop !9
for.cond18.preheader: ; preds = %for.cond1.preheader
%cmp22110 = icmp sgt i32 %4, 0
br i1 %cmp22110, label %for.cond21.preheader.us.preheader, label %for.end74
for.cond21.preheader.us.preheader: ; preds = %for.cond18.preheader
%6 = zext i32 %4 to i64
%wide.trip.count130 = zext i32 %4 to i64
br label %for.body23.us
for.body23.us: ; preds = %for.cond21.preheader.us.preheader, %for.cond21.loopexit.us
%indvars.iv127 = phi i64 [ 0, %for.cond21.preheader.us.preheader ], [ %indvars.iv.next128, %for.cond21.loopexit.us ]
%indvars.iv122 = phi i64 [ 1, %for.cond21.preheader.us.preheader ], [ %indvars.iv.next123, %for.cond21.loopexit.us ]
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
%cmp25108.us = icmp ult i64 %indvars.iv.next128, %6
br i1 %cmp25108.us, label %for.body26.lr.ph.us, label %for.cond21.loopexit.us
for.body26.us: ; preds = %for.body26.lr.ph.us, %for.inc44.us
%indvars.iv124 = phi i64 [ %indvars.iv122, %for.body26.lr.ph.us ], [ %indvars.iv.next125, %for.inc44.us ]
%arrayidx34.us = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv124, i64 0
%7 = load i32, ptr %arrayidx34.us, align 4, !tbaa !5
%cmp35.us = icmp eq i32 %8, %7
br i1 %cmp35.us, label %if.then.us, label %for.inc44.us
if.then.us: ; preds = %for.body26.us
store i32 0, ptr %arrayidx39.us, align 4, !tbaa !5
%arrayidx43.us = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv124, i64 0
store i32 0, ptr %arrayidx43.us, align 4, !tbaa !5
br label %for.inc44.us
for.inc44.us: ; preds = %if.then.us, %for.body26.us
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%exitcond.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count130
br i1 %exitcond.not, label %for.cond21.loopexit.us, label %for.body26.us, !llvm.loop !11
for.cond21.loopexit.us: ; preds = %for.inc44.us, %for.body23.us
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%exitcond131.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count130
br i1 %exitcond131.not, label %for.body23.us.1, label %for.body23.us, !llvm.loop !12
for.body26.lr.ph.us: ; preds = %for.body23.us
%arrayidx30.us = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv127, i64 0
%8 = load i32, ptr %arrayidx30.us, align 4, !tbaa !5
%arrayidx39.us = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv127, i64 0
br label %for.body26.us
for.body23.us.1: ; preds = %for.cond21.loopexit.us, %for.cond21.loopexit.us.1
%indvars.iv127.1 = phi i64 [ %indvars.iv.next128.1, %for.cond21.loopexit.us.1 ], [ 0, %for.cond21.loopexit.us ]
%indvars.iv122.1 = phi i64 [ %indvars.iv.next123.1, %for.cond21.loopexit.us.1 ], [ 1, %for.cond21.loopexit.us ]
%indvars.iv.next128.1 = add nuw nsw i64 %indvars.iv127.1, 1
%cmp25108.us.1 = icmp ult i64 %indvars.iv.next128.1, %6
br i1 %cmp25108.us.1, label %for.body26.lr.ph.us.1, label %for.cond21.loopexit.us.1
for.body26.lr.ph.us.1: ; preds = %for.body23.us.1
%arrayidx30.us.1 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv127.1, i64 1
%9 = load i32, ptr %arrayidx30.us.1, align 4, !tbaa !5
%arrayidx39.us.1 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv127.1, i64 1
br label %for.body26.us.1
for.body26.us.1: ; preds = %for.inc44.us.1, %for.body26.lr.ph.us.1
%indvars.iv124.1 = phi i64 [ %indvars.iv122.1, %for.body26.lr.ph.us.1 ], [ %indvars.iv.next125.1, %for.inc44.us.1 ]
%arrayidx34.us.1 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv124.1, i64 1
%10 = load i32, ptr %arrayidx34.us.1, align 4, !tbaa !5
%cmp35.us.1 = icmp eq i32 %9, %10
br i1 %cmp35.us.1, label %if.then.us.1, label %for.inc44.us.1
if.then.us.1: ; preds = %for.body26.us.1
store i32 0, ptr %arrayidx39.us.1, align 4, !tbaa !5
%arrayidx43.us.1 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv124.1, i64 1
store i32 0, ptr %arrayidx43.us.1, align 4, !tbaa !5
br label %for.inc44.us.1
for.inc44.us.1: ; preds = %if.then.us.1, %for.body26.us.1
%indvars.iv.next125.1 = add nuw nsw i64 %indvars.iv124.1, 1
%exitcond.1.not = icmp eq i64 %indvars.iv.next125.1, %wide.trip.count130
br i1 %exitcond.1.not, label %for.cond21.loopexit.us.1, label %for.body26.us.1, !llvm.loop !11
for.cond21.loopexit.us.1: ; preds = %for.inc44.us.1, %for.body23.us.1
%indvars.iv.next123.1 = add nuw nsw i64 %indvars.iv122.1, 1
%exitcond131.1.not = icmp eq i64 %indvars.iv.next128.1, %wide.trip.count130
br i1 %exitcond131.1.not, label %for.body23.us.2, label %for.body23.us.1, !llvm.loop !12
for.body23.us.2: ; preds = %for.cond21.loopexit.us.1, %for.cond21.loopexit.us.2
%indvars.iv127.2 = phi i64 [ %indvars.iv.next128.2, %for.cond21.loopexit.us.2 ], [ 0, %for.cond21.loopexit.us.1 ]
%indvars.iv122.2 = phi i64 [ %indvars.iv.next123.2, %for.cond21.loopexit.us.2 ], [ 1, %for.cond21.loopexit.us.1 ]
%indvars.iv.next128.2 = add nuw nsw i64 %indvars.iv127.2, 1
%cmp25108.us.2 = icmp ult i64 %indvars.iv.next128.2, %6
br i1 %cmp25108.us.2, label %for.body26.lr.ph.us.2, label %for.cond21.loopexit.us.2
for.body26.lr.ph.us.2: ; preds = %for.body23.us.2
%arrayidx30.us.2 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv127.2, i64 2
%11 = load i32, ptr %arrayidx30.us.2, align 4, !tbaa !5
%arrayidx39.us.2 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv127.2, i64 2
br label %for.body26.us.2
for.body26.us.2: ; preds = %for.inc44.us.2, %for.body26.lr.ph.us.2
%indvars.iv124.2 = phi i64 [ %indvars.iv122.2, %for.body26.lr.ph.us.2 ], [ %indvars.iv.next125.2, %for.inc44.us.2 ]
%arrayidx34.us.2 = getelementptr inbounds [200 x [3 x i32]], ptr %score, i64 0, i64 %indvars.iv124.2, i64 2
%12 = load i32, ptr %arrayidx34.us.2, align 4, !tbaa !5
%cmp35.us.2 = icmp eq i32 %11, %12
br i1 %cmp35.us.2, label %if.then.us.2, label %for.inc44.us.2
if.then.us.2: ; preds = %for.body26.us.2
store i32 0, ptr %arrayidx39.us.2, align 4, !tbaa !5
%arrayidx43.us.2 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv124.2, i64 2
store i32 0, ptr %arrayidx43.us.2, align 4, !tbaa !5
br label %for.inc44.us.2
for.inc44.us.2: ; preds = %if.then.us.2, %for.body26.us.2
%indvars.iv.next125.2 = add nuw nsw i64 %indvars.iv124.2, 1
%exitcond.2.not = icmp eq i64 %indvars.iv.next125.2, %wide.trip.count130
br i1 %exitcond.2.not, label %for.cond21.loopexit.us.2, label %for.body26.us.2, !llvm.loop !11
for.cond21.loopexit.us.2: ; preds = %for.inc44.us.2, %for.body23.us.2
%indvars.iv.next123.2 = add nuw nsw i64 %indvars.iv122.2, 1
%exitcond131.2.not = icmp eq i64 %indvars.iv.next128.2, %wide.trip.count130
br i1 %exitcond131.2.not, label %for.cond53.preheader, label %for.body23.us.2, !llvm.loop !12
for.cond53.preheader: ; preds = %for.cond21.loopexit.us.2
br i1 %cmp22110, label %for.cond56.preheader, label %for.end74
for.cond56.preheader: ; preds = %for.cond53.preheader, %for.cond56.preheader
%indvars.iv140 = phi i64 [ %indvars.iv.next141, %for.cond56.preheader ], [ 0, %for.cond53.preheader ]
%arrayidx64 = getelementptr inbounds [200 x i32], ptr %sum, i64 0, i64 %indvars.iv140
%arrayidx64.promoted = load i32, ptr %arrayidx64, align 4, !tbaa !5
%arrayidx62 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv140, i64 0
%13 = load i32, ptr %arrayidx62, align 4, !tbaa !5
%add65 = add nsw i32 %arrayidx64.promoted, %13
%arrayidx62.1 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv140, i64 1
%14 = load i32, ptr %arrayidx62.1, align 4, !tbaa !5
%add65.1 = add nsw i32 %add65, %14
%arrayidx62.2 = getelementptr inbounds [200 x [3 x i32]], ptr %result, i64 0, i64 %indvars.iv140, i64 2
%15 = load i32, ptr %arrayidx62.2, align 4, !tbaa !5
%add65.2 = add nsw i32 %add65.1, %15
store i32 %add65.2, ptr %arrayidx64, align 4, !tbaa !5
%call71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add65.2)
%indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
%16 = load i32, ptr %n, align 4, !tbaa !5
%17 = sext i32 %16 to i64
%cmp54 = icmp slt i64 %indvars.iv.next141, %17
br i1 %cmp54, label %for.cond56.preheader, label %for.end74, !llvm.loop !13
for.end74: ; preds = %for.cond56.preheader, %entry, %for.cond18.preheader, %for.cond53.preheader
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %sum) #4
call void @llvm.lifetime.end.p0(i64 2400, ptr nonnull %result) #4
call void @llvm.lifetime.end.p0(i64 2400, ptr nonnull %score) #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}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
struct Data{
int number[3];
int point;
};
int main(){
struct Data data[200];
int i,j,n;
int flag[3][100] = {0};
scanf("%d",&n);
for(i=0;i<n;i++){
data[i].point = 0;
scanf("%d %d %d",&data[i].number[0],&data[i].number[1],&data[i].number[2]);
for(j=0;j<3;j++){
flag[j][data[i].number[j]]++;
}
}
for(i=0;i<n;i++){
for(j=0;j<3;j++){
if(flag[j][data[i].number[j]] < 2)data[i].point += data[i].number[j];
}
}
for(i=0;i<n;i++){
printf("%d\n",data[i].point);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181623/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181623/source.c"
target datalayout = "e-m:e-p270: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 { [3 x i32], i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data = alloca [200 x %struct.Data], align 16
%n = alloca i32, align 4
%flag = alloca [3 x [100 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 3200, ptr nonnull %data) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 1200, ptr nonnull %flag) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1200) %flag, i8 0, i64 1200, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp92 = icmp sgt i32 %0, 0
br i1 %cmp92, label %for.body, label %for.end68
for.cond29.preheader: ; preds = %for.body
%cmp3095 = icmp sgt i32 %7, 0
br i1 %cmp3095, label %for.cond32.preheader.preheader, label %for.end68
for.cond32.preheader.preheader: ; preds = %for.cond29.preheader
%wide.trip.count = zext i32 %7 to i64
br label %for.cond32.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200 x %struct.Data], ptr %data, i64 0, i64 %indvars.iv
%point = getelementptr inbounds [200 x %struct.Data], ptr %data, i64 0, i64 %indvars.iv, i32 1
store i32 0, ptr %point, align 4, !tbaa !9
%arrayidx7 = getelementptr inbounds [3 x i32], ptr %arrayidx, i64 0, i64 1
%arrayidx11 = getelementptr inbounds [3 x i32], ptr %arrayidx, i64 0, i64 2
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx11)
%1 = load i32, ptr %arrayidx, align 16, !tbaa !5
%idxprom23 = sext i32 %1 to i64
%arrayidx24 = getelementptr inbounds [3 x [100 x i32]], ptr %flag, i64 0, i64 0, i64 %idxprom23
%2 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr %arrayidx24, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%idxprom23.1 = sext i32 %3 to i64
%arrayidx24.1 = getelementptr inbounds [3 x [100 x i32]], ptr %flag, i64 0, i64 1, i64 %idxprom23.1
%4 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%inc.1 = add nsw i32 %4, 1
store i32 %inc.1, ptr %arrayidx24.1, align 4, !tbaa !5
%5 = load i32, ptr %arrayidx11, align 8, !tbaa !5
%idxprom23.2 = sext i32 %5 to i64
%arrayidx24.2 = getelementptr inbounds [3 x [100 x i32]], ptr %flag, i64 0, i64 2, i64 %idxprom23.2
%6 = load i32, ptr %arrayidx24.2, align 4, !tbaa !5
%inc.2 = add nsw i32 %6, 1
store i32 %inc.2, ptr %arrayidx24.2, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp, label %for.body, label %for.cond29.preheader, !llvm.loop !11
for.cond32.preheader: ; preds = %for.cond32.preheader.preheader, %for.inc53.2
%indvars.iv105 = phi i64 [ 0, %for.cond32.preheader.preheader ], [ %indvars.iv.next106, %for.inc53.2 ]
%arrayidx38 = getelementptr inbounds [200 x %struct.Data], ptr %data, i64 0, i64 %indvars.iv105
%point52 = getelementptr inbounds [200 x %struct.Data], ptr %data, i64 0, i64 %indvars.iv105, i32 1
%9 = load i32, ptr %arrayidx38, align 16, !tbaa !5
%idxprom42 = sext i32 %9 to i64
%arrayidx43 = getelementptr inbounds [3 x [100 x i32]], ptr %flag, i64 0, i64 0, i64 %idxprom42
%10 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%cmp44 = icmp slt i32 %10, 2
br i1 %cmp44, label %if.then, label %for.inc53
for.cond59.preheader: ; preds = %for.inc53.2
br i1 %cmp3095, label %for.body61, label %for.end68
if.then: ; preds = %for.cond32.preheader
%11 = load i32, ptr %point52, align 4, !tbaa !9
%add = add nsw i32 %11, %9
store i32 %add, ptr %point52, align 4, !tbaa !9
br label %for.inc53
for.inc53: ; preds = %for.cond32.preheader, %if.then
%arrayidx41.1 = getelementptr inbounds [3 x i32], ptr %arrayidx38, i64 0, i64 1
%12 = load i32, ptr %arrayidx41.1, align 4, !tbaa !5
%idxprom42.1 = sext i32 %12 to i64
%arrayidx43.1 = getelementptr inbounds [3 x [100 x i32]], ptr %flag, i64 0, i64 1, i64 %idxprom42.1
%13 = load i32, ptr %arrayidx43.1, align 4, !tbaa !5
%cmp44.1 = icmp slt i32 %13, 2
br i1 %cmp44.1, label %if.then.1, label %for.inc53.1
if.then.1: ; preds = %for.inc53
%14 = load i32, ptr %point52, align 4, !tbaa !9
%add.1 = add nsw i32 %14, %12
store i32 %add.1, ptr %point52, align 4, !tbaa !9
br label %for.inc53.1
for.inc53.1: ; preds = %if.then.1, %for.inc53
%arrayidx41.2 = getelementptr inbounds [3 x i32], ptr %arrayidx38, i64 0, i64 2
%15 = load i32, ptr %arrayidx41.2, align 8, !tbaa !5
%idxprom42.2 = sext i32 %15 to i64
%arrayidx43.2 = getelementptr inbounds [3 x [100 x i32]], ptr %flag, i64 0, i64 2, i64 %idxprom42.2
%16 = load i32, ptr %arrayidx43.2, align 4, !tbaa !5
%cmp44.2 = icmp slt i32 %16, 2
br i1 %cmp44.2, label %if.then.2, label %for.inc53.2
if.then.2: ; preds = %for.inc53.1
%17 = load i32, ptr %point52, align 4, !tbaa !9
%add.2 = add nsw i32 %17, %15
store i32 %add.2, ptr %point52, align 4, !tbaa !9
br label %for.inc53.2
for.inc53.2: ; preds = %if.then.2, %for.inc53.1
%indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
%exitcond.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count
br i1 %exitcond.not, label %for.cond59.preheader, label %for.cond32.preheader, !llvm.loop !13
for.body61: ; preds = %for.cond59.preheader, %for.body61
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.body61 ], [ 0, %for.cond59.preheader ]
%point64 = getelementptr inbounds [200 x %struct.Data], ptr %data, i64 0, i64 %indvars.iv108, i32 1
%18 = load i32, ptr %point64, align 4, !tbaa !9
%call65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18)
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp60 = icmp slt i64 %indvars.iv.next109, %20
br i1 %cmp60, label %for.body61, label %for.end68, !llvm.loop !14
for.end68: ; preds = %for.body61, %entry, %for.cond29.preheader, %for.cond59.preheader
call void @llvm.lifetime.end.p0(i64 1200, ptr nonnull %flag) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 3200, ptr nonnull %data) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 12}
!10 = !{!"Data", !7, i64 0, !6, i64 12}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
|
#include <stdio.h>
int main(void){
int N,K;
scanf("%d %d",&N,&K);
int A[N];
int i;
/*
for(i=0;i<N;i++)
{
scanf("%d",&A[i]);
}
*/
int ans = 1;
N = N - K;
K--;
while(1){
if(N <= 0) break;
ans++;
N -= K;
}
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181681/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181681/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = call ptr @llvm.stacksave.p0()
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = load i32, ptr %K, align 4, !tbaa !5
%sub = sub nsw i32 %1, %2
store i32 %sub, ptr %N, align 4, !tbaa !5
%dec = add nsw i32 %2, -1
store i32 %dec, ptr %K, align 4, !tbaa !5
%cmp4 = icmp slt i32 %sub, 1
br i1 %cmp4, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end
%ans.05 = phi i32 [ %inc, %if.end ], [ 1, %entry ]
%3 = phi i32 [ %sub1, %if.end ], [ %sub, %entry ]
%inc = add nuw nsw i32 %ans.05, 1
%sub1 = sub nsw i32 %3, %dec
%cmp = icmp slt i32 %sub1, 1
br i1 %cmp, label %while.cond.while.end_crit_edge, label %if.end
while.cond.while.end_crit_edge: ; preds = %if.end
store i32 %sub1, ptr %N, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%ans.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 1, %entry ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int a[100005];
int cmp(const void*a,const void*b)
{
return (*(int *)a-*(int *)b);
}
int main()
{
int n,k,i,j;
int count=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
qsort(a,n,sizeof(a[0]),cmp);
for(i=0;i<n;)
{
for(j=i+1;j<i+k&&j<n;j++)
a[j]=a[i];
i+=(k-1);
count++;
if(i==n-1)
break;
}
printf("%d",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181731/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181731/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@a = dso_local global [100005 x i32] zeroinitializer, align 16
; 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) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
%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
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.body, label %entry.for.end_crit_edge
entry.for.end_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x i32], ptr @a, 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
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry.for.end_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.end_crit_edge ], [ %2, %for.body ]
call void @qsort(ptr noundef nonnull @a, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @cmp) #6
%3 = load i32, ptr %n, align 4
%4 = load i32, ptr %k, align 4
%sub22 = add nsw i32 %3, -1
%5 = add i32 %4, -1
br label %for.cond2
for.cond2: ; preds = %for.end19, %for.end
%indvars.iv46 = phi i32 [ %indvars.iv.next47, %for.end19 ], [ 1, %for.end ]
%i.1 = phi i32 [ %add20, %for.end19 ], [ 0, %for.end ]
%count.0 = phi i32 [ %inc21, %for.end19 ], [ 0, %for.end ]
%6 = add i32 %4, %i.1
%7 = call i32 @llvm.smin.i32(i32 %3, i32 %6)
%smin = sext i32 %7 to i64
%8 = sext i32 %indvars.iv46 to i64
%9 = sub nsw i64 %smin, %8
%10 = xor i64 %8, -1
%11 = add nsw i64 %10, %smin
%12 = sext i32 %indvars.iv46 to i64
%cmp3 = icmp slt i32 %i.1, %3
br i1 %cmp3, label %for.cond6.preheader, label %for.end25
for.cond6.preheader: ; preds = %for.cond2
%add7 = add nsw i32 %4, %i.1
%invariant.smin = call i32 @llvm.smin.i32(i32 %3, i32 %add7)
%j.042 = add nsw i32 %i.1, 1
%13 = icmp slt i32 %j.042, %invariant.smin
br i1 %13, label %for.body12.lr.ph, label %for.end19
for.body12.lr.ph: ; preds = %for.cond6.preheader
%idxprom13 = sext i32 %i.1 to i64
%arrayidx14 = getelementptr inbounds [100005 x i32], ptr @a, i64 0, i64 %idxprom13
%14 = sext i32 %invariant.smin to i64
%xtraiter = and i64 %9, 3
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body12.prol.loopexit, label %for.body12.prol
for.body12.prol: ; preds = %for.body12.lr.ph, %for.body12.prol
%indvars.iv48.prol = phi i64 [ %indvars.iv.next49.prol, %for.body12.prol ], [ %12, %for.body12.lr.ph ]
%prol.iter = phi i64 [ %prol.iter.next, %for.body12.prol ], [ 0, %for.body12.lr.ph ]
%15 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16.prol = getelementptr inbounds [100005 x i32], ptr @a, i64 0, i64 %indvars.iv48.prol
store i32 %15, ptr %arrayidx16.prol, align 4, !tbaa !5
%indvars.iv.next49.prol = add nsw i64 %indvars.iv48.prol, 1
%prol.iter.next = add i64 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body12.prol.loopexit, label %for.body12.prol, !llvm.loop !11
for.body12.prol.loopexit: ; preds = %for.body12.prol, %for.body12.lr.ph
%indvars.iv48.unr = phi i64 [ %12, %for.body12.lr.ph ], [ %indvars.iv.next49.prol, %for.body12.prol ]
%16 = icmp ult i64 %11, 3
br i1 %16, label %for.end19, label %for.body12
for.body12: ; preds = %for.body12.prol.loopexit, %for.body12
%indvars.iv48 = phi i64 [ %indvars.iv.next49.3, %for.body12 ], [ %indvars.iv48.unr, %for.body12.prol.loopexit ]
%17 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100005 x i32], ptr @a, i64 0, i64 %indvars.iv48
store i32 %17, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next49 = add nsw i64 %indvars.iv48, 1
%18 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16.1 = getelementptr inbounds [100005 x i32], ptr @a, i64 0, i64 %indvars.iv.next49
store i32 %18, ptr %arrayidx16.1, align 4, !tbaa !5
%indvars.iv.next49.1 = add nsw i64 %indvars.iv48, 2
%19 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16.2 = getelementptr inbounds [100005 x i32], ptr @a, i64 0, i64 %indvars.iv.next49.1
store i32 %19, ptr %arrayidx16.2, align 4, !tbaa !5
%indvars.iv.next49.2 = add nsw i64 %indvars.iv48, 3
%20 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16.3 = getelementptr inbounds [100005 x i32], ptr @a, i64 0, i64 %indvars.iv.next49.2
store i32 %20, ptr %arrayidx16.3, align 4, !tbaa !5
%indvars.iv.next49.3 = add nsw i64 %indvars.iv48, 4
%21 = icmp slt i64 %indvars.iv.next49.3, %14
br i1 %21, label %for.body12, label %for.end19, !llvm.loop !13
for.end19: ; preds = %for.body12.prol.loopexit, %for.body12, %for.cond6.preheader
%sub = add i32 %i.1, -1
%add20 = add i32 %sub, %4
%inc21 = add nuw nsw i32 %count.0, 1
%cmp23 = icmp eq i32 %add20, %sub22
%indvars.iv.next47 = add i32 %indvars.iv46, %5
br i1 %cmp23, label %for.end25, label %for.cond2, !llvm.loop !14
for.end25: ; preds = %for.end19, %for.cond2
%count.1 = phi i32 [ %inc21, %for.end19 ], [ %count.0, %for.cond2 ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include "stdio.h"
int main(int argc, char const *argv[]) {
int n,k,min,len;
scanf("%d %d",&n,&k );
int a[n];
for(int i=0; i<n; i++){
scanf("%d",&a[i] );
}
min=a[0];
for(int j=0; j<n; j++){
if(a[j]<min) min=a[j];
}
int count=1;
len=n-k;
while (len>0) {
len=len-(k-1);
count++;
}
printf("%d\n",count );
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181775/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181775/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %3, 0
br i1 %cmp28, label %for.body, label %for.cond.cleanup5
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
%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.cond.cleanup5, !llvm.loop !9
for.cond.cleanup5: ; preds = %for.body, %entry
%.lcssa44 = phi i32 [ %3, %entry ], [ %4, %for.body ]
%6 = load i32, ptr %k, align 4, !tbaa !5
%sub = sub nsw i32 %.lcssa44, %6
%cmp1533 = icmp sgt i32 %sub, 0
br i1 %cmp1533, label %while.body, label %while.end
while.body: ; preds = %for.cond.cleanup5, %while.body
%count.035 = phi i32 [ %inc18, %while.body ], [ 1, %for.cond.cleanup5 ]
%len.034 = phi i32 [ %sub17, %while.body ], [ %sub, %for.cond.cleanup5 ]
%reass.sub = sub i32 %len.034, %6
%sub17 = add i32 %reass.sub, 1
%inc18 = add nuw nsw i32 %count.035, 1
%cmp15 = icmp ult i32 %reass.sub, 2147483647
br i1 %cmp15, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %for.cond.cleanup5
%count.0.lcssa = phi i32 [ 1, %for.cond.cleanup5 ], [ %inc18, %while.body ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h> // printf(), scanf()
#include <stdbool.h>
#define MAX_V 1000
#define MAX_E 2000
#define INF 100000000
typedef struct edge_tbl
{
int from;
int to;
int cost;
} edge;
edge es[MAX_E];
int V, E;
void
bellman_ford(int s)
{
int d[MAX_V];
int i, j;
for (i = 0; i < V; ++i)
d[i] = INF;
d[s] = 0;
i = 0;
while (true)
{
bool update = false;
for (j = 0; j < E; ++j)
{
edge e = es[j];
if (d[e.from] != INF && d[e.from] + e.cost < d[e.to])
{
d[e.to] = d[e.from] + e.cost;
update = true;
if (i == V - 1)
{
printf("NEGATIVE CYCLE\n");
return;
}
}
}
if (!update)
break;
i++;
}
for (i = 0; i < V; ++i)
{
if (d[i] == INF)
printf("INF\n");
else
printf("%d\n", d[i]);
}
}
int
main(int argc, char** argv)
{
int r;
int s, t, d;
int i;
scanf("%d %d %d", &V, &E, &r);
for (i = 0; i < E; ++i)
{
scanf("%d %d %d", &s, &t, &d);
es[i].from = s;
es[i].to = t;
es[i].cost = d;
}
bellman_ford(r);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181818/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181818/source.c"
target datalayout = "e-m:e-p270: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.edge_tbl = type { i32, i32, i32 }
@V = dso_local global i32 0, align 4
@E = dso_local global i32 0, align 4
@es = dso_local local_unnamed_addr global [2000 x %struct.edge_tbl] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.3 = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@str = private unnamed_addr constant [15 x i8] c"NEGATIVE CYCLE\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"INF\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @bellman_ford(i32 noundef %s) local_unnamed_addr #0 {
entry:
%d = alloca [1000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %d) #5
%0 = load i32, ptr @V, align 4
%cmp82 = icmp sgt i32 %0, 0
br i1 %cmp82, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body.preheader134, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%1 = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %index
store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %1, align 16, !tbaa !5
%2 = getelementptr inbounds i32, ptr %1, i64 4
store <4 x i32> <i32 100000000, i32 100000000, i32 100000000, i32 100000000>, ptr %2, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%3 = icmp eq i64 %index.next, %n.vec
br i1 %3, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader134
for.body.preheader134: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader134, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader134 ]
%arrayidx = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %indvars.iv
store i32 100000000, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%idxprom1 = sext i32 %s to i64
%arrayidx2 = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %idxprom1
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%4 = load i32, ptr @E, align 4, !tbaa !5
%cmp484 = icmp sgt i32 %4, 0
%sub = add nsw i32 %0, -1
br i1 %cmp484, label %while.cond.us.preheader, label %for.cond37.preheader
while.cond.us.preheader: ; preds = %for.end
%wide.trip.count118 = zext i32 %4 to i64
br label %while.cond.us
while.cond.us: ; preds = %while.cond.us.preheader, %for.cond3.for.end30_crit_edge.us
%i.1.us = phi i32 [ %spec.select.us, %for.cond3.for.end30_crit_edge.us ], [ 0, %while.cond.us.preheader ]
%cmp25.us = icmp eq i32 %i.1.us, %sub
%cmp25.fr.us = freeze i1 %cmp25.us
br i1 %cmp25.fr.us, label %for.body5.us.us.preheader, label %for.body5.us87
for.body5.us.us.preheader: ; preds = %while.cond.us
%wide.trip.count123 = zext i32 %4 to i64
br label %for.body5.us.us
for.body5.us87: ; preds = %while.cond.us, %for.inc28.us105
%indvars.iv116 = phi i64 [ %indvars.iv.next117, %for.inc28.us105 ], [ 0, %while.cond.us ]
%update.085.us = phi i8 [ %update.2.ph.us, %for.inc28.us105 ], [ 0, %while.cond.us ]
%arrayidx7.us90 = getelementptr inbounds [2000 x %struct.edge_tbl], ptr @es, i64 0, i64 %indvars.iv116
%e.sroa.0.0.copyload.us91 = load i32, ptr %arrayidx7.us90, align 4, !tbaa.struct !14
%idxprom8.us92 = sext i32 %e.sroa.0.0.copyload.us91 to i64
%arrayidx9.us93 = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %idxprom8.us92
%5 = load i32, ptr %arrayidx9.us93, align 4, !tbaa !5
%cmp10.not.us94 = icmp eq i32 %5, 100000000
br i1 %cmp10.not.us94, label %for.inc28.us105, label %land.lhs.true.us95
land.lhs.true.us95: ; preds = %for.body5.us87
%e.sroa.8.0.arrayidx7.sroa_idx.us96 = getelementptr inbounds i8, ptr %arrayidx7.us90, i64 8
%e.sroa.8.0.copyload.us97 = load i32, ptr %e.sroa.8.0.arrayidx7.sroa_idx.us96, align 4, !tbaa.struct !15
%e.sroa.6.0.arrayidx7.sroa_idx.us98 = getelementptr inbounds i8, ptr %arrayidx7.us90, i64 4
%e.sroa.6.0.copyload.us99 = load i32, ptr %e.sroa.6.0.arrayidx7.sroa_idx.us98, align 4, !tbaa.struct !16
%add.us100 = add nsw i32 %e.sroa.8.0.copyload.us97, %5
%idxprom14.us101 = sext i32 %e.sroa.6.0.copyload.us99 to i64
%arrayidx15.us102 = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %idxprom14.us101
%6 = load i32, ptr %arrayidx15.us102, align 4, !tbaa !5
%cmp16.us103 = icmp slt i32 %add.us100, %6
%spec.store.select = tail call i32 @llvm.smin.i32(i32 %add.us100, i32 %6)
store i32 %spec.store.select, ptr %arrayidx15.us102, align 4
%spec.select = select i1 %cmp16.us103, i8 1, i8 %update.085.us
br label %for.inc28.us105
for.inc28.us105: ; preds = %land.lhs.true.us95, %for.body5.us87
%update.2.ph.us = phi i8 [ %update.085.us, %for.body5.us87 ], [ %spec.select, %land.lhs.true.us95 ]
%indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
%exitcond119.not = icmp eq i64 %indvars.iv.next117, %wide.trip.count118
br i1 %exitcond119.not, label %for.cond3.for.end30_crit_edge.us, label %for.body5.us87, !llvm.loop !17
for.cond3.for.end30_crit_edge.us: ; preds = %for.inc28.us105
%7 = and i8 %update.2.ph.us, 1
%tobool.not.us = icmp eq i8 %7, 0
%8 = zext i8 %7 to i32
%spec.select.us = add i32 %i.1.us, %8
br i1 %tobool.not.us, label %for.cond37.preheader, label %while.cond.us
for.body5.us.us: ; preds = %for.body5.us.us.preheader, %for.inc28.us.us
%indvars.iv120 = phi i64 [ 0, %for.body5.us.us.preheader ], [ %indvars.iv.next121, %for.inc28.us.us ]
%arrayidx7.us.us = getelementptr inbounds [2000 x %struct.edge_tbl], ptr @es, i64 0, i64 %indvars.iv120
%e.sroa.0.0.copyload.us.us = load i32, ptr %arrayidx7.us.us, align 4, !tbaa.struct !14
%idxprom8.us.us = sext i32 %e.sroa.0.0.copyload.us.us to i64
%arrayidx9.us.us = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %idxprom8.us.us
%9 = load i32, ptr %arrayidx9.us.us, align 4, !tbaa !5
%cmp10.not.us.us = icmp eq i32 %9, 100000000
br i1 %cmp10.not.us.us, label %for.inc28.us.us, label %land.lhs.true.us.us
land.lhs.true.us.us: ; preds = %for.body5.us.us
%e.sroa.8.0.arrayidx7.sroa_idx.us.us = getelementptr inbounds i8, ptr %arrayidx7.us.us, i64 8
%e.sroa.8.0.copyload.us.us = load i32, ptr %e.sroa.8.0.arrayidx7.sroa_idx.us.us, align 4, !tbaa.struct !15
%e.sroa.6.0.arrayidx7.sroa_idx.us.us = getelementptr inbounds i8, ptr %arrayidx7.us.us, i64 4
%e.sroa.6.0.copyload.us.us = load i32, ptr %e.sroa.6.0.arrayidx7.sroa_idx.us.us, align 4, !tbaa.struct !16
%add.us.us = add nsw i32 %e.sroa.8.0.copyload.us.us, %9
%idxprom14.us.us = sext i32 %e.sroa.6.0.copyload.us.us to i64
%arrayidx15.us.us = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %idxprom14.us.us
%10 = load i32, ptr %arrayidx15.us.us, align 4, !tbaa !5
%cmp16.us.us = icmp slt i32 %add.us.us, %10
br i1 %cmp16.us.us, label %if.then.us, label %for.inc28.us.us
for.inc28.us.us: ; preds = %land.lhs.true.us.us, %for.body5.us.us
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%exitcond124.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count123
br i1 %exitcond124.not, label %for.cond37.preheader, label %for.body5.us.us, !llvm.loop !17
if.then.us: ; preds = %land.lhs.true.us.us
%arrayidx15.us.us.le = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %idxprom14.us.us
store i32 %add.us.us, ptr %arrayidx15.us.us.le, align 4, !tbaa !5
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup52
for.cond37.preheader: ; preds = %for.cond3.for.end30_crit_edge.us, %for.inc28.us.us, %for.end
br i1 %cmp82, label %for.body39, label %cleanup52
for.body39: ; preds = %for.cond37.preheader, %for.inc49
%indvars.iv125 = phi i64 [ %indvars.iv.next126, %for.inc49 ], [ 0, %for.cond37.preheader ]
%arrayidx41 = getelementptr inbounds [1000 x i32], ptr %d, i64 0, i64 %indvars.iv125
%11 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%cmp42 = icmp eq i32 %11, 100000000
br i1 %cmp42, label %if.then43, label %if.else
if.then43: ; preds = %for.body39
%puts73 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %for.inc49
if.else: ; preds = %for.body39
%call47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
br label %for.inc49
for.inc49: ; preds = %if.then43, %if.else
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%12 = load i32, ptr @V, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp38 = icmp slt i64 %indvars.iv.next126, %13
br i1 %cmp38, label %for.body39, label %cleanup52, !llvm.loop !18
cleanup52: ; preds = %for.inc49, %for.cond37.preheader, %if.then.us
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %d) #5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%r = alloca i32, align 4
%s = alloca i32, align 4
%t = alloca i32, align 4
%d = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @V, ptr noundef nonnull @E, ptr noundef nonnull %r)
%0 = load i32, ptr @E, align 4, !tbaa !5
%cmp10 = icmp sgt i32 %0, 0
br i1 %cmp10, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %s, ptr noundef nonnull %t, ptr noundef nonnull %d)
%1 = load i32, ptr %s, align 4, !tbaa !5
%arrayidx = getelementptr inbounds [2000 x %struct.edge_tbl], ptr @es, i64 0, i64 %indvars.iv
store i32 %1, ptr %arrayidx, align 4, !tbaa !19
%2 = load i32, ptr %t, align 4, !tbaa !5
%to = getelementptr inbounds [2000 x %struct.edge_tbl], ptr @es, i64 0, i64 %indvars.iv, i32 1
store i32 %2, ptr %to, align 4, !tbaa !21
%3 = load i32, ptr %d, align 4, !tbaa !5
%cost = getelementptr inbounds [2000 x %struct.edge_tbl], ptr @es, i64 0, i64 %indvars.iv, i32 2
store i32 %3, ptr %cost, align 4, !tbaa !22
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr @E, 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 !23
for.end: ; preds = %for.body, %entry
%6 = load i32, ptr %r, align 4, !tbaa !5
call void @bellman_ford(i32 noundef %6)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %r) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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, !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 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!15 = !{i64 0, i64 4, !5}
!16 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!20, !6, i64 0}
!20 = !{!"edge_tbl", !6, i64 0, !6, i64 4, !6, i64 8}
!21 = !{!20, !6, i64 4}
!22 = !{!20, !6, i64 8}
!23 = distinct !{!23, !10}
|
#include <stdio.h>
#include <string.h>
int N, M, Q, i, D[100], t;
int main(void)
{
for(;scanf("%d%d",&N,&Q),N;)
{
memset(D,0,sizeof(D));
for(i=0;i<N;i++)
for(scanf("%d",&M);M--;)
{
scanf("%d",&t);
D[t]++;
}
for(i=0,t=-1;i<100;i++)
if ((t==-1&&D[i]>=Q)||(t!=-1&&D[i]>D[t]))
t=i;
printf ("%d\n", t == -1 ? 0 : t);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181861/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181861/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@N = dso_local global i32 0, align 4
@Q = dso_local global i32 0, align 4
@D = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@i = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@M = dso_local global i32 0, align 4
@t = dso_local global i32 0, align 4
@.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:
%call35 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @Q)
%0 = load i32, ptr @N, align 4, !tbaa !5
%tobool.not36 = icmp eq i32 %0, 0
br i1 %tobool.not36, label %for.end29, label %for.body
for.body: ; preds = %entry, %for.end26
%1 = phi i32 [ %16, %for.end26 ], [ %0, %entry ]
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) @D, i8 0, i64 400, i1 false)
store i32 0, ptr @i, align 4, !tbaa !5
%cmp33 = icmp sgt i32 %1, 0
br i1 %cmp33, label %for.body2, label %for.end9
for.body2: ; preds = %for.body, %for.inc
%call3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @M)
%2 = load i32, ptr @M, align 4, !tbaa !5
%dec31 = add nsw i32 %2, -1
store i32 %dec31, ptr @M, align 4, !tbaa !5
%tobool5.not32 = icmp eq i32 %2, 0
br i1 %tobool5.not32, label %for.inc, label %for.body6
for.body6: ; preds = %for.body2, %for.body6
%call7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @t)
%3 = load i32, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %3 to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @D, i64 0, i64 %idxprom
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%5 = load i32, ptr @M, align 4, !tbaa !5
%dec = add nsw i32 %5, -1
store i32 %dec, ptr @M, align 4, !tbaa !5
%tobool5.not = icmp eq i32 %5, 0
br i1 %tobool5.not, label %for.inc, label %for.body6, !llvm.loop !9
for.inc: ; preds = %for.body6, %for.body2
%6 = load i32, ptr @i, align 4, !tbaa !5
%inc8 = add nsw i32 %6, 1
store i32 %inc8, ptr @i, align 4, !tbaa !5
%7 = load i32, ptr @N, align 4, !tbaa !5
%cmp = icmp slt i32 %inc8, %7
br i1 %cmp, label %for.body2, label %for.end9, !llvm.loop !11
for.end9: ; preds = %for.inc, %for.body
store i32 -1, ptr @t, align 4, !tbaa !5
%8 = load i32, ptr @Q, align 4
br label %for.body12
for.body12: ; preds = %for.end9, %for.inc24
%9 = phi i32 [ -1, %for.end9 ], [ %14, %for.inc24 ]
%indvars.iv = phi i64 [ 0, %for.end9 ], [ %indvars.iv.next, %for.inc24 ]
%10 = phi i32 [ -1, %for.end9 ], [ %15, %for.inc24 ]
%cmp13 = icmp eq i32 %10, -1
%arrayidx15 = getelementptr inbounds [100 x i32], ptr @D, i64 0, i64 %indvars.iv
%11 = load i32, ptr %arrayidx15, align 4, !tbaa !5
br i1 %cmp13, label %land.lhs.true, label %land.lhs.true18
land.lhs.true: ; preds = %for.body12
%cmp16.not = icmp slt i32 %11, %8
br i1 %cmp16.not, label %for.inc24, label %if.then
land.lhs.true18: ; preds = %for.body12
%idxprom21 = sext i32 %10 to i64
%arrayidx22 = getelementptr inbounds [100 x i32], ptr @D, i64 0, i64 %idxprom21
%12 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %11, %12
br i1 %cmp23, label %if.then, label %for.inc24
if.then: ; preds = %land.lhs.true18, %land.lhs.true
%13 = trunc i64 %indvars.iv to i32
store i32 %13, ptr @t, align 4, !tbaa !5
br label %for.inc24
for.inc24: ; preds = %land.lhs.true, %land.lhs.true18, %if.then
%14 = phi i32 [ %9, %land.lhs.true ], [ %9, %land.lhs.true18 ], [ %13, %if.then ]
%15 = phi i32 [ -1, %land.lhs.true ], [ %10, %land.lhs.true18 ], [ %13, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 100
br i1 %exitcond.not, label %for.end26, label %for.body12, !llvm.loop !12
for.end26: ; preds = %for.inc24
store i32 100, ptr @i, align 4, !tbaa !5
%cmp27 = icmp eq i32 %14, -1
%cond = select i1 %cmp27, i32 0, i32 %14
%call28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cond)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @Q)
%16 = load i32, ptr @N, align 4, !tbaa !5
%tobool.not = icmp eq i32 %16, 0
br i1 %tobool.not, label %for.end29, label %for.body, !llvm.loop !13
for.end29: ; preds = %for.end26, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdbool.h>
#define MAX 1000000
int main(void)
{
int i, j;
bool isPrime[MAX];
isPrime[0] = isPrime[1] = false;
for (i = 2; i < MAX; i++) {
isPrime[i] = true;
}
int n, n_max = 1;
int cnt;
while (scanf("%d", &n) != EOF) {
if (n > n_max) {
for (i = n_max + 1; i <= n; i++) {
if (isPrime[i] == true) {
for (j = i + i; j <= MAX; j += i) {
isPrime[j] = false;
}
}
}
n_max = n;
}
cnt = 0;
for (i = 2; i <= n; i++) {
if (isPrime[i] == true) {
cnt++;
}
}
printf("%d\n", cnt);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181904/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181904/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%isPrime = alloca [1000000 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1000000, ptr nonnull %isPrime) #5
%arrayidx = getelementptr inbounds [1000000 x i8], ptr %isPrime, i64 0, i64 1
store i8 0, ptr %arrayidx, align 1, !tbaa !5
store i8 0, ptr %isPrime, align 16, !tbaa !5
%scevgep = getelementptr inbounds i8, ptr %isPrime, i64 2
call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(999998) %scevgep, i8 1, i64 999998, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp3.not68 = icmp eq i32 %call67, -1
br i1 %cmp3.not68, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end42
%n_max.069 = phi i32 [ %n_max.1, %for.end42 ], [ 1, %entry ]
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp4 = icmp sgt i32 %0, %n_max.069
br i1 %cmp4, label %for.cond5.preheader, label %if.end26
for.cond5.preheader: ; preds = %while.body
%1 = shl i32 %n_max.069, 1
%2 = sext i32 %n_max.069 to i64
%wide.trip.count = sext i32 %0 to i64
br label %for.body7
for.body7: ; preds = %for.cond5.preheader, %for.inc23
%indvars.iv76 = phi i64 [ %2, %for.cond5.preheader ], [ %indvars.iv.next77, %for.inc23 ]
%indvars.iv71.in = phi i64 [ %2, %for.cond5.preheader ], [ %indvars.iv71, %for.inc23 ]
%indvars.iv.in = phi i32 [ %1, %for.cond5.preheader ], [ %indvars.iv, %for.inc23 ]
%indvars.iv = add i32 %indvars.iv.in, 2
%indvars.iv71 = add nsw i64 %indvars.iv71.in, 1
%indvars.iv.next77 = add nsw i64 %indvars.iv76, 1
%arrayidx9 = getelementptr inbounds [1000000 x i8], ptr %isPrime, i64 0, i64 %indvars.iv.next77
%3 = load i8, ptr %arrayidx9, align 1, !tbaa !5, !range !11, !noundef !12
%tobool.not = icmp ne i8 %3, 0
%cmp1560 = icmp slt i64 %indvars.iv76, 500000
%or.cond = and i1 %tobool.not, %cmp1560
br i1 %or.cond, label %for.body17.preheader, label %for.inc23
for.body17.preheader: ; preds = %for.body7
%4 = sext i32 %indvars.iv to i64
br label %for.body17
for.body17: ; preds = %for.body17.preheader, %for.body17
%indvars.iv73 = phi i64 [ %4, %for.body17.preheader ], [ %indvars.iv.next74, %for.body17 ]
%arrayidx19 = getelementptr inbounds [1000000 x i8], ptr %isPrime, i64 0, i64 %indvars.iv73
store i8 0, ptr %arrayidx19, align 1, !tbaa !5
%indvars.iv.next74 = add i64 %indvars.iv73, %indvars.iv71
%cmp15 = icmp slt i64 %indvars.iv.next74, 1000001
br i1 %cmp15, label %for.body17, label %for.inc23, !llvm.loop !13
for.inc23: ; preds = %for.body17, %for.body7
%exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond.not, label %if.end26, label %for.body7, !llvm.loop !15
if.end26: ; preds = %for.inc23, %while.body
%n_max.1 = phi i32 [ %n_max.069, %while.body ], [ %0, %for.inc23 ]
%cmp28.not64 = icmp slt i32 %0, 2
br i1 %cmp28.not64, label %for.end42, label %for.body30.preheader
for.body30.preheader: ; preds = %if.end26
%5 = add nuw i32 %0, 1
%wide.trip.count82 = zext i32 %5 to i64
%6 = add nsw i64 %wide.trip.count82, -2
%min.iters.check = icmp ult i64 %6, 8
br i1 %min.iters.check, label %for.body30.preheader86, label %vector.ph
vector.ph: ; preds = %for.body30.preheader
%n.vec = and i64 %6, -8
%ind.end = or i64 %n.vec, 2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi84 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%offset.idx = or i64 %index, 2
%7 = getelementptr inbounds [1000000 x i8], ptr %isPrime, i64 0, i64 %offset.idx
%wide.load = load <4 x i8>, ptr %7, align 2, !tbaa !5
%8 = getelementptr inbounds i8, ptr %7, i64 4
%wide.load85 = load <4 x i8>, ptr %8, align 2, !tbaa !5
%9 = zext <4 x i8> %wide.load to <4 x i32>
%10 = zext <4 x i8> %wide.load85 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi84, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.end42, label %for.body30.preheader86
for.body30.preheader86: ; preds = %for.body30.preheader, %middle.block
%indvars.iv79.ph = phi i64 [ 2, %for.body30.preheader ], [ %ind.end, %middle.block ]
%cnt.066.ph = phi i32 [ 0, %for.body30.preheader ], [ %14, %middle.block ]
br label %for.body30
for.body30: ; preds = %for.body30.preheader86, %for.body30
%indvars.iv79 = phi i64 [ %indvars.iv.next80, %for.body30 ], [ %indvars.iv79.ph, %for.body30.preheader86 ]
%cnt.066 = phi i32 [ %spec.select, %for.body30 ], [ %cnt.066.ph, %for.body30.preheader86 ]
%arrayidx32 = getelementptr inbounds [1000000 x i8], ptr %isPrime, i64 0, i64 %indvars.iv79
%15 = load i8, ptr %arrayidx32, align 1, !tbaa !5, !range !11, !noundef !12
%inc38 = zext i8 %15 to i32
%spec.select = add nuw nsw i32 %cnt.066, %inc38
%indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
%exitcond83.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count82
br i1 %exitcond83.not, label %for.end42, label %for.body30, !llvm.loop !19
for.end42: ; preds = %for.body30, %middle.block, %if.end26
%cnt.0.lcssa = phi i32 [ 0, %if.end26 ], [ %14, %middle.block ], [ %spec.select, %for.body30 ]
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp3.not = icmp eq i32 %call, -1
br i1 %cmp3.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %for.end42, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.end.p0(i64 1000000, ptr nonnull %isPrime) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { 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 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !14, !18, !17}
!20 = distinct !{!20, !14}
|
#include <stdio.h>
int prime[1000000]={0};
int main(void)
{
int i,j;
prime[0]=prime[1]=1;
for(i=2;i<1000000;i++)
{
if(prime[i]==1) continue;
for(j=2;i*j<1000000;j++)
prime[i*j]=1;
}
int n;
while(scanf("%d",&n)!=EOF)
{
int box=0;
for(i=2;i<=n;i++)
if(prime[i]==0)
box++;
printf("%d\n",box);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181948/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181948/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@prime = dso_local local_unnamed_addr global [1000000 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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
store i32 1, ptr getelementptr inbounds ([1000000 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !5
store i32 1, ptr @prime, align 16, !tbaa !5
br label %for.body
for.body: ; preds = %entry, %for.inc8
%indvars.iv45 = phi i64 [ 2, %entry ], [ %indvars.iv.next46, %for.inc8 ]
%indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next, %for.inc8 ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv45
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp ne i32 %0, 1
%cmp336 = icmp ult i64 %indvars.iv45, 500000
%or.cond = and i1 %cmp1, %cmp336
br i1 %or.cond, label %for.body4, label %for.inc8
for.body4: ; preds = %for.body, %for.body4
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %for.body4 ], [ 2, %for.body ]
%indvars.iv47 = phi i64 [ %indvars.iv.next48, %for.body4 ], [ %indvars.iv, %for.body ]
%arrayidx7 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv47
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%1 = mul nuw nsw i64 %indvars.iv.next50, %indvars.iv45
%indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, %indvars.iv45
%cmp3 = icmp ult i64 %1, 1000000
br i1 %cmp3, label %for.body4, label %for.inc8, !llvm.loop !9
for.inc8: ; preds = %for.body4, %for.body
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%exitcond.not = icmp eq i64 %indvars.iv.next46, 1000000
br i1 %exitcond.not, label %for.end10, label %for.body, !llvm.loop !11
for.end10: ; preds = %for.inc8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp11.not44 = icmp eq i32 %call43, -1
br i1 %cmp11.not44, label %while.end, label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.end10, %for.end23
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp13.not40 = icmp slt i32 %2, 2
br i1 %cmp13.not40, label %for.end23, label %for.body14.preheader
for.body14.preheader: ; preds = %for.cond12.preheader
%3 = add nuw i32 %2, 1
%wide.trip.count = zext i32 %3 to i64
%4 = add nsw i64 %wide.trip.count, -2
%min.iters.check = icmp ult i64 %4, 8
br i1 %min.iters.check, label %for.body14.preheader62, label %vector.ph
vector.ph: ; preds = %for.body14.preheader
%n.vec = and i64 %4, -8
%ind.end = or i64 %n.vec, 2
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%vec.phi60 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%offset.idx = or i64 %index, 2
%5 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %5, align 8, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load61 = load <4 x i32>, ptr %6, align 8, !tbaa !5
%7 = icmp eq <4 x i32> %wide.load, zeroinitializer
%8 = icmp eq <4 x i32> %wide.load61, zeroinitializer
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi60, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %4, %n.vec
br i1 %cmp.n, label %for.end23, label %for.body14.preheader62
for.body14.preheader62: ; preds = %for.body14.preheader, %middle.block
%indvars.iv56.ph = phi i64 [ 2, %for.body14.preheader ], [ %ind.end, %middle.block ]
%box.042.ph = phi i32 [ 0, %for.body14.preheader ], [ %14, %middle.block ]
br label %for.body14
for.body14: ; preds = %for.body14.preheader62, %for.body14
%indvars.iv56 = phi i64 [ %indvars.iv.next57, %for.body14 ], [ %indvars.iv56.ph, %for.body14.preheader62 ]
%box.042 = phi i32 [ %spec.select, %for.body14 ], [ %box.042.ph, %for.body14.preheader62 ]
%arrayidx16 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv56
%15 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%cmp17 = icmp eq i32 %15, 0
%inc19 = zext i1 %cmp17 to i32
%spec.select = add nuw nsw i32 %box.042, %inc19
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%exitcond59.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count
br i1 %exitcond59.not, label %for.end23, label %for.body14, !llvm.loop !15
for.end23: ; preds = %for.body14, %middle.block, %for.cond12.preheader
%box.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ %14, %middle.block ], [ %spec.select, %for.body14 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %box.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp11.not = icmp eq i32 %call, -1
br i1 %cmp11.not, label %while.end, label %for.cond12.preheader, !llvm.loop !16
while.end: ; preds = %for.end23, %for.end10
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !14, !13}
!16 = distinct !{!16, !10}
|
#include<stdio.h>
int main(void){
int i,j,k,n,judge ;
int prime_array[1000000] = {2,3};
while(scanf("%d",&n)==1){
if (n<=1) {
printf("%d\n",0);
} else if (n ==2){
printf("%d\n",1);
} else{
k = 2;
for(j=5;j<=n;j+=2){
judge = 1;
for(i=0;prime_array[i]*prime_array[i]<=j;i++){
if(j%prime_array[i]==0){
judge = 0;
break;
}
}
if(judge){
prime_array[k++] = j;
}
}
printf("%d\n",k);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_181991/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_181991/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%prime_array = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %prime_array) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000000) %prime_array, i8 0, i64 4000000, i1 false)
store i32 2, ptr %prime_array, align 16
%0 = getelementptr inbounds <{ i32, i32, [999998 x i32] }>, ptr %prime_array, i64 0, i32 1
store i32 3, ptr %0, align 4
%call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp42 = icmp eq i32 %call41, 1
br i1 %cmp42, label %while.body, label %while.end
while.body: ; preds = %entry, %if.end26
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %1, 2
br i1 %cmp1, label %if.end26, label %if.else
if.else: ; preds = %while.body
%cmp3 = icmp eq i32 %1, 2
br i1 %cmp3, label %if.end26, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else
%cmp7.not38 = icmp ult i32 %1, 5
br i1 %cmp7.not38, label %if.end26, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.cond.preheader, %for.inc22
%k.040 = phi i32 [ %k.1, %for.inc22 ], [ 2, %for.cond.preheader ]
%j.039 = phi i32 [ %add, %for.inc22 ], [ 5, %for.cond.preheader ]
%2 = load i32, ptr %prime_array, align 16, !tbaa !5
%mul35 = mul nsw i32 %2, %2
%cmp11.not.not36 = icmp ugt i32 %mul35, %j.039
br i1 %cmp11.not.not36, label %if.then17, label %for.body12
for.cond8: ; preds = %for.body12
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1000000 x i32], ptr %prime_array, i64 0, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%mul = mul nsw i32 %3, %3
%cmp11.not.not = icmp ugt i32 %mul, %j.039
br i1 %cmp11.not.not, label %if.then17, label %for.body12, !llvm.loop !9
for.body12: ; preds = %for.cond8.preheader, %for.cond8
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond8 ], [ 0, %for.cond8.preheader ]
%4 = phi i32 [ %3, %for.cond8 ], [ %2, %for.cond8.preheader ]
%rem = srem i32 %j.039, %4
%cmp15 = icmp eq i32 %rem, 0
br i1 %cmp15, label %for.inc22, label %for.cond8
if.then17: ; preds = %for.cond8, %for.cond8.preheader
%inc18 = add nsw i32 %k.040, 1
%idxprom19 = sext i32 %k.040 to i64
%arrayidx20 = getelementptr inbounds [1000000 x i32], ptr %prime_array, i64 0, i64 %idxprom19
store i32 %j.039, ptr %arrayidx20, align 4, !tbaa !5
br label %for.inc22
for.inc22: ; preds = %for.body12, %if.then17
%k.1 = phi i32 [ %inc18, %if.then17 ], [ %k.040, %for.body12 ]
%add = add nuw nsw i32 %j.039, 2
%cmp7.not = icmp sgt i32 %add, %1
br i1 %cmp7.not, label %if.end26, label %for.cond8.preheader, !llvm.loop !11
if.end26: ; preds = %for.inc22, %for.cond.preheader, %if.else, %while.body
%.sink = phi i32 [ 0, %while.body ], [ 1, %if.else ], [ 2, %for.cond.preheader ], [ %k.1, %for.inc22 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp = icmp eq i32 %call, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %if.end26, %entry
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %prime_array) #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}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int n, i, j, k;
int p[1000000];
while(scanf("%d", &n) != EOF){
for(i = 0; i<n; i++) p[i] = 0;
p[0] = 1;
for(i=2 ; i<=n/2; i++){
for(j=2; i*j<=n; j++){
if(p[i*j -1] ==0) p[i*j-1] =1;
}
}
for(i =0; i<n; i++){
if(p[i] == 0) k++;
}
printf("%d\n",k );
k = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182040/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182040/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %p) #5
%call62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not63 = icmp eq i32 %call62, -1
br i1 %cmp.not63, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end34
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp150 = icmp sgt i32 %0, 0
br i1 %cmp150, label %for.end, label %for.end34
for.end: ; preds = %for.cond.preheader
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %p, i8 0, i64 %2, i1 false), !tbaa !5
store i32 1, ptr %p, align 16, !tbaa !5
%cmp4.not56 = icmp ult i32 %0, 4
br i1 %cmp4.not56, label %for.body25.preheader, label %for.cond6.preheader.preheader
for.cond6.preheader.preheader: ; preds = %for.end
%div7879 = lshr i32 %0, 1
%3 = zext i32 %0 to i64
%4 = add nuw nsw i32 %div7879, 1
%wide.trip.count = zext i32 %4 to i64
br label %for.cond6.preheader
for.cond23.preheader: ; preds = %for.inc20
br i1 %cmp150, label %for.body25.preheader, label %for.end34
for.body25.preheader: ; preds = %for.end, %for.cond23.preheader
%wide.trip.count74 = zext i32 %0 to i64
%min.iters.check = icmp ult i32 %0, 8
br i1 %min.iters.check, label %for.body25.preheader82, label %vector.ph
vector.ph: ; preds = %for.body25.preheader
%n.vec = and i64 %wide.trip.count74, 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 ], [ %11, %vector.body ]
%vec.phi80 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %12, %vector.body ]
%5 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %index
%wide.load = load <4 x i32>, ptr %5, align 16, !tbaa !5
%6 = getelementptr inbounds i32, ptr %5, i64 4
%wide.load81 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = icmp eq <4 x i32> %wide.load, zeroinitializer
%8 = icmp eq <4 x i32> %wide.load81, zeroinitializer
%9 = zext <4 x i1> %7 to <4 x i32>
%10 = zext <4 x i1> %8 to <4 x i32>
%11 = add <4 x i32> %vec.phi, %9
%12 = add <4 x i32> %vec.phi80, %10
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count74
br i1 %cmp.n, label %for.end34, label %for.body25.preheader82
for.body25.preheader82: ; preds = %for.body25.preheader, %middle.block
%indvars.iv71.ph = phi i64 [ 0, %for.body25.preheader ], [ %n.vec, %middle.block ]
%k.160.ph = phi i32 [ 0, %for.body25.preheader ], [ %14, %middle.block ]
br label %for.body25
for.cond6.preheader: ; preds = %for.cond6.preheader.preheader, %for.inc20
%indvars.iv67 = phi i64 [ 2, %for.cond6.preheader.preheader ], [ %indvars.iv.next68, %for.inc20 ]
%15 = shl nuw nsw i64 %indvars.iv67, 1
%cmp7.not53 = icmp ugt i64 %15, %3
br i1 %cmp7.not53, label %for.inc20, label %for.body8
for.body8: ; preds = %for.cond6.preheader, %for.body8
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body8 ], [ 2, %for.cond6.preheader ]
%mul55.in = phi i64 [ %17, %for.body8 ], [ %15, %for.cond6.preheader ]
%sub = shl i64 %mul55.in, 32
%sext = add i64 %sub, -4294967296
%idxprom10 = ashr exact i64 %sext, 32
%arrayidx11 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %idxprom10
%16 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%spec.store.select = call i32 @llvm.umax.i32(i32 %16, i32 1)
store i32 %spec.store.select, ptr %arrayidx11, align 4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%17 = mul nuw nsw i64 %indvars.iv.next, %indvars.iv67
%cmp7.not = icmp ugt i64 %17, %3
br i1 %cmp7.not, label %for.inc20, label %for.body8, !llvm.loop !13
for.inc20: ; preds = %for.body8, %for.cond6.preheader
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
br i1 %exitcond.not, label %for.cond23.preheader, label %for.cond6.preheader, !llvm.loop !14
for.body25: ; preds = %for.body25.preheader82, %for.body25
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body25 ], [ %indvars.iv71.ph, %for.body25.preheader82 ]
%k.160 = phi i32 [ %spec.select, %for.body25 ], [ %k.160.ph, %for.body25.preheader82 ]
%arrayidx27 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %indvars.iv71
%18 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp28 = icmp eq i32 %18, 0
%inc30 = zext i1 %cmp28 to i32
%spec.select = add nuw nsw i32 %k.160, %inc30
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
br i1 %exitcond75.not, label %for.end34, label %for.body25, !llvm.loop !15
for.end34: ; preds = %for.body25, %middle.block, %for.cond.preheader, %for.cond23.preheader
%k.1.lcssa = phi i32 [ 0, %for.cond23.preheader ], [ 0, %for.cond.preheader ], [ %14, %middle.block ], [ %spec.select, %for.body25 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.1.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !16
while.end: ; preds = %for.end34, %entry
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %p) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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.umax.i32(i32, i32) #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#include <math.h>
int is_prime1(int);
int is_prime2(int);
int prime[168];
int main()
{
int input, input_cnt, prime_cnt, cnt;
int output[30];
/*Make prime table*/
prime[0] = 2;
prime_cnt = 1;
for(cnt = 3; cnt < 1000; cnt += 2)
if(is_prime1(cnt)){
prime[prime_cnt++] = cnt;
}
/*Get, calculate input then save in output[]*/
input_cnt = 0;
while(scanf("%d", &input) != EOF){
prime_cnt = 0;
if(input >= 2)
prime_cnt++;
for(cnt = 3; cnt <= input; cnt += 2)
if(is_prime2(cnt))
prime_cnt++;
output[input_cnt] = prime_cnt;
input_cnt++;
}
/*print output[]*/
for(cnt = 0; cnt < input_cnt; cnt++)
printf("%d\n", output[cnt]);
return 0;
}
/*Test prime directly*/
int is_prime1(int prime1_input)
{
int prime1_cnt;
if(prime1_input == 1){
return 0;
}
else if(prime1_input == 2 || prime1_input == 3 || prime1_input == 5 || prime1_input == 7){
return 1;
}
else if((prime1_input % 2) == 0){
return 0;
}
for(prime1_cnt = 3 ; prime1_cnt <= (sqrt(prime1_input)); prime1_cnt += 2)
if(prime1_input % prime1_cnt == 0)
return 0;
return 1;
}
/*Test prime with prime table*/
int is_prime2(int prime2_input)
{
int prime2_cnt = 0;
for( ;prime2_cnt <168; prime2_cnt++){
if(prime[prime2_cnt] > sqrt(prime2_input))
break;
if(prime2_input % prime[prime2_cnt] == 0)
return 0;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182084/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182084/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@prime = dso_local local_unnamed_addr global [168 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
@switch.table.is_prime1 = private unnamed_addr constant [7 x i32] [i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca i32, align 4
%output = alloca [30 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #6
call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %output) #6
store i32 2, ptr @prime, align 16, !tbaa !5
br label %for.body
while.cond.preheader: ; preds = %for.inc
%call161 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp2.not62 = icmp eq i32 %call161, -1
br i1 %cmp2.not62, label %for.end29, label %while.body
for.body: ; preds = %entry, %for.inc
%cnt.056 = phi i32 [ 3, %entry ], [ %add, %for.inc ]
%prime_cnt.055 = phi i32 [ 1, %entry ], [ %prime_cnt.1, %for.inc ]
switch i32 %cnt.056, label %for.cond.preheader.i [
i32 2, label %if.then
i32 7, label %if.then
i32 5, label %if.then
i32 3, label %if.then
]
for.cond.preheader.i: ; preds = %for.body
%conv13.i = sitofp i32 %cnt.056 to double
%call32.i = tail call double @sqrt(double noundef %conv13.i) #6
%cmp1433.i = fcmp ult double %call32.i, 3.000000e+00
br i1 %cmp1433.i, label %if.then, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %prime1_cnt.034.i, 2
%conv.i = sitofp i32 %add.i to double
%call.i = tail call double @sqrt(double noundef %conv13.i) #6
%cmp14.i = fcmp ult double %call.i, %conv.i
br i1 %cmp14.i, label %if.then, label %for.body.i, !llvm.loop !9
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%prime1_cnt.034.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem16.i = urem i32 %cnt.056, %prime1_cnt.034.i
%cmp17.i = icmp eq i32 %rem16.i, 0
br i1 %cmp17.i, label %for.inc, label %for.cond.i
if.then: ; preds = %for.cond.i, %for.body, %for.body, %for.body, %for.body, %for.cond.preheader.i
%inc = add nsw i32 %prime_cnt.055, 1
%idxprom = sext i32 %prime_cnt.055 to i64
%arrayidx = getelementptr inbounds [168 x i32], ptr @prime, i64 0, i64 %idxprom
store i32 %cnt.056, ptr %arrayidx, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body.i, %if.then
%prime_cnt.1 = phi i32 [ %inc, %if.then ], [ %prime_cnt.055, %for.body.i ]
%add = add nuw nsw i32 %cnt.056, 2
%cmp = icmp ult i32 %cnt.056, 998
br i1 %cmp, label %for.body, label %while.cond.preheader, !llvm.loop !11
for.cond21.preheader: ; preds = %for.end17
%0 = and i64 %indvars.iv.next, 4294967295
%cmp2265.not = icmp eq i64 %0, 0
br i1 %cmp2265.not, label %for.end29, label %for.body23.preheader
for.body23.preheader: ; preds = %for.cond21.preheader
%wide.trip.count = and i64 %indvars.iv.next, 4294967295
br label %for.body23
while.body: ; preds = %while.cond.preheader, %for.end17
%indvars.iv = phi i64 [ %indvars.iv.next, %for.end17 ], [ 0, %while.cond.preheader ]
%1 = load i32, ptr %input, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %1, 1
%spec.select = zext i1 %cmp3 to i32
%cmp8.not57 = icmp slt i32 %1, 3
br i1 %cmp8.not57, label %for.end17, label %for.body9
for.body9: ; preds = %while.body, %for.cond7
%cnt.159 = phi i32 [ %add16, %for.cond7 ], [ 3, %while.body ]
%prime_cnt.358 = phi i32 [ %4, %for.cond7 ], [ %spec.select, %while.body ]
%conv1.i = sitofp i32 %cnt.159 to double
br label %for.body.i45
for.cond.i48: ; preds = %if.end.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, 168
br i1 %exitcond.not.i, label %is_prime2.exit.thread, label %for.body.i45, !llvm.loop !12
for.body.i45: ; preds = %for.cond.i48, %for.body9
%indvars.iv.i = phi i64 [ 0, %for.body9 ], [ %indvars.iv.next.i, %for.cond.i48 ]
%arrayidx.i = getelementptr inbounds [168 x i32], ptr @prime, i64 0, i64 %indvars.iv.i
%2 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%conv.i46 = sitofp i32 %2 to double
%call.i47 = call double @sqrt(double noundef %conv1.i) #6
%cmp2.i = fcmp olt double %call.i47, %conv.i46
br i1 %cmp2.i, label %is_prime2.exit.thread, label %if.end.i
if.end.i: ; preds = %for.body.i45
%3 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%rem.i = srem i32 %cnt.159, %3
%cmp6.i = icmp eq i32 %rem.i, 0
br i1 %cmp6.i, label %for.cond7, label %for.cond.i48
is_prime2.exit.thread: ; preds = %for.body.i45, %for.cond.i48
%inc1354 = add nsw i32 %prime_cnt.358, 1
br label %for.cond7
for.cond7: ; preds = %if.end.i, %is_prime2.exit.thread
%4 = phi i32 [ %inc1354, %is_prime2.exit.thread ], [ %prime_cnt.358, %if.end.i ]
%add16 = add nuw nsw i32 %cnt.159, 2
%5 = load i32, ptr %input, align 4, !tbaa !5
%cmp8.not = icmp sgt i32 %add16, %5
br i1 %cmp8.not, label %for.end17, label %for.body9, !llvm.loop !13
for.end17: ; preds = %for.cond7, %while.body
%prime_cnt.3.lcssa = phi i32 [ %spec.select, %while.body ], [ %4, %for.cond7 ]
%arrayidx19 = getelementptr inbounds [30 x i32], ptr %output, i64 0, i64 %indvars.iv
store i32 %prime_cnt.3.lcssa, ptr %arrayidx19, align 4, !tbaa !5
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%cmp2.not = icmp eq i32 %call1, -1
br i1 %cmp2.not, label %for.cond21.preheader, label %while.body, !llvm.loop !14
for.body23: ; preds = %for.body23.preheader, %for.body23
%indvars.iv68 = phi i64 [ 0, %for.body23.preheader ], [ %indvars.iv.next69, %for.body23 ]
%arrayidx25 = getelementptr inbounds [30 x i32], ptr %output, i64 0, i64 %indvars.iv68
%6 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%exitcond.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count
br i1 %exitcond.not, label %for.end29, label %for.body23, !llvm.loop !15
for.end29: ; preds = %for.body23, %while.cond.preheader, %for.cond21.preheader
call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %output) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input) #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 memory(write) uwtable
define dso_local i32 @is_prime1(i32 noundef %prime1_input) local_unnamed_addr #2 {
entry:
%switch.tableidx = add i32 %prime1_input, -1
%0 = icmp ult i32 %switch.tableidx, 7
br i1 %0, label %switch.hole_check, label %if.else8
if.else8: ; preds = %switch.hole_check, %entry
%1 = and i32 %prime1_input, 1
%cmp9 = icmp eq i32 %1, 0
br i1 %cmp9, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.else8
%conv13 = sitofp i32 %prime1_input to double
%call32 = tail call double @sqrt(double noundef %conv13) #6
%cmp1433 = fcmp ult double %call32, 3.000000e+00
br i1 %cmp1433, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %prime1_cnt.034, 2
%conv = sitofp i32 %add to double
%call = tail call double @sqrt(double noundef %conv13) #6
%cmp14 = fcmp ult double %call, %conv
br i1 %cmp14, label %cleanup, label %for.body, !llvm.loop !9
for.body: ; preds = %for.cond.preheader, %for.cond
%prime1_cnt.034 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem16 = srem i32 %prime1_input, %prime1_cnt.034
%cmp17 = icmp eq i32 %rem16, 0
br i1 %cmp17, label %cleanup, label %for.cond
switch.hole_check: ; preds = %entry
%switch.maskindex = trunc i32 %switch.tableidx to i8
%switch.shifted = lshr i8 87, %switch.maskindex
%2 = and i8 %switch.shifted, 1
%switch.lobit.not = icmp eq i8 %2, 0
br i1 %switch.lobit.not, label %if.else8, label %switch.lookup
switch.lookup: ; preds = %switch.hole_check
%3 = sext i32 %switch.tableidx to i64
%switch.gep = getelementptr inbounds [7 x i32], ptr @switch.table.is_prime1, i64 0, i64 %3
%switch.load = load i32, ptr %switch.gep, align 4
br label %cleanup
cleanup: ; preds = %for.body, %for.cond, %switch.lookup, %for.cond.preheader, %if.else8
%retval.0 = phi i32 [ 0, %if.else8 ], [ 1, %for.cond.preheader ], [ %switch.load, %switch.lookup ], [ 0, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable
define dso_local i32 @is_prime2(i32 noundef %prime2_input) local_unnamed_addr #4 {
entry:
%conv1 = sitofp i32 %prime2_input to double
br label %for.body
for.cond: ; preds = %if.end
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 168
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !12
for.body: ; preds = %entry, %for.cond
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.cond ]
%arrayidx = getelementptr inbounds [168 x i32], ptr @prime, i64 0, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%call = tail call double @sqrt(double noundef %conv1) #6
%cmp2 = fcmp olt double %call, %conv
br i1 %cmp2, label %cleanup, label %if.end
if.end: ; preds = %for.body
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%rem = srem i32 %prime2_input, %1
%cmp6 = icmp eq i32 %rem, 0
br i1 %cmp6, label %cleanup, label %for.cond
cleanup: ; preds = %for.cond, %for.body, %if.end
%retval.0 = phi i32 [ 0, %if.end ], [ 1, %for.body ], [ 1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind memory(readwrite, argmem: write, inaccessiblemem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#define MAX 1000010
int isPrime(int n){
int i;
if(n<2)return 0;
if(n==2)return 1;
if(n%2==0)return 0;
for(i=3;i<=n/i;i+=2)
if(n%i==0)
return 0;
return 1;
}
int main(){
int a,i;
int prime[MAX];
for(i=0;i<=MAX;i++)
prime[i]=isPrime(i);
for(i=1;i<MAX;i++)
prime[i]+=prime[i-1];
while(scanf("%d",&a)!=EOF){
printf("%d\n",prime[a]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182127/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182127/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @isPrime(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i32 %n, 2
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp1 = icmp eq i32 %n, 2
br i1 %cmp1, label %cleanup, label %if.end3
if.end3: ; preds = %if.end
%rem = and i32 %n, 1
%cmp4 = icmp eq i32 %rem, 0
br i1 %cmp4, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %if.end3
%cmp7.not20 = icmp ult i32 %n, 9
br i1 %cmp7.not20, label %cleanup, label %for.body
for.cond: ; preds = %for.body
%add = add nuw nsw i32 %i.021, 2
%div = sdiv i32 %n, %add
%cmp7.not = icmp sgt i32 %add, %div
br i1 %cmp7.not, label %cleanup, label %for.body, !llvm.loop !5
for.body: ; preds = %for.cond.preheader, %for.cond
%i.021 = phi i32 [ %add, %for.cond ], [ 3, %for.cond.preheader ]
%rem8 = srem i32 %n, %i.021
%cmp9 = icmp eq i32 %rem8, 0
br i1 %cmp9, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %for.cond.preheader, %if.end3, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 1, %if.end ], [ 0, %if.end3 ], [ 1, %for.cond.preheader ], [ 0, %for.body ], [ 1, %for.cond ]
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
%prime = alloca [1000010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4000040, ptr nonnull %prime) #4
br label %for.body
for.body: ; preds = %entry, %isPrime.exit
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %isPrime.exit ]
%cmp.i = icmp ult i64 %indvars.iv, 2
br i1 %cmp.i, label %isPrime.exit, label %if.end.i
if.end.i: ; preds = %for.body
%cmp1.i = icmp eq i64 %indvars.iv, 2
br i1 %cmp1.i, label %isPrime.exit, label %if.end3.i
if.end3.i: ; preds = %if.end.i
%0 = trunc i64 %indvars.iv to i32
%rem.i = and i32 %0, 1
%cmp4.i = icmp eq i32 %rem.i, 0
br i1 %cmp4.i, label %isPrime.exit, label %for.cond.preheader.i
for.cond.preheader.i: ; preds = %if.end3.i
%cmp7.not20.i = icmp ult i64 %indvars.iv, 9
br i1 %cmp7.not20.i, label %isPrime.exit, label %for.body.i
for.cond.i: ; preds = %for.body.i
%add.i = add nuw nsw i32 %i.021.i, 2
%div.i = udiv i32 %0, %add.i
%cmp7.not.i = icmp ugt i32 %add.i, %div.i
br i1 %cmp7.not.i, label %isPrime.exit, label %for.body.i, !llvm.loop !5
for.body.i: ; preds = %for.cond.preheader.i, %for.cond.i
%i.021.i = phi i32 [ %add.i, %for.cond.i ], [ 3, %for.cond.preheader.i ]
%rem8.i = urem i32 %0, %i.021.i
%cmp9.i = icmp eq i32 %rem8.i, 0
br i1 %cmp9.i, label %isPrime.exit, label %for.cond.i
isPrime.exit: ; preds = %for.cond.i, %for.body.i, %for.body, %if.end.i, %if.end3.i, %for.cond.preheader.i
%retval.0.i = phi i32 [ 0, %for.body ], [ 1, %if.end.i ], [ 0, %if.end3.i ], [ 1, %for.cond.preheader.i ], [ 1, %for.cond.i ], [ 0, %for.body.i ]
%arrayidx = getelementptr inbounds [1000010 x i32], ptr %prime, i64 0, i64 %indvars.iv
store i32 %retval.0.i, ptr %arrayidx, align 4, !tbaa !7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000011
br i1 %exitcond.not, label %for.body3.preheader, label %for.body, !llvm.loop !11
for.body3.preheader: ; preds = %isPrime.exit
%.pre = load i32, ptr %prime, align 16, !tbaa !7
br label %for.body3
while.cond.preheader: ; preds = %for.body3
%call1126 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp12.not27 = icmp eq i32 %call1126, -1
br i1 %cmp12.not27, label %while.end, label %while.body
for.body3: ; preds = %for.body3.1, %for.body3.preheader
%1 = phi i32 [ %.pre, %for.body3.preheader ], [ %add.3, %for.body3.1 ]
%indvars.iv29 = phi i64 [ 1, %for.body3.preheader ], [ %indvars.iv.next30.3, %for.body3.1 ]
%arrayidx7 = getelementptr inbounds [1000010 x i32], ptr %prime, i64 0, i64 %indvars.iv29
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !7
%add = add nsw i32 %2, %1
store i32 %add, ptr %arrayidx7, align 4, !tbaa !7
%indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
%exitcond33.not = icmp eq i64 %indvars.iv.next30, 1000010
br i1 %exitcond33.not, label %while.cond.preheader, label %for.body3.1, !llvm.loop !12
for.body3.1: ; preds = %for.body3
%arrayidx7.1 = getelementptr inbounds [1000010 x i32], ptr %prime, i64 0, i64 %indvars.iv.next30
%3 = load i32, ptr %arrayidx7.1, align 4, !tbaa !7
%add.1 = add nsw i32 %3, %add
store i32 %add.1, ptr %arrayidx7.1, align 4, !tbaa !7
%indvars.iv.next30.1 = add nuw nsw i64 %indvars.iv29, 2
%arrayidx7.2 = getelementptr inbounds [1000010 x i32], ptr %prime, i64 0, i64 %indvars.iv.next30.1
%4 = load i32, ptr %arrayidx7.2, align 4, !tbaa !7
%add.2 = add nsw i32 %4, %add.1
store i32 %add.2, ptr %arrayidx7.2, align 4, !tbaa !7
%indvars.iv.next30.2 = add nuw nsw i64 %indvars.iv29, 3
%arrayidx7.3 = getelementptr inbounds [1000010 x i32], ptr %prime, i64 0, i64 %indvars.iv.next30.2
%5 = load i32, ptr %arrayidx7.3, align 4, !tbaa !7
%add.3 = add nsw i32 %5, %add.2
store i32 %add.3, ptr %arrayidx7.3, align 4, !tbaa !7
%indvars.iv.next30.3 = add nuw nsw i64 %indvars.iv29, 4
br label %for.body3
while.body: ; preds = %while.cond.preheader, %while.body
%6 = load i32, ptr %a, align 4, !tbaa !7
%idxprom13 = sext i32 %6 to i64
%arrayidx14 = getelementptr inbounds [1000010 x i32], ptr %prime, i64 0, i64 %idxprom13
%7 = load i32, ptr %arrayidx14, align 4, !tbaa !7
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp12.not = icmp eq i32 %call11, -1
br i1 %cmp12.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4000040, ptr nonnull %prime) #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 = { 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
|
#include <stdio.h>
#define MAX_SIZE (1000001)
int prime[MAX_SIZE];
int main(void)
{
int n, i, j;
for (i = 0; i < MAX_SIZE; i++){
prime[i] = 1;
}
prime[0] = prime[1] = 0;
for (i = 2; i * i < MAX_SIZE; i++){
if (prime[i] == 1){
for (j = i * i; j < MAX_SIZE; j += i){
prime[j] = 0;
}
}
}
for (i = 1; i < MAX_SIZE - 1; i++){
prime[i + 1] += prime[i];
}
while (scanf("%d", &n) != EOF){
printf("%d\n", prime[n]);
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182170/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182170/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@prime = dso_local local_unnamed_addr global [1000001 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: 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
br label %vector.body
vector.body: ; preds = %vector.body, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.4, %vector.body ]
%0 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %1, align 16, !tbaa !5
%index.next = add nuw nsw i64 %index, 8
%2 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %index.next
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 16
%4 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %index.next.1
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i32, ptr %4, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %5, align 16, !tbaa !5
%index.next.2 = add nuw nsw i64 %index, 24
%6 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %index.next.2
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %7, align 16, !tbaa !5
%index.next.3 = add nuw nsw i64 %index, 32
%8 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %index.next.3
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %8, align 16, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 16, !tbaa !5
%index.next.4 = add nuw nsw i64 %index, 40
%10 = icmp eq i64 %index.next.4, 1000000
br i1 %10, label %for.body, label %vector.body, !llvm.loop !9
for.body: ; preds = %vector.body
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 1000000), align 16, !tbaa !5
store i32 0, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !5
store i32 0, ptr @prime, align 16, !tbaa !5
br label %for.body3
for.body3: ; preds = %for.body, %for.inc15
%indvars.iv58 = phi i64 [ 2, %for.body ], [ %indvars.iv.next59, %for.inc15 ]
%mul53 = phi i32 [ 4, %for.body ], [ %mul, %for.inc15 ]
%arrayidx5 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv58
%11 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %11, 1
%cmp950 = icmp ult i32 %mul53, 1000001
%or.cond = and i1 %cmp6, %cmp950
br i1 %or.cond, label %for.body10.preheader, label %for.inc15
for.body10.preheader: ; preds = %for.body3
%12 = zext i32 %mul53 to i64
br label %for.body10
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv60 = phi i64 [ %12, %for.body10.preheader ], [ %indvars.iv.next61, %for.body10 ]
%arrayidx12 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv60
store i32 0, ptr %arrayidx12, align 4, !tbaa !5
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, %indvars.iv58
%cmp9 = icmp ult i64 %indvars.iv.next61, 1000001
br i1 %cmp9, label %for.body10, label %for.inc15, !llvm.loop !13
for.inc15: ; preds = %for.body10, %for.body3
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%13 = trunc i64 %indvars.iv.next59 to i32
%mul = mul nsw i32 %13, %13
%exitcond64.not = icmp eq i64 %indvars.iv.next59, 1001
br i1 %exitcond64.not, label %for.body20.preheader, label %for.body3, !llvm.loop !14
for.body20.preheader: ; preds = %for.inc15
%.pre = load i32, ptr getelementptr inbounds ([1000001 x i32], ptr @prime, i64 0, i64 1), align 4, !tbaa !5
br label %for.body20
while.cond.preheader: ; preds = %for.body20
%call55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp30.not56 = icmp eq i32 %call55, -1
br i1 %cmp30.not56, label %while.end, label %while.body
for.body20: ; preds = %for.body20, %for.body20.preheader
%14 = phi i32 [ %.pre, %for.body20.preheader ], [ %add26.2, %for.body20 ]
%indvars.iv65 = phi i64 [ 1, %for.body20.preheader ], [ %indvars.iv.next66.2, %for.body20 ]
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%arrayidx25 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv.next66
%15 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%add26 = add nsw i32 %15, %14
store i32 %add26, ptr %arrayidx25, align 4, !tbaa !5
%indvars.iv.next66.1 = add nuw nsw i64 %indvars.iv65, 2
%arrayidx25.1 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv.next66.1
%16 = load i32, ptr %arrayidx25.1, align 4, !tbaa !5
%add26.1 = add nsw i32 %16, %add26
store i32 %add26.1, ptr %arrayidx25.1, align 4, !tbaa !5
%indvars.iv.next66.2 = add nuw nsw i64 %indvars.iv65, 3
%arrayidx25.2 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %indvars.iv.next66.2
%17 = load i32, ptr %arrayidx25.2, align 4, !tbaa !5
%add26.2 = add nsw i32 %17, %add26.1
store i32 %add26.2, ptr %arrayidx25.2, align 4, !tbaa !5
%exitcond68.not.2 = icmp eq i64 %indvars.iv.next66.2, 1000000
br i1 %exitcond68.not.2, label %while.cond.preheader, label %for.body20, !llvm.loop !15
while.body: ; preds = %while.cond.preheader, %while.body
%18 = load i32, ptr %n, align 4, !tbaa !5
%idxprom31 = sext i32 %18 to i64
%arrayidx32 = getelementptr inbounds [1000001 x i32], ptr @prime, i64 0, i64 %idxprom31
%19 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp30.not = icmp eq i32 %call, -1
br i1 %cmp30.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %while.cond.preheader
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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
#define N 1000000
int main(void){
int p[N];
int i,j,n;
p[0]=0; p[1]=0; p[2]=1;
for( i=3;i<N;i++ ){
p[i] = i%2;
}
for( i=2;i<N;i++ ){
if( p[i]==1 ){
for( j=i*2;j<N;j+=i )
p[j]=0;
}
}
for( i=1;i<N;i++ )
p[i] += p[i-1];
// p[i] : number of primes that is smaller than i
while( 1 ){
if( scanf("%d ",&n)!=1 )
break;
printf("%d\n",p[n] );
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182242/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182242/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%p = alloca [1000000 x i32], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %p) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
store i32 0, ptr %p, align 16, !tbaa !5
%arrayidx1 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 1
store i32 0, ptr %arrayidx1, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 2
store i32 1, ptr %arrayidx2, align 8, !tbaa !5
br label %vector.body
vector.body: ; preds = %vector.body.1, %entry
%index = phi i64 [ 0, %entry ], [ %index.next.1, %vector.body.1 ]
%vec.ind = phi <4 x i32> [ <i32 3, i32 4, i32 5, i32 6>, %entry ], [ %vec.ind.next.1, %vector.body.1 ]
%offset.idx = or i64 %index, 3
%0 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%1 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%2 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %offset.idx
store <4 x i32> %0, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> %1, ptr %3, align 4, !tbaa !5
%4 = icmp eq i64 %index, 999984
br i1 %4, label %for.body, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%offset.idx.1 = or i64 %index, 11
%5 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%6 = and <4 x i32> %vec.ind, <i32 1, i32 1, i32 1, i32 1>
%7 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %offset.idx.1
store <4 x i32> %5, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
store <4 x i32> %6, ptr %8, align 4, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 16
%vec.ind.next.1 = add <4 x i32> %vec.ind, <i32 16, i32 16, i32 16, i32 16>
br label %vector.body
for.body: ; preds = %vector.body
%arrayidx3 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 999995
store i32 1, ptr %arrayidx3, align 4, !tbaa !5
%arrayidx3.1 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 999996
store i32 0, ptr %arrayidx3.1, align 16, !tbaa !5
%arrayidx3.2 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 999997
store i32 1, ptr %arrayidx3.2, align 4, !tbaa !5
%arrayidx3.3 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 999998
store i32 0, ptr %arrayidx3.3, align 8, !tbaa !5
%arrayidx3.4 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 999999
store i32 1, ptr %arrayidx3.4, align 4, !tbaa !5
br label %for.body6
for.body6: ; preds = %for.body, %for.inc17
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.inc17 ], [ 2, %for.body ]
%indvars.iv60 = phi i64 [ %indvars.iv.next61, %for.inc17 ], [ 4, %for.body ]
%arrayidx8 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %indvars.iv62
%9 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%cmp9 = icmp eq i32 %9, 1
%cmp1152 = icmp ult i64 %indvars.iv62, 500000
%or.cond = and i1 %cmp9, %cmp1152
br i1 %or.cond, label %for.body12, label %for.inc17
for.body12: ; preds = %for.body6, %for.body12
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.body12 ], [ %indvars.iv60, %for.body6 ]
%arrayidx14 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %indvars.iv64
store i32 0, ptr %arrayidx14, align 4, !tbaa !5
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, %indvars.iv62
%cmp11 = icmp ult i64 %indvars.iv.next65, 1000000
br i1 %cmp11, label %for.body12, label %for.inc17, !llvm.loop !13
for.inc17: ; preds = %for.body12, %for.body6
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 2
%exitcond68.not = icmp eq i64 %indvars.iv.next63, 1000000
br i1 %exitcond68.not, label %for.body22.preheader, label %for.body6, !llvm.loop !14
for.body22.preheader: ; preds = %for.inc17
%.pre = load i32, ptr %p, align 16, !tbaa !5
br label %for.body22
while.cond.preheader: ; preds = %for.body22
%call57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp31.not58 = icmp eq i32 %call57, 1
br i1 %cmp31.not58, label %if.end33, label %while.end
for.body22: ; preds = %for.body22, %for.body22.preheader
%10 = phi i32 [ %.pre, %for.body22.preheader ], [ %add27.2, %for.body22 ]
%indvars.iv69 = phi i64 [ 1, %for.body22.preheader ], [ %indvars.iv.next70.2, %for.body22 ]
%arrayidx26 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %indvars.iv69
%11 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%add27 = add nsw i32 %11, %10
store i32 %add27, ptr %arrayidx26, align 4, !tbaa !5
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%arrayidx26.1 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %indvars.iv.next70
%12 = load i32, ptr %arrayidx26.1, align 4, !tbaa !5
%add27.1 = add nsw i32 %12, %add27
store i32 %add27.1, ptr %arrayidx26.1, align 4, !tbaa !5
%indvars.iv.next70.1 = add nuw nsw i64 %indvars.iv69, 2
%arrayidx26.2 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %indvars.iv.next70.1
%13 = load i32, ptr %arrayidx26.2, align 4, !tbaa !5
%add27.2 = add nsw i32 %13, %add27.1
store i32 %add27.2, ptr %arrayidx26.2, align 4, !tbaa !5
%indvars.iv.next70.2 = add nuw nsw i64 %indvars.iv69, 3
%exitcond73.not.2 = icmp eq i64 %indvars.iv.next70.2, 1000000
br i1 %exitcond73.not.2, label %while.cond.preheader, label %for.body22, !llvm.loop !15
if.end33: ; preds = %while.cond.preheader, %if.end33
%14 = load i32, ptr %n, align 4, !tbaa !5
%idxprom34 = sext i32 %14 to i64
%arrayidx35 = getelementptr inbounds [1000000 x i32], ptr %p, i64 0, i64 %idxprom34
%15 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp31.not = icmp eq i32 %call, 1
br i1 %cmp31.not, label %if.end33, label %while.end
while.end: ; preds = %if.end33, %while.cond.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %p) #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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main(){
int i,j,n,count=2,a[1000000];
while(scanf("%d",&n)!=EOF){
if (n<=1) {
count=0;
}else if (n==2) {
count=1;
}else{
a[0]=2;
a[1]=3;
for(i=5;i<=n;i+=2) {
j=0;
while(a[j]*a[j]<=i){
if(i%a[j]==0){
break;
}
j++;
}
if (a[j]*a[j]>i) {
a[count]=i;
count++;
}
}
}
printf("%d\n",count);
count=2;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182329/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182329/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [1000000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4000000, ptr nonnull %a) #3
%call50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not51 = icmp eq i32 %call50, -1
br i1 %cmp.not51, label %while.end31, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%arrayidx5 = getelementptr inbounds [1000000 x i32], ptr %a, i64 0, i64 1
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.end29
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp slt i32 %0, 2
br i1 %cmp1, label %if.end29, label %if.else
if.else: ; preds = %while.body
%cmp2 = icmp eq i32 %0, 2
br i1 %cmp2, label %if.end29, label %if.else4
if.else4: ; preds = %if.else
store i32 2, ptr %a, align 16, !tbaa !5
store i32 3, ptr %arrayidx5, align 4, !tbaa !5
%cmp6.not47 = icmp ult i32 %0, 5
br i1 %cmp6.not47, label %if.end29, label %while.cond7.preheader
while.cond7.preheader: ; preds = %if.else4, %for.inc
%count.149 = phi i32 [ %count.2, %for.inc ], [ 2, %if.else4 ]
%i.048 = phi i32 [ %add, %for.inc ], [ 5, %if.else4 ]
%1 = load i32, ptr %a, align 16, !tbaa !5
%mul44 = mul nsw i32 %1, %1
%cmp11.not45 = icmp ugt i32 %mul44, %i.048
br i1 %cmp11.not45, label %if.then23, label %while.body12
while.cond7: ; preds = %while.body12
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx8 = getelementptr inbounds [1000000 x i32], ptr %a, i64 0, i64 %indvars.iv.next
%2 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%mul = mul nsw i32 %2, %2
%cmp11.not = icmp ugt i32 %mul, %i.048
br i1 %cmp11.not, label %if.then23, label %while.body12, !llvm.loop !9
while.body12: ; preds = %while.cond7.preheader, %while.cond7
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond7 ], [ 0, %while.cond7.preheader ]
%3 = phi i32 [ %2, %while.cond7 ], [ %1, %while.cond7.preheader ]
%rem = srem i32 %i.048, %3
%cmp15 = icmp eq i32 %rem, 0
br i1 %cmp15, label %for.inc, label %while.cond7
if.then23: ; preds = %while.cond7, %while.cond7.preheader
%idxprom24 = sext i32 %count.149 to i64
%arrayidx25 = getelementptr inbounds [1000000 x i32], ptr %a, i64 0, i64 %idxprom24
store i32 %i.048, ptr %arrayidx25, align 4, !tbaa !5
%inc26 = add nsw i32 %count.149, 1
br label %for.inc
for.inc: ; preds = %while.body12, %if.then23
%count.2 = phi i32 [ %inc26, %if.then23 ], [ %count.149, %while.body12 ]
%add = add nuw nsw i32 %i.048, 2
%cmp6.not = icmp sgt i32 %add, %0
br i1 %cmp6.not, label %if.end29, label %while.cond7.preheader, !llvm.loop !11
if.end29: ; preds = %for.inc, %if.else4, %if.else, %while.body
%count.3 = phi i32 [ 0, %while.body ], [ 1, %if.else ], [ 2, %if.else4 ], [ %count.2, %for.inc ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.3)
%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.end31, label %while.body, !llvm.loop !12
while.end31: ; preds = %if.end29, %entry
call void @llvm.lifetime.end.p0(i64 4000000, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include<math.h>
int main()
{
int r,l,i,x,y,flg=0;
float t;
scanf("%d",&l);
for(i=0;i<l;i++){
scanf("%d%d",&x,&y);
t=sqrt((x*x)+(y*y));
r=t;
if(t==r && t!=0 ){
printf("1\n");
}
else if(t==0)
printf("0\n");
else
printf("2\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18238/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.5 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.6 = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%l = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %l)
%0 = load i32, ptr %l, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.026 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i32, ptr %x, align 4, !tbaa !5
%mul = mul nsw i32 %1, %1
%2 = load i32, ptr %y, align 4, !tbaa !5
%mul2 = mul nsw i32 %2, %2
%add = add nuw nsw i32 %mul2, %mul
%conv = sitofp i32 %add to double
%call3 = call double @sqrt(double noundef %conv) #5
%conv4 = fptrunc double %call3 to float
%conv5 = fptosi float %conv4 to i32
%conv6 = sitofp i32 %conv5 to float
%cmp7 = fcmp oeq float %conv4, %conv6
%cmp9 = fcmp une float %conv4, 0.000000e+00
%or.cond = and i1 %cmp9, %cmp7
%cmp12 = fcmp oeq float %conv4, 0.000000e+00
%str.5.str = select i1 %cmp12, ptr @str.5, ptr @str
%str.6.sink = select i1 %or.cond, ptr @str.6, ptr %str.5.str
%puts24 = call i32 @puts(ptr nonnull dereferenceable(1) %str.6.sink)
%inc = add nuw nsw i32 %i.026, 1
%3 = load i32, ptr %l, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="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 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{
int t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
long long int n,B,x,y,T=0,sum=0;
scanf("%lld %lld %lld %lld",&n,&B,&x,&y);
for(int j=0;j<n;j++)
{
if(T+x<=B)
T+=x;
else
T-=y;
sum+=T;
}
printf("%lld\n",sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%t = alloca i32, align 4
%n = alloca i64, align 8
%B = alloca i64, align 8
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup5, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #3
ret i32 0
for.body: ; preds = %entry, %for.cond.cleanup5
%i.026 = phi i32 [ %inc13, %for.cond.cleanup5 ], [ 0, %entry ]
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y) #3
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %B, ptr noundef nonnull %x, ptr noundef nonnull %y)
%1 = load i64, ptr %n, align 8, !tbaa !9
%cmp321 = icmp sgt i64 %1, 0
br i1 %cmp321, label %for.body6.lr.ph, label %for.cond.cleanup5
for.body6.lr.ph: ; preds = %for.body
%2 = load i64, ptr %x, align 8, !tbaa !9
%3 = load i64, ptr %B, align 8, !tbaa !9
%4 = load i64, ptr %y, align 8
%xtraiter = and i64 %1, 3
%5 = icmp ult i64 %1, 4
br i1 %5, label %for.cond.cleanup5.loopexit.unr-lcssa, label %for.body6.lr.ph.new
for.body6.lr.ph.new: ; preds = %for.body6.lr.ph
%unroll_iter = and i64 %1, -4
br label %for.body6
for.cond.cleanup5.loopexit.unr-lcssa: ; preds = %for.body6, %for.body6.lr.ph
%add10.lcssa.ph = phi i64 [ undef, %for.body6.lr.ph ], [ %add10.3, %for.body6 ]
%sum.023.unr = phi i64 [ 0, %for.body6.lr.ph ], [ %add10.3, %for.body6 ]
%T.022.unr = phi i64 [ 0, %for.body6.lr.ph ], [ %T.1.3, %for.body6 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup5, label %for.body6.epil
for.body6.epil: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa, %for.body6.epil
%sum.023.epil = phi i64 [ %add10.epil, %for.body6.epil ], [ %sum.023.unr, %for.cond.cleanup5.loopexit.unr-lcssa ]
%T.022.epil = phi i64 [ %T.1.epil, %for.body6.epil ], [ %T.022.unr, %for.cond.cleanup5.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body6.epil ], [ 0, %for.cond.cleanup5.loopexit.unr-lcssa ]
%add.epil = add nsw i64 %2, %T.022.epil
%cmp7.not.epil = icmp sgt i64 %add.epil, %3
%sub.epil = sub nsw i64 %T.022.epil, %4
%T.1.epil = select i1 %cmp7.not.epil, i64 %sub.epil, i64 %add.epil
%add10.epil = add nsw i64 %T.1.epil, %sum.023.epil
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup5, label %for.body6.epil, !llvm.loop !11
for.cond.cleanup5: ; preds = %for.cond.cleanup5.loopexit.unr-lcssa, %for.body6.epil, %for.body
%sum.0.lcssa = phi i64 [ 0, %for.body ], [ %add10.lcssa.ph, %for.cond.cleanup5.loopexit.unr-lcssa ], [ %add10.epil, %for.body6.epil ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
%inc13 = add nuw nsw i32 %i.026, 1
%6 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc13, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.body6: ; preds = %for.body6, %for.body6.lr.ph.new
%sum.023 = phi i64 [ 0, %for.body6.lr.ph.new ], [ %add10.3, %for.body6 ]
%T.022 = phi i64 [ 0, %for.body6.lr.ph.new ], [ %T.1.3, %for.body6 ]
%niter = phi i64 [ 0, %for.body6.lr.ph.new ], [ %niter.next.3, %for.body6 ]
%add = add nsw i64 %2, %T.022
%cmp7.not = icmp sgt i64 %add, %3
%sub = sub nsw i64 %T.022, %4
%T.1 = select i1 %cmp7.not, i64 %sub, i64 %add
%add10 = add nsw i64 %T.1, %sum.023
%add.1 = add nsw i64 %2, %T.1
%cmp7.not.1 = icmp sgt i64 %add.1, %3
%sub.1 = sub nsw i64 %T.1, %4
%T.1.1 = select i1 %cmp7.not.1, i64 %sub.1, i64 %add.1
%add10.1 = add nsw i64 %T.1.1, %add10
%add.2 = add nsw i64 %2, %T.1.1
%cmp7.not.2 = icmp sgt i64 %add.2, %3
%sub.2 = sub nsw i64 %T.1.1, %4
%T.1.2 = select i1 %cmp7.not.2, i64 %sub.2, i64 %add.2
%add10.2 = add nsw i64 %T.1.2, %add10.1
%add.3 = add nsw i64 %2, %T.1.2
%cmp7.not.3 = icmp sgt i64 %add.3, %3
%sub.3 = sub nsw i64 %T.1.2, %4
%T.1.3 = select i1 %cmp7.not.3, i64 %sub.3, i64 %add.3
%add10.3 = add nsw i64 %T.1.3, %add10.2
%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.cleanup5.loopexit.unr-lcssa, label %for.body6, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include<stdio.h>
#include<math.h>
int prime[1000000];
int main(void){
int i,j,sq_n,count;
double n;
while(scanf("%lf",&n)!=EOF){
count=0;
sq_n=sqrt(n);
for(i=0;i<n;i++)
prime[i]=1;
prime[0]=0;
for(i=1;i<sq_n;i++){
if(prime[i]==1){
for(j=(i+1);(i+1)*j<=n;j++) {
prime[(i+1)*j-1]=0;
}
}
}
for(i=0;i<n;i++){
if(prime[i]==1){
count++;
}
}
printf("%d\n",count);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182473/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182473/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@prime = dso_local local_unnamed_addr global [1000000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
%call72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not73 = icmp eq i32 %call72, -1
br i1 %cmp.not73, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end43
%0 = load double, ptr %n, align 8, !tbaa !5
%call1 = call double @sqrt(double noundef %0) #4
%conv = fptosi double %call1 to i32
%1 = load double, ptr %n, align 8, !tbaa !5
%cmp359 = fcmp ogt double %1, 0.000000e+00
br i1 %cmp359, label %for.body, label %for.end
for.body: ; preds = %while.body, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %while.body ]
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !9
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%2 = trunc i64 %indvars.iv.next to i32
%conv2 = sitofp i32 %2 to double
%cmp3 = fcmp ogt double %1, %conv2
br i1 %cmp3, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %while.body
store i32 0, ptr @prime, align 16, !tbaa !9
%cmp666 = icmp sgt i32 %conv, 1
br i1 %cmp666, label %for.body8.preheader, label %for.cond29.preheader
for.body8.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %conv to i64
br label %for.body8
for.cond29.preheader: ; preds = %for.inc26, %for.end
br i1 %cmp359, label %for.body33, label %for.end43
for.body8: ; preds = %for.body8.preheader, %for.inc26
%indvars.iv81 = phi i64 [ 1, %for.body8.preheader ], [ %4, %for.inc26 ]
%indvars.iv75 = phi i64 [ 2, %for.body8.preheader ], [ %indvars.iv.next76, %for.inc26 ]
%arrayidx10 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv81
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !9
%cmp11 = icmp eq i32 %3, 1
%4 = add nuw nsw i64 %indvars.iv81, 1
br i1 %cmp11, label %if.then, label %for.inc26
if.then: ; preds = %for.body8
%5 = mul nsw i64 %4, %4
%6 = trunc i64 %5 to i32
%conv1562 = sitofp i32 %6 to double
%cmp1663 = fcmp ult double %1, %conv1562
br i1 %cmp1663, label %for.inc26, label %for.body18
for.body18: ; preds = %if.then, %for.body18
%indvars.iv77 = phi i64 [ %indvars.iv.next78, %for.body18 ], [ %indvars.iv75, %if.then ]
%mul65 = phi i64 [ %7, %for.body18 ], [ %5, %if.then ]
%sub = shl i64 %mul65, 32
%sext = add i64 %sub, -4294967296
%idxprom21 = ashr exact i64 %sext, 32
%arrayidx22 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %idxprom21
store i32 0, ptr %arrayidx22, align 4, !tbaa !9
%indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
%7 = mul nsw i64 %indvars.iv.next78, %4
%8 = trunc i64 %7 to i32
%conv15 = sitofp i32 %8 to double
%cmp16 = fcmp ult double %1, %conv15
br i1 %cmp16, label %for.inc26, label %for.body18, !llvm.loop !13
for.inc26: ; preds = %for.body18, %for.body8, %if.then
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond.not = icmp eq i64 %4, %wide.trip.count
br i1 %exitcond.not, label %for.cond29.preheader, label %for.body8, !llvm.loop !14
for.body33: ; preds = %for.cond29.preheader, %for.body33
%indvars.iv86 = phi i64 [ %indvars.iv.next87, %for.body33 ], [ 0, %for.cond29.preheader ]
%count.070 = phi i32 [ %spec.select, %for.body33 ], [ 0, %for.cond29.preheader ]
%arrayidx35 = getelementptr inbounds [1000000 x i32], ptr @prime, i64 0, i64 %indvars.iv86
%9 = load i32, ptr %arrayidx35, align 4, !tbaa !9
%cmp36 = icmp eq i32 %9, 1
%inc39 = zext i1 %cmp36 to i32
%spec.select = add nuw nsw i32 %count.070, %inc39
%indvars.iv.next87 = add nuw i64 %indvars.iv86, 1
%10 = trunc i64 %indvars.iv.next87 to i32
%conv30 = sitofp i32 %10 to double
%cmp31 = fcmp ogt double %1, %conv30
br i1 %cmp31, label %for.body33, label %for.end43, !llvm.loop !15
for.end43: ; preds = %for.body33, %for.cond29.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond29.preheader ], [ %spec.select, %for.body33 ]
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %for.end43, %entry
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: 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 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
|
#include<stdio.h>
int a[1000001];
int Func(int n) {
if (n == 0)return 0;
else return a[n] + Func(n - 1);
}
int main() {
a[0] = 0;
a[1] = 0;
a[2] = 1;
for (int i = 3; i <= 1000000; i++) {
if (i % 2 == 0)a[i] = 0;
else {
int h = 1;
for (int j = 3; j*j <= i && h == 1; j += 2) {
if (i%j == 0)h = 0;
}
a[i] = h;
}
}
int n;
while (~scanf("%d", &n)) {
printf("%d\n", Func(n));
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local local_unnamed_addr global [1000001 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @Func(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp3 = icmp eq i32 %n, 0
br i1 %cmp3, label %return, label %if.else.preheader
if.else.preheader: ; preds = %entry
%0 = sext i32 %n to i64
%1 = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %if.else.preheader10, label %vector.ph
vector.ph: ; preds = %if.else.preheader
%n.vec = and i64 %1, 4294967288
%ind.end = sub nsw i64 %0, %n.vec
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 ], [ %5, %vector.body ]
%vec.phi7 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%offset.idx = sub i64 %0, %index
%2 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %offset.idx
%3 = getelementptr inbounds i32, ptr %2, i64 -3
%wide.load = load <4 x i32>, ptr %3, align 4, !tbaa !5
%reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%4 = getelementptr inbounds i32, ptr %2, i64 -7
%wide.load8 = load <4 x i32>, ptr %4, align 4, !tbaa !5
%reverse9 = shufflevector <4 x i32> %wide.load8, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%5 = add <4 x i32> %reverse, %vec.phi
%6 = add <4 x i32> %reverse9, %vec.phi7
%index.next = add nuw i64 %index, 8
%7 = icmp eq i64 %index.next, %n.vec
br i1 %7, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %6, %5
%8 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %1
br i1 %cmp.n, label %return, label %if.else.preheader10
if.else.preheader10: ; preds = %if.else.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %if.else.preheader ], [ %ind.end, %middle.block ]
%accumulator.tr4.ph = phi i32 [ 0, %if.else.preheader ], [ %8, %middle.block ]
br label %if.else
if.else: ; preds = %if.else.preheader10, %if.else
%indvars.iv = phi i64 [ %indvars.iv.next, %if.else ], [ %indvars.iv.ph, %if.else.preheader10 ]
%accumulator.tr4 = phi i32 [ %add, %if.else ], [ %accumulator.tr4.ph, %if.else.preheader10 ]
%arrayidx = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %indvars.iv
%9 = load i32, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%add = add nsw i32 %9, %accumulator.tr4
%10 = and i64 %indvars.iv.next, 4294967295
%cmp = icmp eq i64 %10, 0
br i1 %cmp, label %return, label %if.else, !llvm.loop !12
return: ; preds = %if.else, %middle.block, %entry
%accumulator.tr.lcssa = phi i32 [ 0, %entry ], [ %8, %middle.block ], [ %add, %if.else ]
ret i32 %accumulator.tr.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
store i32 0, ptr @a, align 16, !tbaa !5
store i32 0, ptr getelementptr inbounds ([1000001 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @a, i64 0, i64 2), align 8, !tbaa !5
br label %for.body
for.cond.cleanup: ; preds = %for.inc13
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not31 = icmp eq i32 %call30, -1
br i1 %tobool.not31, label %while.end, label %while.body
for.body: ; preds = %entry, %for.inc13
%indvars.iv = phi i64 [ 3, %entry ], [ %indvars.iv.next, %for.inc13 ]
%0 = trunc i64 %indvars.iv to i32
%rem = and i32 %0, 1
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %for.inc13, label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body
%cmp327 = icmp ugt i64 %indvars.iv, 8
br i1 %cmp327, label %for.body6, label %for.inc13
for.cond.cleanup5.loopexit: ; preds = %for.body6
%spec.select = zext i1 %cmp8 to i32
br label %for.inc13
for.body6: ; preds = %for.cond2.preheader, %for.body6
%j.028 = phi i32 [ %add, %for.body6 ], [ 3, %for.cond2.preheader ]
%rem7 = urem i32 %0, %j.028
%cmp8 = icmp ne i32 %rem7, 0
%add = add nuw nsw i32 %j.028, 2
%mul = mul nsw i32 %add, %add
%1 = zext i32 %mul to i64
%cmp3 = icmp uge i64 %indvars.iv, %1
%2 = and i1 %cmp8, %cmp3
br i1 %2, label %for.body6, label %for.cond.cleanup5.loopexit, !llvm.loop !13
for.inc13: ; preds = %for.cond2.preheader, %for.cond.cleanup5.loopexit, %for.body
%.sink = phi i32 [ 0, %for.body ], [ 1, %for.cond2.preheader ], [ %spec.select, %for.cond.cleanup5.loopexit ]
%arrayidx = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %indvars.iv
store i32 %.sink, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000001
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
while.body: ; preds = %for.cond.cleanup, %Func.exit
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp3.i = icmp eq i32 %3, 0
br i1 %cmp3.i, label %Func.exit, label %if.else.preheader.i
if.else.preheader.i: ; preds = %while.body
%4 = sext i32 %3 to i64
%5 = zext i32 %3 to i64
%min.iters.check = icmp ult i32 %3, 8
br i1 %min.iters.check, label %if.else.i.preheader, label %vector.ph
vector.ph: ; preds = %if.else.preheader.i
%n.vec = and i64 %5, 4294967288
%ind.end = sub nsw i64 %4, %n.vec
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 ], [ %9, %vector.body ]
%vec.phi33 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%offset.idx = sub i64 %4, %index
%6 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %offset.idx
%7 = getelementptr inbounds i32, ptr %6, i64 -3
%wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
%reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%8 = getelementptr inbounds i32, ptr %6, i64 -7
%wide.load34 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%reverse35 = shufflevector <4 x i32> %wide.load34, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%9 = add <4 x i32> %reverse, %vec.phi
%10 = add <4 x i32> %reverse35, %vec.phi33
%index.next = add nuw i64 %index, 8
%11 = icmp eq i64 %index.next, %n.vec
br i1 %11, label %middle.block, label %vector.body, !llvm.loop !16
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %5
br i1 %cmp.n, label %Func.exit, label %if.else.i.preheader
if.else.i.preheader: ; preds = %if.else.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ %4, %if.else.preheader.i ], [ %ind.end, %middle.block ]
%accumulator.tr4.i.ph = phi i32 [ 0, %if.else.preheader.i ], [ %12, %middle.block ]
br label %if.else.i
if.else.i: ; preds = %if.else.i.preheader, %if.else.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %if.else.i ], [ %indvars.iv.i.ph, %if.else.i.preheader ]
%accumulator.tr4.i = phi i32 [ %add.i, %if.else.i ], [ %accumulator.tr4.i.ph, %if.else.i.preheader ]
%arrayidx.i = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %indvars.iv.i
%13 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%indvars.iv.next.i = add nsw i64 %indvars.iv.i, -1
%add.i = add nsw i32 %13, %accumulator.tr4.i
%14 = and i64 %indvars.iv.next.i, 4294967295
%cmp.i = icmp eq i64 %14, 0
br i1 %cmp.i, label %Func.exit, label %if.else.i, !llvm.loop !17
Func.exit: ; preds = %if.else.i, %middle.block, %while.body
%accumulator.tr.lcssa.i = phi i32 [ 0, %while.body ], [ %12, %middle.block ], [ %add.i, %if.else.i ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %accumulator.tr.lcssa.i)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%tobool.not = icmp eq i32 %call, -1
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %Func.exit, %for.cond.cleanup
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: 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 @__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(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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !11, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !10, !11}
!17 = distinct !{!17, !11, !10}
!18 = distinct !{!18, !14}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define BUF_SIZE 20
#define DIVISOR 1000000007
// size: specify sizeof(str)
int get_str(char *str, int size) {
if(!fgets(str, size, stdin)) return -1;
return 0;
}
int get_int(void) {
int num;
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return 0;
sscanf(line, "%d", &num);
#else
#error
#endif
return num;
}
int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
char line[BUF_SIZE];
if(!fgets(line, BUF_SIZE, stdin)) return -1;
sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
return 0;
}
int main(void) {
int n, k;
get_int2(&n, &k);
int pat, i;
for(pat = 0; pat < (1<<n); pat++) {
if(__builtin_popcount(pat)!=k) continue;
printf("%d:", pat);
for(i = 0; i < n; i++) {
if(!(pat & (1<<i))) continue;
printf(" %d", i);
}
putchar('\n');
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182567/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182567/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@stdin = external local_unnamed_addr global ptr, align 8
@.str = private unnamed_addr constant [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:\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_str(ptr noundef %str, i32 noundef %size) local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = tail call ptr @fgets(ptr noundef %str, i32 noundef %size, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
%. = sext i1 %tobool.not to i32
ret i32 %.
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%line = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %line) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 20, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %entry
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str, ptr noundef nonnull %num) #4
%1 = load i32, ptr %num, align 4, !tbaa !9
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %1, %if.end ], [ 0, %entry ]
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %line) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_sscanf(ptr nocapture noundef readonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%line = alloca [20 x i8], align 16
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %line) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %line, i32 noundef 20, ptr noundef %0)
%tobool.not = icmp eq ptr %call, null
br i1 %tobool.not, label %cleanup, label %if.end
if.end: ; preds = %entry
%call2 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line, ptr noundef nonnull @.str.1, ptr noundef %a1, ptr noundef %a2) #4
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ 0, %if.end ], [ -1, %entry ]
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %line) #4
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%line.i = alloca [20 x i8], align 16
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %line.i) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call ptr @fgets(ptr noundef nonnull %line.i, i32 noundef 20, ptr noundef %0)
%tobool.not.i = icmp eq ptr %call.i, null
br i1 %tobool.not.i, label %get_int2.exit, label %if.end.i
if.end.i: ; preds = %entry
%call2.i = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %line.i, ptr noundef nonnull @.str.1, ptr noundef nonnull %n, ptr noundef nonnull %k) #4
br label %get_int2.exit
get_int2.exit: ; preds = %entry, %if.end.i
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %line.i) #4
%1 = load i32, ptr %n, align 4, !tbaa !9
%cmp25.not = icmp eq i32 %1, 31
br i1 %cmp25.not, label %for.end13, label %for.body
for.body: ; preds = %get_int2.exit, %for.inc11
%2 = phi i32 [ %9, %for.inc11 ], [ %1, %get_int2.exit ]
%pat.026 = phi i32 [ %inc12, %for.inc11 ], [ 0, %get_int2.exit ]
%3 = call i32 @llvm.ctpop.i32(i32 %pat.026), !range !11
%4 = load i32, ptr %k, align 4, !tbaa !9
%cmp1.not = icmp eq i32 %3, %4
br i1 %cmp1.not, label %if.end, label %for.inc11
if.end: ; preds = %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %pat.026)
%5 = load i32, ptr %n, align 4, !tbaa !9
%cmp422 = icmp sgt i32 %5, 0
br i1 %cmp422, label %for.body5, label %for.end
for.body5: ; preds = %if.end, %for.inc
%6 = phi i32 [ %7, %for.inc ], [ %5, %if.end ]
%i.023 = phi i32 [ %inc, %for.inc ], [ 0, %if.end ]
%shl6 = shl nuw i32 1, %i.023
%and = and i32 %shl6, %pat.026
%tobool.not = icmp eq i32 %and, 0
br i1 %tobool.not, label %for.inc, label %if.end8
if.end8: ; preds = %for.body5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %i.023)
%.pre = load i32, ptr %n, align 4, !tbaa !9
br label %for.inc
for.inc: ; preds = %for.body5, %if.end8
%7 = phi i32 [ %6, %for.body5 ], [ %.pre, %if.end8 ]
%inc = add nuw nsw i32 %i.023, 1
%cmp4 = icmp slt i32 %inc, %7
br i1 %cmp4, label %for.body5, label %for.end, !llvm.loop !12
for.end: ; preds = %for.inc, %if.end
%8 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i21 = call i32 @putc(i32 noundef 10, ptr noundef %8)
%.pre27 = load i32, ptr %n, align 4, !tbaa !9
br label %for.inc11
for.inc11: ; preds = %for.body, %for.end
%9 = phi i32 [ %2, %for.body ], [ %.pre27, %for.end ]
%inc12 = add nuw nsw i32 %pat.026, 1
%shl = shl nuw i32 1, %9
%cmp = icmp slt i32 %inc12, %shl
br i1 %cmp, label %for.body, label %for.end13, !llvm.loop !14
for.end13: ; preds = %for.inc11, %get_int2.exit
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 speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i32 0, i32 32}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include <stdio.h>
int main(void){
// Your code here!
long int n,a,b;
scanf("%ld %ld %ld",&n,&a,&b);
if(n==1 && a==b){
printf("1\n");
}else if(n==1 && a!=b){
printf("0\n");
}else if(a>b){
printf("0\n");
}else{
printf("%ld\n",(n-2)*(b-a)+1);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182646/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182646/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%ld %ld %ld\00", align 1
@.str.3 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str.4 = private unnamed_addr constant [2 x i8] c"0\00", align 1
@str.5 = private unnamed_addr constant [2 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
%a = alloca i64, align 8
%b = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 1
%.pre = load i64, ptr %a, align 8, !tbaa !5
%.pre20 = load i64, ptr %b, align 8, !tbaa !5
br i1 %cmp, label %land.lhs.true, label %if.else8
land.lhs.true: ; preds = %entry
%cmp1 = icmp eq i64 %.pre, %.pre20
br i1 %cmp1, label %if.then, label %if.then6
if.then: ; preds = %land.lhs.true
%puts19 = call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
br label %if.end16
if.then6: ; preds = %land.lhs.true
%puts18 = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end16
if.else8: ; preds = %entry
%cmp9 = icmp sgt i64 %.pre, %.pre20
br i1 %cmp9, label %if.then10, label %if.else12
if.then10: ; preds = %if.else8
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str.4)
br label %if.end16
if.else12: ; preds = %if.else8
%sub = add nsw i64 %0, -2
%sub13 = sub nsw i64 %.pre20, %.pre
%mul = mul nsw i64 %sub13, %sub
%add = add nsw i64 %mul, 1
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %add)
br label %if.end16
if.end16: ; preds = %if.then6, %if.else12, %if.then10, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #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"}
|
#include <stdio.h>
#include <math.h>
int main()
{
int x, y, z, p;
scanf("%d", &x);
while (x > 0)
{
scanf("%d", &y);
scanf("%d", &z);
int pt = y * y + z * z;
int q = sqrt(pt);
if (y == 0 && z == 0)
{
int u = 0;
printf("%d\n", u);
}
else if (q * q == pt)
{
int r = 1;
printf("%d\n", r);
}
else
{
int ip = 2;
printf("%d\n", ip);
}
x--;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18269/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18269/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%y = alloca i32, align 4
%z = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %z) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%.pr = load i32, ptr %x, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %.pr, 0
br i1 %cmp21, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %y)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %z)
%0 = load i32, ptr %y, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%1 = load i32, ptr %z, align 4, !tbaa !5
%mul3 = mul nsw i32 %1, %1
%add = add nuw nsw i32 %mul3, %mul
%conv = sitofp i32 %add to double
%call4 = call double @sqrt(double noundef %conv) #4
%2 = load i32, ptr %y, align 4, !tbaa !5
%cmp6 = icmp eq i32 %2, 0
%3 = load i32, ptr %z, align 4
%cmp8 = icmp eq i32 %3, 0
%or.cond = select i1 %cmp6, i1 %cmp8, i1 false
%conv5 = fptosi double %call4 to i32
%mul11 = mul nsw i32 %conv5, %conv5
%cmp12 = icmp eq i32 %mul11, %add
%. = select i1 %cmp12, i32 1, i32 2
%.sink = select i1 %or.cond, i32 0, i32 %.
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.sink)
%4 = load i32, ptr %x, align 4, !tbaa !5
%dec = add nsw i32 %4, -1
store i32 %dec, ptr %x, align 4, !tbaa !5
%cmp = icmp sgt i32 %4, 1
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %z) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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 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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
long long N,A,B;
long long i;
long long max,min,ans;
scanf("%lld%lld%lld",&N,&A,&B);
if(A > B){
ans = 0;
}else if(N == 1 && A != B){
ans = 0;
}else{
min = A*(N-1)+B;
max = B*(N-1)+A;
ans = max-min+1;
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182732/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182732/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%A = alloca i64, align 8
%B = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i64, ptr %A, align 8, !tbaa !5
%1 = load i64, ptr %B, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
br i1 %cmp, label %if.end10, label %if.else
if.else: ; preds = %entry
%2 = load i64, ptr %N, align 8, !tbaa !5
%cmp1 = icmp ne i64 %2, 1
%cmp2.not = icmp eq i64 %0, %1
%or.cond = or i1 %cmp2.not, %cmp1
br i1 %or.cond, label %if.else4, label %if.end10
if.else4: ; preds = %if.else
%sub = add nsw i64 %2, -1
%reass.add = sub i64 %1, %0
%reass.mul = mul i64 %reass.add, %sub
%add7 = add i64 %0, 1
%sub8 = sub i64 %add7, %1
%add9 = add i64 %sub8, %reass.mul
br label %if.end10
if.end10: ; preds = %if.else, %entry, %if.else4
%ans.0 = phi i64 [ %add9, %if.else4 ], [ 0, %entry ], [ 0, %if.else ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int N, D1, D2, i, j, k, l, f, g;
scanf("%d%d%d", &N, &D1, &D2);
for(k = 0; (D1 & 1) == 0; D1 >>= 1, k++){}
for(l = 0; (D2 & 1) == 0; D2 >>= 1, l++){}
int num = 0;
for(i = 0; i < 2 * N; i++){
for(j = 0; j < 2 * N; j++){
if(num == N * N){
return 0;
}
if(((((k&1)|(((i>>(k>>1))^(j>>(k>>1)))&1))&(((k^1)&1)|((i>>(k>>1))&1)))|(((l&1)|(((i>>(l>>1))^(j>>(l>>1)))&1))&(((l^1)&1)|((i>>(l>>1))&1))))==0){
printf("%d %d\n", i, j);
num++;
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182783/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182783/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%D1 = alloca i32, align 4
%D2 = 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 %D1) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %D2) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %D1, ptr noundef nonnull %D2)
%D1.promoted = load i32, ptr %D1, align 4, !tbaa !5
%and95 = and i32 %D1.promoted, 1
%cmp96 = icmp eq i32 %and95, 0
br i1 %cmp96, label %for.inc, label %for.cond1.preheader
for.cond.for.cond1.preheader_crit_edge: ; preds = %for.inc
store i32 %shr, ptr %D1, align 4, !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond.for.cond1.preheader_crit_edge, %entry
%k.0.lcssa = phi i32 [ %inc, %for.cond.for.cond1.preheader_crit_edge ], [ 0, %entry ]
%D2.promoted = load i32, ptr %D2, align 4, !tbaa !5
%and2100 = and i32 %D2.promoted, 1
%cmp3101 = icmp eq i32 %and2100, 0
br i1 %cmp3101, label %for.inc5, label %for.cond9.preheader
for.inc: ; preds = %entry, %for.inc
%k.098 = phi i32 [ %inc, %for.inc ], [ 0, %entry ]
%shr9497 = phi i32 [ %shr, %for.inc ], [ %D1.promoted, %entry ]
%shr = ashr i32 %shr9497, 1
%inc = add nuw nsw i32 %k.098, 1
%0 = and i32 %shr9497, 2
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %for.inc, label %for.cond.for.cond1.preheader_crit_edge, !llvm.loop !9
for.cond1.for.cond9.preheader_crit_edge: ; preds = %for.inc5
store i32 %shr6, ptr %D2, align 4, !tbaa !5
br label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.cond1.for.cond9.preheader_crit_edge, %for.cond1.preheader
%l.0.lcssa = phi i32 [ %inc7, %for.cond1.for.cond9.preheader_crit_edge ], [ 0, %for.cond1.preheader ]
%1 = load i32, ptr %N, align 4, !tbaa !5
%cmp10111 = icmp sgt i32 %1, 0
br i1 %cmp10111, label %for.cond12.preheader.lr.ph, label %cleanup
for.cond12.preheader.lr.ph: ; preds = %for.cond9.preheader
%shr19 = lshr i32 %k.0.lcssa, 1
%xor24 = and i32 %k.0.lcssa, 1
%and25 = xor i32 %xor24, 1
%shr32 = lshr i32 %l.0.lcssa, 1
%xor39 = and i32 %l.0.lcssa, 1
%and40 = xor i32 %xor39, 1
br label %for.cond12.preheader
for.inc5: ; preds = %for.cond1.preheader, %for.inc5
%l.0103 = phi i32 [ %inc7, %for.inc5 ], [ 0, %for.cond1.preheader ]
%shr699102 = phi i32 [ %shr6, %for.inc5 ], [ %D2.promoted, %for.cond1.preheader ]
%shr6 = ashr i32 %shr699102, 1
%inc7 = add nuw nsw i32 %l.0103, 1
%2 = and i32 %shr699102, 2
%cmp3 = icmp eq i32 %2, 0
br i1 %cmp3, label %for.inc5, label %for.cond1.for.cond9.preheader_crit_edge, !llvm.loop !11
for.cond12.preheader: ; preds = %for.cond12.preheader.lr.ph, %for.inc55
%3 = phi i32 [ %1, %for.cond12.preheader.lr.ph ], [ %8, %for.inc55 ]
%num.0113 = phi i32 [ 0, %for.cond12.preheader.lr.ph ], [ %num.1.lcssa, %for.inc55 ]
%i.0112 = phi i32 [ 0, %for.cond12.preheader.lr.ph ], [ %inc56, %for.inc55 ]
%cmp14106 = icmp sgt i32 %3, 0
br i1 %cmp14106, label %for.body15.lr.ph, label %for.inc55
for.body15.lr.ph: ; preds = %for.cond12.preheader
%shr20 = lshr i32 %i.0112, %shr19
%and28 = and i32 %shr20, 1
%or29 = or i32 %and28, %and25
%shr33 = lshr i32 %i.0112, %shr32
%and43 = and i32 %shr33, 1
%or44 = or i32 %and43, %and40
br label %for.body15
for.body15: ; preds = %for.body15.lr.ph, %for.inc52
%4 = phi i32 [ %3, %for.body15.lr.ph ], [ %6, %for.inc52 ]
%5 = phi i32 [ %3, %for.body15.lr.ph ], [ %7, %for.inc52 ]
%num.1108 = phi i32 [ %num.0113, %for.body15.lr.ph ], [ %num.2, %for.inc52 ]
%j.0107 = phi i32 [ 0, %for.body15.lr.ph ], [ %inc53, %for.inc52 ]
%mul16 = mul nsw i32 %5, %5
%cmp17 = icmp eq i32 %num.1108, %mul16
br i1 %cmp17, label %cleanup, label %if.end
if.end: ; preds = %for.body15
%shr2088 = xor i32 %j.0107, %i.0112
%xor = lshr i32 %shr2088, %shr19
%and1889 = or i32 %xor, %k.0.lcssa
%and30 = and i32 %and1889, %or29
%xor36 = lshr i32 %shr2088, %shr32
%and3191 = or i32 %xor36, %l.0.lcssa
%and45 = and i32 %and3191, %or44
%or46 = or i32 %and30, %and45
%cmp47 = icmp eq i32 %or46, 0
br i1 %cmp47, label %if.then48, label %for.inc52
if.then48: ; preds = %if.end
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.0112, i32 noundef %j.0107)
%inc50 = add nsw i32 %num.1108, 1
%.pre = load i32, ptr %N, align 4, !tbaa !5
br label %for.inc52
for.inc52: ; preds = %if.end, %if.then48
%6 = phi i32 [ %.pre, %if.then48 ], [ %4, %if.end ]
%7 = phi i32 [ %.pre, %if.then48 ], [ %5, %if.end ]
%num.2 = phi i32 [ %inc50, %if.then48 ], [ %num.1108, %if.end ]
%inc53 = add nuw nsw i32 %j.0107, 1
%mul13 = shl nsw i32 %7, 1
%cmp14 = icmp slt i32 %inc53, %mul13
br i1 %cmp14, label %for.body15, label %for.inc55, !llvm.loop !12
for.inc55: ; preds = %for.inc52, %for.cond12.preheader
%8 = phi i32 [ %3, %for.cond12.preheader ], [ %6, %for.inc52 ]
%num.1.lcssa = phi i32 [ %num.0113, %for.cond12.preheader ], [ %num.2, %for.inc52 ]
%inc56 = add nuw nsw i32 %i.0112, 1
%mul = shl nsw i32 %8, 1
%cmp10 = icmp slt i32 %inc56, %mul
br i1 %cmp10, label %for.cond12.preheader, label %cleanup, !llvm.loop !13
cleanup: ; preds = %for.inc55, %for.body15, %for.cond9.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D2) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %D1) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int main(void)
{
int kai, i, j, max1 = 0, max2 = 0;
int no[10];
scanf( "%d",&kai );
for(i = 0; i < kai; i++){
scanf( "%d %d %d %d %d %d %d %d %d %d", &no[0], &no[1], &no[2], &no[3], &no[4], &no[5], &no[6], &no[7], &no[8], &no[9] );
for( j = 0; j < 10; j++){
if(max1 < no[j])
max1 = no[j];
else if(max2 < no[j])
max2 = no[j];
else
break;
}
if( j == 10 )
printf( "YES\n" );
else
printf( "NO\n" );
max1 = max2 = 0;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182833/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182833/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [30 x i8] c"%d %d %d %d %d %d %d %d %d %d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.4 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%kai = alloca i32, align 4
%no = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kai) #4
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %no) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %kai)
%0 = load i32, ptr %kai, align 4, !tbaa !5
%cmp48 = icmp sgt i32 %0, 0
br i1 %cmp48, label %for.body.lr.ph, label %for.end34
for.body.lr.ph: ; preds = %entry
%arrayidx1 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 4
%arrayidx5 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 5
%arrayidx6 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 6
%arrayidx7 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 7
%arrayidx8 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 8
%arrayidx9 = getelementptr inbounds [10 x i32], ptr %no, i64 0, i64 9
br label %for.body
for.body: ; preds = %for.body.lr.ph, %if.end31
%i.049 = phi i32 [ 0, %for.body.lr.ph ], [ %inc33, %if.end31 ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %no, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx5, ptr noundef nonnull %arrayidx6, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx9)
%1 = load i32, ptr %no, align 16, !tbaa !5
%cmp15 = icmp sgt i32 %1, 0
br i1 %cmp15, label %for.inc, label %if.else29
for.inc: ; preds = %for.body
%2 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp15.1 = icmp slt i32 %1, %2
br i1 %cmp15.1, label %for.inc.1, label %if.else.1
if.else.1: ; preds = %for.inc
%cmp20.1 = icmp sgt i32 %2, 0
br i1 %cmp20.1, label %for.inc.1, label %if.else29
for.inc.1: ; preds = %if.else.1, %for.inc
%max1.2.1 = phi i32 [ %2, %for.inc ], [ %1, %if.else.1 ]
%max2.2.1 = phi i32 [ 0, %for.inc ], [ %2, %if.else.1 ]
%3 = load i32, ptr %arrayidx2, align 8, !tbaa !5
%cmp15.2 = icmp slt i32 %max1.2.1, %3
br i1 %cmp15.2, label %for.inc.2, label %if.else.2
if.else.2: ; preds = %for.inc.1
%cmp20.2 = icmp slt i32 %max2.2.1, %3
br i1 %cmp20.2, label %for.inc.2, label %if.else29
for.inc.2: ; preds = %if.else.2, %for.inc.1
%max1.2.2 = phi i32 [ %3, %for.inc.1 ], [ %max1.2.1, %if.else.2 ]
%max2.2.2 = phi i32 [ %max2.2.1, %for.inc.1 ], [ %3, %if.else.2 ]
%4 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%cmp15.3 = icmp slt i32 %max1.2.2, %4
br i1 %cmp15.3, label %for.inc.3, label %if.else.3
if.else.3: ; preds = %for.inc.2
%cmp20.3 = icmp slt i32 %max2.2.2, %4
br i1 %cmp20.3, label %for.inc.3, label %if.else29
for.inc.3: ; preds = %if.else.3, %for.inc.2
%max1.2.3 = phi i32 [ %4, %for.inc.2 ], [ %max1.2.2, %if.else.3 ]
%max2.2.3 = phi i32 [ %max2.2.2, %for.inc.2 ], [ %4, %if.else.3 ]
%5 = load i32, ptr %arrayidx4, align 16, !tbaa !5
%cmp15.4 = icmp slt i32 %max1.2.3, %5
br i1 %cmp15.4, label %for.inc.4, label %if.else.4
if.else.4: ; preds = %for.inc.3
%cmp20.4 = icmp slt i32 %max2.2.3, %5
br i1 %cmp20.4, label %for.inc.4, label %if.else29
for.inc.4: ; preds = %if.else.4, %for.inc.3
%max1.2.4 = phi i32 [ %5, %for.inc.3 ], [ %max1.2.3, %if.else.4 ]
%max2.2.4 = phi i32 [ %max2.2.3, %for.inc.3 ], [ %5, %if.else.4 ]
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp15.5 = icmp slt i32 %max1.2.4, %6
br i1 %cmp15.5, label %for.inc.5, label %if.else.5
if.else.5: ; preds = %for.inc.4
%cmp20.5 = icmp slt i32 %max2.2.4, %6
br i1 %cmp20.5, label %for.inc.5, label %if.else29
for.inc.5: ; preds = %if.else.5, %for.inc.4
%max1.2.5 = phi i32 [ %6, %for.inc.4 ], [ %max1.2.4, %if.else.5 ]
%max2.2.5 = phi i32 [ %max2.2.4, %for.inc.4 ], [ %6, %if.else.5 ]
%7 = load i32, ptr %arrayidx6, align 8, !tbaa !5
%cmp15.6 = icmp slt i32 %max1.2.5, %7
br i1 %cmp15.6, label %for.inc.6, label %if.else.6
if.else.6: ; preds = %for.inc.5
%cmp20.6 = icmp slt i32 %max2.2.5, %7
br i1 %cmp20.6, label %for.inc.6, label %if.else29
for.inc.6: ; preds = %if.else.6, %for.inc.5
%max1.2.6 = phi i32 [ %7, %for.inc.5 ], [ %max1.2.5, %if.else.6 ]
%max2.2.6 = phi i32 [ %max2.2.5, %for.inc.5 ], [ %7, %if.else.6 ]
%8 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp15.7 = icmp slt i32 %max1.2.6, %8
br i1 %cmp15.7, label %for.inc.7, label %if.else.7
if.else.7: ; preds = %for.inc.6
%cmp20.7 = icmp slt i32 %max2.2.6, %8
br i1 %cmp20.7, label %for.inc.7, label %if.else29
for.inc.7: ; preds = %if.else.7, %for.inc.6
%max1.2.7 = phi i32 [ %8, %for.inc.6 ], [ %max1.2.6, %if.else.7 ]
%max2.2.7 = phi i32 [ %max2.2.6, %for.inc.6 ], [ %8, %if.else.7 ]
%9 = load i32, ptr %arrayidx8, align 16, !tbaa !5
%cmp15.8 = icmp slt i32 %max1.2.7, %9
br i1 %cmp15.8, label %for.inc.8, label %if.else.8
if.else.8: ; preds = %for.inc.7
%cmp20.8 = icmp slt i32 %max2.2.7, %9
br i1 %cmp20.8, label %for.inc.8, label %if.else29
for.inc.8: ; preds = %if.else.8, %for.inc.7
%max1.2.8 = phi i32 [ %9, %for.inc.7 ], [ %max1.2.7, %if.else.8 ]
%max2.2.8 = phi i32 [ %max2.2.7, %for.inc.7 ], [ %9, %if.else.8 ]
%10 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp15.9 = icmp slt i32 %max1.2.8, %10
%cmp20.9 = icmp slt i32 %max2.2.8, %10
%or.cond = select i1 %cmp15.9, i1 true, i1 %cmp20.9
br i1 %or.cond, label %if.end31, label %if.else29
if.else29: ; preds = %for.inc.8, %if.else.1, %if.else.2, %if.else.3, %if.else.4, %if.else.5, %if.else.6, %if.else.7, %if.else.8, %for.body
br label %if.end31
if.end31: ; preds = %for.inc.8, %if.else29
%str.sink = phi ptr [ @str, %if.else29 ], [ @str.4, %for.inc.8 ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
%inc33 = add nuw nsw i32 %i.049, 1
%11 = load i32, ptr %kai, align 4, !tbaa !5
%cmp = icmp slt i32 %inc33, %11
br i1 %cmp, label %for.body, label %for.end34, !llvm.loop !9
for.end34: ; preds = %if.end31, %entry
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %no) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kai) #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>
int n,i,a,b,f,x,y,z;
int main(){
scanf("%d",&n);
while(n--){
scanf("%d",&a);
b=f=0;x=y=1;
for(i=1;i<10;i++){
scanf("%d",&z);
if(a>z && b>z)f=1;
else if(a<z && b<z){
if(a>b)a=z;
else b=z;
}else{
if(a>b)b=z;
else a=z;
}
}
printf("%s\n",(f==0)?("YES"):("NO"));
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182891/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@a = dso_local global i32 0, align 4
@f = dso_local local_unnamed_addr global i32 0, align 4
@b = dso_local local_unnamed_addr global i32 0, align 4
@y = dso_local local_unnamed_addr global i32 0, align 4
@x = dso_local local_unnamed_addr global i32 0, align 4
@i = dso_local local_unnamed_addr global i32 0, align 4
@z = dso_local global i32 0, align 4
@.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:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%dec25 = add nsw i32 %0, -1
store i32 %dec25, ptr @n, align 4, !tbaa !5
%tobool.not26 = icmp eq i32 %0, 0
br i1 %tobool.not26, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a)
store i32 0, ptr @f, align 4, !tbaa !5
store i32 0, ptr @b, align 4, !tbaa !5
store i32 1, ptr @y, align 4, !tbaa !5
store i32 1, ptr @x, align 4, !tbaa !5
store i32 1, ptr @i, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %while.body, %for.inc
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @z)
%1 = load i32, ptr @a, align 4, !tbaa !5
%2 = load i32, ptr @z, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %1, %2
%3 = load i32, ptr @b, align 4
%cmp4 = icmp sgt i32 %3, %2
%or.cond = select i1 %cmp3, i1 %cmp4, i1 false
br i1 %or.cond, label %if.then, label %if.else
if.then: ; preds = %for.body
store i32 1, ptr @f, align 4, !tbaa !5
br label %for.inc
if.else: ; preds = %for.body
%cmp5 = icmp slt i32 %1, %2
%cmp7 = icmp slt i32 %3, %2
%or.cond24 = select i1 %cmp5, i1 %cmp7, i1 false
%cmp9 = icmp sgt i32 %1, %3
br i1 %or.cond24, label %if.then8, label %if.else12
if.then8: ; preds = %if.else
br i1 %cmp9, label %if.then10, label %if.else11
if.then10: ; preds = %if.then8
store i32 %2, ptr @a, align 4, !tbaa !5
br label %for.inc
if.else11: ; preds = %if.then8
store i32 %2, ptr @b, align 4, !tbaa !5
br label %for.inc
if.else12: ; preds = %if.else
br i1 %cmp9, label %if.then14, label %if.else15
if.then14: ; preds = %if.else12
store i32 %2, ptr @b, align 4, !tbaa !5
br label %for.inc
if.else15: ; preds = %if.else12
store i32 %2, ptr @a, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.then, %if.then14, %if.else15, %if.then10, %if.else11
%4 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%cmp = icmp slt i32 %4, 9
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc
%5 = load i32, ptr @f, align 4, !tbaa !5
%cmp19 = icmp eq i32 %5, 0
%cond = select i1 %cmp19, ptr @.str.2, ptr @.str.3
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) %cond)
%6 = load i32, ptr @n, align 4, !tbaa !5
%dec = add nsw i32 %6, -1
store i32 %dec, ptr @n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %6, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %for.end, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main() {
int N, i, a, b, c;
const char *result;
scanf(" %d", &N);
while (N--) {
result = "YES";
b = c = 0;
for (i = 0; i < 10; i++) {
scanf(" %d", &a);
if (b < a)
b = a;
else if (c < a)
c = a;
else
result = "NO";
}
puts(result);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_182949/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_182949/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%dec13 = add nsw i32 %0, -1
store i32 %dec13, ptr %N, align 4, !tbaa !5
%tobool.not14 = icmp eq i32 %0, 0
br i1 %tobool.not14, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.cond.preheader
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 4, !tbaa !5
%cmp2 = icmp sgt i32 %1, 0
%b.1 = call i32 @llvm.smax.i32(i32 %1, i32 0)
%call1.1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.1 = icmp slt i32 %b.1, %2
%cmp3.1 = icmp sgt i32 %2, 0
%.c.0.1 = call i32 @llvm.smax.i32(i32 %2, i32 0)
%b.1.1 = call i32 @llvm.smax.i32(i32 %b.1, i32 %2)
%c.1.1 = select i1 %cmp2.1, i32 0, i32 %.c.0.1
%3 = or i1 %cmp2.1, %cmp3.1
%call1.2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%4 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.2 = icmp slt i32 %b.1.1, %4
%cmp3.2 = icmp slt i32 %c.1.1, %4
%.c.0.2 = call i32 @llvm.smax.i32(i32 %c.1.1, i32 %4)
%b.1.2 = call i32 @llvm.smax.i32(i32 %b.1.1, i32 %4)
%c.1.2 = select i1 %cmp2.2, i32 %c.1.1, i32 %.c.0.2
%5 = select i1 %cmp2.2, i1 true, i1 %cmp3.2
%call1.3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%6 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.3 = icmp slt i32 %b.1.2, %6
%cmp3.3 = icmp slt i32 %c.1.2, %6
%.c.0.3 = call i32 @llvm.smax.i32(i32 %c.1.2, i32 %6)
%b.1.3 = call i32 @llvm.smax.i32(i32 %b.1.2, i32 %6)
%c.1.3 = select i1 %cmp2.3, i32 %c.1.2, i32 %.c.0.3
%7 = select i1 %cmp2.3, i1 true, i1 %cmp3.3
%call1.4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%8 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.4 = icmp slt i32 %b.1.3, %8
%cmp3.4 = icmp slt i32 %c.1.3, %8
%.c.0.4 = call i32 @llvm.smax.i32(i32 %c.1.3, i32 %8)
%b.1.4 = call i32 @llvm.smax.i32(i32 %b.1.3, i32 %8)
%c.1.4 = select i1 %cmp2.4, i32 %c.1.3, i32 %.c.0.4
%9 = select i1 %cmp2.4, i1 true, i1 %cmp3.4
%call1.5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%10 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.5 = icmp slt i32 %b.1.4, %10
%cmp3.5 = icmp slt i32 %c.1.4, %10
%.c.0.5 = call i32 @llvm.smax.i32(i32 %c.1.4, i32 %10)
%b.1.5 = call i32 @llvm.smax.i32(i32 %b.1.4, i32 %10)
%c.1.5 = select i1 %cmp2.5, i32 %c.1.4, i32 %.c.0.5
%11 = select i1 %cmp2.5, i1 true, i1 %cmp3.5
%call1.6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%12 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.6 = icmp slt i32 %b.1.5, %12
%cmp3.6 = icmp slt i32 %c.1.5, %12
%.c.0.6 = call i32 @llvm.smax.i32(i32 %c.1.5, i32 %12)
%b.1.6 = call i32 @llvm.smax.i32(i32 %b.1.5, i32 %12)
%c.1.6 = select i1 %cmp2.6, i32 %c.1.5, i32 %.c.0.6
%13 = select i1 %cmp2.6, i1 true, i1 %cmp3.6
%call1.7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%14 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.7 = icmp slt i32 %b.1.6, %14
%cmp3.7 = icmp slt i32 %c.1.6, %14
%.c.0.7 = call i32 @llvm.smax.i32(i32 %c.1.6, i32 %14)
%b.1.7 = call i32 @llvm.smax.i32(i32 %b.1.6, i32 %14)
%c.1.7 = select i1 %cmp2.7, i32 %c.1.6, i32 %.c.0.7
%15 = select i1 %cmp2.7, i1 true, i1 %cmp3.7
%call1.8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%16 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.8 = icmp slt i32 %b.1.7, %16
%cmp3.8 = icmp slt i32 %c.1.7, %16
%.c.0.8 = call i32 @llvm.smax.i32(i32 %c.1.7, i32 %16)
%b.1.8 = call i32 @llvm.smax.i32(i32 %b.1.7, i32 %16)
%c.1.8 = select i1 %cmp2.8, i32 %c.1.7, i32 %.c.0.8
%17 = select i1 %cmp2.8, i1 true, i1 %cmp3.8
%call1.9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%18 = load i32, ptr %a, align 4, !tbaa !5
%cmp2.9 = icmp slt i32 %b.1.8, %18
%cmp3.9 = icmp slt i32 %c.1.8, %18
%19 = select i1 %cmp2.9, i1 true, i1 %cmp3.9
%20 = select i1 %19, i1 %17, i1 false
%21 = select i1 %20, i1 %15, i1 false
%22 = select i1 %21, i1 %13, i1 false
%23 = select i1 %22, i1 %11, i1 false
%24 = select i1 %23, i1 %9, i1 false
%25 = select i1 %24, i1 %7, i1 false
%26 = select i1 %25, i1 %5, i1 false
%27 = select i1 %26, i1 %3, i1 false
%28 = select i1 %27, i1 %cmp2, i1 false
%result.1.9 = select i1 %28, ptr @.str.1, ptr @.str.2
%call7 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %result.1.9)
%29 = load i32, ptr %N, align 4, !tbaa !5
%dec = add nsw i32 %29, -1
store i32 %dec, ptr %N, align 4, !tbaa !5
%tobool.not = icmp eq i32 %29, 0
br i1 %tobool.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %for.cond.preheader, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 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"}
|
#include<stdio.h>
int main() {
int i,j;
int n;
int s[100005];
int s2[100005];
int result = 0;
scanf("%d", &n);
for (i = 0; i <= 100002; i++) {
s[i] = 0;
s2[i] = 0;
}
for (i = 0; i < n; i++) {
scanf("%d",&s[i]);
}
for (i = 0; i < n; i++) {
if (s[i] <= 100000) {
s2[s[i]]++;
}
else {
s2[100001]++;
}
}
for (i = 1; i < 100001; i++) {
if (s2[i] > i) {
result = result + s2[i]-i;
}
else if (s2[i] < i) {
result = result + s2[i];
}
}
result = result + s2[100001];
printf("%d",result);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183012/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183012/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = alloca [100005 x i32], align 16
%s2 = alloca [100005 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 400020, ptr nonnull %s2) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400012) %s, i8 0, i64 400012, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400012) %s2, i8 0, i64 400012, i1 false), !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp477 = icmp sgt i32 %0, 0
br i1 %cmp477, label %for.body5, label %for.body30.preheader
for.cond12.preheader: ; preds = %for.body5
%cmp1379 = icmp sgt i32 %2, 0
br i1 %cmp1379, label %for.body14.lr.ph, label %for.body30.preheader
for.body14.lr.ph: ; preds = %for.cond12.preheader
%arrayidx23 = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 100001
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 1
%1 = icmp eq i32 %2, 1
br i1 %1, label %for.body30.preheader.loopexit.unr-lcssa, label %for.body14.lr.ph.new
for.body14.lr.ph.new: ; preds = %for.body14.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body5: ; preds = %entry, %for.body5
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body5 ], [ 0, %entry ]
%arrayidx7 = getelementptr inbounds [100005 x i32], ptr %s, 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
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !9
for.body14: ; preds = %for.body14, %for.body14.lr.ph.new
%indvars.iv86 = phi i64 [ 0, %for.body14.lr.ph.new ], [ %indvars.iv.next87.1, %for.body14 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.new ], [ %niter.next.1, %for.body14 ]
%arrayidx16 = getelementptr inbounds [100005 x i32], ptr %s, i64 0, i64 %indvars.iv86
%4 = load i32, ptr %arrayidx16, align 8, !tbaa !5
%cmp17 = icmp slt i32 %4, 100001
%idxprom20 = sext i32 %4 to i64
%arrayidx21 = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 %idxprom20
%arrayidx21.sink95 = select i1 %cmp17, ptr %arrayidx21, ptr %arrayidx23
%5 = load i32, ptr %arrayidx21.sink95, align 4, !tbaa !5
%inc22 = add nsw i32 %5, 1
store i32 %inc22, ptr %arrayidx21.sink95, align 4, !tbaa !5
%indvars.iv.next87 = or i64 %indvars.iv86, 1
%arrayidx16.1 = getelementptr inbounds [100005 x i32], ptr %s, i64 0, i64 %indvars.iv.next87
%6 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%cmp17.1 = icmp slt i32 %6, 100001
%idxprom20.1 = sext i32 %6 to i64
%arrayidx21.1 = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 %idxprom20.1
%arrayidx21.sink95.1 = select i1 %cmp17.1, ptr %arrayidx21.1, ptr %arrayidx23
%7 = load i32, ptr %arrayidx21.sink95.1, align 4, !tbaa !5
%inc22.1 = add nsw i32 %7, 1
store i32 %inc22.1, ptr %arrayidx21.sink95.1, align 4, !tbaa !5
%indvars.iv.next87.1 = add nuw nsw i64 %indvars.iv86, 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.body30.preheader.loopexit.unr-lcssa, label %for.body14, !llvm.loop !11
for.body30.preheader.loopexit.unr-lcssa: ; preds = %for.body14, %for.body14.lr.ph
%indvars.iv86.unr = phi i64 [ 0, %for.body14.lr.ph ], [ %indvars.iv.next87.1, %for.body14 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body30.preheader, label %for.body14.epil
for.body14.epil: ; preds = %for.body30.preheader.loopexit.unr-lcssa
%arrayidx16.epil = getelementptr inbounds [100005 x i32], ptr %s, i64 0, i64 %indvars.iv86.unr
%8 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%cmp17.epil = icmp slt i32 %8, 100001
%idxprom20.epil = sext i32 %8 to i64
%arrayidx21.epil = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 %idxprom20.epil
%arrayidx21.sink95.epil = select i1 %cmp17.epil, ptr %arrayidx21.epil, ptr %arrayidx23
%9 = load i32, ptr %arrayidx21.sink95.epil, align 4, !tbaa !5
%inc22.epil = add nsw i32 %9, 1
store i32 %inc22.epil, ptr %arrayidx21.sink95.epil, align 4, !tbaa !5
br label %for.body30.preheader
for.body30.preheader: ; preds = %for.body14.epil, %for.body30.preheader.loopexit.unr-lcssa, %entry, %for.cond12.preheader
br label %for.body30
for.body30: ; preds = %for.inc47.1, %for.body30.preheader
%indvars.iv89 = phi i64 [ 1, %for.body30.preheader ], [ %indvars.iv.next90.1, %for.inc47.1 ]
%result.082 = phi i32 [ 0, %for.body30.preheader ], [ %result.1.1, %for.inc47.1 ]
%arrayidx32 = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 %indvars.iv89
%10 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp33 = icmp slt i64 %indvars.iv89, %11
br i1 %cmp33, label %if.then34, label %if.else37
if.then34: ; preds = %for.body30
%12 = trunc i64 %indvars.iv89 to i32
%add = sub i32 %result.082, %12
%sub = add i32 %add, %10
br label %for.inc47
if.else37: ; preds = %for.body30
%cmp40 = icmp sgt i64 %indvars.iv89, %11
%add44 = select i1 %cmp40, i32 %10, i32 0
%spec.select = add nsw i32 %add44, %result.082
br label %for.inc47
for.inc47: ; preds = %if.else37, %if.then34
%result.1 = phi i32 [ %sub, %if.then34 ], [ %spec.select, %if.else37 ]
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%arrayidx32.1 = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 %indvars.iv.next90
%13 = load i32, ptr %arrayidx32.1, align 4, !tbaa !5
%14 = sext i32 %13 to i64
%cmp33.1 = icmp slt i64 %indvars.iv.next90, %14
br i1 %cmp33.1, label %if.then34.1, label %if.else37.1
if.else37.1: ; preds = %for.inc47
%cmp40.1.not = icmp slt i64 %indvars.iv89, %14
%add44.1 = select i1 %cmp40.1.not, i32 0, i32 %13
%spec.select.1 = add nsw i32 %add44.1, %result.1
br label %for.inc47.1
if.then34.1: ; preds = %for.inc47
%15 = trunc i64 %indvars.iv.next90 to i32
%add.1 = sub i32 %result.1, %15
%sub.1 = add i32 %add.1, %13
br label %for.inc47.1
for.inc47.1: ; preds = %if.then34.1, %if.else37.1
%result.1.1 = phi i32 [ %sub.1, %if.then34.1 ], [ %spec.select.1, %if.else37.1 ]
%indvars.iv.next90.1 = add nuw nsw i64 %indvars.iv89, 2
%exitcond92.not.1 = icmp eq i64 %indvars.iv.next90.1, 100001
br i1 %exitcond92.not.1, label %for.end49, label %for.body30, !llvm.loop !12
for.end49: ; preds = %for.inc47.1
%arrayidx50 = getelementptr inbounds [100005 x i32], ptr %s2, i64 0, i64 100001
%16 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%add51 = add nsw i32 %16, %result.1.1
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add51)
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %s2) #4
call void @llvm.lifetime.end.p0(i64 400020, ptr nonnull %s) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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}
|
#include <stdio.h>
int main(void)
{
float a, b;
while (scanf("%f %f", &a, &b) != EOF){
if(a < 35.5 && b < 71){
printf("AAA\n");
}
else if(a < 37.5 && b < 77) {
printf("AA\n");
}
else if(a < 40 && b < 83) {
printf("A\n");
}
else if(a < 43 && b < 89) {
printf("B\n");
}
else if(a < 50 && b < 105) {
printf("C\n");
}
else if(a < 55 && b < 116) {
printf("D\n");
}
else if(a < 70 && b < 148) {
printf("E\n");
}
else {
printf("NA\n");
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183056/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183056/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f %f\00", align 1
@str = private unnamed_addr constant [3 x i8] c"NA\00", align 1
@str.9 = private unnamed_addr constant [2 x i8] c"E\00", align 1
@str.10 = private unnamed_addr constant [2 x i8] c"D\00", align 1
@str.11 = private unnamed_addr constant [2 x i8] c"C\00", align 1
@str.12 = private unnamed_addr constant [2 x i8] c"B\00", align 1
@str.13 = private unnamed_addr constant [2 x i8] c"A\00", align 1
@str.14 = private unnamed_addr constant [3 x i8] c"AA\00", align 1
@str.15 = private unnamed_addr constant [4 x i8] c"AAA\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca float, align 4
%b = alloca float, 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
%call75 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not76 = icmp eq i32 %call75, -1
br i1 %cmp.not76, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end61
%0 = load float, ptr %a, align 4, !tbaa !5
%cmp1 = fcmp olt float %0, 3.550000e+01
%1 = load float, ptr %b, align 4
%cmp3 = fcmp olt float %1, 7.100000e+01
%or.cond = select i1 %cmp1, i1 %cmp3, i1 false
br i1 %or.cond, label %if.end61, label %if.else
if.else: ; preds = %while.body
%cmp7 = fcmp olt float %0, 3.750000e+01
%cmp10 = fcmp olt float %1, 7.700000e+01
%or.cond62 = select i1 %cmp7, i1 %cmp10, i1 false
br i1 %or.cond62, label %if.end61, label %if.else14
if.else14: ; preds = %if.else
%cmp15 = fcmp olt float %0, 4.000000e+01
%cmp18 = fcmp olt float %1, 8.300000e+01
%or.cond63 = select i1 %cmp15, i1 %cmp18, i1 false
br i1 %or.cond63, label %if.end61, label %if.else22
if.else22: ; preds = %if.else14
%cmp23 = fcmp olt float %0, 4.300000e+01
%cmp26 = fcmp olt float %1, 8.900000e+01
%or.cond64 = select i1 %cmp23, i1 %cmp26, i1 false
br i1 %or.cond64, label %if.end61, label %if.else30
if.else30: ; preds = %if.else22
%cmp31 = fcmp olt float %0, 5.000000e+01
%cmp34 = fcmp olt float %1, 1.050000e+02
%or.cond65 = select i1 %cmp31, i1 %cmp34, i1 false
br i1 %or.cond65, label %if.end61, label %if.else38
if.else38: ; preds = %if.else30
%cmp39 = fcmp olt float %0, 5.500000e+01
%cmp42 = fcmp olt float %1, 1.160000e+02
%or.cond66 = select i1 %cmp39, i1 %cmp42, i1 false
br i1 %or.cond66, label %if.end61, label %if.else46
if.else46: ; preds = %if.else38
%cmp47 = fcmp olt float %0, 7.000000e+01
%cmp50 = fcmp olt float %1, 1.480000e+02
%or.cond67 = select i1 %cmp47, i1 %cmp50, i1 false
%str.9.str = select i1 %or.cond67, ptr @str.9, ptr @str
br label %if.end61
if.end61: ; preds = %if.else46, %if.else38, %if.else30, %if.else22, %if.else14, %if.else, %while.body
%str.14.sink = phi ptr [ @str.15, %while.body ], [ @str.14, %if.else ], [ @str.13, %if.else14 ], [ @str.12, %if.else22 ], [ @str.11, %if.else30 ], [ @str.10, %if.else38 ], [ %str.9.str, %if.else46 ]
%puts73 = call i32 @puts(ptr nonnull dereferenceable(1) %str.14.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end61, %entry
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 = !{!"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)
{
int i,j,result1=7,result2=7;
double data1,data2;
double set1[7]={35.5,37.5,40,43,50,55,70};
double set2[7]={71,77,83,89,105,116,148};
while((scanf("%lf %lf",&data1,&data2)) != EOF){
for(i=6;i>=0;i--){
if(data1<set1[i])
result1=i;
if(data2<set2[i])
result2=i;
}
if(result1>=result2)
result1=result1;
else
result1=result2;
switch(result1){
case 0:
printf("AAA\n");
break;
case 1:
printf("AA\n");
break;
case 2:
printf("A\n");
break;
case 3:
printf("B\n");
break;
case 4:
printf("C\n");
break;
case 5:
printf("D\n");
break;
case 6:
printf("E\n");
break;
default:
printf("NA\n");
break;
}
result1=7;
result2=7;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183106/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183106/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%lf %lf\00", align 1
@str = private unnamed_addr constant [2 x i8] c"E\00", align 1
@str.9 = private unnamed_addr constant [2 x i8] c"D\00", align 1
@str.10 = private unnamed_addr constant [2 x i8] c"C\00", align 1
@str.11 = private unnamed_addr constant [2 x i8] c"B\00", align 1
@str.12 = private unnamed_addr constant [2 x i8] c"A\00", align 1
@str.13 = private unnamed_addr constant [3 x i8] c"AA\00", align 1
@str.14 = private unnamed_addr constant [4 x i8] c"AAA\00", align 1
@str.15 = private unnamed_addr constant [3 x i8] c"NA\00", align 1
@reltable.main = private unnamed_addr constant [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @str.14 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.13 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.12 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.11 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.10 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @str.9 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)], align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%data1 = alloca double, align 8
%data2 = alloca double, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %data1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %data2) #6
%call43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data1, ptr noundef nonnull %data2)
%cmp.not44 = icmp eq i32 %call43, -1
br i1 %cmp.not44, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %sw.epilog
%0 = load double, ptr %data1, align 8, !tbaa !5
%1 = load double, ptr %data2, align 8, !tbaa !5
%cmp2 = fcmp olt double %0, 7.000000e+01
%result1.2 = select i1 %cmp2, i32 6, i32 7
%cmp5 = fcmp olt double %1, 1.480000e+02
%result2.2 = select i1 %cmp5, i32 6, i32 7
%cmp2.1 = fcmp olt double %0, 5.500000e+01
%result1.2.1 = select i1 %cmp2.1, i32 5, i32 %result1.2
%cmp5.1 = fcmp olt double %1, 1.160000e+02
%result2.2.1 = select i1 %cmp5.1, i32 5, i32 %result2.2
%cmp2.2 = fcmp olt double %0, 5.000000e+01
%result1.2.2 = select i1 %cmp2.2, i32 4, i32 %result1.2.1
%cmp5.2 = fcmp olt double %1, 1.050000e+02
%result2.2.2 = select i1 %cmp5.2, i32 4, i32 %result2.2.1
%cmp2.3 = fcmp olt double %0, 4.300000e+01
%result1.2.3 = select i1 %cmp2.3, i32 3, i32 %result1.2.2
%cmp5.3 = fcmp olt double %1, 8.900000e+01
%result2.2.3 = select i1 %cmp5.3, i32 3, i32 %result2.2.2
%cmp2.4 = fcmp olt double %0, 4.000000e+01
%result1.2.4 = select i1 %cmp2.4, i32 2, i32 %result1.2.3
%cmp5.4 = fcmp olt double %1, 8.300000e+01
%result2.2.4 = select i1 %cmp5.4, i32 2, i32 %result2.2.3
%cmp2.5 = fcmp olt double %0, 3.750000e+01
%result1.2.5 = select i1 %cmp2.5, i32 1, i32 %result1.2.4
%cmp5.5 = fcmp olt double %1, 7.700000e+01
%result2.2.5 = select i1 %cmp5.5, i32 1, i32 %result2.2.4
%cmp2.6 = fcmp olt double %0, 3.550000e+01
%result1.2.6 = select i1 %cmp2.6, i32 0, i32 %result1.2.5
%cmp5.6 = fcmp olt double %1, 7.100000e+01
%result2.2.6 = select i1 %cmp5.6, i32 0, i32 %result2.2.5
%result2.1.result1.1 = call i32 @llvm.smax.i32(i32 %result1.2.6, i32 %result2.2.6)
%2 = icmp ult i32 %result2.1.result1.1, 7
br i1 %2, label %switch.lookup, label %sw.epilog
switch.lookup: ; preds = %for.cond.preheader
%3 = sext i32 %result2.1.result1.1 to i64
%reltable.shift = shl i64 %3, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %sw.epilog
sw.epilog: ; preds = %for.cond.preheader, %switch.lookup
%str.15.sink = phi ptr [ %reltable.intrinsic, %switch.lookup ], [ @str.15, %for.cond.preheader ]
%puts39 = call i32 @puts(ptr nonnull dereferenceable(1) %str.15.sink)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %data1, ptr noundef nonnull %data2)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
while.end: ; preds = %sw.epilog, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %data2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %data1) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 N,i,x;
scanf("%d",&N);
for(i=0;i<2;i++)
{
x=N%10;
if(x==9)
{
printf("Yes");
return 0;
}
N=N/10;
}
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183157/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183157/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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)
%N.promoted = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %N.promoted, 10
%div = sdiv i32 %N.promoted, 10
%cmp1 = icmp eq i32 %rem, 9
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %entry
store i32 %div, ptr %N, align 4, !tbaa !5
%rem.1 = srem i32 %div, 10
%cmp1.1 = icmp eq i32 %rem.1, 9
br i1 %cmp1.1, label %cleanup, label %if.end.1
if.end.1: ; preds = %if.end
%div.1 = sdiv i32 %N.promoted, 100
store i32 %div.1, ptr %N, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %entry, %if.end, %if.end.1
%.str.2.sink = phi ptr [ @.str.2, %if.end.1 ], [ @.str.1, %if.end ], [ @.str.1, %entry ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
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,i,j;
scanf("%d",&n);
i=n/10;
j=n%10;
if (i==9||j==9)
printf("Yes\n");
else
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183207/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
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
%rem = srem i32 %0, 10
%.off = add i32 %0, -90
%cmp = icmp ult i32 %.off, 10
%cmp1 = icmp eq i32 %rem, 9
%or.cond = or i1 %cmp, %cmp1
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
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"}
|
#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a/90==1||a%10==9)printf("Yes\n");
else printf("No\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%.off = add i32 %0, -90
%cmp = icmp ult i32 %.off, 90
%rem = srem i32 %0, 10
%cmp1 = icmp eq i32 %rem, 9
%or.cond = or i1 %cmp, %cmp1
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
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"}
|
#include <stdio.h>
int main(void){
int x;
scanf("%d",&x);
printf(x/10==9||x%10==9?"Yes":"No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183294/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183294/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; 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) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i32, ptr %x, align 4, !tbaa !5
%.off = add i32 %0, -90
%cmp = icmp ult i32 %.off, 10
br i1 %cmp, label %lor.end, label %lor.rhs
lor.rhs: ; preds = %entry
%rem = srem i32 %0, 10
%cmp1 = icmp eq i32 %rem, 9
%1 = select i1 %cmp1, ptr @.str.1, ptr @.str.2
br label %lor.end
lor.end: ; preds = %lor.rhs, %entry
%cond = phi ptr [ @.str.1, %entry ], [ %1, %lor.rhs ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond)
call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF){
int a,b,c=0;
a=n%10;
b=n/10;
if(a==9||b==9)
printf("Yes\n");
else
if(c==0) printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp.not10 = icmp eq i32 %call9, -1
br i1 %cmp.not10, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%0 = load i32, ptr %n, align 4, !tbaa !5
%rem = srem i32 %0, 10
%cmp1 = icmp eq i32 %rem, 9
%.off = add i32 %0, -90
%cmp2 = icmp ult i32 %.off, 10
%or.cond = or i1 %cmp1, %cmp2
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%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 = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIG 2000000007
#define MOD 1000000007
typedef unsigned long long ull;
typedef signed long long sll;
#define N_MAX 200000
#define M_MAX 100000
typedef struct {
int a;
int b;
} hw;
const hw vector8[8] = {
{-1, -1},
{-1, 0},
{-1, +1},
{ 0, -1},
{ 0, +1},
{+1, -1},
{+1, 0},
{+1, +1}
};
ull n, m;
ull h, w;
ull k;
ull va, vb, vc, vd, ve, vf;
// ull a[N_MAX];
sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
// char s[N_MAX + 1];
// char t[N_MAX + 1];
// hw arr[N_MAX];
// hw brr[N_MAX];
// ull digitdp[102][ 2][ 2];
// pos less carry
void swap_adj(ull *a, ull *b){
ull tmp = *b;
*b = *a;
*a = tmp;
return;
}
ull divide(ull a, ull b){
ull x = MOD - 2;
ull ans = 1;
while (x) {
if (x & 1) ans = (ans * b) % MOD;
b = (b * b) % MOD;
x /= 2;
}
return (a * ans) % MOD;
}
int digits(ull x){
int i = 1;
while (x >= 10) {
x /= 10;
i++;
}
return i;
}
int min(ull x, ull y){
return (x < y) ? x : y;
}
ull gcd(ull x, ull y){
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow(ull a, ull x){
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= MOD;
}
x /= 2;
a = (a * a) % MOD;
}
return result;
}
// int nextroute(int arr[]){
// int i = n - 1;
// int j, x;
// while (arr[i - 1] > arr[i]) i--;
// x = n;
// for (j = i; j < n; j++) {
// if (arr[j] < arr[i - 1]) continue;
// if (x == n || arr[x] > arr[j]) x = j;
// }
// arr[i - 1] ^= arr[x];
// arr[x] ^= arr[i - 1];
// arr[i - 1] ^= arr[x];
// qsort(&arr[i], n - i, sizeof(int), comp);
// return 0;
// }
int nibutan_target(ull target){
ull maxdist = (target * (target + 1) / 2); // 時刻targetまでに到着できる距離は[-maxdist, maxdist]
return (n <= maxdist);
}
int targetdig(ull x, int index /* 1-indexed */){
// static...?
int posmax = digits(x);
if (posmax < index) return -1;
while (posmax > index) {
posmax--;
x /= 10;
}
return x % 10;
}
int intcomp(const void *left, const void *right){
if ((*(int*)left) < (*(int*)right)) {
return -1;
} else if ((*(int*)left) > (*(int*)right)) {
return +1;
} else {
return 0;
}
}
int ullcomp(const void *left, const void *right){
if ((*(ull*)left) < (*(ull*)right)) {
return -1;
} else if ((*(ull*)left) > (*(ull*)right)) {
return +1;
} else {
return 0;
}
}
int hwAcomp(const void *left, const void *right){
return intcomp(&(((hw*)left)->a), &(((hw*)right)->a));
}
int hwBcomp(const void *left, const void *right){
return intcomp(&(((hw*)left)->b), &(((hw*)right)->b));
}
int hwABcomp(const void *left, const void *right){
int x = hwAcomp(left, right);
if (x) return x;
return hwBcomp(left, right);
}
int findarr(hw arr[], int length, int h, int w){
int minok = length - 1;
int minng = -1;
while (minng + 1 < minok) {
int med = (minok + minng) / 2;
if (arr[med].a <= h) {
minok = med;
} else {
minng = med;
}
}
if (arr[minok].a != h) return 0;
int maxok = minok;
int maxng = length;
while (maxok + 1 < maxng) {
int med = (maxok + maxng) / 2;
if (arr[med].a <= h) {
maxok = med;
} else {
maxng = med;
}
}
minok = minok;
minng = maxok + 1;
while (minok + 1 < minng) {
int med = (maxok + maxng) / 2;
if (arr[med].b < w) {
minok = med;
} else if (arr[med].b > w) {
minng = med;
} else {
return 1;
}
}
if (arr[minok].a != w) return 0;
return 1;
}
ull solve(){
int i, j;
// int pos, less, carry;
// const int posmax = strlen(s);
// int stackmax = -1;
ull result;
sll sum;
printf("%llu\n", result);
return 0;
}
int main(void){
int i, j;
int x;
int a, b, c;
scanf("%d", &a);
if (a / 10 == 9 || a % 10 == 9) {
puts("Yes");
} else {
puts("No");
}
// solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.hw = type { i32, i32 }
@vector8 = dso_local local_unnamed_addr constant [8 x %struct.hw] [%struct.hw { i32 -1, i32 -1 }, %struct.hw { i32 -1, i32 0 }, %struct.hw { i32 -1, i32 1 }, %struct.hw { i32 0, i32 -1 }, %struct.hw { i32 0, i32 1 }, %struct.hw { i32 1, i32 -1 }, %struct.hw { i32 1, i32 0 }, %struct.hw { i32 1, i32 1 }], align 16
@n = dso_local local_unnamed_addr global i64 0, align 8
@.str = private unnamed_addr constant [6 x i8] c"%llu\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@m = dso_local local_unnamed_addr global i64 0, align 8
@h = dso_local local_unnamed_addr global i64 0, align 8
@w = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@va = dso_local local_unnamed_addr global i64 0, align 8
@vb = dso_local local_unnamed_addr global i64 0, align 8
@vc = dso_local local_unnamed_addr global i64 0, align 8
@vd = dso_local local_unnamed_addr global i64 0, align 8
@ve = dso_local local_unnamed_addr global i64 0, align 8
@vf = dso_local local_unnamed_addr global i64 0, align 8
@a = dso_local local_unnamed_addr global [200000 x i64] zeroinitializer, align 16
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap_adj(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
store i64 %1, ptr %b, align 8, !tbaa !5
store i64 %0, ptr %a, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
br label %while.body
while.body: ; preds = %entry, %if.end
%ans.014 = phi i64 [ 1, %entry ], [ %ans.1, %if.end ]
%x.013 = phi i64 [ 1000000005, %entry ], [ %div11, %if.end ]
%b.addr.012 = phi i64 [ %b, %entry ], [ %rem3, %if.end ]
%and = and i64 %x.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %ans.014, %b.addr.012
%rem = urem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%ans.1 = phi i64 [ %rem, %if.then ], [ %ans.014, %while.body ]
%mul2 = mul i64 %b.addr.012, %b.addr.012
%rem3 = urem i64 %mul2, 1000000007
%div11 = lshr i64 %x.013, 1
%tobool.not = icmp ult i64 %x.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.end
%mul4 = mul i64 %ans.1, %a
%rem5 = urem i64 %mul4, 1000000007
ret i64 %rem5
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @digits(i64 noundef %x) local_unnamed_addr #2 {
entry:
%cmp3 = icmp ugt i64 %x, 9
br i1 %cmp3, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%i.05 = phi i32 [ %inc, %while.body ], [ 1, %entry ]
%x.addr.04 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%div = udiv i64 %x.addr.04, 10
%inc = add nuw nsw i32 %i.05, 1
%cmp = icmp ugt i64 %x.addr.04, 99
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 1, %entry ], [ %inc, %while.body ]
ret i32 %i.0.lcssa
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i64 noundef %x, i64 noundef %y) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
%conv = trunc i64 %cond to i32
ret i32 %conv
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not11 = icmp eq i64 %x, 0
br i1 %tobool.not11, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.014 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%x.addr.013 = phi i64 [ %div10, %if.end ], [ %x, %entry ]
%a.addr.012 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.014, %a.addr.012
%rem = urem i64 %mul, 1000000007
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.014, %while.body ]
%div10 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.012, %a.addr.012
%rem3 = urem i64 %mul2, 1000000007
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @nibutan_target(i64 noundef %target) local_unnamed_addr #4 {
entry:
%add = add i64 %target, 1
%mul = mul i64 %add, %target
%div2 = lshr i64 %mul, 1
%0 = load i64, ptr @n, align 8, !tbaa !5
%cmp = icmp ule i64 %0, %div2
%conv = zext i1 %cmp to i32
ret i32 %conv
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @targetdig(i64 noundef %x, i32 noundef %index) local_unnamed_addr #2 {
entry:
%cmp3.i = icmp ugt i64 %x, 9
br i1 %cmp3.i, label %while.body.i, label %digits.exit
while.body.i: ; preds = %entry, %while.body.i
%i.05.i = phi i32 [ %inc.i, %while.body.i ], [ 1, %entry ]
%x.addr.04.i = phi i64 [ %div.i, %while.body.i ], [ %x, %entry ]
%div.i = udiv i64 %x.addr.04.i, 10
%inc.i = add nuw nsw i32 %i.05.i, 1
%cmp.i = icmp ugt i64 %x.addr.04.i, 99
br i1 %cmp.i, label %while.body.i, label %digits.exit, !llvm.loop !11
digits.exit: ; preds = %while.body.i, %entry
%i.0.lcssa.i = phi i32 [ 1, %entry ], [ %inc.i, %while.body.i ]
%cmp = icmp slt i32 %i.0.lcssa.i, %index
br i1 %cmp, label %cleanup, label %while.cond.preheader
while.cond.preheader: ; preds = %digits.exit
%cmp17 = icmp sgt i32 %i.0.lcssa.i, %index
br i1 %cmp17, label %while.body.preheader, label %while.end
while.body.preheader: ; preds = %while.cond.preheader
%0 = sub i32 %i.0.lcssa.i, %index
%1 = xor i32 %index, -1
%2 = add i32 %i.0.lcssa.i, %1
%xtraiter = and i32 %0, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %while.body.prol.loopexit, label %while.body.prol
while.body.prol: ; preds = %while.body.preheader, %while.body.prol
%posmax.09.prol = phi i32 [ %dec.prol, %while.body.prol ], [ %i.0.lcssa.i, %while.body.preheader ]
%x.addr.08.prol = phi i64 [ %div.prol, %while.body.prol ], [ %x, %while.body.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %while.body.prol ], [ 0, %while.body.preheader ]
%dec.prol = add nsw i32 %posmax.09.prol, -1
%div.prol = udiv i64 %x.addr.08.prol, 10
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %while.body.prol.loopexit, label %while.body.prol, !llvm.loop !13
while.body.prol.loopexit: ; preds = %while.body.prol, %while.body.preheader
%posmax.09.unr = phi i32 [ %i.0.lcssa.i, %while.body.preheader ], [ %dec.prol, %while.body.prol ]
%x.addr.08.unr = phi i64 [ %x, %while.body.preheader ], [ %div.prol, %while.body.prol ]
%div.lcssa.unr = phi i64 [ undef, %while.body.preheader ], [ %div.prol, %while.body.prol ]
%3 = icmp ult i32 %2, 3
br i1 %3, label %while.end, label %while.body
while.body: ; preds = %while.body.prol.loopexit, %while.body
%posmax.09 = phi i32 [ %dec.3, %while.body ], [ %posmax.09.unr, %while.body.prol.loopexit ]
%x.addr.08 = phi i64 [ %div.3, %while.body ], [ %x.addr.08.unr, %while.body.prol.loopexit ]
%dec.3 = add nsw i32 %posmax.09, -4
%div.3 = udiv i64 %x.addr.08, 10000
%cmp1.3 = icmp sgt i32 %dec.3, %index
br i1 %cmp1.3, label %while.body, label %while.end, !llvm.loop !15
while.end: ; preds = %while.body.prol.loopexit, %while.body, %while.cond.preheader
%x.addr.0.lcssa = phi i64 [ %x, %while.cond.preheader ], [ %div.lcssa.unr, %while.body.prol.loopexit ], [ %div.3, %while.body ]
%rem = urem i64 %x.addr.0.lcssa, 10
%conv = trunc i64 %rem to i32
br label %cleanup
cleanup: ; preds = %digits.exit, %while.end
%retval.0 = phi i32 [ %conv, %while.end ], [ -1, %digits.exit ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @intcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !16
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp sgt i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !5
%1 = load i64, ptr %right, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cmp1 = icmp ugt i64 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @hwAcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !16
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp.i = icmp slt i32 %0, %1
%cmp1.i = icmp sgt i32 %0, %1
%..i = zext i1 %cmp1.i to i32
%retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i
ret i32 %retval.0.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @hwBcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%b = getelementptr inbounds %struct.hw, ptr %left, i64 0, i32 1
%b1 = getelementptr inbounds %struct.hw, ptr %right, i64 0, i32 1
%0 = load i32, ptr %b, align 4, !tbaa !16
%1 = load i32, ptr %b1, align 4, !tbaa !16
%cmp.i = icmp slt i32 %0, %1
%cmp1.i = icmp sgt i32 %0, %1
%..i = zext i1 %cmp1.i to i32
%retval.0.i = select i1 %cmp.i, i32 -1, i32 %..i
ret i32 %retval.0.i
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @hwABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %left, align 4, !tbaa !16
%1 = load i32, ptr %right, align 4, !tbaa !16
%cmp.i.i = icmp slt i32 %0, %1
%cmp1.i.i = icmp sgt i32 %0, %1
%..i.i = zext i1 %cmp1.i.i to i32
%retval.0.i.i = select i1 %cmp.i.i, i32 -1, i32 %..i.i
%tobool.not = icmp eq i32 %retval.0.i.i, 0
br i1 %tobool.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%b.i = getelementptr inbounds %struct.hw, ptr %left, i64 0, i32 1
%b1.i = getelementptr inbounds %struct.hw, ptr %right, i64 0, i32 1
%2 = load i32, ptr %b.i, align 4, !tbaa !16
%3 = load i32, ptr %b1.i, align 4, !tbaa !16
%cmp.i.i5 = icmp slt i32 %2, %3
%cmp1.i.i6 = icmp sgt i32 %2, %3
%..i.i7 = zext i1 %cmp1.i.i6 to i32
%retval.0.i.i8 = select i1 %cmp.i.i5, i32 -1, i32 %..i.i7
br label %cleanup
cleanup: ; preds = %entry, %if.end
%retval.0 = phi i32 [ %retval.0.i.i8, %if.end ], [ %retval.0.i.i, %entry ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @findarr(ptr nocapture noundef readonly %arr, i32 noundef %length, i32 noundef %h, i32 noundef %w) local_unnamed_addr #6 {
entry:
%sub = add nsw i32 %length, -1
%cmp90 = icmp sgt i32 %length, 1
br i1 %cmp90, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%minok.092 = phi i32 [ %minok.0.div, %while.body ], [ %sub, %entry ]
%minng.091 = phi i32 [ %div.minng.0, %while.body ], [ -1, %entry ]
%add1 = add nsw i32 %minok.092, %minng.091
%div = sdiv i32 %add1, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !18
%cmp2.not = icmp sgt i32 %0, %h
%div.minng.0 = select i1 %cmp2.not, i32 %div, i32 %minng.091
%minok.0.div = select i1 %cmp2.not, i32 %minok.092, i32 %div
%add = add nsw i32 %div.minng.0, 1
%cmp = icmp slt i32 %add, %minok.0.div
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%minok.0.lcssa = phi i32 [ %sub, %entry ], [ %minok.0.div, %while.body ]
%idxprom3 = sext i32 %minok.0.lcssa to i64
%arrayidx4 = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom3
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !18
%cmp6.not = icmp eq i32 %1, %h
br i1 %cmp6.not, label %while.cond9.preheader, label %cleanup54
while.cond9.preheader: ; preds = %while.end
%add1093 = add nsw i32 %minok.0.lcssa, 1
%cmp1194 = icmp slt i32 %add1093, %length
br i1 %cmp1194, label %while.body12, label %while.end45
while.cond25.preheader: ; preds = %while.body12
%cmp27101 = icmp slt i32 %minok.0.lcssa, %maxok.0.div15
br i1 %cmp27101, label %while.body28.lr.ph, label %while.end45
while.body28.lr.ph: ; preds = %while.cond25.preheader
%add30 = add nsw i32 %div15.maxng.0, %maxok.0.div15
%div31 = sdiv i32 %add30, 2
%idxprom32 = sext i32 %div31 to i64
%b = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom32, i32 1
%2 = load i32, ptr %b, align 4, !tbaa !21
%cmp34 = icmp slt i32 %2, %w
br i1 %cmp34, label %while.body28.lr.ph.split.us, label %while.body28.lr.ph.split
while.body28.lr.ph.split.us: ; preds = %while.body28.lr.ph
%cmp27.us = icmp slt i32 %div31, %maxok.0.div15
br i1 %cmp27.us, label %while.body28.us, label %while.body28.lr.ph.split.us.while.end45_crit_edge, !llvm.loop !22
while.body28.lr.ph.split.us.while.end45_crit_edge: ; preds = %while.body28.lr.ph.split.us
%arrayidx47.phi.trans.insert = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom32
%.pre = load i32, ptr %arrayidx47.phi.trans.insert, align 4, !tbaa !18
br label %while.end45
while.body28.us: ; preds = %while.body28.lr.ph.split.us, %while.body28.us
br label %while.body28.us
while.body28.lr.ph.split: ; preds = %while.body28.lr.ph
%cmp40 = icmp sgt i32 %2, %w
br i1 %cmp40, label %while.body28.lr.ph.split.split, label %cleanup54
while.body28.lr.ph.split.split: ; preds = %while.body28.lr.ph.split
%cmp27 = icmp slt i32 %add1093, %div31
br i1 %cmp27, label %while.body28, label %while.end45, !llvm.loop !22
while.body12: ; preds = %while.cond9.preheader, %while.body12
%maxng.096 = phi i32 [ %div15.maxng.0, %while.body12 ], [ %length, %while.cond9.preheader ]
%maxok.095 = phi i32 [ %maxok.0.div15, %while.body12 ], [ %minok.0.lcssa, %while.cond9.preheader ]
%add14 = add nsw i32 %maxng.096, %maxok.095
%div15 = sdiv i32 %add14, 2
%idxprom16 = sext i32 %div15 to i64
%arrayidx17 = getelementptr inbounds %struct.hw, ptr %arr, i64 %idxprom16
%3 = load i32, ptr %arrayidx17, align 4, !tbaa !18
%cmp19.not = icmp sgt i32 %3, %h
%maxok.0.div15 = select i1 %cmp19.not, i32 %maxok.095, i32 %div15
%div15.maxng.0 = select i1 %cmp19.not, i32 %div15, i32 %maxng.096
%add10 = add nsw i32 %maxok.0.div15, 1
%cmp11 = icmp slt i32 %add10, %div15.maxng.0
br i1 %cmp11, label %while.body12, label %while.cond25.preheader, !llvm.loop !23
while.body28: ; preds = %while.body28.lr.ph.split.split, %while.body28
br label %while.body28
while.end45: ; preds = %while.cond9.preheader, %while.body28.lr.ph.split.us.while.end45_crit_edge, %while.body28.lr.ph.split.split, %while.cond25.preheader
%4 = phi i32 [ %.pre, %while.body28.lr.ph.split.us.while.end45_crit_edge ], [ %h, %while.body28.lr.ph.split.split ], [ %h, %while.cond25.preheader ], [ %h, %while.cond9.preheader ]
%cmp49.not = icmp eq i32 %4, %w
%. = zext i1 %cmp49.not to i32
br label %cleanup54
cleanup54: ; preds = %while.body28.lr.ph.split, %while.end45, %while.end
%retval.3 = phi i32 [ 0, %while.end ], [ %., %while.end45 ], [ 1, %while.body28.lr.ph.split ]
ret i32 %retval.3
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #7 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef undef)
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #7 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #10
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !16
%.off = add i32 %0, -90
%cmp = icmp ult i32 %.off, 10
%rem = srem i32 %0, 10
%cmp1 = icmp eq i32 %rem, 9
%or.cond = or i1 %cmp, %cmp1
%.str.2..str.3 = select i1 %or.cond, ptr @.str.2, ptr @.str.3
%call3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #10
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #8
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #9
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree norecurse nosync nounwind memory(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 nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !17, i64 0}
!19 = !{!"", !17, i64 0, !17, i64 4}
!20 = distinct !{!20, !10}
!21 = !{!19, !17, i64 4}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
|
#include <stdio.h>
int main()
{
char S[100];
char T[100];
scanf("%s %s",S, T);
printf("%s%s\n",T, S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100 x i8], align 16
%T = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %T)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %T, ptr noundef nonnull %S)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include <stdio.h>
int main(){
char a[101];
char b[101];
scanf("%s %s",a,b);
printf("%s%s",b,a);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183517/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183517/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [101 x i8], align 16
%b = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %b, ptr noundef nonnull %a)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 101, 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)"}
|
#include<stdio.h>
int main(){
char S[100];
char T[100];
scanf("%s %s",&S,&T);
printf("%s%s",T,S);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183560/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183560/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%s %s\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%s%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%S = alloca [100 x i8], align 16
%T = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S, ptr noundef nonnull %T)
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %T, ptr noundef nonnull %S)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(){
char s[101],t[101]; scanf("%s%s",s,t);
printf("%s%s\n",t,s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183603/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183603/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
%t = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %t, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
#include<string.h>
int main(){
char x[100],y[100];
scanf("%s%s",x,y);
printf("%s%s\n",y,x);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183647/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183647/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%s%s\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [100 x i8], align 16
%y = alloca [100 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %y, ptr noundef nonnull %x)
call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 100, 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)"}
|
#include <stdio.h>
int main(int argc, char const *argv[]) {
char S[110];
char T[110];
scanf("%s", S);
scanf("%s", T);
printf("%s", T);
printf("%s\n", S);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183690/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183690/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%S = alloca [110 x i8], align 16
%T = alloca [110 x i8], align 16
call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %S) #4
call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %T) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %S)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %T)
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %S)
call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %S) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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)"}
|
#include<stdio.h>
int main(void){
char s[101],t[101],*pt,*pt2;
scanf("%s%s",s,t);
pt=&s[0];
pt2=&t[0];
while(*pt2){
printf("%c",*pt2);
pt2++;
}
while(*pt){
printf("%c",*pt);
pt++;
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183733/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183733/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
%t = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t)
%0 = load i8, ptr %t, align 16, !tbaa !5
%tobool.not19 = icmp eq i8 %0, 0
br i1 %tobool.not19, label %while.cond4.preheader, label %while.body
while.cond4.preheader: ; preds = %while.body, %entry
%1 = load i8, ptr %s, align 16, !tbaa !5
%tobool5.not21 = icmp eq i8 %1, 0
br i1 %tobool5.not21, label %while.end10, label %while.body6
while.body: ; preds = %entry, %while.body
%2 = phi i8 [ %3, %while.body ], [ %0, %entry ]
%pt2.020 = phi ptr [ %incdec.ptr, %while.body ], [ %t, %entry ]
%conv = sext i8 %2 to i32
%putchar18 = call i32 @putchar(i32 %conv)
%incdec.ptr = getelementptr inbounds i8, ptr %pt2.020, i64 1
%3 = load i8, ptr %incdec.ptr, align 1, !tbaa !5
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %while.cond4.preheader, label %while.body, !llvm.loop !8
while.body6: ; preds = %while.cond4.preheader, %while.body6
%4 = phi i8 [ %5, %while.body6 ], [ %1, %while.cond4.preheader ]
%pt.022 = phi ptr [ %incdec.ptr9, %while.body6 ], [ %s, %while.cond4.preheader ]
%conv7 = sext i8 %4 to i32
%putchar17 = call i32 @putchar(i32 %conv7)
%incdec.ptr9 = getelementptr inbounds i8, ptr %pt.022, i64 1
%5 = load i8, ptr %incdec.ptr9, align 1, !tbaa !5
%tobool5.not = icmp eq i8 %5, 0
br i1 %tobool5.not, label %while.end10, label %while.body6, !llvm.loop !10
while.end10: ; preds = %while.body6, %while.cond4.preheader
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include<stdio.h>
int main(void)
{
char s[101],t[101];
scanf("%s%s",s,t);
printf("%s%s",t,s);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183777/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183777/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%s%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [101 x i8], align 16
%t = alloca [101 x i8], align 16
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 101, ptr nonnull %t) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s, ptr noundef nonnull %t)
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %t, ptr noundef nonnull %s)
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %t) #3
call void @llvm.lifetime.end.p0(i64 101, ptr nonnull %s) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main()
{
int i,j,n,m;
scanf("%d",&n);
int count[3],flag=0;
count[0]=0;
count[1]=0;
count[2]=0;
for(i=0;i<n;i++)
{
scanf("%d",&m);
if(m==25) count[0]++;
if(m==50)
{
if(count[0])
{
count[0]--;
count[1]++;
}
else flag=1;
}
if(m==100)
{
if(count[1] && count[0])
{
count[1]--;
count[0]--;
}
else if(count[0]>2)
{
count[0] -= 3;
}
else flag=1;
}
}
if(flag) printf("NO\n");
else printf("YES\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_18382/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_18382/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [4 x i8] c"YES\00", align 1
@str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %0, 0
br i1 %cmp58, label %for.body.outer, label %if.else39
for.body.outer: ; preds = %entry, %for.inc
%flag.062.ph = phi i32 [ %flag.2, %for.inc ], [ 0, %entry ]
%count.sroa.0.061.ph = phi i32 [ %count.sroa.0.3, %for.inc ], [ 0, %entry ]
%count.sroa.14.060.ph = phi i32 [ %count.sroa.14.2, %for.inc ], [ 0, %entry ]
%i.059.ph = phi i32 [ %inc35, %for.inc ], [ 0, %entry ]
%call3.peel = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp4.peel = icmp eq i32 %1, 25
%inc.peel = zext i1 %cmp4.peel to i32
%spec.select.peel = add nsw i32 %count.sroa.0.061.ph, %inc.peel
switch i32 %1, label %for.inc [
i32 50, label %if.then7.peel
i32 100, label %if.then16
]
if.then7.peel: ; preds = %for.body.outer
%tobool.not.peel = icmp eq i32 %spec.select.peel, 0
br i1 %tobool.not.peel, label %for.inc.thread.peel, label %if.then9
for.inc.thread.peel: ; preds = %if.then7.peel
%inc3567.peel = add nuw nsw i32 %i.059.ph, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp68.peel = icmp slt i32 %inc3567.peel, %2
br i1 %cmp68.peel, label %for.body, label %if.end41
for.body: ; preds = %for.inc.thread.peel, %for.inc.thread
%i.059 = phi i32 [ %inc3567, %for.inc.thread ], [ %inc3567.peel, %for.inc.thread.peel ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !5
%cmp4 = icmp eq i32 %3, 25
switch i32 %3, label %for.inc.loopexit.loopexit [
i32 50, label %if.then7
i32 100, label %if.then16.loopexit
]
if.then7: ; preds = %for.body
br i1 %cmp4, label %if.then9.loopexit, label %for.inc.thread
if.then9.loopexit: ; preds = %if.then7
%inc.le = zext i1 %cmp4 to i32
br label %if.then9
if.then9: ; preds = %if.then9.loopexit, %if.then7.peel
%flag.062.lcssa100 = phi i32 [ %flag.062.ph, %if.then7.peel ], [ 1, %if.then9.loopexit ]
%i.059.lcssa96 = phi i32 [ %i.059.ph, %if.then7.peel ], [ %i.059, %if.then9.loopexit ]
%spec.select.lcssa93 = phi i32 [ %spec.select.peel, %if.then7.peel ], [ %inc.le, %if.then9.loopexit ]
%dec = add nsw i32 %spec.select.lcssa93, -1
%inc12 = add nsw i32 %count.sroa.14.060.ph, 1
br label %for.inc
if.then16.loopexit: ; preds = %for.body
%inc.le111 = zext i1 %cmp4 to i32
br label %if.then16
if.then16: ; preds = %if.then16.loopexit, %for.body.outer
%flag.062.lcssa99 = phi i32 [ %flag.062.ph, %for.body.outer ], [ 1, %if.then16.loopexit ]
%i.059.lcssa95 = phi i32 [ %i.059.ph, %for.body.outer ], [ %i.059, %if.then16.loopexit ]
%spec.select.lcssa92 = phi i32 [ %spec.select.peel, %for.body.outer ], [ %inc.le111, %if.then16.loopexit ]
%tobool18 = icmp ne i32 %count.sroa.14.060.ph, 0
%tobool20 = icmp ne i32 %spec.select.lcssa92, 0
%or.cond = select i1 %tobool18, i1 %tobool20, i1 false
br i1 %or.cond, label %if.then21, label %if.else26
if.then21: ; preds = %if.then16
%dec23 = add nsw i32 %count.sroa.14.060.ph, -1
%dec25 = add nsw i32 %spec.select.lcssa92, -1
br label %for.inc
if.else26: ; preds = %if.then16
%cmp28 = icmp sgt i32 %spec.select.lcssa92, 2
%sub = add nsw i32 %spec.select.lcssa92, -3
%spec.select52 = select i1 %cmp28, i32 %sub, i32 %spec.select.lcssa92
%spec.select53 = select i1 %cmp28, i32 %flag.062.lcssa99, i32 1
br label %for.inc
for.inc.loopexit.loopexit: ; preds = %for.body
%inc.le113 = zext i1 %cmp4 to i32
br label %for.inc
for.inc: ; preds = %for.body.outer, %for.inc.loopexit.loopexit, %if.then9, %if.else26, %if.then21
%i.05998 = phi i32 [ %i.059.lcssa95, %if.then21 ], [ %i.059.lcssa95, %if.else26 ], [ %i.059.lcssa96, %if.then9 ], [ %i.059.ph, %for.body.outer ], [ %i.059, %for.inc.loopexit.loopexit ]
%count.sroa.14.2 = phi i32 [ %dec23, %if.then21 ], [ %count.sroa.14.060.ph, %if.else26 ], [ %inc12, %if.then9 ], [ %count.sroa.14.060.ph, %for.inc.loopexit.loopexit ], [ %count.sroa.14.060.ph, %for.body.outer ]
%count.sroa.0.3 = phi i32 [ %dec25, %if.then21 ], [ %spec.select52, %if.else26 ], [ %dec, %if.then9 ], [ %spec.select.peel, %for.body.outer ], [ %inc.le113, %for.inc.loopexit.loopexit ]
%flag.2 = phi i32 [ %flag.062.lcssa99, %if.then21 ], [ %spec.select53, %if.else26 ], [ %flag.062.lcssa100, %if.then9 ], [ %flag.062.ph, %for.body.outer ], [ 1, %for.inc.loopexit.loopexit ]
%inc35 = add nuw nsw i32 %i.05998, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc35, %4
br i1 %cmp, label %for.body.outer, label %for.end, !llvm.loop !9
for.inc.thread: ; preds = %if.then7
%inc3567 = add nuw nsw i32 %i.059, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp68 = icmp slt i32 %inc3567, %5
br i1 %cmp68, label %for.body, label %if.end41, !llvm.loop !11
for.end: ; preds = %for.inc
%6 = icmp eq i32 %flag.2, 0
br i1 %6, label %if.else39, label %if.end41
if.else39: ; preds = %entry, %for.end
br label %if.end41
if.end41: ; preds = %for.inc.thread, %for.inc.thread.peel, %for.end, %if.else39
%str.sink = phi ptr [ @str, %if.else39 ], [ @str.3, %for.end ], [ @str.3, %for.inc.thread.peel ], [ @str.3, %for.inc.thread ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int in(void){
int i;scanf("%d",&i);
return i;
}
long long llin(void){
long long i;scanf("%lld",&i);
return i;
}
void chin(char s[]){
scanf("%s",s);
}
void print(int a){
printf("%d\n",a);
}
void llprint(long long a){
printf("%lld\n",a);
}
void print2(int a,int b){
printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
return a>b?a:b;
}
long long min(long long a,long long b){
return a<b?a:b;
}
int main(void){
int n=in(),m=in(),i,j,c,t[100]={},g[100][100]={},a[100]={};
for(i=0;i<m;i++){
t[i]=in();
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
g[i][j]=in();
}
}
for(i=0;i<m;i++){
c=0;
for(j=0;j<n;j++){
if(t[i]==g[i][j]){
a[j]++;
}
else{
c++;
}
}
a[t[i]-1]+=c;
}
for(i=0;i<n;i++){
print(a[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183863/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183863/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.5 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @in() local_unnamed_addr #0 {
entry:
%i = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i)
%0 = load i32, ptr %i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i) #6
ret i32 %0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @llin() local_unnamed_addr #0 {
entry:
%i = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %i) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %i)
%0 = load i64, ptr %i, align 8, !tbaa !9
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %i) #6
ret i64 %0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @chin(ptr noundef %s) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %s)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print(i32 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %a)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local void @llprint(i64 noundef %a) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %a)
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @print2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %a, i32 noundef %b)
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @max(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @min(i64 noundef %a, i64 noundef %b) local_unnamed_addr #3 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i.i83 = alloca i32, align 4
%i.i81 = alloca i32, align 4
%i.i79 = alloca i32, align 4
%i.i = alloca i32, align 4
%t = alloca [100 x i32], align 16
%g = alloca [100 x [100 x i32]], align 16
%a = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i) #6
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i)
%0 = load i32, ptr %i.i, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i79) #6
%call.i80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i79)
%1 = load i32, ptr %i.i79, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i79) #6
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %t) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %t, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %g) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40000) %g, i8 0, i64 40000, i1 false)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %a, i8 0, i64 400, i1 false)
%cmp86 = icmp sgt i32 %1, 0
br i1 %cmp86, label %for.body.preheader, label %for.cond47.preheader
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %1 to i64
br label %for.body
for.cond3.preheader: ; preds = %for.body
br i1 %cmp86, label %for.cond6.preheader.lr.ph, label %for.cond47.preheader
for.cond6.preheader.lr.ph: ; preds = %for.cond3.preheader
%cmp788 = icmp sgt i32 %0, 0
br i1 %cmp788, label %for.cond6.preheader.us.preheader, label %for.end54
for.cond6.preheader.us.preheader: ; preds = %for.cond6.preheader.lr.ph
%wide.trip.count110 = zext i32 %1 to i64
%wide.trip.count105 = zext i32 %0 to i64
br label %for.cond6.preheader.us
for.cond6.preheader.us: ; preds = %for.cond6.preheader.us.preheader, %for.cond6.for.inc17_crit_edge.us
%indvars.iv107 = phi i64 [ 0, %for.cond6.preheader.us.preheader ], [ %indvars.iv.next108, %for.cond6.for.inc17_crit_edge.us ]
br label %for.body8.us
for.body8.us: ; preds = %for.cond6.preheader.us, %for.body8.us
%indvars.iv102 = phi i64 [ 0, %for.cond6.preheader.us ], [ %indvars.iv.next103, %for.body8.us ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i83) #6
%call.i84.us = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i83)
%2 = load i32, ptr %i.i83, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i83) #6
%arrayidx13.us = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %indvars.iv107, i64 %indvars.iv102
store i32 %2, ptr %arrayidx13.us, align 4, !tbaa !5
%indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
%exitcond106.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count105
br i1 %exitcond106.not, label %for.cond6.for.inc17_crit_edge.us, label %for.body8.us, !llvm.loop !11
for.cond6.for.inc17_crit_edge.us: ; preds = %for.body8.us
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count110
br i1 %exitcond111.not, label %for.cond20.preheader, label %for.cond6.preheader.us, !llvm.loop !13
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %i.i81) #6
%call.i82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i.i81)
%3 = load i32, ptr %i.i81, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %i.i81) #6
%arrayidx = getelementptr inbounds [100 x i32], ptr %t, i64 0, i64 %indvars.iv
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond3.preheader, label %for.body, !llvm.loop !14
for.cond20.preheader: ; preds = %for.cond6.for.inc17_crit_edge.us
br i1 %cmp86, label %for.cond23.preheader.lr.ph, label %for.cond47.preheader
for.cond23.preheader.lr.ph: ; preds = %for.cond20.preheader
%cmp2492 = icmp sgt i32 %0, 0
br i1 %cmp2492, label %for.cond23.preheader.us.preheader, label %for.end54
for.cond23.preheader.us.preheader: ; preds = %for.cond23.preheader.lr.ph
%wide.trip.count120 = zext i32 %1 to i64
%xtraiter = and i64 %wide.trip.count105, 1
%4 = icmp eq i32 %0, 1
%unroll_iter = and i64 %wide.trip.count105, 4294967294
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond23.preheader.us
for.cond23.preheader.us: ; preds = %for.cond23.preheader.us.preheader, %for.cond23.for.end39_crit_edge.us
%indvars.iv117 = phi i64 [ 0, %for.cond23.preheader.us.preheader ], [ %indvars.iv.next118, %for.cond23.for.end39_crit_edge.us ]
%arrayidx27.us = getelementptr inbounds [100 x i32], ptr %t, i64 0, i64 %indvars.iv117
%5 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5
br i1 %4, label %for.cond23.for.end39_crit_edge.us.unr-lcssa, label %for.body25.us
for.body25.us: ; preds = %for.cond23.preheader.us, %for.inc37.us.1
%indvars.iv112 = phi i64 [ %indvars.iv.next113.1, %for.inc37.us.1 ], [ 0, %for.cond23.preheader.us ]
%c.094.us = phi i32 [ %c.1.us.1, %for.inc37.us.1 ], [ 0, %for.cond23.preheader.us ]
%niter = phi i64 [ %niter.next.1, %for.inc37.us.1 ], [ 0, %for.cond23.preheader.us ]
%arrayidx31.us = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %indvars.iv117, i64 %indvars.iv112
%6 = load i32, ptr %arrayidx31.us, align 8, !tbaa !5
%cmp32.us = icmp eq i32 %5, %6
br i1 %cmp32.us, label %if.then.us, label %if.else.us
if.else.us: ; preds = %for.body25.us
%inc36.us = add nsw i32 %c.094.us, 1
br label %for.inc37.us
if.then.us: ; preds = %for.body25.us
%arrayidx34.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv112
%7 = load i32, ptr %arrayidx34.us, align 8, !tbaa !5
%inc35.us = add nsw i32 %7, 1
store i32 %inc35.us, ptr %arrayidx34.us, align 8, !tbaa !5
br label %for.inc37.us
for.inc37.us: ; preds = %if.then.us, %if.else.us
%c.1.us = phi i32 [ %c.094.us, %if.then.us ], [ %inc36.us, %if.else.us ]
%indvars.iv.next113 = or i64 %indvars.iv112, 1
%arrayidx31.us.1 = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %indvars.iv117, i64 %indvars.iv.next113
%8 = load i32, ptr %arrayidx31.us.1, align 4, !tbaa !5
%cmp32.us.1 = icmp eq i32 %5, %8
br i1 %cmp32.us.1, label %if.then.us.1, label %if.else.us.1
if.else.us.1: ; preds = %for.inc37.us
%inc36.us.1 = add nsw i32 %c.1.us, 1
br label %for.inc37.us.1
if.then.us.1: ; preds = %for.inc37.us
%arrayidx34.us.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next113
%9 = load i32, ptr %arrayidx34.us.1, align 4, !tbaa !5
%inc35.us.1 = add nsw i32 %9, 1
store i32 %inc35.us.1, ptr %arrayidx34.us.1, align 4, !tbaa !5
br label %for.inc37.us.1
for.inc37.us.1: ; preds = %if.then.us.1, %if.else.us.1
%c.1.us.1 = phi i32 [ %c.1.us, %if.then.us.1 ], [ %inc36.us.1, %if.else.us.1 ]
%indvars.iv.next113.1 = add nuw nsw i64 %indvars.iv112, 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.cond23.for.end39_crit_edge.us.unr-lcssa, label %for.body25.us, !llvm.loop !15
for.cond23.for.end39_crit_edge.us.unr-lcssa: ; preds = %for.inc37.us.1, %for.cond23.preheader.us
%c.1.us.lcssa.ph = phi i32 [ undef, %for.cond23.preheader.us ], [ %c.1.us.1, %for.inc37.us.1 ]
%indvars.iv112.unr = phi i64 [ 0, %for.cond23.preheader.us ], [ %indvars.iv.next113.1, %for.inc37.us.1 ]
%c.094.us.unr = phi i32 [ 0, %for.cond23.preheader.us ], [ %c.1.us.1, %for.inc37.us.1 ]
br i1 %lcmp.mod.not, label %for.cond23.for.end39_crit_edge.us, label %for.body25.us.epil
for.body25.us.epil: ; preds = %for.cond23.for.end39_crit_edge.us.unr-lcssa
%arrayidx31.us.epil = getelementptr inbounds [100 x [100 x i32]], ptr %g, i64 0, i64 %indvars.iv117, i64 %indvars.iv112.unr
%10 = load i32, ptr %arrayidx31.us.epil, align 4, !tbaa !5
%cmp32.us.epil = icmp eq i32 %5, %10
br i1 %cmp32.us.epil, label %if.then.us.epil, label %if.else.us.epil
if.else.us.epil: ; preds = %for.body25.us.epil
%inc36.us.epil = add nsw i32 %c.094.us.unr, 1
br label %for.cond23.for.end39_crit_edge.us
if.then.us.epil: ; preds = %for.body25.us.epil
%arrayidx34.us.epil = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv112.unr
%11 = load i32, ptr %arrayidx34.us.epil, align 4, !tbaa !5
%inc35.us.epil = add nsw i32 %11, 1
store i32 %inc35.us.epil, ptr %arrayidx34.us.epil, align 4, !tbaa !5
br label %for.cond23.for.end39_crit_edge.us
for.cond23.for.end39_crit_edge.us: ; preds = %if.else.us.epil, %if.then.us.epil, %for.cond23.for.end39_crit_edge.us.unr-lcssa
%c.1.us.lcssa = phi i32 [ %c.1.us.lcssa.ph, %for.cond23.for.end39_crit_edge.us.unr-lcssa ], [ %c.094.us.unr, %if.then.us.epil ], [ %inc36.us.epil, %if.else.us.epil ]
%sub.us = add nsw i32 %5, -1
%idxprom42.us = sext i32 %sub.us to i64
%arrayidx43.us = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %idxprom42.us
%12 = load i32, ptr %arrayidx43.us, align 4, !tbaa !5
%add.us = add nsw i32 %12, %c.1.us.lcssa
store i32 %add.us, ptr %arrayidx43.us, align 4, !tbaa !5
%indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
%exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
br i1 %exitcond121.not, label %for.cond47.preheader, label %for.cond23.preheader.us, !llvm.loop !16
for.cond47.preheader: ; preds = %for.cond23.for.end39_crit_edge.us, %entry, %for.cond3.preheader, %for.cond20.preheader
%cmp4897 = icmp sgt i32 %0, 0
br i1 %cmp4897, label %for.body49.preheader, label %for.end54
for.body49.preheader: ; preds = %for.cond47.preheader
%wide.trip.count125 = zext i32 %0 to i64
br label %for.body49
for.body49: ; preds = %for.body49.preheader, %for.body49
%indvars.iv122 = phi i64 [ 0, %for.body49.preheader ], [ %indvars.iv.next123, %for.body49 ]
%arrayidx51 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv122
%13 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%call.i85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %13)
%indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
%exitcond126.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count125
br i1 %exitcond126.not, label %for.end54, label %for.body49, !llvm.loop !17
for.end54: ; preds = %for.body49, %for.cond6.preheader.lr.ph, %for.cond23.preheader.lr.ph, %for.cond47.preheader
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #6
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %g) #6
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %t) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #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 nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
|
#include <stdio.h>
int main(void)
{
int N, K;
long ans;
scanf("%d %d", &N, &K);
long x = N/K;
ans = x*x*x;
if(K%2 == 0){
x = N/(K/2) - N/K;
ans += x*x*x;
}
printf("%ld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183928/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183928/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%N = alloca i32, align 4
%K = 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 %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = load i32, ptr %K, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%conv = sext i32 %div to i64
%mul = mul nsw i64 %conv, %conv
%mul1 = mul nsw i64 %mul, %conv
%2 = and i32 %1, 1
%cmp = icmp eq i32 %2, 0
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%div3 = sdiv i32 %1, 2
%div4 = sdiv i32 %0, %div3
%sub = sub nsw i32 %div4, %div
%conv6 = sext i32 %sub to i64
%mul7 = mul nsw i64 %conv6, %conv6
%mul8 = mul nsw i64 %mul7, %conv6
%add = add nsw i64 %mul8, %mul1
br label %if.end
if.end: ; preds = %if.then, %entry
%ans.0 = phi i64 [ %add, %if.then ], [ %mul1, %entry ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #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"}
|
#include<stdio.h>
int main()
{
long int N, K;
long int d,e;
long int ans;
scanf("%ld %ld",&N, &K);
d=N/K;
if(K%2==1)
{
ans=d*d*d;
}
else
{
e=(N+K/2)/K;
ans=d*d*d+e*e*e;
}
printf("%ld",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_183971/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_183971/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%0 = load i64, ptr %N, align 8, !tbaa !5
%1 = load i64, ptr %K, align 8, !tbaa !5
%div = sdiv i64 %0, %1
%2 = and i64 %1, -9223372036854775807
%cmp = icmp eq i64 %2, 1
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i64 %div, %div
%mul1 = mul nsw i64 %mul, %div
br label %if.end
if.else: ; preds = %entry
%div2 = sdiv i64 %1, 2
%add = add nsw i64 %div2, %0
%div3 = sdiv i64 %add, %1
%mul4 = mul nsw i64 %div, %div
%mul5 = mul nsw i64 %mul4, %div
%mul6 = mul nsw i64 %div3, %div3
%mul7 = mul nsw i64 %mul6, %div3
%add8 = add nsw i64 %mul7, %mul5
br label %if.end
if.end: ; preds = %if.else, %if.then
%ans.0 = phi i64 [ %mul1, %if.then ], [ %add8, %if.else ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
#define INF ((1LL<<62)-(1LL<<31))
ll dp[420][420];
ll ans=INF;
int main(){
int n,ma,mb;
scanf("%d%d%d",&n,&ma,&mb);
rep(i,0,410)rep(j,0,410)dp[i][j]=INF;
dp[0][0]=0;
rep(i,0,n){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
for(int aa=400;aa>=0;aa--)for(int bb=400;bb>=0;bb--)if(dp[aa][bb]!=INF)dp[aa+a][bb+b]=min(dp[aa+a][bb+b],dp[aa][bb]+c);
}
for(int aa=ma,bb=mb;aa<=400&&bb<=400;aa+=ma,bb+=mb)ans=min(ans,dp[aa][bb]);
printf("%lld\n",ans==INF?-1:ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184028/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184028/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@ans = dso_local local_unnamed_addr global i64 4611686016279904256, align 8
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@dp = dso_local local_unnamed_addr global [420 x [420 x i64]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%ma = alloca i32, align 4
%mb = 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 %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ma) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %mb) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %ma, ptr noundef nonnull %mb)
br label %vector.ph
vector.ph: ; preds = %for.body4, %entry
%i.0133 = phi i64 [ 0, %entry ], [ %inc7, %for.body4 ]
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next.2, %vector.body ]
%0 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %i.0133, i64 %index
store <2 x i64> <i64 4611686016279904256, i64 4611686016279904256>, ptr %0, align 16, !tbaa !5
%1 = getelementptr inbounds i64, ptr %0, i64 2
store <2 x i64> <i64 4611686016279904256, i64 4611686016279904256>, ptr %1, align 16, !tbaa !5
%index.next = add nuw nsw i64 %index, 4
%2 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %i.0133, i64 %index.next
store <2 x i64> <i64 4611686016279904256, i64 4611686016279904256>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i64, ptr %2, i64 2
store <2 x i64> <i64 4611686016279904256, i64 4611686016279904256>, ptr %3, align 16, !tbaa !5
%index.next.1 = add nuw nsw i64 %index, 8
%4 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %i.0133, i64 %index.next.1
store <2 x i64> <i64 4611686016279904256, i64 4611686016279904256>, ptr %4, align 16, !tbaa !5
%5 = getelementptr inbounds i64, ptr %4, i64 2
store <2 x i64> <i64 4611686016279904256, i64 4611686016279904256>, ptr %5, align 16, !tbaa !5
%index.next.2 = add nuw nsw i64 %index, 12
%6 = icmp eq i64 %index.next.2, 408
br i1 %6, label %for.body4, label %vector.body, !llvm.loop !9
for.cond.cleanup: ; preds = %for.body4
store i64 0, ptr @dp, align 16, !tbaa !5
%7 = load i32, ptr %n, align 4, !tbaa !13
%cmp11137 = icmp sgt i32 %7, 0
br i1 %cmp11137, label %for.body14, label %for.cond.cleanup13
for.body4: ; preds = %vector.body
%arrayidx5 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %i.0133, i64 408
store i64 4611686016279904256, ptr %arrayidx5, align 16, !tbaa !5
%arrayidx5.1 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %i.0133, i64 409
store i64 4611686016279904256, ptr %arrayidx5.1, align 8, !tbaa !5
%inc7 = add nuw nsw i64 %i.0133, 1
%exitcond145.not = icmp eq i64 %inc7, 410
br i1 %exitcond145.not, label %for.cond.cleanup, label %vector.ph, !llvm.loop !15
for.cond.cleanup13: ; preds = %for.cond.cleanup19, %for.cond.cleanup
%8 = load i32, ptr %ma, align 4, !tbaa !13
%9 = load i32, ptr %mb, align 4, !tbaa !13
%ans.promoted = load i64, ptr @ans, align 8
%cmp73140 = icmp slt i32 %8, 401
%cmp75141 = icmp slt i32 %9, 401
%10 = select i1 %cmp73140, i1 %cmp75141, i1 false
br i1 %10, label %for.body78.preheader, label %for.cond.cleanup77
for.body78.preheader: ; preds = %for.cond.cleanup13
%11 = sext i32 %9 to i64
%12 = sext i32 %8 to i64
br label %for.body78
for.body14: ; preds = %for.cond.cleanup, %for.cond.cleanup19
%i9.0138 = phi i64 [ %inc68, %for.cond.cleanup19 ], [ 0, %for.cond.cleanup ]
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
%call15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%13 = load i32, ptr %a, align 4
%14 = load i32, ptr %b, align 4
%15 = load i32, ptr %c, align 4
%conv40 = sext i32 %15 to i64
%16 = sext i32 %14 to i64
%17 = sext i32 %13 to i64
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.body14, %for.cond.cleanup24
%indvars.iv148 = phi i64 [ 400, %for.body14 ], [ %indvars.iv.next149, %for.cond.cleanup24 ]
%18 = add nsw i64 %indvars.iv148, %17
br label %for.body25
for.cond.cleanup19: ; preds = %for.cond.cleanup24
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
%inc68 = add nuw nsw i64 %i9.0138, 1
%19 = load i32, ptr %n, align 4, !tbaa !13
%conv = sext i32 %19 to i64
%cmp11 = icmp slt i64 %inc68, %conv
br i1 %cmp11, label %for.body14, label %for.cond.cleanup13, !llvm.loop !16
for.cond.cleanup24: ; preds = %for.inc62
%indvars.iv.next149 = add nsw i64 %indvars.iv148, -1
%cmp17.not = icmp eq i64 %indvars.iv148, 0
br i1 %cmp17.not, label %for.cond.cleanup19, label %for.cond21.preheader, !llvm.loop !17
for.body25: ; preds = %for.cond21.preheader, %for.inc62
%indvars.iv = phi i64 [ 400, %for.cond21.preheader ], [ %indvars.iv.next, %for.inc62 ]
%arrayidx28 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %indvars.iv148, i64 %indvars.iv
%20 = load i64, ptr %arrayidx28, align 8, !tbaa !5
%cmp29.not = icmp eq i64 %20, 4611686016279904256
br i1 %cmp29.not, label %for.inc62, label %if.then
if.then: ; preds = %for.body25
%21 = add nsw i64 %indvars.iv, %16
%arrayidx35 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %18, i64 %21
%22 = load i64, ptr %arrayidx35, align 8, !tbaa !5
%add41 = add nsw i64 %20, %conv40
%.add41 = call i64 @llvm.smin.i64(i64 %22, i64 %add41)
store i64 %.add41, ptr %arrayidx35, align 8, !tbaa !5
br label %for.inc62
for.inc62: ; preds = %for.body25, %if.then
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp22.not = icmp eq i64 %indvars.iv, 0
br i1 %cmp22.not, label %for.cond.cleanup24, label %for.body25, !llvm.loop !18
for.cond72.for.cond.cleanup77_crit_edge: ; preds = %for.body78
store i64 %., ptr @ans, align 8, !tbaa !5
br label %for.cond.cleanup77
for.cond.cleanup77: ; preds = %for.cond72.for.cond.cleanup77_crit_edge, %for.cond.cleanup13
%23 = phi i64 [ %., %for.cond72.for.cond.cleanup77_crit_edge ], [ %ans.promoted, %for.cond.cleanup13 ]
%cmp97 = icmp eq i64 %23, 4611686016279904256
%cond102 = select i1 %cmp97, i64 -1, i64 %23
%call103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %cond102)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %mb) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ma) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body78: ; preds = %for.body78.preheader, %for.body78
%indvars.iv154 = phi i64 [ %12, %for.body78.preheader ], [ %indvars.iv.next155, %for.body78 ]
%indvars.iv152 = phi i64 [ %11, %for.body78.preheader ], [ %indvars.iv.next153, %for.body78 ]
%.139142 = phi i64 [ %ans.promoted, %for.body78.preheader ], [ %., %for.body78 ]
%arrayidx82 = getelementptr inbounds [420 x [420 x i64]], ptr @dp, i64 0, i64 %indvars.iv154, i64 %indvars.iv152
%24 = load i64, ptr %arrayidx82, align 8, !tbaa !5
%. = call i64 @llvm.smin.i64(i64 %.139142, i64 %24)
%indvars.iv.next155 = add i64 %indvars.iv154, %12
%indvars.iv.next153 = add i64 %indvars.iv152, %11
%cmp73 = icmp slt i64 %indvars.iv.next155, 401
%cmp75 = icmp slt i64 %indvars.iv.next153, 401
%25 = select i1 %cmp73, i1 %cmp75, i1 false
br i1 %25, label %for.body78, label %for.cond72.for.cond.cleanup77_crit_edge, !llvm.loop !19
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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 i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define int long long
int ABS(int a){
return a >= 0 ? a : -a;
}
signed main(){
int N, i;
scanf("%lld", &N);
int *A = (int *)malloc(sizeof(int) * (N + 2));
int *S = (int *)malloc(sizeof(int) * (N + 2));
int *T = (int *)malloc(sizeof(int) * (N + 2));
A[0] = 0;
A[N + 1] = 0;
for(i = 1; i <= N; i++){
scanf("%lld", &A[i]);
}
S[0] = 0;
for(i = 1; i <= N; i++){
S[i] = S[i - 1] + ABS(A[i] - A[i - 1]);
}
T[N + 1] = 0;
for(i = N; i > 0; i--){
T[i] = T[i + 1] + ABS(A[i] - A[i + 1]);
}
/* for(i = 1; i <= N; i++){
printf("S[%lld] = %lld\n", i, S[i]);
}
for(i = 1; i <= N; i++){
printf("T[%lld] = %lld\n", i, T[i]);
}
*/ for(i = 1; i <= N; i++){
printf("%lld\n", S[i - 1] + ABS(A[i - 1] - A[i + 1]) + T[i + 1]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184079/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184079/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @ABS(i64 noundef %a) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.abs.i64(i64 %a, i1 true)
ret i64 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%add = shl i64 %0, 3
%mul = add i64 %add, 16
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%call4 = call noalias ptr @malloc(i64 noundef %mul) #7
%call7 = call noalias ptr @malloc(i64 noundef %mul) #7
store i64 0, ptr %call1, align 8, !tbaa !5
%1 = getelementptr i64, ptr %call1, i64 %0
%arrayidx9 = getelementptr i64, ptr %1, i64 1
store i64 0, ptr %arrayidx9, align 8, !tbaa !5
%cmp.not98 = icmp slt i64 %0, 1
br i1 %cmp.not98, label %for.end61, label %for.body
for.body: ; preds = %entry, %for.body
%i.099 = phi i64 [ %inc, %for.body ], [ 1, %entry ]
%arrayidx10 = getelementptr inbounds i64, ptr %call1, i64 %i.099
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx10)
%inc = add nuw nsw i64 %i.099, 1
%2 = load i64, ptr %N, align 8, !tbaa !5
%cmp.not.not = icmp slt i64 %i.099, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
store i64 0, ptr %call4, align 8, !tbaa !5
%cmp14.not100 = icmp slt i64 %2, 1
br i1 %cmp14.not100, label %for.end61, label %for.body15.preheader
for.body15.preheader: ; preds = %for.end
%.pre = load i64, ptr %call1, align 8, !tbaa !5
%3 = add i64 %2, -1
%xtraiter = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %for.end26.unr-lcssa, label %for.body15.preheader.new
for.body15.preheader.new: ; preds = %for.body15.preheader
%unroll_iter = and i64 %2, -2
br label %for.body15
for.body15: ; preds = %for.body15, %for.body15.preheader.new
%5 = phi i64 [ %.pre, %for.body15.preheader.new ], [ %8, %for.body15 ]
%6 = phi i64 [ 0, %for.body15.preheader.new ], [ %add22.1, %for.body15 ]
%i.1101 = phi i64 [ 1, %for.body15.preheader.new ], [ %inc25.1, %for.body15 ]
%niter = phi i64 [ 0, %for.body15.preheader.new ], [ %niter.next.1, %for.body15 ]
%arrayidx17 = getelementptr inbounds i64, ptr %call1, i64 %i.1101
%7 = load i64, ptr %arrayidx17, align 8, !tbaa !5
%sub20 = sub nsw i64 %7, %5
%cond.i = call i64 @llvm.abs.i64(i64 %sub20, i1 true)
%add22 = add nuw nsw i64 %cond.i, %6
%arrayidx23 = getelementptr inbounds i64, ptr %call4, i64 %i.1101
store i64 %add22, ptr %arrayidx23, align 8, !tbaa !5
%inc25 = add nuw i64 %i.1101, 1
%arrayidx17.1 = getelementptr inbounds i64, ptr %call1, i64 %inc25
%8 = load i64, ptr %arrayidx17.1, align 8, !tbaa !5
%sub20.1 = sub nsw i64 %8, %7
%cond.i.1 = call i64 @llvm.abs.i64(i64 %sub20.1, i1 true)
%add22.1 = add nuw nsw i64 %cond.i.1, %add22
%arrayidx23.1 = getelementptr inbounds i64, ptr %call4, i64 %inc25
store i64 %add22.1, ptr %arrayidx23.1, align 8, !tbaa !5
%inc25.1 = add nuw i64 %i.1101, 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.end26.unr-lcssa, label %for.body15, !llvm.loop !11
for.end26.unr-lcssa: ; preds = %for.body15, %for.body15.preheader
%.unr = phi i64 [ %.pre, %for.body15.preheader ], [ %8, %for.body15 ]
%.unr115 = phi i64 [ 0, %for.body15.preheader ], [ %add22.1, %for.body15 ]
%i.1101.unr = phi i64 [ 1, %for.body15.preheader ], [ %inc25.1, %for.body15 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end26, label %for.body15.epil
for.body15.epil: ; preds = %for.end26.unr-lcssa
%arrayidx17.epil = getelementptr inbounds i64, ptr %call1, i64 %i.1101.unr
%9 = load i64, ptr %arrayidx17.epil, align 8, !tbaa !5
%sub20.epil = sub nsw i64 %9, %.unr
%cond.i.epil = call i64 @llvm.abs.i64(i64 %sub20.epil, i1 true)
%add22.epil = add nuw nsw i64 %cond.i.epil, %.unr115
%arrayidx23.epil = getelementptr inbounds i64, ptr %call4, i64 %i.1101.unr
store i64 %add22.epil, ptr %arrayidx23.epil, align 8, !tbaa !5
br label %for.end26
for.end26: ; preds = %for.end26.unr-lcssa, %for.body15.epil
%10 = getelementptr i64, ptr %call7, i64 %2
%arrayidx28 = getelementptr i64, ptr %10, i64 1
store i64 0, ptr %arrayidx28, align 8, !tbaa !5
%cmp30102 = icmp sgt i64 %2, 0
br i1 %cmp30102, label %for.body31.preheader, label %for.cond43.preheader
for.body31.preheader: ; preds = %for.end26
%scevgep = getelementptr i8, ptr %call7, i64 8
%11 = shl i64 %2, 3
%scevgep114 = getelementptr i8, ptr %scevgep, i64 %11
%load_initial = load i64, ptr %scevgep114, align 8
%xtraiter116 = and i64 %2, 1
%lcmp.mod117.not = icmp eq i64 %xtraiter116, 0
br i1 %lcmp.mod117.not, label %for.body31.prol.loopexit, label %for.body31.prol
for.body31.prol: ; preds = %for.body31.preheader
%arrayidx34.prol = getelementptr inbounds i64, ptr %call1, i64 %2
%12 = load i64, ptr %arrayidx34.prol, align 8, !tbaa !5
%13 = getelementptr i64, ptr %call1, i64 %2
%arrayidx36.prol = getelementptr i64, ptr %13, i64 1
%14 = load i64, ptr %arrayidx36.prol, align 8, !tbaa !5
%sub37.prol = sub nsw i64 %12, %14
%cond.i96.prol = call i64 @llvm.abs.i64(i64 %sub37.prol, i1 true)
%add39.prol = add nsw i64 %cond.i96.prol, %load_initial
%arrayidx40.prol = getelementptr inbounds i64, ptr %call7, i64 %2
store i64 %add39.prol, ptr %arrayidx40.prol, align 8, !tbaa !5
%dec.prol = add nsw i64 %2, -1
br label %for.body31.prol.loopexit
for.body31.prol.loopexit: ; preds = %for.body31.prol, %for.body31.preheader
%store_forwarded.unr = phi i64 [ %load_initial, %for.body31.preheader ], [ %add39.prol, %for.body31.prol ]
%i.2103.unr = phi i64 [ %2, %for.body31.preheader ], [ %dec.prol, %for.body31.prol ]
%15 = icmp eq i64 %3, 0
br i1 %15, label %for.cond43.preheader, label %for.body31.preheader.new
for.body31.preheader.new: ; preds = %for.body31.prol.loopexit
%invariant.gep = getelementptr i64, ptr %call1, i64 1
%invariant.gep119 = getelementptr i64, ptr %call1, i64 1
br label %for.body31
for.cond43.preheader: ; preds = %for.body31.prol.loopexit, %for.body31, %for.end26
br i1 %cmp14.not100, label %for.end61, label %for.body45
for.body31: ; preds = %for.body31, %for.body31.preheader.new
%store_forwarded = phi i64 [ %store_forwarded.unr, %for.body31.preheader.new ], [ %add39.1, %for.body31 ]
%i.2103 = phi i64 [ %i.2103.unr, %for.body31.preheader.new ], [ %dec.1, %for.body31 ]
%arrayidx34 = getelementptr inbounds i64, ptr %call1, i64 %i.2103
%16 = load i64, ptr %arrayidx34, align 8, !tbaa !5
%gep = getelementptr i64, ptr %invariant.gep, i64 %i.2103
%17 = load i64, ptr %gep, align 8, !tbaa !5
%sub37 = sub nsw i64 %16, %17
%cond.i96 = call i64 @llvm.abs.i64(i64 %sub37, i1 true)
%add39 = add nsw i64 %cond.i96, %store_forwarded
%arrayidx40 = getelementptr inbounds i64, ptr %call7, i64 %i.2103
store i64 %add39, ptr %arrayidx40, align 8, !tbaa !5
%dec = add nsw i64 %i.2103, -1
%arrayidx34.1 = getelementptr inbounds i64, ptr %call1, i64 %dec
%18 = load i64, ptr %arrayidx34.1, align 8, !tbaa !5
%gep120 = getelementptr i64, ptr %invariant.gep119, i64 %dec
%19 = load i64, ptr %gep120, align 8, !tbaa !5
%sub37.1 = sub nsw i64 %18, %19
%cond.i96.1 = call i64 @llvm.abs.i64(i64 %sub37.1, i1 true)
%add39.1 = add nsw i64 %cond.i96.1, %add39
%arrayidx40.1 = getelementptr inbounds i64, ptr %call7, i64 %dec
store i64 %add39.1, ptr %arrayidx40.1, align 8, !tbaa !5
%dec.1 = add nsw i64 %i.2103, -2
%cmp30.1 = icmp ugt i64 %dec, 1
br i1 %cmp30.1, label %for.body31, label %for.cond43.preheader, !llvm.loop !12
for.body45: ; preds = %for.cond43.preheader, %for.body45
%i.3105 = phi i64 [ %add50, %for.body45 ], [ 1, %for.cond43.preheader ]
%sub46 = add nsw i64 %i.3105, -1
%arrayidx47 = getelementptr inbounds i64, ptr %call4, i64 %sub46
%20 = load i64, ptr %arrayidx47, align 8, !tbaa !5
%arrayidx49 = getelementptr inbounds i64, ptr %call1, i64 %sub46
%21 = load i64, ptr %arrayidx49, align 8, !tbaa !5
%add50 = add nuw nsw i64 %i.3105, 1
%arrayidx51 = getelementptr inbounds i64, ptr %call1, i64 %add50
%22 = load i64, ptr %arrayidx51, align 8, !tbaa !5
%sub52 = sub nsw i64 %21, %22
%cond.i97 = call i64 @llvm.abs.i64(i64 %sub52, i1 true)
%arrayidx56 = getelementptr inbounds i64, ptr %call7, i64 %add50
%23 = load i64, ptr %arrayidx56, align 8, !tbaa !5
%add54 = add i64 %23, %20
%add57 = add i64 %add54, %cond.i97
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %add57)
%24 = load i64, ptr %N, align 8, !tbaa !5
%cmp44.not.not = icmp slt i64 %i.3105, %24
br i1 %cmp44.not.not, label %for.body45, label %for.end61, !llvm.loop !13
for.end61: ; preds = %for.body45, %for.end, %entry, %for.cond43.preheader
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #5
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
int main()
{
long long int a, b, c, d, m, n, o, p;
scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
m = a*c;
n = a*d;
o = b*c;
p = b*d;
if(m >= n && m >= o && m >= p)
{
printf("%lld\n", m);
}
else if(n >= m && n >= o && n >= p)
{
printf("%lld\n", n);
}
else if(o >= m && o >= n && o >= p)
{
printf("%lld\n", o);
}
else
{
printf("%lld\n", p);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184121/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184121/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [20 x i8] c"%lld %lld %lld %lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, 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 = 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 i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %c, align 8, !tbaa !5
%mul = mul nsw i64 %1, %0
%2 = load i64, ptr %d, align 8, !tbaa !5
%mul1 = mul nsw i64 %2, %0
%3 = load i64, ptr %b, align 8, !tbaa !5
%mul2 = mul nsw i64 %3, %1
%mul3 = mul nsw i64 %3, %2
%cmp.not = icmp slt i64 %mul, %mul1
%cmp4.not = icmp slt i64 %mul, %mul2
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp4.not
%cmp6.not = icmp slt i64 %mul, %mul3
%or.cond45 = select i1 %or.cond, i1 true, i1 %cmp6.not
br i1 %or.cond45, label %if.else, label %if.end26
if.else: ; preds = %entry
%cmp8.not = icmp slt i64 %mul1, %mul
%cmp10.not = icmp slt i64 %mul1, %mul2
%or.cond46 = select i1 %cmp8.not, i1 true, i1 %cmp10.not
%cmp12.not = icmp slt i64 %mul1, %mul3
%or.cond47 = select i1 %or.cond46, i1 true, i1 %cmp12.not
br i1 %or.cond47, label %if.else15, label %if.end26
if.else15: ; preds = %if.else
%cmp16.not = icmp slt i64 %mul2, %mul
%cmp18.not = icmp slt i64 %mul2, %mul1
%or.cond48 = or i1 %cmp16.not, %cmp18.not
%cmp20.not = icmp slt i64 %mul2, %mul3
%or.cond49 = select i1 %or.cond48, i1 true, i1 %cmp20.not
%mul3.mul2 = select i1 %or.cond49, i64 %mul3, i64 %mul2
br label %if.end26
if.end26: ; preds = %if.else15, %if.else, %entry
%mul1.sink = phi i64 [ %mul, %entry ], [ %mul1, %if.else ], [ %mul3.mul2, %if.else15 ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul1.sink)
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
//ABC178_B
#include <stdio.h>
int main(){
long int a,b,c,d;
long int tmp1=0,tmp2=0;
scanf("%ld %ld %ld %ld",&a,&b,&c,&d);
//条件 a<b c<d
//すべてが正であったらb*dを出力
//0も正と考える
if(a>=0 && b>=0 && c>=0 && d>=0){
printf("%ld",b*d);
}
//一つ負の数があったとする
//条件よりaもしくはcのみ負の値の場合
//aもしくはcだけ負だとすると、
//数の大きいほうだけをかければいい(上と同じ)
else if(a<0 && b>=0 && c>=0 && d>=0 || a>=0 && b>=0 && c<0 && d>=0){
printf("%ld",b*d);
}
//2つ負の数があったとする
//条件よりabが負の場合b*c
//cdが負の場合a*d
//acが負の場合、a*c or c*dの大きいほうを出力
else if(a<0 && b<0 && c>=0 && d>=0){
printf("%ld",b*c);
}
else if(a>=0 && b>=0 && c<0 && d<0){
printf("%ld",a*d);
}
else if(a<0 && b>=0 && c<0 && d>=0){
tmp1 = a*c;
tmp2 = b*d;
if(tmp1 > tmp2){
printf("%ld",tmp1);
}
else printf("%ld",tmp2);
}
//3つの負の数があったとする
//条件よりabcが負の場合a*c
//acdが負の場合a*c
else if(a<0 && b<0 && c<0 && d>=0){
printf("%ld",a*c);
}
else if(a<0 && b>=0 && c<0 && d<0){
printf("%ld",a*c);
}
//4つの負の数があったとする
//条件よりabcdが負の場合、a*c
else if(a<0 && b<0 && c<0 && d<0){
printf("%ld",a*c);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184165/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184165/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%ld %ld %ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, -1
%1 = load i64, ptr %b, align 8
%cmp1 = icmp sgt i64 %1, -1
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%2 = load i64, ptr %c, align 8
%cmp3 = icmp sgt i64 %2, -1
%or.cond103 = select i1 %or.cond, i1 %cmp3, i1 false
%3 = load i64, ptr %d, align 8
%cmp5 = icmp sgt i64 %3, -1
%or.cond104 = select i1 %or.cond103, i1 %cmp5, i1 false
br i1 %or.cond104, label %if.then, label %if.else
if.then: ; preds = %entry
%mul = mul nsw i64 %3, %1
br label %if.end102.sink.split
if.else: ; preds = %entry
%cmp7 = icmp slt i64 %0, 0
%or.cond105 = select i1 %cmp7, i1 %cmp1, i1 false
%or.cond106 = select i1 %or.cond105, i1 %cmp3, i1 false
%or.cond107 = select i1 %or.cond106, i1 %cmp5, i1 false
br i1 %or.cond107, label %if.then21, label %lor.lhs.false
lor.lhs.false: ; preds = %if.else
%cmp18 = icmp slt i64 %2, 0
%or.cond109 = select i1 %or.cond, i1 %cmp18, i1 false
%or.cond110 = select i1 %or.cond109, i1 %cmp5, i1 false
br i1 %or.cond110, label %if.then21, label %if.else24
if.then21: ; preds = %lor.lhs.false, %if.else
%mul22 = mul nsw i64 %3, %1
br label %if.end102.sink.split
if.else24: ; preds = %lor.lhs.false
%cmp27 = icmp slt i64 %1, 0
%or.cond111 = select i1 %cmp7, i1 %cmp27, i1 false
%or.cond112 = select i1 %or.cond111, i1 %cmp3, i1 false
%or.cond113 = select i1 %or.cond112, i1 %cmp5, i1 false
br i1 %or.cond113, label %if.then32, label %if.else35
if.then32: ; preds = %if.else24
%mul33 = mul nsw i64 %2, %1
br label %if.end102.sink.split
if.else35: ; preds = %if.else24
%cmp42 = icmp slt i64 %3, 0
%or.cond116 = select i1 %or.cond109, i1 %cmp42, i1 false
br i1 %or.cond116, label %if.then43, label %if.else46
if.then43: ; preds = %if.else35
%mul44 = mul nsw i64 %3, %0
br label %if.end102.sink.split
if.else46: ; preds = %if.else35
%or.cond118 = select i1 %or.cond105, i1 %cmp18, i1 false
%or.cond119 = select i1 %or.cond118, i1 %cmp5, i1 false
br i1 %or.cond119, label %if.then54, label %if.else62
if.then54: ; preds = %if.else46
%mul55 = mul nsw i64 %2, %0
%mul56 = mul nsw i64 %3, %1
%mul55.mul56 = call i64 @llvm.smax.i64(i64 %mul55, i64 %mul56)
br label %if.end102.sink.split
if.else62: ; preds = %if.else46
%or.cond121 = select i1 %or.cond111, i1 %cmp18, i1 false
%or.cond122 = select i1 %or.cond121, i1 %cmp5, i1 false
br i1 %or.cond122, label %if.then70, label %if.else73
if.then70: ; preds = %if.else62
%mul71 = mul nsw i64 %2, %0
br label %if.end102.sink.split
if.else73: ; preds = %if.else62
%or.cond125 = select i1 %or.cond118, i1 %cmp42, i1 false
br i1 %or.cond125, label %if.then81, label %if.else84
if.then81: ; preds = %if.else73
%mul82 = mul nsw i64 %2, %0
br label %if.end102.sink.split
if.else84: ; preds = %if.else73
%or.cond128 = select i1 %or.cond121, i1 %cmp42, i1 false
br i1 %or.cond128, label %if.then92, label %if.end102
if.then92: ; preds = %if.else84
%mul93 = mul nsw i64 %2, %0
br label %if.end102.sink.split
if.end102.sink.split: ; preds = %if.then54, %if.then, %if.then32, %if.then81, %if.then92, %if.then70, %if.then43, %if.then21
%mul22.sink = phi i64 [ %mul22, %if.then21 ], [ %mul44, %if.then43 ], [ %mul71, %if.then70 ], [ %mul93, %if.then92 ], [ %mul82, %if.then81 ], [ %mul33, %if.then32 ], [ %mul, %if.then ], [ %mul55.mul56, %if.then54 ]
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %mul22.sink)
br label %if.end102
if.end102: ; preds = %if.end102.sink.split, %if.else84
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 i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
long a,b,c,d,ac,ad,bc,bd,ans;
// 整数の入力
scanf("%ld %ld %ld %ld", &a,&b,&c,&d);
if(a==0){
a++;
if(a>b) a=b;
}
if(b==0){
b--;
if(b<a) b=a;
}
if(c==0){
c++;
if(c>d) c=d;
}
if(d==0){
d--;
if(d<c) d=c;
}
ac=a*c;
ad=a*d;
bc=b*c;
bd=b*d;
ans = ac;
if(ans<ad) ans=ad;
if(ans<bc) ans=bc;
if(ans<bd) ans=bd;
// 出力
printf("%ld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184208/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184208/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [16 x i8] c"%ld %ld %ld %ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8, !tbaa !5
%cmp = icmp eq i64 %0, 0
%1 = load i64, ptr %b, align 8, !tbaa !5
br i1 %cmp, label %if.then, label %if.end3
if.then: ; preds = %entry
%spec.store.select = call i64 @llvm.smin.i64(i64 %1, i64 1)
store i64 %spec.store.select, ptr %a, align 8
br label %if.end3
if.end3: ; preds = %entry, %if.then
%2 = phi i64 [ %spec.store.select, %if.then ], [ %0, %entry ]
%cmp4 = icmp eq i64 %1, 0
br i1 %cmp4, label %if.then5, label %if.end9
if.then5: ; preds = %if.end3
%spec.store.select50 = call i64 @llvm.smax.i64(i64 %2, i64 -1)
store i64 %spec.store.select50, ptr %b, align 8
br label %if.end9
if.end9: ; preds = %if.then5, %if.end3
%3 = phi i64 [ %spec.store.select50, %if.then5 ], [ %1, %if.end3 ]
%4 = load i64, ptr %c, align 8, !tbaa !5
%cmp10 = icmp eq i64 %4, 0
%5 = load i64, ptr %d, align 8, !tbaa !5
br i1 %cmp10, label %if.then11, label %if.end16
if.then11: ; preds = %if.end9
%spec.store.select51 = call i64 @llvm.smin.i64(i64 %5, i64 1)
store i64 %spec.store.select51, ptr %c, align 8
br label %if.end16
if.end16: ; preds = %if.end9, %if.then11
%6 = phi i64 [ %spec.store.select51, %if.then11 ], [ %4, %if.end9 ]
%cmp17 = icmp eq i64 %5, 0
br i1 %cmp17, label %if.then18, label %if.end23
if.then18: ; preds = %if.end16
%spec.store.select52 = call i64 @llvm.smax.i64(i64 %6, i64 -1)
store i64 %spec.store.select52, ptr %d, align 8
br label %if.end23
if.end23: ; preds = %if.then18, %if.end16
%7 = phi i64 [ %spec.store.select52, %if.then18 ], [ %5, %if.end16 ]
%mul = mul nsw i64 %6, %2
%mul24 = mul nsw i64 %7, %2
%mul25 = mul nsw i64 %3, %6
%mul26 = mul nsw i64 %3, %7
%spec.select = call i64 @llvm.smax.i64(i64 %mul, i64 %mul24)
%ans.1 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %mul25)
%ans.2 = call i64 @llvm.smax.i64(i64 %ans.1, i64 %mul26)
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.2)
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 i64 @llvm.smin.i64(i64, i64) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
long long a,b,c,d,res=0x8000000000000000;
scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
if(a*c>res)res=a*c;
if(a*d>res)res=a*d;
if(b*c>res)res=b*c;
if(b*d>res)res=b*d;
printf("%lld\n",res);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184251/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184251/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [17 x i8] c"%lld%lld%lld%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i64, align 8
%b = alloca i64, align 8
%c = alloca i64, align 8
%d = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, 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 i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %c, align 8, !tbaa !5
%mul = mul nsw i64 %1, %0
%2 = load i64, ptr %d, align 8, !tbaa !5
%mul2 = mul nsw i64 %2, %0
%res.1 = call i64 @llvm.smax.i64(i64 %mul2, i64 %mul)
%3 = load i64, ptr %b, align 8, !tbaa !5
%mul7 = mul nsw i64 %3, %1
%res.2 = call i64 @llvm.smax.i64(i64 %mul7, i64 %res.1)
%mul12 = mul nsw i64 %3, %2
%res.3 = call i64 @llvm.smax.i64(i64 %mul12, i64 %res.2)
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %res.3)
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 i64 @llvm.smax.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <math.h>
double pow2(double x);
int main(void)
{
double x1, y1, x2, y2, x3, y3;
double xx1, yy1, xx2, yy2, xx3, yy3;
double a1, b1, c1, a2, b2, c2;
double xp, yp;
double r;
int n;
scanf("%d", &n);
int i;
for (i = 1; i <= n; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
xx1 = pow2(x1);
yy1 = pow2(y1);
xx2 = pow2(x2);
yy2 = pow2(y2);
xx3 = pow2(x3);
yy3 = pow2(y3);
a1 = 2 * (x2 - x1);
b1 = 2 * (y2 - y1);
c1 = xx1 - xx2 + yy1 - yy2;
a2 = 2 * (x3 - x1);
b2 = 2 * (y3 - y1);
c2 = xx1 - xx3 + yy1 - yy3;
xp = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
yp = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
r = sqrt(pow2(xp - x1) + pow2(yp - y1));
printf("%.3f %.3f %.3f\n", xp, yp, r);
}
return 0;
}
double pow2(double x)
{
return x * x;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184295/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
%x3 = alloca double, align 8
%y3 = alloca double, align 8
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not60 = icmp slt i32 %0, 1
br i1 %cmp.not60, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%i.061 = phi i32 [ %inc, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3)
%1 = load double, ptr %x1, align 8, !tbaa !9
%mul.i = fmul double %1, %1
%2 = load double, ptr %y1, align 8, !tbaa !9
%mul.i53 = fmul double %2, %2
%3 = load double, ptr %x2, align 8, !tbaa !9
%mul.i54 = fmul double %3, %3
%4 = load double, ptr %y2, align 8, !tbaa !9
%mul.i55 = fmul double %4, %4
%5 = load double, ptr %x3, align 8, !tbaa !9
%mul.i56 = fmul double %5, %5
%6 = load double, ptr %y3, align 8, !tbaa !9
%mul.i57 = fmul double %6, %6
%sub = fsub double %3, %1
%mul = fmul double %sub, 2.000000e+00
%sub8 = fsub double %4, %2
%sub10 = fsub double %mul.i, %mul.i54
%add = fadd double %mul.i53, %sub10
%sub12 = fsub double %5, %1
%mul13 = fmul double %sub12, 2.000000e+00
%sub14 = fsub double %6, %2
%sub16 = fsub double %mul.i, %mul.i56
%add17 = fadd double %mul.i53, %sub16
%7 = fneg double %mul13
%8 = insertelement <2 x double> poison, double %sub8, i64 0
%9 = insertelement <2 x double> %8, double %add, i64 1
%10 = insertelement <2 x double> <double 2.000000e+00, double poison>, double %mul.i55, i64 1
%11 = fmul <2 x double> %9, %10
%12 = fsub <2 x double> %9, %10
%13 = shufflevector <2 x double> %11, <2 x double> %12, <2 x i32> <i32 0, i32 3>
%14 = insertelement <2 x double> poison, double %sub14, i64 0
%15 = insertelement <2 x double> %14, double %add17, i64 1
%16 = insertelement <2 x double> <double 2.000000e+00, double poison>, double %mul.i57, i64 1
%17 = fmul <2 x double> %15, %16
%18 = fsub <2 x double> %15, %16
%19 = shufflevector <2 x double> %17, <2 x double> %18, <2 x i32> <i32 0, i32 3>
%20 = extractelement <2 x double> %11, i64 0
%neg23 = fmul double %20, %7
%21 = extractelement <2 x double> %17, i64 0
%22 = call double @llvm.fmuladd.f64(double %mul, double %21, double %neg23)
%23 = fneg <2 x double> %19
%24 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%25 = insertelement <2 x double> %24, double %mul, i64 1
%26 = fmul <2 x double> %25, %23
%27 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%28 = insertelement <2 x double> %27, double %mul13, i64 1
%29 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %13, <2 x double> %28, <2 x double> %26)
%30 = insertelement <2 x double> poison, double %22, i64 0
%31 = shufflevector <2 x double> %30, <2 x double> poison, <2 x i32> zeroinitializer
%32 = fdiv <2 x double> %29, %31
%33 = insertelement <2 x double> poison, double %1, i64 0
%34 = insertelement <2 x double> %33, double %2, i64 1
%35 = fsub <2 x double> %32, %34
%36 = fmul <2 x double> %35, %35
%shift = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%37 = fadd <2 x double> %36, %shift
%add35 = extractelement <2 x double> %37, i64 0
%sqrt = call double @llvm.sqrt.f64(double %add35)
%38 = extractelement <2 x double> %32, i64 0
%39 = extractelement <2 x double> %32, i64 1
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %38, double noundef %39, double noundef %sqrt)
%inc = add nuw nsw i32 %i.061, 1
%40 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.061, %40
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @pow2(double noundef %x) local_unnamed_addr #3 {
entry:
%mul = fmul double %x, %x
ret double %mul
}
; 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
; 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 <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(){
double x1,x2,x3,y1,y2,y3;
double s,S;
double a,b,c;
double R;
int i,n;
double x,y;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
a=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
b=(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2);
c=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);
a=sqrt(a);
b=sqrt(b);
c=sqrt(c);
R=a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
x=(y1-y3)*(y1*y1-y2*y2+x1*x1-x2*x2)-(y1-y2)*(y1*y1-y3*y3+x1*x1-x3*x3);
x/=(2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3));
y=(x1-x3)*(x1*x1-x2*x2+y1*y1-y2*y2)-(x1-x2)*(x1*x1-x3*x3+y1*y1-y3*y3);
y/=(2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3));
printf("%.3f %.3f %.3f\n",x,y,R);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184338/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184338/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca double, align 8
%x2 = alloca double, align 8
%x3 = alloca double, align 8
%y1 = alloca double, align 8
%y2 = alloca double, align 8
%y3 = alloca double, align 8
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp105 = icmp sgt i32 %0, 0
br i1 %cmp105, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.0106 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3)
%1 = load double, ptr %x2, align 8, !tbaa !9
%2 = load double, ptr %x1, align 8, !tbaa !9
%3 = load double, ptr %y2, align 8, !tbaa !9
%4 = load double, ptr %y1, align 8, !tbaa !9
%5 = load double, ptr %x3, align 8, !tbaa !9
%6 = load double, ptr %y3, align 8, !tbaa !9
%sub11 = fsub double %2, %5
%sub13 = fsub double %4, %6
%mul15 = fmul double %sub13, %sub13
%7 = call double @llvm.fmuladd.f64(double %sub11, double %sub11, double %mul15)
%8 = insertelement <2 x double> poison, double %1, i64 0
%9 = insertelement <2 x double> %8, double %5, i64 1
%10 = insertelement <2 x double> poison, double %2, i64 0
%11 = insertelement <2 x double> %10, double %1, i64 1
%12 = fsub <2 x double> %9, %11
%13 = insertelement <2 x double> poison, double %3, i64 0
%14 = insertelement <2 x double> %13, double %6, i64 1
%15 = insertelement <2 x double> poison, double %4, i64 0
%16 = insertelement <2 x double> %15, double %3, i64 1
%17 = fsub <2 x double> %14, %16
%18 = fmul <2 x double> %17, %17
%19 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %12, <2 x double> %12, <2 x double> %18)
%20 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %19)
%sqrt = call double @llvm.sqrt.f64(double %7)
%21 = extractelement <2 x double> %20, i64 0
%22 = extractelement <2 x double> %20, i64 1
%mul = fmul double %21, %22
%mul19 = fmul double %sqrt, %mul
%add = fadd double %21, %22
%add20 = fadd double %sqrt, %add
%23 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%24 = fsub <2 x double> %20, %23
%25 = insertelement <2 x double> poison, double %sqrt, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = fadd <2 x double> %26, %24
%28 = extractelement <2 x double> %27, i64 1
%mul23 = fmul double %add20, %28
%29 = extractelement <2 x double> %27, i64 0
%mul26 = fmul double %29, %mul23
%sub28 = fsub double %add, %sqrt
%mul29 = fmul double %sub28, %mul26
%call30 = call double @sqrt(double noundef %mul29) #6
%div = fdiv double %mul19, %call30
%30 = load double, ptr %y1, align 8, !tbaa !9
%31 = load double, ptr %y3, align 8, !tbaa !9
%32 = load double, ptr %y2, align 8, !tbaa !9
%33 = fneg double %32
%neg = fmul double %32, %33
%34 = call double @llvm.fmuladd.f64(double %30, double %30, double %neg)
%35 = load double, ptr %x1, align 8, !tbaa !9
%36 = call double @llvm.fmuladd.f64(double %35, double %35, double %34)
%37 = load double, ptr %x2, align 8, !tbaa !9
%neg36 = fneg double %37
%38 = call double @llvm.fmuladd.f64(double %neg36, double %37, double %36)
%sub38 = fsub double %30, %32
%39 = fneg double %31
%neg41 = fmul double %31, %39
%40 = call double @llvm.fmuladd.f64(double %30, double %30, double %neg41)
%41 = call double @llvm.fmuladd.f64(double %35, double %35, double %40)
%42 = load double, ptr %x3, align 8, !tbaa !9
%neg44 = fneg double %42
%43 = call double @llvm.fmuladd.f64(double %neg44, double %42, double %41)
%44 = fneg double %sub38
%sub49 = fsub double %35, %37
%45 = fmul double %sub38, -2.000000e+00
%sub31 = fsub double %30, %31
%mul48 = fmul double %sub31, 2.000000e+00
%46 = insertelement <2 x double> poison, double %43, i64 0
%47 = insertelement <2 x double> %46, double %45, i64 1
%48 = insertelement <2 x double> poison, double %44, i64 0
%49 = insertelement <2 x double> poison, double %sub31, i64 0
%50 = insertelement <2 x double> %49, double %mul48, i64 1
%51 = insertelement <2 x double> poison, double %38, i64 0
%52 = insertelement <2 x double> %51, double %sub49, i64 1
%neg60 = fmul double %37, %neg36
%53 = call double @llvm.fmuladd.f64(double %35, double %35, double %neg60)
%54 = call double @llvm.fmuladd.f64(double %30, double %30, double %53)
%55 = call double @llvm.fmuladd.f64(double %33, double %32, double %54)
%neg68 = fmul double %42, %neg44
%56 = call double @llvm.fmuladd.f64(double %35, double %35, double %neg68)
%57 = call double @llvm.fmuladd.f64(double %30, double %30, double %56)
%58 = call double @llvm.fmuladd.f64(double %39, double %31, double %57)
%59 = fneg double %sub49
%60 = fmul double %sub49, -2.000000e+00
%sub53 = fsub double %35, %42
%61 = insertelement <2 x double> %48, double %sub53, i64 1
%62 = fmul <2 x double> %47, %61
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %50, <2 x double> %52, <2 x double> %62)
%64 = extractelement <2 x double> %63, i64 0
%65 = extractelement <2 x double> %63, i64 1
%div56 = fdiv double %64, %65
%mul75 = fmul double %sub53, 2.000000e+00
%66 = insertelement <2 x double> poison, double %58, i64 0
%67 = insertelement <2 x double> %66, double %sub31, i64 1
%68 = insertelement <2 x double> poison, double %59, i64 0
%69 = insertelement <2 x double> %68, double %60, i64 1
%70 = fmul <2 x double> %67, %69
%71 = insertelement <2 x double> poison, double %sub53, i64 0
%72 = insertelement <2 x double> %71, double %mul75, i64 1
%73 = insertelement <2 x double> poison, double %55, i64 0
%74 = insertelement <2 x double> %73, double %sub38, i64 1
%75 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %72, <2 x double> %74, <2 x double> %70)
%76 = extractelement <2 x double> %75, i64 0
%77 = extractelement <2 x double> %75, i64 1
%div83 = fdiv double %76, %77
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %div56, double noundef %div83, double noundef %div)
%inc = add nuw nsw i32 %i.0106, 1
%78 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %78
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 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #6
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 double @llvm.sqrt.f64(double) #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>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #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 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h> /*TeraPadÉÄ"ÒW"¨"«·¦Ö~"*/
#include <math.h>
#define A 0
#define B 1
#define C 2
#define X 0
#define Y 1
void syori1(double a,double b,double c,double d,double e,double f,double *x,double *y){ /*x + y= (ªÓ½Â) Ìûö®ððB*/
*x=( c*(e/b)-f )/( a*(e/b)-d );
*y=( ( c-(a * *x) )/b );
}
int syori2(double n){ /* ¬_æ4ÊðlÌÜü yg¢ûzn+=syori2(n) */
n*=1000;
n = n - (double)(int)n;
if(n>=0.5){
return (0.001);
}else{
return 0.;
}
}
int main(){
double xy[3][2],
xp,yp,r,
a,b,c,
cosA,
as[2],at[2],uhen[2],
t,s,
AO[2]; /*AOxNg{x,y}*/
int n, /*f[^Zbg*/
i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%lf %lf %lf %lf %lf %lf",&xy[A][X],&xy[A][Y],&xy[B][X],&xy[B][Y],&xy[C][X],&xy[C][Y]);
c=sqrt( pow( xy[A][X] - xy[B][X] ,2) + pow( xy[A][Y] - xy[B][Y] ,2) ); /* |AB| (xNgÌ嫳) */
a=sqrt( pow( xy[B][X] - xy[C][X] ,2) + pow( xy[B][Y] - xy[C][Y] ,2) ); /* |BC| */
b=sqrt( pow( xy[C][X] - xy[A][X] ,2) + pow( xy[C][Y] - xy[A][Y] ,2) ); /* |AC| */
cosA = ( pow(b,2) + pow(c,2) - pow(a,2) ) / (2*b*c); /* ]·èæè */
as[0] = pow(c,2); /* |AB|^2 */
at[0] = c*b*cosA; /* |AB|*|AC|*cos (A) */
uhen[0] = as[0]/2; /* sÌWÌQ */
as[1] = c*b*cosA; /* at[0]ɯ¶ */
at[1] = pow(b,2); /* |AC|^2 */
uhen[1] = at[1]/2; /* tÌWÌQ */
syori1(at[0],as[0],uhen[0],at[1],as[1],uhen[1],&t,&s); /*y¨mç¹zsÆtªoܵ½B()t+s=ÌA§ûö®*/
AO[X]= s*( xy[B][X] - xy[A][X] ) + t*( xy[C][X] - xy[A][X] ); /* AO = a*AB + t*AC */
AO[Y]= s*( xy[B][Y] - xy[A][Y] ) + t*( xy[C][Y] - xy[A][Y] );
r = a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
xp = AO[X] + xy[A][X];
yp = AO[Y] + xy[A][Y];
r+=0. ;
xp+=0. ;
yp+=0. ;
r += syori2(r);
xp += syori2(xp);
yp += syori2(yp);
printf("%.3lf %.3lf %.3lf\n",xp,yp,r);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184389/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184389/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.2 = private unnamed_addr constant [19 x i8] c"%.3lf %.3lf %.3lf\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @syori1(double noundef %a, double noundef %b, double noundef %c, double noundef %d, double noundef %e, double noundef %f, ptr nocapture noundef writeonly %x, ptr nocapture noundef writeonly %y) local_unnamed_addr #0 {
entry:
%div = fdiv double %e, %b
%0 = insertelement <2 x double> poison, double %f, i64 0
%1 = insertelement <2 x double> %0, double %d, i64 1
%2 = fneg <2 x double> %1
%3 = insertelement <2 x double> poison, double %c, i64 0
%4 = insertelement <2 x double> %3, double %a, i64 1
%5 = insertelement <2 x double> poison, double %div, i64 0
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%7 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %4, <2 x double> %6, <2 x double> %2)
%8 = extractelement <2 x double> %7, i64 0
%9 = extractelement <2 x double> %7, i64 1
%div3 = fdiv double %8, %9
store double %div3, ptr %x, align 8, !tbaa !5
%neg4 = fneg double %a
%10 = tail call double @llvm.fmuladd.f64(double %neg4, double %div3, double %c)
%div5 = fdiv double %10, %b
store double %div5, ptr %y, align 8, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @syori2(double noundef %n) local_unnamed_addr #2 {
entry:
ret i32 0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%xy = alloca [3 x [2 x double]], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %xy) #8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp190 = icmp sgt i32 %0, 0
br i1 %cmp190, label %for.body.lr.ph, label %for.end
for.body.lr.ph: ; preds = %entry
%arrayidx3 = getelementptr inbounds [2 x double], ptr %xy, i64 0, i64 1
%arrayidx4 = getelementptr inbounds [3 x [2 x double]], ptr %xy, i64 0, i64 1
%arrayidx7 = getelementptr inbounds [3 x [2 x double]], ptr %xy, i64 0, i64 1, i64 1
%arrayidx8 = getelementptr inbounds [3 x [2 x double]], ptr %xy, i64 0, i64 2
%arrayidx11 = getelementptr inbounds [3 x [2 x double]], ptr %xy, i64 0, i64 2, i64 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.body
%i.0191 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %xy, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx8, ptr noundef nonnull %arrayidx11)
%1 = load double, ptr %xy, align 16, !tbaa !5
%2 = load double, ptr %arrayidx3, align 8, !tbaa !5
%3 = load <2 x double>, ptr %arrayidx4, align 16, !tbaa !5
%4 = load <2 x double>, ptr %arrayidx8, align 16, !tbaa !5
%5 = fsub <2 x double> %3, %4
%6 = fmul <2 x double> %5, %5
%shift = shufflevector <2 x double> %6, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%7 = fadd <2 x double> %6, %shift
%add37 = extractelement <2 x double> %7, i64 0
%sqrt188 = call double @llvm.sqrt.f64(double %add37)
%square185 = fmul double %sqrt188, %sqrt188
%8 = insertelement <2 x double> poison, double %1, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> %4, <2 x i32> <i32 0, i32 2>
%10 = insertelement <2 x double> %3, double %1, i64 1
%11 = fsub <2 x double> %9, %10
%12 = fmul <2 x double> %11, %11
%13 = insertelement <2 x double> %4, double %2, i64 0
%14 = shufflevector <2 x double> %3, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
%15 = insertelement <2 x double> %14, double %2, i64 1
%16 = fsub <2 x double> %13, %15
%17 = fmul <2 x double> %16, %16
%18 = fadd <2 x double> %12, %17
%19 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %18)
%20 = extractelement <2 x double> %19, i64 1
%square183 = fmul double %20, %20
%21 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%22 = fmul <2 x double> %21, %19
%23 = extractelement <2 x double> %22, i64 0
%add55 = fadd double %23, %square183
%sub57 = fsub double %add55, %square185
%mul = fmul double %20, 2.000000e+00
%24 = extractelement <2 x double> %19, i64 0
%mul58 = fmul double %24, %mul
%div = fdiv double %sub57, %mul58
%25 = insertelement <2 x double> <double 5.000000e-01, double poison>, double %div, i64 1
%26 = fmul <2 x double> %22, %25
%27 = extractelement <2 x double> %26, i64 1
%div.i = fdiv double %27, %23
%neg.i = fmul double %square183, -5.000000e-01
%neg2.i = fneg double %square183
%28 = insertelement <2 x double> poison, double %div.i, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = insertelement <2 x double> poison, double %neg.i, i64 0
%31 = insertelement <2 x double> %30, double %neg2.i, i64 1
%32 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %26, <2 x double> %29, <2 x double> %31)
%33 = extractelement <2 x double> %32, i64 0
%34 = extractelement <2 x double> %32, i64 1
%div3.i = fdiv double %33, %34
%neg4.i = fneg double %27
%35 = extractelement <2 x double> %26, i64 0
%36 = call double @llvm.fmuladd.f64(double %neg4.i, double %div3.i, double %35)
%div5.i = fdiv double %36, %23
%37 = extractelement <2 x double> %3, i64 0
%sub85 = fsub double %37, %1
%38 = extractelement <2 x double> %11, i64 1
%mul92 = fmul double %38, %div3.i
%39 = call double @llvm.fmuladd.f64(double %div5.i, double %sub85, double %mul92)
%40 = extractelement <2 x double> %3, i64 1
%sub98 = fsub double %40, %2
%41 = extractelement <2 x double> %16, i64 1
%mul105 = fmul double %41, %div3.i
%42 = call double @llvm.fmuladd.f64(double %div5.i, double %sub98, double %mul105)
%mul107 = fmul double %sqrt188, %20
%mul108 = fmul double %24, %mul107
%add109 = fadd double %sqrt188, %20
%add110 = fadd double %24, %add109
%add111 = fsub double %20, %sqrt188
%add112 = fadd double %24, %add111
%mul113 = fmul double %add110, %add112
%sub114 = fsub double %sqrt188, %20
%add115 = fadd double %24, %sub114
%mul116 = fmul double %add115, %mul113
%sub118 = fsub double %add109, %24
%mul119 = fmul double %sub118, %mul116
%call120 = call double @sqrt(double noundef %mul119) #8
%div121 = fdiv double %mul108, %call120
%43 = load double, ptr %xy, align 16, !tbaa !5
%add125 = fadd double %43, %39
%44 = load double, ptr %arrayidx3, align 8, !tbaa !5
%add129 = fadd double %44, %42
%add130 = fadd double %div121, 0.000000e+00
%add131 = fadd double %add125, 0.000000e+00
%add132 = fadd double %add129, 0.000000e+00
%call141 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %add131, double noundef %add132, double noundef %add130)
%inc = add nuw nsw i32 %i.0191, 1
%45 = load i32, ptr %n, align 4, !tbaa !9
%cmp = icmp slt i32 %inc, %45
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 4, ptr nonnull %n) #8
call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %xy) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #7
; 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>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.sqrt.v2f64(<2 x double>) #7
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(void)
{
float x1, y1, x2, y2, x3, y3;
float a, b, c;
float xp, yp, r;
float S;
int n;
scanf("%d", &n);
while (n){
scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
a = (x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1);
b = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
c = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2);
a = sqrt(a);
b = sqrt(b);
c = sqrt(c);
r = a * b * c;
r /= sqrt( (a+b+c) * (-a+b+c) * (a-b+c) * (a+b-c) );
xp = ((y1 - y3) * (y1 * y1 - y2 * y2 + x1 * x1 -x2 * x2) - (y1 - y2) * (y1 * y1 - y3 * y3 + x1 * x1 - x3 * x3)) / (2 * (y1 - y3) * (x1 - x2) -2 * (y1 - y2) * (x1 - x3));
yp = ((x1 - x3) * (x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2) - (x1 - x2) * (x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3)) / (2 * (x1 - x3) * (y1 - y2) -2 * (x1 - x2) * (y1 - y3));
printf("%.3f %.3f %.3f\n", xp, yp, r);
n--;
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184431/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184431/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [18 x i8] c"%f %f %f %f %f %f\00", align 1
@.str.2 = private unnamed_addr constant [16 x i8] c"%.3f %.3f %.3f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x1 = alloca float, align 4
%y1 = alloca float, align 4
%x2 = alloca float, align 4
%y2 = alloca float, align 4
%x3 = alloca float, align 4
%y3 = alloca float, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x1) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y1) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x2) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y2) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x3) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y3) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%tobool.not116 = icmp eq i32 %.pr, 0
br i1 %tobool.not116, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3)
%0 = load float, ptr %x3, align 4, !tbaa !9
%1 = load float, ptr %x1, align 4, !tbaa !9
%2 = load float, ptr %y3, align 4, !tbaa !9
%3 = load float, ptr %y1, align 4, !tbaa !9
%4 = load float, ptr %x2, align 4, !tbaa !9
%5 = load float, ptr %y2, align 4, !tbaa !9
%sub11 = fsub float %0, %4
%sub13 = fsub float %2, %5
%mul15 = fmul float %sub13, %sub13
%6 = call float @llvm.fmuladd.f32(float %sub11, float %sub11, float %mul15)
%7 = insertelement <2 x float> poison, float %0, i64 0
%8 = insertelement <2 x float> %7, float %4, i64 1
%9 = insertelement <2 x float> poison, float %1, i64 0
%10 = shufflevector <2 x float> %9, <2 x float> poison, <2 x i32> zeroinitializer
%11 = fsub <2 x float> %8, %10
%12 = insertelement <2 x float> poison, float %2, i64 0
%13 = insertelement <2 x float> %12, float %5, i64 1
%14 = insertelement <2 x float> poison, float %3, i64 0
%15 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> zeroinitializer
%16 = fsub <2 x float> %13, %15
%17 = fmul <2 x float> %16, %16
%18 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %11, <2 x float> %11, <2 x float> %17)
%19 = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %18)
%sqrt = call float @llvm.sqrt.f32(float %6)
%20 = extractelement <2 x float> %19, i64 0
%21 = extractelement <2 x float> %19, i64 1
%mul = fmul float %20, %21
%mul24 = fmul float %sqrt, %mul
%add = fadd float %20, %21
%add25 = fadd float %sqrt, %add
%22 = shufflevector <2 x float> %19, <2 x float> poison, <2 x i32> <i32 1, i32 0>
%23 = fsub <2 x float> %19, %22
%24 = insertelement <2 x float> poison, float %sqrt, i64 0
%25 = shufflevector <2 x float> %24, <2 x float> poison, <2 x i32> zeroinitializer
%26 = fadd <2 x float> %25, %23
%27 = extractelement <2 x float> %26, i64 1
%mul28 = fmul float %add25, %27
%28 = extractelement <2 x float> %26, i64 0
%mul31 = fmul float %28, %mul28
%sub33 = fsub float %add, %sqrt
%mul34 = fmul float %sub33, %mul31
%conv35 = fpext float %mul34 to double
%call36 = call double @sqrt(double noundef %conv35) #6
%conv37 = fpext float %mul24 to double
%div = fdiv double %conv37, %call36
%conv38 = fptrunc double %div to float
%29 = load float, ptr %y1, align 4, !tbaa !9
%30 = load float, ptr %y3, align 4, !tbaa !9
%31 = load float, ptr %y2, align 4, !tbaa !9
%32 = fneg float %31
%neg = fmul float %31, %32
%33 = call float @llvm.fmuladd.f32(float %29, float %29, float %neg)
%34 = load float, ptr %x1, align 4, !tbaa !9
%35 = call float @llvm.fmuladd.f32(float %34, float %34, float %33)
%36 = load float, ptr %x2, align 4, !tbaa !9
%neg44 = fneg float %36
%37 = call float @llvm.fmuladd.f32(float %neg44, float %36, float %35)
%sub46 = fsub float %29, %31
%38 = fneg float %30
%neg49 = fmul float %30, %38
%39 = call float @llvm.fmuladd.f32(float %29, float %29, float %neg49)
%40 = call float @llvm.fmuladd.f32(float %34, float %34, float %39)
%41 = load float, ptr %x3, align 4, !tbaa !9
%neg52 = fneg float %41
%42 = call float @llvm.fmuladd.f32(float %neg52, float %41, float %40)
%43 = fneg float %sub46
%sub57 = fsub float %34, %36
%44 = fmul float %sub46, -2.000000e+00
%sub39 = fsub float %29, %30
%mul56 = fmul float %sub39, 2.000000e+00
%45 = insertelement <2 x float> poison, float %42, i64 0
%46 = insertelement <2 x float> %45, float %44, i64 1
%47 = insertelement <2 x float> poison, float %43, i64 0
%48 = insertelement <2 x float> poison, float %sub39, i64 0
%49 = insertelement <2 x float> %48, float %mul56, i64 1
%50 = insertelement <2 x float> poison, float %37, i64 0
%51 = insertelement <2 x float> %50, float %sub57, i64 1
%neg68 = fmul float %36, %neg44
%52 = call float @llvm.fmuladd.f32(float %34, float %34, float %neg68)
%53 = call float @llvm.fmuladd.f32(float %29, float %29, float %52)
%54 = call float @llvm.fmuladd.f32(float %32, float %31, float %53)
%neg76 = fmul float %41, %neg52
%55 = call float @llvm.fmuladd.f32(float %34, float %34, float %neg76)
%56 = call float @llvm.fmuladd.f32(float %29, float %29, float %55)
%57 = call float @llvm.fmuladd.f32(float %38, float %30, float %56)
%58 = fneg float %sub57
%59 = fmul float %sub57, -2.000000e+00
%sub61 = fsub float %34, %41
%60 = insertelement <2 x float> %47, float %sub61, i64 1
%61 = fmul <2 x float> %46, %60
%62 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %49, <2 x float> %51, <2 x float> %61)
%63 = extractelement <2 x float> %62, i64 0
%64 = extractelement <2 x float> %62, i64 1
%div64 = fdiv float %63, %64
%mul83 = fmul float %sub61, 2.000000e+00
%65 = insertelement <2 x float> poison, float %57, i64 0
%66 = insertelement <2 x float> %65, float %sub39, i64 1
%67 = insertelement <2 x float> poison, float %58, i64 0
%68 = insertelement <2 x float> %67, float %59, i64 1
%69 = fmul <2 x float> %66, %68
%70 = insertelement <2 x float> poison, float %sub61, i64 0
%71 = insertelement <2 x float> %70, float %mul83, i64 1
%72 = insertelement <2 x float> poison, float %54, i64 0
%73 = insertelement <2 x float> %72, float %sub46, i64 1
%74 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %71, <2 x float> %73, <2 x float> %69)
%75 = extractelement <2 x float> %74, i64 0
%76 = extractelement <2 x float> %74, i64 1
%div91 = fdiv float %75, %76
%conv92 = fpext float %div64 to double
%conv93 = fpext float %div91 to double
%conv94 = fpext float %conv38 to double
%call95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %conv92, double noundef %conv93, double noundef %conv94)
%77 = load i32, ptr %n, align 4, !tbaa !5
%dec = add nsw i32 %77, -1
store i32 %dec, ptr %n, align 4, !tbaa !5
%tobool.not = icmp eq i32 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y3) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x3) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y2) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x2) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y1) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x1) #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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 float @llvm.sqrt.f32(float) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.sqrt.v2f32(<2 x 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 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
double x1, y1, x2, y2, x3, y3;
double midx1, midx2, midy1, midy2;
double circlex, circley;
double slant1, slant2;
double slice1, slice2;
double radius;
int i;
int input;
scanf("%d", &input);
for (i = 0; i < input; i++) {
scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
midx1 = (x1 + x2) / 2;
midy1 = (y1 + y2) / 2;
midx2 = (x1 + x3) / 2;
midy2 = (y1 + y3) / 2;
slant1 = - (x2 - x1) / (y2 - y1);
slant2 = - (x3 - x1) / (y3 - y1);
slice1 = midy1 - slant1 * midx1;
slice2 = midy2 - slant2 * midx2;
circlex = (slice2 - slice1) / (slant1 - slant2);
circley = slant1 * circlex + slice1;
if (x2 == x1) {
circley = midy1;
circlex = (circley - slice2) / slant2;
}
else if (y2 == y1) {
circlex = midx1;
circley = slant2 * circlex + slice2;
}
if(x3 == x1) {
circley = midy2;
circlex = (circley - slice1) / slant1;
}
else if (y3 == y1) {
circlex = midx2;
circley = slant1 * circlex + slice1;
}
if (x2 == x1 && y3 == y1) {
circley = midy1;
circlex = midx2;
}
else if (x3 == x1 && y2 == y1){
circley = midy2;
circlex = midx1;
}
radius = sqrt((circlex - x1) * (circlex - x1) + (circley - y1) * (circley - y1));
printf("%0.3f %0.3f %0.3f\n", circlex, circley, radius);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184475/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184475/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [24 x i8] c"%lf %lf %lf %lf %lf %lf\00", align 1
@.str.2 = private unnamed_addr constant [19 x i8] c"%0.3f %0.3f %0.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:
%x1 = alloca double, align 8
%y1 = alloca double, align 8
%x2 = alloca double, align 8
%y2 = alloca double, align 8
%x3 = alloca double, align 8
%y3 = alloca double, align 8
%input = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x3) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %y3) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i32, ptr %input, align 4, !tbaa !5
%cmp80 = icmp sgt i32 %0, 0
br i1 %cmp80, label %for.body, label %for.end
for.body: ; preds = %entry, %if.end42
%i.081 = phi i32 [ %inc, %if.end42 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %x1, ptr noundef nonnull %y1, ptr noundef nonnull %x2, ptr noundef nonnull %y2, ptr noundef nonnull %x3, ptr noundef nonnull %y3)
%1 = load double, ptr %x1, align 8, !tbaa !9
%2 = load double, ptr %x2, align 8, !tbaa !9
%add = fadd double %1, %2
%div = fmul double %add, 5.000000e-01
%3 = load double, ptr %y1, align 8, !tbaa !9
%4 = load double, ptr %y2, align 8, !tbaa !9
%add2 = fadd double %3, %4
%div3 = fmul double %add2, 5.000000e-01
%5 = load double, ptr %x3, align 8, !tbaa !9
%add4 = fadd double %1, %5
%div5 = fmul double %add4, 5.000000e-01
%6 = load double, ptr %y3, align 8, !tbaa !9
%add6 = fadd double %3, %6
%div7 = fmul double %add6, 5.000000e-01
%sub = fsub double %2, %1
%fneg = fneg double %sub
%sub8 = fsub double %4, %3
%div9 = fdiv double %fneg, %sub8
%sub10 = fsub double %5, %1
%fneg11 = fneg double %sub10
%sub12 = fsub double %6, %3
%div13 = fdiv double %fneg11, %sub12
%neg = fneg double %div9
%7 = call double @llvm.fmuladd.f64(double %neg, double %div, double %div3)
%neg14 = fneg double %div13
%8 = call double @llvm.fmuladd.f64(double %neg14, double %div5, double %div7)
%cmp18 = fcmp oeq double %2, %1
br i1 %cmp18, label %if.then, label %if.else
if.then: ; preds = %for.body
%sub19 = fsub double %div3, %8
%div20 = fdiv double %sub19, %div13
br label %if.end23
if.else: ; preds = %for.body
%sub15 = fsub double %8, %7
%sub16 = fsub double %div9, %div13
%div17 = fdiv double %sub15, %sub16
%9 = call double @llvm.fmuladd.f64(double %div9, double %div17, double %7)
%cmp21 = fcmp oeq double %4, %3
br i1 %cmp21, label %if.then22, label %if.end23
if.then22: ; preds = %if.else
%10 = call double @llvm.fmuladd.f64(double %div13, double %div, double %8)
br label %if.end23
if.end23: ; preds = %if.else, %if.then22, %if.then
%circley.0 = phi double [ %div3, %if.then ], [ %10, %if.then22 ], [ %9, %if.else ]
%circlex.0 = phi double [ %div20, %if.then ], [ %div, %if.then22 ], [ %div17, %if.else ]
%cmp24 = fcmp une double %5, %1
br i1 %cmp24, label %if.else28, label %if.end32
if.else28: ; preds = %if.end23
%cmp29 = fcmp oeq double %6, %3
%11 = call double @llvm.fmuladd.f64(double %div9, double %div5, double %7)
%circley.1.ph = select i1 %cmp29, double %11, double %circley.0
%cmp3484 = fcmp oeq double %6, %3
%or.cond85 = select i1 %cmp18, i1 %cmp3484, i1 false
%div3.mux87 = select i1 %or.cond85, double %div3, double %circley.1.ph
%12 = select i1 %or.cond85, i1 true, i1 %cmp29
%div5.mux88 = select i1 %12, double %div5, double %circlex.0
br label %if.end42
if.end32: ; preds = %if.end23
%sub26 = fsub double %div7, %7
%div27 = fdiv double %sub26, %div9
%cmp34 = fcmp oeq double %6, %3
%or.cond = select i1 %cmp18, i1 %cmp34, i1 false
%brmerge = or i1 %cmp24, %or.cond
%div3.mux = select i1 %or.cond, double %div3, double %div7
%div5.mux = select i1 %or.cond, double %div5, double %div27
br i1 %brmerge, label %if.end42, label %land.lhs.true38
land.lhs.true38: ; preds = %if.end32
%cmp39 = fcmp oeq double %4, %3
br i1 %cmp39, label %if.then40, label %if.end42
if.then40: ; preds = %land.lhs.true38
br label %if.end42
if.end42: ; preds = %if.else28, %if.end32, %land.lhs.true38, %if.then40
%circley.2 = phi double [ %div7, %if.then40 ], [ %div7, %land.lhs.true38 ], [ %div3.mux, %if.end32 ], [ %div3.mux87, %if.else28 ]
%circlex.2 = phi double [ %div, %if.then40 ], [ %div27, %land.lhs.true38 ], [ %div5.mux, %if.end32 ], [ %div5.mux88, %if.else28 ]
%sub43 = fsub double %circlex.2, %1
%sub45 = fsub double %circley.2, %3
%mul47 = fmul double %sub45, %sub45
%13 = call double @llvm.fmuladd.f64(double %sub43, double %sub43, double %mul47)
%sqrt = call double @llvm.sqrt.f64(double %13)
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %circlex.2, double noundef %circley.2, double noundef %sqrt)
%inc = add nuw nsw i32 %i.081, 1
%14 = load i32, ptr %input, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %14
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %if.end42, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y3) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x3) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x2) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x1) #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 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 = !{!"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"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MOD 1000000007
//昇順
int asc(const void* a, const void* b){
return *(int*)a-*(int*)b;
}
int main(void){
int N;
scanf("%d",&N);
//A[0]~A[N-1]に格納する
int* A;
NEW(A,N);
for(int i=0;i<N;i++){
scanf("%d",&A[i]);
}
qsort(A,N,sizeof(int),asc);
long ans=1;
if(N%2==0){
for(int i=0;i<(N/2);i++){
if(A[2*i]==2*i+1 && A[2*i+1]==2*i+1) ans=(ans*2)%MOD;
else{
ans=0;
break;
}
}
}
else{
if(A[0]==0){
for(int i=1;i<=(N/2);i++){
if(A[2*i-1]==2*i && A[2*i]==2*i) ans=(ans*2)%MOD;
else{
ans=0;
break;
}
}
}
else ans=0;
}
printf("%ld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184518/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184518/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
@str = private unnamed_addr constant [18 x i8] c"not enough memory\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #9
%cmp = icmp eq ptr %call1, null
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp4102 = icmp sgt i32 %0, 0
br i1 %cmp4102, label %for.body, label %for.cond.cleanup
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #10
unreachable
for.cond.cleanup: ; preds = %for.body, %for.cond.preheader
%conv7.pre-phi = phi i64 [ %conv, %for.cond.preheader ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull %call1, i64 noundef %conv7.pre-phi, i64 noundef 4, ptr noundef nonnull @asc) #8
%1 = load i32, ptr %N, align 4, !tbaa !5
%2 = and i32 %1, 1
%cmp8 = icmp eq i32 %2, 0
br i1 %cmp8, label %for.cond12.preheader, label %if.else38
for.cond12.preheader: ; preds = %for.cond.cleanup
%cmp13110 = icmp sgt i32 %1, 1
br i1 %cmp13110, label %for.body16.preheader, label %if.end74
for.body16.preheader: ; preds = %for.cond12.preheader
%div132137 = lshr i32 %1, 1
%wide.trip.count130 = zext i32 %div132137 to i64
br label %for.body16
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %N, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp4 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp4, label %for.body, label %for.cond.cleanup, !llvm.loop !9
for.body16: ; preds = %for.body16.preheader, %if.then31
%indvars.iv125 = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next126, %if.then31 ]
%ans.0111 = phi i64 [ 1, %for.body16.preheader ], [ %rem33, %if.then31 ]
%5 = shl nuw nsw i64 %indvars.iv125, 1
%arrayidx19 = getelementptr inbounds i32, ptr %call1, i64 %5
%6 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%7 = or i64 %5, 1
%8 = zext i32 %6 to i64
%cmp21 = icmp eq i64 %7, %8
br i1 %cmp21, label %land.lhs.true, label %if.end74
land.lhs.true: ; preds = %for.body16
%arrayidx26 = getelementptr inbounds i32, ptr %call1, i64 %7
%9 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%10 = zext i32 %9 to i64
%cmp29 = icmp eq i64 %7, %10
br i1 %cmp29, label %if.then31, label %if.end74
if.then31: ; preds = %land.lhs.true
%mul32 = shl nsw i64 %ans.0111, 1
%rem33 = srem i64 %mul32, 1000000007
%indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
%exitcond131.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count130
br i1 %exitcond131.not, label %if.end74, label %for.body16, !llvm.loop !11
if.else38: ; preds = %for.cond.cleanup
%11 = load i32, ptr %call1, align 4, !tbaa !5
%cmp40 = icmp eq i32 %11, 0
br i1 %cmp40, label %for.cond44.preheader, label %if.end74
for.cond44.preheader: ; preds = %if.else38
%cmp46.not104 = icmp slt i32 %1, 2
br i1 %cmp46.not104, label %if.end74, label %for.body49.preheader
for.body49.preheader: ; preds = %for.cond44.preheader
%div45133136 = lshr i32 %1, 1
%12 = add nuw nsw i32 %div45133136, 1
%wide.trip.count = zext i32 %12 to i64
%invariant.gep = getelementptr i32, ptr %call1, i64 -1
br label %for.body49
for.body49: ; preds = %for.body49.preheader, %if.then63
%indvars.iv120 = phi i64 [ 1, %for.body49.preheader ], [ %indvars.iv.next121, %if.then63 ]
%ans.2105 = phi i64 [ 1, %for.body49.preheader ], [ %rem65, %if.then63 ]
%13 = shl nuw nsw i64 %indvars.iv120, 1
%gep = getelementptr i32, ptr %invariant.gep, i64 %13
%14 = load i32, ptr %gep, align 4, !tbaa !5
%15 = zext i32 %14 to i64
%cmp54 = icmp eq i64 %13, %15
br i1 %cmp54, label %land.lhs.true56, label %if.end74
land.lhs.true56: ; preds = %for.body49
%arrayidx59 = getelementptr inbounds i32, ptr %call1, i64 %13
%16 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%17 = zext i32 %16 to i64
%cmp61 = icmp eq i64 %13, %17
br i1 %cmp61, label %if.then63, label %if.end74
if.then63: ; preds = %land.lhs.true56
%mul64 = shl nsw i64 %ans.2105, 1
%rem65 = srem i64 %mul64, 1000000007
%indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
%exitcond.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count
br i1 %exitcond.not, label %if.end74, label %for.body49, !llvm.loop !12
if.end74: ; preds = %for.body49, %land.lhs.true56, %if.then63, %for.body16, %land.lhs.true, %if.then31, %for.cond44.preheader, %for.cond12.preheader, %if.else38
%ans.4 = phi i64 [ 0, %if.else38 ], [ 1, %for.cond12.preheader ], [ 1, %for.cond44.preheader ], [ 0, %for.body16 ], [ 0, %land.lhs.true ], [ %rem33, %if.then31 ], [ 0, %for.body49 ], [ 0, %land.lhs.true56 ], [ %rem65, %if.then63 ]
%call75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = { nofree nounwind }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { noreturn nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int* data;
int* data_list;
int n;
int i;
int tmp;
int flag = 0;
int sum = 1;
scanf("%d",&n);
data = (int*)calloc(n,sizeof(int));
data_list = (int*)calloc(n,sizeof(int));
for(i=0; i<n; i++){
scanf("%d",data+i);
}
for(i=0; i<n; i++){
tmp = data[i];
data_list[tmp]++;
}
if( n%2 == 1 && data_list[0] != 1 ) flag = 1;
if( flag == 0 ){
if( n%2 == 1 ){
i = 1;
}else{
i = 0;
}
while( i < n && flag == 0 ){
if( data_list[i+1] != 2 ) flag = 1;
i += 2;
}
}
if( flag == 1 ){
printf("0\n");
}else{
for(i=0; i<n/2; i++){
sum *= 2;
sum %= 1000000007;
}
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184561/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184561/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"0\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #6
%call3 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 4) #6
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.body, label %for.end15
for.cond6.preheader: ; preds = %for.body
%cmp778 = icmp sgt i32 %2, 0
br i1 %cmp778, label %for.body9.preheader, label %for.end15
for.body9.preheader: ; preds = %for.cond6.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.end15.loopexit.unr-lcssa, label %for.body9.preheader.new
for.body9.preheader.new: ; preds = %for.body9.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond6.preheader, !llvm.loop !9
for.body9: ; preds = %for.body9, %for.body9.preheader.new
%indvars.iv89 = phi i64 [ 0, %for.body9.preheader.new ], [ %indvars.iv.next90.3, %for.body9 ]
%niter = phi i64 [ 0, %for.body9.preheader.new ], [ %niter.next.3, %for.body9 ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv89
%4 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom10 = sext i32 %4 to i64
%arrayidx11 = getelementptr inbounds i32, ptr %call3, i64 %idxprom10
%5 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%inc12 = add nsw i32 %5, 1
store i32 %inc12, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next90 = or i64 %indvars.iv89, 1
%arrayidx.1 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next90
%6 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%idxprom10.1 = sext i32 %6 to i64
%arrayidx11.1 = getelementptr inbounds i32, ptr %call3, i64 %idxprom10.1
%7 = load i32, ptr %arrayidx11.1, align 4, !tbaa !5
%inc12.1 = add nsw i32 %7, 1
store i32 %inc12.1, ptr %arrayidx11.1, align 4, !tbaa !5
%indvars.iv.next90.1 = or i64 %indvars.iv89, 2
%arrayidx.2 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next90.1
%8 = load i32, ptr %arrayidx.2, align 4, !tbaa !5
%idxprom10.2 = sext i32 %8 to i64
%arrayidx11.2 = getelementptr inbounds i32, ptr %call3, i64 %idxprom10.2
%9 = load i32, ptr %arrayidx11.2, align 4, !tbaa !5
%inc12.2 = add nsw i32 %9, 1
store i32 %inc12.2, ptr %arrayidx11.2, align 4, !tbaa !5
%indvars.iv.next90.2 = or i64 %indvars.iv89, 3
%arrayidx.3 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv.next90.2
%10 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%idxprom10.3 = sext i32 %10 to i64
%arrayidx11.3 = getelementptr inbounds i32, ptr %call3, i64 %idxprom10.3
%11 = load i32, ptr %arrayidx11.3, align 4, !tbaa !5
%inc12.3 = add nsw i32 %11, 1
store i32 %inc12.3, ptr %arrayidx11.3, align 4, !tbaa !5
%indvars.iv.next90.3 = add nuw nsw i64 %indvars.iv89, 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.end15.loopexit.unr-lcssa, label %for.body9, !llvm.loop !11
for.end15.loopexit.unr-lcssa: ; preds = %for.body9, %for.body9.preheader
%indvars.iv89.unr = phi i64 [ 0, %for.body9.preheader ], [ %indvars.iv.next90.3, %for.body9 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end15, label %for.body9.epil
for.body9.epil: ; preds = %for.end15.loopexit.unr-lcssa, %for.body9.epil
%indvars.iv89.epil = phi i64 [ %indvars.iv.next90.epil, %for.body9.epil ], [ %indvars.iv89.unr, %for.end15.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body9.epil ], [ 0, %for.end15.loopexit.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv89.epil
%12 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%idxprom10.epil = sext i32 %12 to i64
%arrayidx11.epil = getelementptr inbounds i32, ptr %call3, i64 %idxprom10.epil
%13 = load i32, ptr %arrayidx11.epil, align 4, !tbaa !5
%inc12.epil = add nsw i32 %13, 1
store i32 %inc12.epil, ptr %arrayidx11.epil, align 4, !tbaa !5
%indvars.iv.next90.epil = add nuw nsw i64 %indvars.iv89.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.end15, label %for.body9.epil, !llvm.loop !12
for.end15: ; preds = %for.end15.loopexit.unr-lcssa, %for.body9.epil, %entry, %for.cond6.preheader
%.lcssa99 = phi i32 [ %2, %for.cond6.preheader ], [ %0, %entry ], [ %2, %for.body9.epil ], [ %2, %for.end15.loopexit.unr-lcssa ]
%14 = and i32 %.lcssa99, -2147483647
%cmp16 = icmp eq i32 %14, 1
br i1 %cmp16, label %land.lhs.true, label %if.then23
land.lhs.true: ; preds = %for.end15
%15 = load i32, ptr %call3, align 4, !tbaa !5
%cmp19.not = icmp eq i32 %15, 1
br i1 %cmp19.not, label %if.then23, label %if.then43
if.then23: ; preds = %for.end15, %land.lhs.true
%. = zext i1 %cmp16 to i32
%cmp2980 = icmp sgt i32 %.lcssa99, %.
br i1 %cmp2980, label %while.body.preheader, label %for.cond46.preheader
while.body.preheader: ; preds = %if.then23
%16 = zext i1 %cmp16 to i64
%17 = sext i32 %.lcssa99 to i64
%invariant.gep = getelementptr i32, ptr %call3, i64 1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%indvars.iv92 = phi i64 [ %16, %while.body.preheader ], [ %indvars.iv.next93, %while.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv92
%18 = load i32, ptr %gep, align 4, !tbaa !5
%cmp35.not = icmp eq i32 %18, 2
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 2
%cmp29 = icmp slt i64 %indvars.iv.next93, %17
%19 = and i1 %cmp29, %cmp35.not
br i1 %19, label %while.body, label %if.end40, !llvm.loop !14
if.end40: ; preds = %while.body
br i1 %cmp35.not, label %for.cond46.preheader, label %if.then43
for.cond46.preheader: ; preds = %if.then23, %if.end40
%div = sdiv i32 %.lcssa99, 2
%cmp4783 = icmp sgt i32 %.lcssa99, 1
br i1 %cmp4783, label %for.body49.preheader, label %for.end53
for.body49.preheader: ; preds = %for.cond46.preheader
%20 = add nsw i32 %div, -1
%xtraiter100 = and i32 %div, 3
%21 = icmp ult i32 %20, 3
br i1 %21, label %for.end53.loopexit.unr-lcssa, label %for.body49.preheader.new
for.body49.preheader.new: ; preds = %for.body49.preheader
%unroll_iter104 = and i32 %div, -4
br label %for.body49
if.then43: ; preds = %land.lhs.true, %if.end40
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end55
for.body49: ; preds = %for.body49, %for.body49.preheader.new
%sum.085 = phi i32 [ 1, %for.body49.preheader.new ], [ %rem50.3, %for.body49 ]
%niter105 = phi i32 [ 0, %for.body49.preheader.new ], [ %niter105.next.3, %for.body49 ]
%mul = shl nsw i32 %sum.085, 1
%rem50 = srem i32 %mul, 1000000007
%mul.1 = shl nsw i32 %rem50, 1
%rem50.1 = srem i32 %mul.1, 1000000007
%mul.2 = shl nsw i32 %rem50.1, 1
%rem50.2 = srem i32 %mul.2, 1000000007
%mul.3 = shl nsw i32 %rem50.2, 1
%rem50.3 = srem i32 %mul.3, 1000000007
%niter105.next.3 = add i32 %niter105, 4
%niter105.ncmp.3 = icmp eq i32 %niter105.next.3, %unroll_iter104
br i1 %niter105.ncmp.3, label %for.end53.loopexit.unr-lcssa, label %for.body49, !llvm.loop !15
for.end53.loopexit.unr-lcssa: ; preds = %for.body49, %for.body49.preheader
%rem50.lcssa.ph = phi i32 [ undef, %for.body49.preheader ], [ %rem50.3, %for.body49 ]
%sum.085.unr = phi i32 [ 1, %for.body49.preheader ], [ %rem50.3, %for.body49 ]
%lcmp.mod102.not = icmp eq i32 %xtraiter100, 0
br i1 %lcmp.mod102.not, label %for.end53, label %for.body49.epil
for.body49.epil: ; preds = %for.end53.loopexit.unr-lcssa, %for.body49.epil
%sum.085.epil = phi i32 [ %rem50.epil, %for.body49.epil ], [ %sum.085.unr, %for.end53.loopexit.unr-lcssa ]
%epil.iter101 = phi i32 [ %epil.iter101.next, %for.body49.epil ], [ 0, %for.end53.loopexit.unr-lcssa ]
%mul.epil = shl nsw i32 %sum.085.epil, 1
%rem50.epil = srem i32 %mul.epil, 1000000007
%epil.iter101.next = add i32 %epil.iter101, 1
%epil.iter101.cmp.not = icmp eq i32 %epil.iter101.next, %xtraiter100
br i1 %epil.iter101.cmp.not, label %for.end53, label %for.body49.epil, !llvm.loop !16
for.end53: ; preds = %for.end53.loopexit.unr-lcssa, %for.body49.epil, %for.cond46.preheader
%sum.0.lcssa = phi i32 [ 1, %for.cond46.preheader ], [ %rem50.lcssa.ph, %for.end53.loopexit.unr-lcssa ], [ %rem50.epil, %for.body49.epil ]
%call54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sum.0.lcssa)
br label %if.end55
if.end55: ; preds = %for.end53, %if.then43
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !13}
|
#include<stdio.h>
int A[100000], n;
/*2分探索*/
int binarySearch(int key){
int left =0;
int right =n;
int mid;
while(left<right){
mid=(left + right)/2;
if(key==A[mid]) return 1;
if(key > A[mid]) left = mid +1;
else if ( key < A[mid]) right = mid;
}
return 0;
}
int main(){
int i, q, k, sum =0;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &A[i]);
}
scanf("%d", &q);
for( i=0; i<q; i++){
scanf("%d", &k);
if(binarySearch(k))sum++;
}
printf("%d\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184604/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184604/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local global [100000 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ]
%left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.025, %left.024
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %key
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %1, %key
%spec.select = select i1 %cmp9, i32 %div, i32 %right.025
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.024
%right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.i = icmp sgt i32 %5, 0
br i1 %cmp23.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.end.i
%right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ]
%left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.024.i, %right.025.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%cmp9.i = icmp sgt i32 %6, %4
%spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i
%right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9
binarySearch.exit: ; preds = %while.body.i
%inc8 = add nsw i32 %sum.025, 1
br label %for.cond3
for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit
%7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int s[1000000], n;
int binary(int);
int main()
{
int i, k, q, sum = 0;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &s[i]);
scanf("%d", &q);
for (i = 0; i < q; i++)
{
scanf("%d", &k);
if (binary(k))
sum++;
}
printf("%d\n", sum);
return 0;
}
int binary(int k)
{
int left = 0, right = n, mid;
while (left < right)
{
mid = (left + right) / 2;
if (k == s[mid])
return 1;
if (k > s[mid])
left = mid + 1;
else if (k < s[mid])
right = mid;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184648/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184648/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@s = dso_local global [1000000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%q = 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 %q) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [1000000 x i32], ptr @s, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.i = icmp sgt i32 %5, 0
br i1 %cmp23.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.end.i
%right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ]
%left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.024.i, %right.025.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @s, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binary.exit, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%cmp9.i = icmp sgt i32 %6, %4
%spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i
%right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !11
binary.exit: ; preds = %while.body.i
%inc8 = add nsw i32 %sum.025, 1
br label %for.cond3
for.cond3: ; preds = %if.end.i, %for.body5, %binary.exit
%7 = phi i32 [ %inc8, %binary.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #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 norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binary(i32 noundef %k) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ]
%left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.025, %left.024
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %k
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %k
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %1, %k
%spec.select = select i1 %cmp9, i32 %div, i32 %right.025
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.024
%right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int a[100001],b[50001];
int main(void){
int n,q,cnt=0,i,j;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&a[i]);
scanf("%d",&q);
for(i=0;i<q;i++)scanf("%d",&b[i]);
for(i=0;i<q;i++){
int l=0,r=n;
while(r-l>1){
int m=(l+r)/2;
if(a[m] > b[i])r=m;
else l=m;
}
cnt+=(a[l]==b[i] || a[r]==b[i]);
}
printf("%d\n",cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184691/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184691/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@a = dso_local global [100001 x i32] zeroinitializer, align 16
@b = dso_local global [50001 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp455 = icmp sgt i32 %3, 0
br i1 %cmp455, label %for.body5, label %for.end34
for.cond12.preheader: ; preds = %for.body5
%cmp1362 = icmp sgt i32 %12, 0
br i1 %cmp1362, label %for.body14.lr.ph, label %for.end34
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1557 = icmp sgt i32 %4, 1
br i1 %cmp1557, label %for.body14.us.preheader, label %for.body14.lr.ph.split
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count78 = zext i32 %12 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.preheader, %lor.end.us
%indvars.iv75 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next76, %lor.end.us ]
%cnt.064.us = phi i32 [ 0, %for.body14.us.preheader ], [ %add31.us, %lor.end.us ]
%arrayidx19.us = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %indvars.iv75
%5 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
br label %while.body.us
lor.rhs.us: ; preds = %while.cond.while.end_crit_edge.us
%idxprom26.us = sext i32 %div.r.0.us to i64
%arrayidx27.us = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %idxprom26.us
%6 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5
%cmp30.us = icmp eq i32 %6, %5
br label %lor.end.us
lor.end.us: ; preds = %lor.rhs.us, %while.cond.while.end_crit_edge.us
%7 = phi i1 [ true, %while.cond.while.end_crit_edge.us ], [ %cmp30.us, %lor.rhs.us ]
%lor.ext.us = zext i1 %7 to i32
%add31.us = add nuw nsw i32 %cnt.064.us, %lor.ext.us
%indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
%exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
br i1 %exitcond79.not, label %for.end34, label %for.body14.us, !llvm.loop !11
while.body.us: ; preds = %for.body14.us, %while.body.us
%r.059.us = phi i32 [ %4, %for.body14.us ], [ %div.r.0.us, %while.body.us ]
%l.058.us = phi i32 [ 0, %for.body14.us ], [ %l.0.div.us, %while.body.us ]
%add.us = add nsw i32 %r.059.us, %l.058.us
%div.us = sdiv i32 %add.us, 2
%idxprom16.us = sext i32 %div.us to i64
%arrayidx17.us = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %idxprom16.us
%8 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5
%cmp20.us = icmp sgt i32 %8, %5
%l.0.div.us = select i1 %cmp20.us, i32 %l.058.us, i32 %div.us
%div.r.0.us = select i1 %cmp20.us, i32 %div.us, i32 %r.059.us
%sub.us = sub nsw i32 %div.r.0.us, %l.0.div.us
%cmp15.us = icmp sgt i32 %sub.us, 1
br i1 %cmp15.us, label %while.body.us, label %while.cond.while.end_crit_edge.us, !llvm.loop !12
while.cond.while.end_crit_edge.us: ; preds = %while.body.us
%idxprom21.us = sext i32 %l.0.div.us to i64
%arrayidx22.us = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %idxprom21.us
%9 = load i32, ptr %arrayidx22.us, align 4, !tbaa !5
%cmp25.us = icmp eq i32 %9, %5
br i1 %cmp25.us, label %lor.end.us, label %lor.rhs.us
for.body14.lr.ph.split: ; preds = %for.body14.lr.ph
%10 = load i32, ptr @a, align 16, !tbaa !5
%idxprom26 = sext i32 %4 to i64
%arrayidx27 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %idxprom26
%wide.trip.count = zext i32 %12 to i64
%xtraiter = and i64 %wide.trip.count, 1
%11 = icmp eq i32 %12, 1
br i1 %11, label %for.end34.loopexit84.unr-lcssa, label %for.body14.lr.ph.split.new
for.body14.lr.ph.split.new: ; preds = %for.body14.lr.ph.split
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body14
for.body5: ; preds = %for.end, %for.body5
%indvars.iv69 = phi i64 [ %indvars.iv.next70, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %indvars.iv69
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%12 = load i32, ptr %q, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp4 = icmp slt i64 %indvars.iv.next70, %13
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.body14: ; preds = %lor.end.1, %for.body14.lr.ph.split.new
%indvars.iv72 = phi i64 [ 0, %for.body14.lr.ph.split.new ], [ %indvars.iv.next73.1, %lor.end.1 ]
%cnt.064 = phi i32 [ 0, %for.body14.lr.ph.split.new ], [ %add31.1, %lor.end.1 ]
%niter = phi i64 [ 0, %for.body14.lr.ph.split.new ], [ %niter.next.1, %lor.end.1 ]
%arrayidx24 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %indvars.iv72
%14 = load i32, ptr %arrayidx24, align 8, !tbaa !5
%cmp25 = icmp eq i32 %10, %14
br i1 %cmp25, label %lor.end, label %lor.rhs
lor.rhs: ; preds = %for.body14
%15 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp30 = icmp eq i32 %15, %14
br label %lor.end
lor.end: ; preds = %lor.rhs, %for.body14
%16 = phi i1 [ true, %for.body14 ], [ %cmp30, %lor.rhs ]
%lor.ext = zext i1 %16 to i32
%add31 = add nuw nsw i32 %cnt.064, %lor.ext
%indvars.iv.next73 = or i64 %indvars.iv72, 1
%arrayidx24.1 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %indvars.iv.next73
%17 = load i32, ptr %arrayidx24.1, align 4, !tbaa !5
%cmp25.1 = icmp eq i32 %10, %17
br i1 %cmp25.1, label %lor.end.1, label %lor.rhs.1
lor.rhs.1: ; preds = %lor.end
%18 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp30.1 = icmp eq i32 %18, %17
br label %lor.end.1
lor.end.1: ; preds = %lor.rhs.1, %lor.end
%19 = phi i1 [ true, %lor.end ], [ %cmp30.1, %lor.rhs.1 ]
%lor.ext.1 = zext i1 %19 to i32
%add31.1 = add nuw nsw i32 %add31, %lor.ext.1
%indvars.iv.next73.1 = add nuw nsw i64 %indvars.iv72, 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.end34.loopexit84.unr-lcssa, label %for.body14, !llvm.loop !11
for.end34.loopexit84.unr-lcssa: ; preds = %lor.end.1, %for.body14.lr.ph.split
%add31.lcssa.ph = phi i32 [ undef, %for.body14.lr.ph.split ], [ %add31.1, %lor.end.1 ]
%indvars.iv72.unr = phi i64 [ 0, %for.body14.lr.ph.split ], [ %indvars.iv.next73.1, %lor.end.1 ]
%cnt.064.unr = phi i32 [ 0, %for.body14.lr.ph.split ], [ %add31.1, %lor.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end34, label %for.body14.epil
for.body14.epil: ; preds = %for.end34.loopexit84.unr-lcssa
%arrayidx24.epil = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %indvars.iv72.unr
%20 = load i32, ptr %arrayidx24.epil, align 4, !tbaa !5
%cmp25.epil = icmp eq i32 %10, %20
br i1 %cmp25.epil, label %lor.end.epil, label %lor.rhs.epil
lor.rhs.epil: ; preds = %for.body14.epil
%21 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%cmp30.epil = icmp eq i32 %21, %20
%22 = zext i1 %cmp30.epil to i32
br label %lor.end.epil
lor.end.epil: ; preds = %lor.rhs.epil, %for.body14.epil
%lor.ext.epil = phi i32 [ 1, %for.body14.epil ], [ %22, %lor.rhs.epil ]
%add31.epil = add nuw nsw i32 %cnt.064.unr, %lor.ext.epil
br label %for.end34
for.end34: ; preds = %lor.end.epil, %for.end34.loopexit84.unr-lcssa, %lor.end.us, %for.end, %for.cond12.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.end ], [ %add31.us, %lor.end.us ], [ %add31.lcssa.ph, %for.end34.loopexit84.unr-lcssa ], [ %add31.epil, %lor.end.epil ]
%call35 = 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 %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main() {
long n,q,i,j,C;
char *S;
scanf("%ld", &n);
S = (char*)calloc(1000000001,sizeof(char));
for(i = 0; i < n; i++) { scanf("%ld", &j); S[j]=1;}
scanf("%ld", &q);
long T;C = 0;
for(i = 0; i < q; i++) {
scanf("%ld",&T);
if(S[T] == 1) C++;
}
printf("%ld\n",C);
free(S);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184763/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184763/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%q = alloca i64, align 8
%j = alloca i64, align 8
%T = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %j) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call noalias dereferenceable_or_null(1000000001) ptr @calloc(i64 noundef 1000000001, i64 noundef 1) #6
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp22 = icmp sgt i64 %0, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.023 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %j)
%1 = load i64, ptr %j, align 8, !tbaa !5
%arrayidx = getelementptr inbounds i8, ptr %call1, i64 %1
store i8 1, ptr %arrayidx, align 1, !tbaa !9
%inc = add nuw nsw i64 %i.023, 1
%2 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %entry
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %T) #5
%3 = load i64, ptr %q, align 8, !tbaa !5
%cmp524 = icmp sgt i64 %3, 0
br i1 %cmp524, label %for.body6, label %for.end14
for.body6: ; preds = %for.end, %for.body6
%i.126 = phi i64 [ %inc13, %for.body6 ], [ 0, %for.end ]
%C.025 = phi i64 [ %spec.select, %for.body6 ], [ 0, %for.end ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%4 = load i64, ptr %T, align 8, !tbaa !5
%arrayidx8 = getelementptr inbounds i8, ptr %call1, i64 %4
%5 = load i8, ptr %arrayidx8, align 1, !tbaa !9
%cmp9 = icmp eq i8 %5, 1
%inc11 = zext i1 %cmp9 to i64
%spec.select = add nuw nsw i64 %C.025, %inc11
%inc13 = add nuw nsw i64 %i.126, 1
%6 = load i64, ptr %q, align 8, !tbaa !5
%cmp5 = icmp slt i64 %inc13, %6
br i1 %cmp5, label %for.body6, label %for.end14, !llvm.loop !12
for.end14: ; preds = %for.body6, %for.end
%C.0.lcssa = phi i64 [ 0, %for.end ], [ %spec.select, %for.body6 ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %C.0.lcssa)
call void @free(ptr noundef %call1) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %T) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %j) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include<stdio.h>
#define N 100000
#define Q 50000
int binarySearch(int);
int n,S[N];
int main()
{
int q,i,j,count=0,T[Q],key;
scanf("%d",&n);
for(i=0;i<=n-1;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(j=0;j<=q-1;j++){
scanf("%d",&T[j]);
if(binarySearch(T[j])==1)
count++;
}
printf("%d\n",count);
return 0;
}
int binarySearch(int key)
{
int left=0,right=n,mid;
while(left<right){
mid=(left+right)/2;
if(S[mid]==key){
return 1;
}
else if(key<S[mid]){
right=mid;
}
else if(key>S[mid]){
left=mid+1;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184813/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184813/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@S = dso_local global [100000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
%T = alloca [50000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not28 = icmp sgt i32 %0, 0
br i1 %cmp.not.not28, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp.not.not = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp5.not.not30 = icmp sgt i32 %3, 0
br i1 %cmp5.not.not30, label %for.body6, label %for.end17
for.body6: ; preds = %for.end, %for.cond3
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.cond3 ], [ 0, %for.end ]
%count.032 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%arrayidx8 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv34
%call9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx8)
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp24.i = icmp sgt i32 %5, 0
br i1 %cmp24.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body6, %if.else.i
%right.026.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body6 ]
%left.025.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body6 ]
%add.i = add nsw i32 %left.025.i, %right.026.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp sgt i32 %6, %4
%cmp9.i = icmp slt i32 %6, %4
%add11.i = add nsw i32 %div.i, 1
%spec.select.i = select i1 %cmp9.i, i32 %add11.i, i32 %left.025.i
%left.1.i = select i1 %cmp4.i, i32 %left.025.i, i32 %spec.select.i
%right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.026.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !11
binarySearch.exit: ; preds = %while.body.i
%inc14 = add nsw i32 %count.032, 1
br label %for.cond3
for.cond3: ; preds = %if.else.i, %for.body6, %binarySearch.exit
%7 = phi i32 [ %inc14, %binarySearch.exit ], [ %count.032, %for.body6 ], [ %count.032, %if.else.i ]
%indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp5.not.not = icmp slt i64 %indvars.iv.next35, %9
br i1 %cmp5.not.not, label %for.body6, label %for.end17, !llvm.loop !12
for.end17: ; preds = %for.cond3, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.else
%right.026 = phi i32 [ %right.1, %if.else ], [ %0, %entry ]
%left.025 = phi i32 [ %left.1, %if.else ], [ 0, %entry ]
%add = add nsw i32 %right.026, %left.025
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp4 = icmp sgt i32 %1, %key
%cmp9 = icmp slt i32 %1, %key
%add11 = add nsw i32 %div, 1
%spec.select = select i1 %cmp9, i32 %add11, i32 %left.025
%left.1 = select i1 %cmp4, i32 %left.025, i32 %spec.select
%right.1 = select i1 %cmp4, i32 %div, i32 %right.026
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %while.body, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ]
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#define n 1000000
#define q 50000
int s[n],t[q];
int search(int,int);
int main(){
int i;
int num = 0;
int slength,tlength;
scanf("%d",&slength);//input
for(i = 0 ; i < slength ; i++)
{
scanf("%d",&s[i]);
}
scanf("%d",&tlength);
for(i = 0 ; i < tlength ; i++)
{
scanf("%d",&t[i]);
}
for(i = 0 ; i < tlength ; i++)
{
num += search(t[i],slength);
}
printf("%d\n",num);
return 0;
}
int search(int key,int length)
{
int left = 0;
int right = length;
int mid;
while(left < right)
{
mid = (left + right) / 2;
if(key == s[mid])return 1;
if(key > s[mid])left = mid +1;
else if(key < s[mid])right = mid;
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184864/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@s = dso_local global [1000000 x i32] zeroinitializer, align 16
@t = dso_local global [50000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%slength = alloca i32, align 4
%tlength = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %slength) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tlength) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %slength)
%0 = load i32, ptr %slength, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, 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 [1000000 x i32], ptr @s, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %slength, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %tlength)
%3 = load i32, ptr %tlength, align 4, !tbaa !5
%cmp433 = icmp sgt i32 %3, 0
br i1 %cmp433, label %for.body5, label %for.end20
for.cond12.preheader: ; preds = %for.body5
%cmp1335 = icmp sgt i32 %7, 0
br i1 %cmp1335, label %for.body14.lr.ph, label %for.end20
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %slength, align 4, !tbaa !5
%cmp23.i = icmp sgt i32 %4, 0
br i1 %cmp23.i, label %for.body14.us.preheader, label %for.end20
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count = zext i32 %7 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.preheader, %search.exit.loopexit.us
%indvars.iv45 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next46, %search.exit.loopexit.us ]
%num.037.us = phi i32 [ 0, %for.body14.us.preheader ], [ %add.us, %search.exit.loopexit.us ]
%arrayidx16.us = getelementptr inbounds [50000 x i32], ptr @t, i64 0, i64 %indvars.iv45
%5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5
br label %while.body.i.us
while.body.i.us: ; preds = %for.body14.us, %if.end.i.us
%right.025.i.us = phi i32 [ %right.1.i.us, %if.end.i.us ], [ %4, %for.body14.us ]
%left.024.i.us = phi i32 [ %left.1.i.us, %if.end.i.us ], [ 0, %for.body14.us ]
%add.i.us = add nsw i32 %left.024.i.us, %right.025.i.us
%div.i.us = sdiv i32 %add.i.us, 2
%idxprom.i.us = sext i32 %div.i.us to i64
%arrayidx.i.us = getelementptr inbounds [1000000 x i32], ptr @s, i64 0, i64 %idxprom.i.us
%6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i32 %6, %5
br i1 %cmp1.i.us, label %search.exit.loopexit.us, label %if.end.i.us
if.end.i.us: ; preds = %while.body.i.us
%cmp4.i.us = icmp slt i32 %6, %5
%add6.i.us = add nsw i32 %div.i.us, 1
%cmp9.i.us = icmp sgt i32 %6, %5
%spec.select.i.us = select i1 %cmp9.i.us, i32 %div.i.us, i32 %right.025.i.us
%left.1.i.us = select i1 %cmp4.i.us, i32 %add6.i.us, i32 %left.024.i.us
%right.1.i.us = select i1 %cmp4.i.us, i32 %right.025.i.us, i32 %spec.select.i.us
%cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us
br i1 %cmp.i.us, label %while.body.i.us, label %search.exit.loopexit.us, !llvm.loop !11
search.exit.loopexit.us: ; preds = %if.end.i.us, %while.body.i.us
%retval.0.i.ph.us = phi i32 [ 1, %while.body.i.us ], [ 0, %if.end.i.us ]
%add.us = add nuw nsw i32 %retval.0.i.ph.us, %num.037.us
%indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
%exitcond.not = icmp eq i64 %indvars.iv.next46, %wide.trip.count
br i1 %exitcond.not, label %for.end20, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv42 = phi i64 [ %indvars.iv.next43, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50000 x i32], ptr @t, i64 0, i64 %indvars.iv42
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
%7 = load i32, ptr %tlength, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next43, %8
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end20: ; preds = %search.exit.loopexit.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader
%num.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %add.us, %search.exit.loopexit.us ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %num.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tlength) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %slength) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @search(i32 noundef %key, i32 noundef %length) local_unnamed_addr #3 {
entry:
%cmp23 = icmp sgt i32 %length, 0
br i1 %cmp23, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.025 = phi i32 [ %right.1, %if.end ], [ %length, %entry ]
%left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.025, %left.024
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @s, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %key
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %0, %key
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %0, %key
%spec.select = select i1 %cmp9, i32 %div, i32 %right.025
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.024
%right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 #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> // printf(), scanf()
#include <stdbool.h>
#define MAX_N 100000
int s[MAX_N];
int n = 0;
bool
search(int x)
{
int l = 0, r = n - 1;
while (l <= r)
{
int i = (l + r) / 2;
if (x > s[i])
l = i + 1;
else if (x < s[i])
r = i - 1;
else
return true;
}
return false;
}
int
main(int argc, char** argv)
{
int q = 0;
int t = 0;
int i;
scanf("%d", &n);
for (i = 0; i < n; ++i)
scanf("%d", &s[i]);
scanf("%d", &q);
int count = 0;
for (i = 0; i < q; ++i)
{
scanf("%d", &t);
if (search(t))
count++;
}
printf("%d\n", count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@s = dso_local global [100000 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local zeroext i1 @search(i32 noundef %x) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
br label %while.cond.outer
while.cond.outer: ; preds = %if.then, %entry
%l.0.ph = phi i32 [ %add2, %if.then ], [ 0, %entry ]
%r.0.ph = phi i32 [ %r.0, %if.then ], [ %sub, %entry ]
br label %while.cond
while.cond: ; preds = %while.cond.outer, %cleanup
%r.0 = phi i32 [ %sub7, %cleanup ], [ %r.0.ph, %while.cond.outer ]
%cmp.not.not = icmp sle i32 %l.0.ph, %r.0
br i1 %cmp.not.not, label %while.body, label %cleanup10
while.body: ; preds = %while.cond
%add = add nsw i32 %r.0, %l.0.ph
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp slt i32 %1, %x
br i1 %cmp1, label %if.then, label %cleanup
if.then: ; preds = %while.body
%add2 = add nsw i32 %div, 1
br label %while.cond.outer, !llvm.loop !9
cleanup: ; preds = %while.body
%cmp5 = icmp sgt i32 %1, %x
%sub7 = add nsw i32 %div, -1
br i1 %cmp5, label %while.cond, label %cleanup10, !llvm.loop !9
cleanup10: ; preds = %while.cond, %cleanup
ret i1 %cmp.not.not
}
; 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:
%q = alloca i32, align 4
%t = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
store i32 0, ptr %q, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
store i32 0, ptr %t, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp422 = icmp sgt i32 %3, 0
br i1 %cmp422, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %search.exit
%count.024 = phi i32 [ %spec.select, %search.exit ], [ 0, %for.end ]
%i.123 = phi i32 [ %inc10, %search.exit ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%4 = load i32, ptr %t, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%sub.i = add nsw i32 %5, -1
br label %while.cond.outer.i
while.cond.outer.i: ; preds = %if.then.i, %for.body5
%l.0.ph.i = phi i32 [ %add2.i, %if.then.i ], [ 0, %for.body5 ]
%r.0.ph.i = phi i32 [ %r.0.i, %if.then.i ], [ %sub.i, %for.body5 ]
br label %while.cond.i
while.cond.i: ; preds = %cleanup.i, %while.cond.outer.i
%r.0.i = phi i32 [ %sub7.i, %cleanup.i ], [ %r.0.ph.i, %while.cond.outer.i ]
%cmp.not.not.i.not.not = icmp sle i32 %l.0.ph.i, %r.0.i
br i1 %cmp.not.not.i.not.not, label %while.body.i, label %search.exit
while.body.i: ; preds = %while.cond.i
%add.i = add nsw i32 %r.0.i, %l.0.ph.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp slt i32 %6, %4
br i1 %cmp1.i, label %if.then.i, label %cleanup.i
if.then.i: ; preds = %while.body.i
%add2.i = add nsw i32 %div.i, 1
br label %while.cond.outer.i, !llvm.loop !9
cleanup.i: ; preds = %while.body.i
%cmp5.i = icmp sgt i32 %6, %4
%sub7.i = add nsw i32 %div.i, -1
br i1 %cmp5.i, label %while.cond.i, label %search.exit, !llvm.loop !9
search.exit: ; preds = %while.cond.i, %cleanup.i
%inc8 = zext i1 %cmp.not.not.i.not.not to i32
%spec.select = add nuw nsw i32 %count.024, %inc8
%inc10 = add nuw nsw i32 %i.123, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %7
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %search.exit, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %spec.select, %search.exit ]
%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 %t) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(){
int an,bn,i,j,count=0;
scanf("%d",&an);
int A[an+1];
for(i=0;i<an;i++)
scanf("%d",&A[i]);
scanf("%d",&bn);
int B[bn+1];
for(i=0;i<bn;i++)
scanf("%d",&B[i]);
//search
for(i=0;i<bn;i++){
j=0;
A[an]=B[i];
while(A[j]!=B[i])
j++;
if(j!=an)count++;
//printf("j=%d\n",j);
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_184958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_184958/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%an = alloca i32, align 4
%bn = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %an) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %bn) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %an)
%0 = load i32, ptr %an, 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 %an, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %3, 0
br i1 %cmp45, 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 %an, 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 !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %bn)
%6 = load i32, ptr %bn, align 4, !tbaa !5
%add3 = add nsw i32 %6, 1
%7 = zext i32 %add3 to i64
%vla4 = alloca i32, i64 %7, align 16
%cmp647 = icmp sgt i32 %6, 0
br i1 %cmp647, label %for.body7, label %for.end31
for.cond14.preheader: ; preds = %for.body7
%cmp1549 = icmp sgt i32 %10, 0
br i1 %cmp1549, label %for.body16.lr.ph, label %for.end31
for.body16.lr.ph: ; preds = %for.cond14.preheader
%8 = load i32, ptr %an, align 4, !tbaa !5
%idxprom19 = sext i32 %8 to i64
%arrayidx20 = getelementptr inbounds i32, ptr %vla, i64 %idxprom19
%wide.trip.count = zext i32 %10 to i64
%xtraiter = and i64 %wide.trip.count, 1
%9 = icmp eq i32 %10, 1
br i1 %9, label %for.end31.loopexit.unr-lcssa, label %for.body16.lr.ph.new
for.body16.lr.ph.new: ; preds = %for.body16.lr.ph
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body16
for.body7: ; preds = %for.end, %for.body7
%indvars.iv55 = phi i64 [ %indvars.iv.next56, %for.body7 ], [ 0, %for.end ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv55
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx9)
%indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
%10 = load i32, ptr %bn, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp6 = icmp slt i64 %indvars.iv.next56, %11
br i1 %cmp6, label %for.body7, label %for.cond14.preheader, !llvm.loop !11
for.body16: ; preds = %while.end.1, %for.body16.lr.ph.new
%indvars.iv61 = phi i64 [ 0, %for.body16.lr.ph.new ], [ %indvars.iv.next62.1, %while.end.1 ]
%count.050 = phi i32 [ 0, %for.body16.lr.ph.new ], [ %spec.select.1, %while.end.1 ]
%niter = phi i64 [ 0, %for.body16.lr.ph.new ], [ %niter.next.1, %while.end.1 ]
%arrayidx18 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv61
%12 = load i32, ptr %arrayidx18, align 8, !tbaa !5
store i32 %12, ptr %arrayidx20, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %for.body16
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %while.cond ], [ 0, %for.body16 ]
%arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv58
%13 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%cmp25.not = icmp eq i32 %13, %12
%indvars.iv.next59 = add nuw i64 %indvars.iv58, 1
br i1 %cmp25.not, label %while.end, label %while.cond, !llvm.loop !12
while.end: ; preds = %while.cond
%14 = trunc i64 %indvars.iv58 to i32
%cmp27.not = icmp ne i32 %8, %14
%inc28 = zext i1 %cmp27.not to i32
%spec.select = add nuw nsw i32 %count.050, %inc28
%indvars.iv.next62 = or i64 %indvars.iv61, 1
%arrayidx18.1 = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv.next62
%15 = load i32, ptr %arrayidx18.1, align 4, !tbaa !5
store i32 %15, ptr %arrayidx20, align 4, !tbaa !5
br label %while.cond.1
while.cond.1: ; preds = %while.cond.1, %while.end
%indvars.iv58.1 = phi i64 [ %indvars.iv.next59.1, %while.cond.1 ], [ 0, %while.end ]
%arrayidx22.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv58.1
%16 = load i32, ptr %arrayidx22.1, align 4, !tbaa !5
%cmp25.not.1 = icmp eq i32 %16, %15
%indvars.iv.next59.1 = add nuw i64 %indvars.iv58.1, 1
br i1 %cmp25.not.1, label %while.end.1, label %while.cond.1, !llvm.loop !12
while.end.1: ; preds = %while.cond.1
%17 = trunc i64 %indvars.iv58.1 to i32
%cmp27.not.1 = icmp ne i32 %8, %17
%inc28.1 = zext i1 %cmp27.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc28.1
%indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 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.end31.loopexit.unr-lcssa, label %for.body16, !llvm.loop !13
for.end31.loopexit.unr-lcssa: ; preds = %while.end.1, %for.body16.lr.ph
%spec.select.lcssa.ph = phi i32 [ undef, %for.body16.lr.ph ], [ %spec.select.1, %while.end.1 ]
%indvars.iv61.unr = phi i64 [ 0, %for.body16.lr.ph ], [ %indvars.iv.next62.1, %while.end.1 ]
%count.050.unr = phi i32 [ 0, %for.body16.lr.ph ], [ %spec.select.1, %while.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end31, label %for.body16.epil
for.body16.epil: ; preds = %for.end31.loopexit.unr-lcssa
%arrayidx18.epil = getelementptr inbounds i32, ptr %vla4, i64 %indvars.iv61.unr
%18 = load i32, ptr %arrayidx18.epil, align 4, !tbaa !5
store i32 %18, ptr %arrayidx20, align 4, !tbaa !5
br label %while.cond.epil
while.cond.epil: ; preds = %while.cond.epil, %for.body16.epil
%indvars.iv58.epil = phi i64 [ %indvars.iv.next59.epil, %while.cond.epil ], [ 0, %for.body16.epil ]
%arrayidx22.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv58.epil
%19 = load i32, ptr %arrayidx22.epil, align 4, !tbaa !5
%cmp25.not.epil = icmp eq i32 %19, %18
%indvars.iv.next59.epil = add nuw i64 %indvars.iv58.epil, 1
br i1 %cmp25.not.epil, label %while.end.epil, label %while.cond.epil, !llvm.loop !12
while.end.epil: ; preds = %while.cond.epil
%20 = trunc i64 %indvars.iv58.epil to i32
%cmp27.not.epil = icmp ne i32 %8, %20
%inc28.epil = zext i1 %cmp27.not.epil to i32
%spec.select.epil = add nuw nsw i32 %count.050.unr, %inc28.epil
br label %for.end31
for.end31: ; preds = %while.end.epil, %for.end31.loopexit.unr-lcssa, %for.end, %for.cond14.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond14.preheader ], [ 0, %for.end ], [ %spec.select.lcssa.ph, %for.end31.loopexit.unr-lcssa ], [ %spec.select.epil, %while.end.epil ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %bn) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %an) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 100000
#define M 50000
int main(){
int i,j,left,right,mid,n,length,count=0,A[N],B[M];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
scanf("%d",&length);
for(j=0;j<length;j++){
scanf("%d",&B[j]);
}
for(i=0;i<length;i++){
left=0;
right=n;
while(left<right){
mid=(right+left)/2;
if(B[i]==A[mid]){
count++;
break;
}
if(B[i]>A[mid]){
left=mid+1;
}
else if(B[i]<A[mid]){
right=mid;
}
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185007/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185007/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%length = alloca i32, align 4
%A = alloca [100000 x i32], align 16
%B = alloca [50000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %length) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %0, 0
br i1 %cmp58, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %length)
%3 = load i32, ptr %length, align 4, !tbaa !5
%cmp460 = icmp sgt i32 %3, 0
br i1 %cmp460, label %for.body5, label %for.end39
for.cond12.preheader: ; preds = %for.body5
%cmp1365 = icmp sgt i32 %7, 0
br i1 %cmp1365, label %for.body14.lr.ph, label %for.end39
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1562 = icmp sgt i32 %4, 0
br i1 %cmp1562, label %for.body14.us.preheader, label %for.end39
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count = zext i32 %7 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.preheader, %for.inc37.us
%indvars.iv76 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next77, %for.inc37.us ]
%count.068.us = phi i32 [ 0, %for.body14.us.preheader ], [ %count.1.us, %for.inc37.us ]
%arrayidx17.us = getelementptr inbounds [50000 x i32], ptr %B, i64 0, i64 %indvars.iv76
%5 = load i32, ptr %arrayidx17.us, align 4, !tbaa !5
br label %while.body.us
while.body.us: ; preds = %for.body14.us, %if.end.us
%right.064.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.end.us ]
%left.063.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.end.us ]
%add.us = add nsw i32 %right.064.us, %left.063.us
%div.us = sdiv i32 %add.us, 2
%idxprom18.us = sext i32 %div.us to i64
%arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %A, i64 0, i64 %idxprom18.us
%6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp20.us = icmp eq i32 %5, %6
br i1 %cmp20.us, label %if.then.us, label %if.end.us
if.end.us: ; preds = %while.body.us
%cmp26.us = icmp sgt i32 %5, %6
%add28.us = add nsw i32 %div.us, 1
%cmp33.us = icmp slt i32 %5, %6
%spec.select.us = select i1 %cmp33.us, i32 %div.us, i32 %right.064.us
%left.1.us = select i1 %cmp26.us, i32 %add28.us, i32 %left.063.us
%right.1.us = select i1 %cmp26.us, i32 %right.064.us, i32 %spec.select.us
%cmp15.us = icmp slt i32 %left.1.us, %right.1.us
br i1 %cmp15.us, label %while.body.us, label %for.inc37.us, !llvm.loop !11
if.then.us: ; preds = %while.body.us
%inc21.us = add nsw i32 %count.068.us, 1
br label %for.inc37.us
for.inc37.us: ; preds = %if.end.us, %if.then.us
%count.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %count.068.us, %if.end.us ]
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond.not = icmp eq i64 %indvars.iv.next77, %wide.trip.count
br i1 %exitcond.not, label %for.end39, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv73 = phi i64 [ %indvars.iv.next74, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50000 x i32], ptr %B, i64 0, i64 %indvars.iv73
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
%7 = load i32, ptr %length, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next74, %8
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end39: ; preds = %for.inc37.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %count.1.us, %for.inc37.us ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %length) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
int A[100000],n;
int binarySearch(int key){
int left=0;
int right=n;
int mid;
while(left<right){
mid=(left+right)/2;
if(A[mid]==key){
return 1;
}
if(key>A[mid]){
left=mid+1;
}
else if(key<A[mid]){
right=mid;
}
}
return 0;
}
int main(){
int i, q, key, sum=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&A[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++){
scanf("%d",&key);
if(binarySearch(key)){
sum++;
}
}
printf("%d\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185050/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185050/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local global [100000 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ]
%left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.025, %left.024
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %key
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %1, %key
%spec.select = select i1 %cmp9, i32 %div, i32 %right.025
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.024
%right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %key, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.i = icmp sgt i32 %5, 0
br i1 %cmp23.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.end.i
%right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ]
%left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.024.i, %right.025.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @A, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%cmp9.i = icmp sgt i32 %6, %4
%spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i
%right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9
binarySearch.exit: ; preds = %while.body.i
%inc8 = add nsw i32 %sum.025, 1
br label %for.cond3
for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit
%7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int A[1000000], n;
int binarySearch(int key){
int left = 0;
int right = n;
int mid;
while( left < right ){
mid = (left + right) / 2;
if( key == A[mid] ) return 1;
if( key > A[mid] ) left = mid + 1;
else if( key < A[mid] ) right = mid;
}
return 0;
}
int main(){
int i, q, k, sum = 0;
scanf("%d", &n);
for( i = 0; i < n; i++ ){
scanf("%d", &A[i]);
}
scanf("%d", &q);
for(i = 0; i < q; i++){
scanf("%d", &k);
if( binarySearch(k) ) sum++;
}
printf("%d\n", sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185094/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185094/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local global [1000000 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ]
%left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.025, %left.024
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %key
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %1, %key
%spec.select = select i1 %cmp9, i32 %div, i32 %right.025
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.024
%right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.i = icmp sgt i32 %5, 0
br i1 %cmp23.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.end.i
%right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ]
%left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.024.i, %right.025.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%cmp9.i = icmp sgt i32 %6, %4
%spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i
%right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9
binarySearch.exit: ; preds = %while.body.i
%inc8 = add nsw i32 %sum.025, 1
br label %for.cond3
for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit
%7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int S[1000000], N, k = 0;
int binarySearch(int X){
int left = 0;
int right = N;
int middle;
while(left < right){
middle = (left + right) / 2;
if(X == S[middle]){
return 1;
}
else if(X > S[middle]){
left = middle + 1;
}
else {
right = middle;
}
}
return 0;
}
int main() {
int M, i, x,count = 0 ;
scanf("%d", &N);
for(i = 0; i < N; i++){
scanf("%d", &S[i]);
}
scanf("%d", &M);
for(i = 0; i < M; i++){
scanf("%d", &x);
if(binarySearch(x) == 1){
count += 1;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185137/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185137/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@k = dso_local local_unnamed_addr global i32 0, align 4
@N = dso_local global i32 0, align 4
@S = dso_local global [1000000 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %X) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.else
%right.019 = phi i32 [ %right.1, %if.else ], [ %0, %entry ]
%left.018 = phi i32 [ %left.1, %if.else ], [ 0, %entry ]
%add = add nsw i32 %right.019, %left.018
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %X
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %X
%add6 = add nsw i32 %div, 1
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.018
%right.1 = select i1 %cmp4, i32 %right.019, i32 %div
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %while.body, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%M = alloca i32, align 4
%x = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %M) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N)
%0 = load i32, ptr @N, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [1000000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @N, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %M)
%3 = load i32, ptr %M, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%count.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%4 = load i32, ptr %x, align 4, !tbaa !5
%5 = load i32, ptr @N, align 4, !tbaa !5
%cmp17.i = icmp sgt i32 %5, 0
br i1 %cmp17.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.else.i
%right.019.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ]
%left.018.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.018.i, %right.019.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @S, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.018.i
%right.1.i = select i1 %cmp4.i, i32 %right.019.i, i32 %div.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9
binarySearch.exit: ; preds = %while.body.i
%add = add nsw i32 %count.025, 1
br label %for.cond3
for.cond3: ; preds = %if.else.i, %for.body5, %binarySearch.exit
%7 = phi i32 [ %add, %binarySearch.exit ], [ %count.025, %for.body5 ], [ %count.025, %if.else.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %M, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%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 %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %M) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int descending_compare(const void *a, const void *b){
if (*(int*)a > *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int ascending_compare(const void *a, const void *b){
if (*(int*)a < *(int*)b){
return -1;
}else if (*(int*)a == *(int*)b){
return 0;
}else{
return 1;
}
}
int lower_bound(int *a, int n, int key){
int left, mid, right;
left = 0, right = n;
mid = (left + right)/2;
while ((left+1 != mid || mid+1 != right) && mid != left){
if (key > a[mid]){
left = mid;
}else{
right = mid+1;
}
mid = (left + right)/2;
}
if (a[left] >= key)return left;
if (a[mid] >= key)return mid;
if (a[right] >= key)return right;
return n;
}
//greatest common divisor
unsigned long gcd(unsigned long x, unsigned long y){
if (y == 0){
return x;
}else if (x > y){
return gcd(y, x % y);
}else{
return gcd(x, y % x);
}
}
unsigned long lcm(unsigned long x, unsigned long y){
unsigned long g = gcd(x, y);
return x*y/g;
}
long long factorial(int x){
long long rtn = 1;
int i;
for (i = x; i > 1; i--){
rtn = (rtn*i);
}
return rtn;
}
int s[100005];
int t;
int n;
int q;
int my_bsearch(int key){
int left, right, mid;
left = 0;
right = n;
while (left < right){
mid = (left+right)/2;
if (s[mid] == key){
return mid;
}else if(s[mid] < key){
left = mid + 1;
}else if(s[mid] > key){
right = mid;
}
}
return -1;
}
int main(void){
int cnt = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++){
scanf("%d", &s[i]);
}
qsort(s, n, sizeof(int), ascending_compare);
scanf("%d", &q);
for (int i = 0; i < q; i++){
scanf("%d", &t);
if (my_bsearch(t) != -1){
cnt++;
}
}
printf("%d\n", cnt);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185188/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185188/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@s = dso_local global [100005 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@q = dso_local global i32 0, align 4
@t = dso_local global i32 0, align 4
@.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 @descending_compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ascending_compare(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @lower_bound(ptr nocapture noundef readonly %a, i32 noundef %n, i32 noundef %key) local_unnamed_addr #1 {
entry:
%mid.050 = sdiv i32 %n, 2
%0 = and i32 %n, -2
%cmp.not51 = icmp eq i32 %0, 2
%add252 = add nsw i32 %mid.050, 1
%cmp3.not53 = icmp eq i32 %add252, %n
%or.cond54 = select i1 %cmp.not51, i1 %cmp3.not53, i1 false
%n.off = add i32 %n, 1
%cmp4.not55 = icmp ult i32 %n.off, 3
%or.cond4956 = or i1 %cmp4.not55, %or.cond54
br i1 %or.cond4956, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%add260 = phi i32 [ %add2, %while.body ], [ %add252, %entry ]
%mid.059 = phi i32 [ %mid.0, %while.body ], [ %mid.050, %entry ]
%right.058 = phi i32 [ %right.1, %while.body ], [ %n, %entry ]
%left.057 = phi i32 [ %left.1, %while.body ], [ 0, %entry ]
%idxprom = sext i32 %mid.059 to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp5 = icmp slt i32 %1, %key
%left.1 = select i1 %cmp5, i32 %mid.059, i32 %left.057
%right.1 = select i1 %cmp5, i32 %right.058, i32 %add260
%add7 = add nsw i32 %left.1, %right.1
%mid.0 = sdiv i32 %add7, 2
%add1 = add nsw i32 %left.1, 1
%cmp.not = icmp eq i32 %add1, %mid.0
%add2 = add nsw i32 %mid.0, 1
%cmp3.not = icmp eq i32 %add2, %right.1
%or.cond = select i1 %cmp.not, i1 %cmp3.not, i1 false
%cmp4.not = icmp eq i32 %mid.0, %left.1
%or.cond49 = or i1 %cmp4.not, %or.cond
br i1 %or.cond49, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%left.0.lcssa = phi i32 [ 0, %entry ], [ %left.1, %while.body ]
%right.0.lcssa = phi i32 [ %n, %entry ], [ %right.1, %while.body ]
%mid.0.lcssa = phi i32 [ %mid.050, %entry ], [ %mid.0, %while.body ]
%idxprom9 = sext i32 %left.0.lcssa to i64
%arrayidx10 = getelementptr inbounds i32, ptr %a, i64 %idxprom9
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp slt i32 %2, %key
br i1 %cmp11.not, label %if.end13, label %cleanup
if.end13: ; preds = %while.end
%idxprom14 = sext i32 %mid.0.lcssa to i64
%arrayidx15 = getelementptr inbounds i32, ptr %a, i64 %idxprom14
%3 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16.not = icmp slt i32 %3, %key
br i1 %cmp16.not, label %if.end18, label %cleanup
if.end18: ; preds = %if.end13
%idxprom19 = sext i32 %right.0.lcssa to i64
%arrayidx20 = getelementptr inbounds i32, ptr %a, i64 %idxprom19
%4 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%cmp21.not = icmp slt i32 %4, %key
%n.right.0 = select i1 %cmp21.not, i32 %n, i32 %right.0.lcssa
br label %cleanup
cleanup: ; preds = %if.end18, %if.end13, %while.end
%retval.0 = phi i32 [ %left.0.lcssa, %while.end ], [ %mid.0.lcssa, %if.end13 ], [ %n.right.0, %if.end18 ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
%cmp1518 = icmp eq i64 %y, 0
br i1 %cmp1518, label %return, label %if.else.lr.ph
if.else.lr.ph: ; preds = %entry, %if.then2
%y.tr.ph20 = phi i64 [ %rem, %if.then2 ], [ %y, %entry ]
%x.tr.ph19 = phi i64 [ %y.tr16, %if.then2 ], [ %x, %entry ]
br label %if.else
if.else: ; preds = %if.else.lr.ph, %if.else3
%y.tr16 = phi i64 [ %y.tr.ph20, %if.else.lr.ph ], [ %rem4, %if.else3 ]
%cmp1 = icmp ugt i64 %x.tr.ph19, %y.tr16
br i1 %cmp1, label %if.then2, label %if.else3
if.then2: ; preds = %if.else
%rem = urem i64 %x.tr.ph19, %y.tr16
%cmp15 = icmp eq i64 %rem, 0
br i1 %cmp15, label %return, label %if.else.lr.ph
if.else3: ; preds = %if.else
%rem4 = urem i64 %y.tr16, %x.tr.ph19
%cmp = icmp eq i64 %rem4, 0
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.then2, %if.else3, %entry
%x.tr.ph.lcssa = phi i64 [ %x, %entry ], [ %x.tr.ph19, %if.else3 ], [ %y.tr16, %if.then2 ]
ret i64 %x.tr.ph.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %x, i64 noundef %y) local_unnamed_addr #2 {
entry:
%cmp1518.i = icmp eq i64 %y, 0
br i1 %cmp1518.i, label %gcd.exit, label %if.else.lr.ph.i
if.else.lr.ph.i: ; preds = %entry, %if.then2.i
%y.tr.ph20.i = phi i64 [ %rem.i, %if.then2.i ], [ %y, %entry ]
%x.tr.ph19.i = phi i64 [ %y.tr16.i, %if.then2.i ], [ %x, %entry ]
br label %if.else.i
if.else.i: ; preds = %if.else3.i, %if.else.lr.ph.i
%y.tr16.i = phi i64 [ %y.tr.ph20.i, %if.else.lr.ph.i ], [ %rem4.i, %if.else3.i ]
%cmp1.i = icmp ugt i64 %x.tr.ph19.i, %y.tr16.i
br i1 %cmp1.i, label %if.then2.i, label %if.else3.i
if.then2.i: ; preds = %if.else.i
%rem.i = urem i64 %x.tr.ph19.i, %y.tr16.i
%cmp15.i = icmp eq i64 %rem.i, 0
br i1 %cmp15.i, label %gcd.exit, label %if.else.lr.ph.i
if.else3.i: ; preds = %if.else.i
%rem4.i = urem i64 %y.tr16.i, %x.tr.ph19.i
%cmp.i = icmp eq i64 %rem4.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.else.i
gcd.exit: ; preds = %if.then2.i, %if.else3.i, %entry
%x.tr.ph.lcssa.i = phi i64 [ %x, %entry ], [ %x.tr.ph19.i, %if.else3.i ], [ %y.tr16.i, %if.then2.i ]
%mul = mul i64 %y, %x
%div = udiv i64 %mul, %x.tr.ph.lcssa.i
ret i64 %div
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @factorial(i32 noundef %x) local_unnamed_addr #2 {
entry:
%cmp4 = icmp sgt i32 %x, 1
br i1 %cmp4, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = zext i32 %x to i64
br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%rtn.05 = phi i64 [ 1, %for.body.preheader ], [ %mul, %for.body ]
%mul = mul nsw i64 %rtn.05, %indvars.iv
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%cmp = icmp ugt i64 %indvars.iv, 2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%rtn.0.lcssa = phi i64 [ 1, %entry ], [ %mul, %for.body ]
ret i64 %rtn.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @my_bsearch(i32 noundef %key) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %0, 0
br i1 %cmp25, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.else
%right.027 = phi i32 [ %right.1, %if.else ], [ %0, %entry ]
%left.026 = phi i32 [ %left.1, %if.else ], [ 0, %entry ]
%add = add nsw i32 %right.027, %left.026
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100005 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %key
%add6 = add nsw i32 %div, 1
%cmp10 = icmp sgt i32 %1, %key
%spec.select = select i1 %cmp10, i32 %div, i32 %right.027
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.026
%right.1 = select i1 %cmp4, i32 %right.027, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !12
cleanup: ; preds = %while.body, %if.else, %entry
%retval.0 = phi i32 [ -1, %entry ], [ -1, %if.else ], [ %div, %while.body ]
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #4 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, 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 ], [ %3, %for.body ]
tail call void @qsort(ptr noundef nonnull @s, i64 noundef %conv.pre-phi, i64 noundef 4, ptr noundef nonnull @ascending_compare) #7
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
%1 = load i32, ptr @q, align 4, !tbaa !5
%cmp529 = icmp sgt i32 %1, 0
br i1 %cmp529, label %for.body8, label %for.cond.cleanup7
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100005 x i32], ptr @s, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr @n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !13
for.cond.cleanup7: ; preds = %for.cond4, %for.cond.cleanup
%cnt.0.lcssa = phi i32 [ 0, %for.cond.cleanup ], [ %7, %for.cond4 ]
%call17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %cnt.0.lcssa)
ret i32 0
for.body8: ; preds = %for.cond.cleanup, %for.cond4
%i3.031 = phi i32 [ %inc15, %for.cond4 ], [ 0, %for.cond.cleanup ]
%cnt.030 = phi i32 [ %7, %for.cond4 ], [ 0, %for.cond.cleanup ]
%call9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
%4 = load i32, ptr @t, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp25.i = icmp sgt i32 %5, 0
br i1 %cmp25.i, label %while.body.i, label %my_bsearch.exit.thread
while.body.i: ; preds = %for.body8, %if.else.i
%right.027.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body8 ]
%left.026.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body8 ]
%add.i = add nsw i32 %left.026.i, %right.027.i
%add.i.fr = freeze i32 %add.i
%div.i = sdiv i32 %add.i.fr, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100005 x i32], ptr @s, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %my_bsearch.exit, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%cmp10.i = icmp sgt i32 %6, %4
%spec.select.i = select i1 %cmp10.i, i32 %div.i, i32 %right.027.i
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.026.i
%right.1.i = select i1 %cmp4.i, i32 %right.027.i, i32 %spec.select.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %my_bsearch.exit.thread, !llvm.loop !12
my_bsearch.exit: ; preds = %while.body.i
%add.i.off = add i32 %add.i.fr, 3
%cmp11.not = icmp ult i32 %add.i.off, 2
%inc13 = add nsw i32 %cnt.030, 1
br i1 %cmp11.not, label %my_bsearch.exit.thread, label %for.cond4
my_bsearch.exit.thread: ; preds = %if.else.i, %for.body8, %my_bsearch.exit
br label %for.cond4
for.cond4: ; preds = %my_bsearch.exit, %my_bsearch.exit.thread
%7 = phi i32 [ %cnt.030, %my_bsearch.exit.thread ], [ %inc13, %my_bsearch.exit ]
%inc15 = add nuw nsw i32 %i3.031, 1
%8 = load i32, ptr @q, align 4, !tbaa !5
%cmp5 = icmp slt i32 %inc15, %8
br i1 %cmp5, label %for.body8, label %for.cond.cleanup7, !llvm.loop !14
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 #5
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#include<stdlib.h>
int T[50000],S[100000];
int binarySearch(int,int);
int main() {
int n,i,q,j,k=0;
scanf("%d",&n);
for(j=0;j<n;j++) {
scanf("%d",&S[j]);
}
scanf("%d",&q);
for(i=0;i<q;i++) {
scanf("%d",&T[i]);
if(binarySearch(T[i],n)==1) k++;
}
printf("%d\n",k);
return 0;
}
int binarySearch(int key, int n) {
int left = 0,mid;
int right = n;
while( left < right) {
mid = (left + right) / 2;
if (S[mid] == key)
return 1;
else if (key < S[mid])
right = mid;
else
left = mid + 1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185238/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@S = dso_local global [100000 x i32] zeroinitializer, align 16
@T = dso_local global [50000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %0, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp429 = icmp sgt i32 %3, 0
br i1 %cmp429, label %for.body5, label %for.end16
for.body5: ; preds = %for.end, %for.cond3
%indvars.iv33 = phi i64 [ %indvars.iv.next34, %for.cond3 ], [ 0, %for.end ]
%k.031 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50000 x i32], ptr @T, i64 0, i64 %indvars.iv33
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp17.i = icmp sgt i32 %5, 0
br i1 %cmp17.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.else.i
%right.019.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ]
%left.018.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.018.i, %right.019.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.else.i
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp sgt i32 %6, %4
%add7.i = add nsw i32 %div.i, 1
%left.1.i = select i1 %cmp4.i, i32 %left.018.i, i32 %add7.i
%right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.019.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !11
binarySearch.exit: ; preds = %while.body.i
%inc13 = add nsw i32 %k.031, 1
br label %for.cond3
for.cond3: ; preds = %if.else.i, %for.body5, %binarySearch.exit
%7 = phi i32 [ %inc13, %binarySearch.exit ], [ %k.031, %for.body5 ], [ %k.031, %if.else.i ]
%indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next34, %9
br i1 %cmp4, label %for.body5, label %for.end16, !llvm.loop !12
for.end16: ; preds = %for.cond3, %for.end
%k.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key, i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp17 = icmp sgt i32 %n, 0
br i1 %cmp17, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.else
%right.019 = phi i32 [ %right.1, %if.else ], [ %n, %entry ]
%left.018 = phi i32 [ %left.1, %if.else ], [ 0, %entry ]
%add = add nsw i32 %right.019, %left.018
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @S, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %key
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp4 = icmp sgt i32 %0, %key
%add7 = add nsw i32 %div, 1
%left.1 = select i1 %cmp4, i32 %left.018, i32 %add7
%right.1 = select i1 %cmp4, i32 %div, i32 %right.019
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %while.body, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ]
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int binarySearch(int *, int, int);
int main(){
int N[100000]; int Q[50000];
int nnum, qnum;
int i, j, count = 0;
scanf("%d", &nnum);
for(i = 0; i < nnum; i++){
scanf("%d", &N[i]);
}
scanf("%d", &qnum);
for(i = 0; i < qnum; i++){
scanf("%d", &Q[i]);
}
for(i = 0; i < qnum; i++){
if(binarySearch(N, nnum, Q[i]) == 1){
count++;
}
}
printf("%d\n", count);
return 0;
}
int binarySearch(int *A, int length, int key){
int left, right, mid;
left = 0;
right = length;
while(left < right){
mid = (left + right)/2;
if(key == A[mid]){
return 1;
}
if(key < A[mid]){
right = mid;
}
else {
left = mid+1;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185289/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185289/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [100000 x i32], align 16
%Q = alloca [50000 x i32], align 16
%nnum = alloca i32, align 4
%qnum = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %Q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %nnum) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %qnum) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %nnum)
%0 = load i32, ptr %nnum, align 4, !tbaa !5
%cmp36 = icmp sgt i32 %0, 0
br i1 %cmp36, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %N, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %nnum, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %qnum)
%3 = load i32, ptr %qnum, align 4, !tbaa !5
%cmp438 = icmp sgt i32 %3, 0
br i1 %cmp438, label %for.body5, label %for.end22
for.cond12.preheader: ; preds = %for.body5
%cmp1340 = icmp sgt i32 %8, 0
br i1 %cmp1340, label %for.body14.lr.ph, label %for.end22
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %nnum, align 4, !tbaa !5
%cmp17.i = icmp sgt i32 %4, 0
br i1 %cmp17.i, label %for.body14.us.preheader, label %for.end22
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count = zext i32 %8 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.preheader, %for.cond12.us
%indvars.iv51 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next52, %for.cond12.us ]
%count.042.us = phi i32 [ 0, %for.body14.us.preheader ], [ %7, %for.cond12.us ]
%arrayidx16.us = getelementptr inbounds [50000 x i32], ptr %Q, i64 0, i64 %indvars.iv51
%5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5
br label %while.body.i.us
while.body.i.us: ; preds = %for.body14.us, %if.end.i.us
%right.019.i.us = phi i32 [ %right.1.i.us, %if.end.i.us ], [ %4, %for.body14.us ]
%left.018.i.us = phi i32 [ %left.1.i.us, %if.end.i.us ], [ 0, %for.body14.us ]
%add.i.us = add nsw i32 %left.018.i.us, %right.019.i.us
%div.i.us = sdiv i32 %add.i.us, 2
%idxprom.i.us = sext i32 %div.i.us to i64
%arrayidx.i.us = getelementptr inbounds i32, ptr %N, i64 %idxprom.i.us
%6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i32 %6, %5
br i1 %cmp1.i.us, label %binarySearch.exit.us, label %if.end.i.us
if.end.i.us: ; preds = %while.body.i.us
%cmp4.i.us = icmp sgt i32 %6, %5
%add6.i.us = add nsw i32 %div.i.us, 1
%left.1.i.us = select i1 %cmp4.i.us, i32 %left.018.i.us, i32 %add6.i.us
%right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.019.i.us
%cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us
br i1 %cmp.i.us, label %while.body.i.us, label %for.cond12.us, !llvm.loop !11
binarySearch.exit.us: ; preds = %while.body.i.us
%inc19.us = add nsw i32 %count.042.us, 1
br label %for.cond12.us
for.cond12.us: ; preds = %if.end.i.us, %binarySearch.exit.us
%7 = phi i32 [ %inc19.us, %binarySearch.exit.us ], [ %count.042.us, %if.end.i.us ]
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
br i1 %exitcond.not, label %for.end22, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50000 x i32], ptr %Q, i64 0, i64 %indvars.iv48
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
%8 = load i32, ptr %qnum, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next49, %9
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end22: ; preds = %for.cond12.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %7, %for.cond12.us ]
%call23 = 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 %qnum) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %nnum) #4
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %Q) #4
call void @llvm.lifetime.end.p0(i64 400000, 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 norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @binarySearch(ptr nocapture noundef readonly %A, i32 noundef %length, i32 noundef %key) local_unnamed_addr #3 {
entry:
%cmp17 = icmp sgt i32 %length, 0
br i1 %cmp17, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.019 = phi i32 [ %right.1, %if.end ], [ %length, %entry ]
%left.018 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.019, %left.018
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %key
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp sgt i32 %0, %key
%add6 = add nsw i32 %div, 1
%left.1 = select i1 %cmp4, i32 %left.018, i32 %add6
%right.1 = select i1 %cmp4, i32 %div, i32 %right.019
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree norecurse nosync nounwind memory(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 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 100000
#define Q 50000
int main(){
int S[N], T[Q], C = 0;
int left, right, mid, key;
int n, q, i;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &S[i]);
}
scanf("%d", &q);
for(i = 0; i < q; i++){
scanf("%d", &T[i]);
}
for(i = 0; i < q; i++){
key = T[i];
left = 0;
right = n;
while(left < right){
mid = (left + right) / 2;
if(S[mid] == key){
C++;
break; }
else if (key < S[mid]){
right = mid;
}
else left = mid + 1;
}
}
printf("%d\n", C);
return 0; }
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185331/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185331/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%S = alloca [100000 x i32], align 16
%T = alloca [50000 x i32], align 16
%n = alloca i32, align 4
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 200000, ptr nonnull %T) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp49 = icmp sgt i32 %0, 0
br i1 %cmp49, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp451 = icmp sgt i32 %3, 0
br i1 %cmp451, label %for.body5, label %for.end31
for.cond12.preheader: ; preds = %for.body5
%cmp1356 = icmp sgt i32 %7, 0
br i1 %cmp1356, label %for.body14.lr.ph, label %for.end31
for.body14.lr.ph: ; preds = %for.cond12.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp1753 = icmp sgt i32 %4, 0
br i1 %cmp1753, label %for.body14.us.preheader, label %for.end31
for.body14.us.preheader: ; preds = %for.body14.lr.ph
%wide.trip.count = zext i32 %7 to i64
br label %for.body14.us
for.body14.us: ; preds = %for.body14.us.preheader, %for.inc29.us
%indvars.iv66 = phi i64 [ 0, %for.body14.us.preheader ], [ %indvars.iv.next67, %for.inc29.us ]
%C.057.us = phi i32 [ 0, %for.body14.us.preheader ], [ %C.1.us, %for.inc29.us ]
%arrayidx16.us = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv66
%5 = load i32, ptr %arrayidx16.us, align 4, !tbaa !5
br label %while.body.us
while.body.us: ; preds = %for.body14.us, %if.else.us
%left.055.us = phi i32 [ 0, %for.body14.us ], [ %left.1.us, %if.else.us ]
%right.054.us = phi i32 [ %4, %for.body14.us ], [ %right.1.us, %if.else.us ]
%add.us = add nsw i32 %left.055.us, %right.054.us
%div.us = sdiv i32 %add.us, 2
%idxprom18.us = sext i32 %div.us to i64
%arrayidx19.us = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom18.us
%6 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
%cmp20.us = icmp eq i32 %6, %5
br i1 %cmp20.us, label %if.then.us, label %if.else.us
if.else.us: ; preds = %while.body.us
%cmp24.us = icmp slt i32 %5, %6
%add27.us = add nsw i32 %div.us, 1
%right.1.us = select i1 %cmp24.us, i32 %div.us, i32 %right.054.us
%left.1.us = select i1 %cmp24.us, i32 %left.055.us, i32 %add27.us
%cmp17.us = icmp slt i32 %left.1.us, %right.1.us
br i1 %cmp17.us, label %while.body.us, label %for.inc29.us, !llvm.loop !11
if.then.us: ; preds = %while.body.us
%inc21.us = add nsw i32 %C.057.us, 1
br label %for.inc29.us
for.inc29.us: ; preds = %if.else.us, %if.then.us
%C.1.us = phi i32 [ %inc21.us, %if.then.us ], [ %C.057.us, %if.else.us ]
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count
br i1 %exitcond.not, label %for.end31, label %for.body14.us, !llvm.loop !12
for.body5: ; preds = %for.end, %for.body5
%indvars.iv63 = phi i64 [ %indvars.iv.next64, %for.body5 ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [50000 x i32], ptr %T, i64 0, i64 %indvars.iv63
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp4 = icmp slt i64 %indvars.iv.next64, %8
br i1 %cmp4, label %for.body5, label %for.cond12.preheader, !llvm.loop !13
for.end31: ; preds = %for.inc29.us, %for.end, %for.body14.lr.ph, %for.cond12.preheader
%C.0.lcssa = phi i32 [ 0, %for.cond12.preheader ], [ 0, %for.body14.lr.ph ], [ 0, %for.end ], [ %C.1.us, %for.inc29.us ]
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %C.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.end.p0(i64 200000, ptr nonnull %T) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define N 1000000000
int *S, n;
int binarySearch(int);
int main(){
int *T;
int q;
int i,j,k;
int cnt = 0;
int left,right,mid;
scanf("%d",&n);
if(n > 100000)
exit(1);
S = (int*)malloc(sizeof(int) * n);
for(i = 0; i < n; i++){
scanf("%d",&S[i]);
if(S[i] > N)
exit(1);
}
scanf("%d",&q);
if(q > 50000)
exit(2);
T = (int*)malloc(sizeof(int) * q);
for(i = 0; i < q; i++){
scanf("%d",&T[i]);
if(T[i] > N)
exit(1);
for(j = 0; j < i; j++){
if(T[i] == T[j]){
printf("Tは互いに異なる要素を入力してください\n");
exit(1);
}
}
}
for(i = 0; i < q; i++){
if(binarySearch(T[i]))
cnt++;
}
printf("%d\n",cnt);
return 0;
}
int binarySearch(int key){
int left = 0;
int right = n;
int mid;
while(left < right){
mid = (left + right) / 2;
if(key == S[mid])
return 1;
else if(key < S[mid])
right = mid;
else
left = mid + 1;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@S = dso_local local_unnamed_addr global ptr null, align 8
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [56 x i8] c"T\E3\81\AF\E4\BA\92\E3\81\84\E3\81\AB\E7\95\B0\E3\81\AA\E3\82\8B\E8\A6\81\E7\B4\A0\E3\82\92\E5\85\A5\E5\8A\9B\E3\81\97\E3\81\A6\E3\81\8F\E3\81\A0\E3\81\95\E3\81\84\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%q = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #7
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 100000
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @exit(i32 noundef 1) #8
unreachable
if.end: ; preds = %entry
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = tail call noalias ptr @malloc(i64 noundef %mul) #9
store ptr %call1, ptr @S, align 8, !tbaa !9
%cmp290 = icmp sgt i32 %0, 0
br i1 %cmp290, label %for.body, label %for.end
for.cond: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp2, label %for.body, label %for.end, !llvm.loop !11
for.body: ; preds = %if.end, %for.cond
%3 = phi ptr [ %4, %for.cond ], [ %call1, %if.end ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.cond ], [ 0, %if.end ]
%arrayidx = getelementptr inbounds i32, ptr %3, i64 %indvars.iv
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%4 = load ptr, ptr @S, align 8, !tbaa !9
%arrayidx6 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv
%5 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp sgt i32 %5, 1000000000
br i1 %cmp7, label %if.then9, label %for.cond
if.then9: ; preds = %for.body
tail call void @exit(i32 noundef 1) #8
unreachable
for.end: ; preds = %for.cond, %if.end
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%6 = load i32, ptr %q, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %6, 50000
br i1 %cmp12, label %if.then14, label %if.end15
if.then14: ; preds = %for.end
call void @exit(i32 noundef 2) #8
unreachable
if.end15: ; preds = %for.end
%conv16 = sext i32 %6 to i64
%mul17 = shl nsw i64 %conv16, 2
%call18 = call noalias ptr @malloc(i64 noundef %mul17) #9
%cmp2094 = icmp sgt i32 %6, 0
br i1 %cmp2094, label %for.body22, label %for.end63
for.cond51.preheader: ; preds = %for.inc48
%cmp5296 = icmp sgt i32 %14, 0
br i1 %cmp5296, label %for.body54.lr.ph, label %for.end63
for.body54.lr.ph: ; preds = %for.cond51.preheader
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp17.i = icmp sgt i32 %7, 0
%8 = load ptr, ptr @S, align 8
br i1 %cmp17.i, label %for.body54.us.preheader, label %for.end63
for.body54.us.preheader: ; preds = %for.body54.lr.ph
%wide.trip.count = zext i32 %14 to i64
br label %for.body54.us
for.body54.us: ; preds = %for.body54.us.preheader, %for.cond51.us
%indvars.iv110 = phi i64 [ 0, %for.body54.us.preheader ], [ %indvars.iv.next111, %for.cond51.us ]
%cnt.097.us = phi i32 [ 0, %for.body54.us.preheader ], [ %11, %for.cond51.us ]
%arrayidx56.us = getelementptr inbounds i32, ptr %call18, i64 %indvars.iv110
%9 = load i32, ptr %arrayidx56.us, align 4, !tbaa !5
br label %while.body.i.us
while.body.i.us: ; preds = %if.else.i.us, %for.body54.us
%right.019.i.us = phi i32 [ %7, %for.body54.us ], [ %right.1.i.us, %if.else.i.us ]
%left.018.i.us = phi i32 [ 0, %for.body54.us ], [ %left.1.i.us, %if.else.i.us ]
%add.i.us = add nsw i32 %left.018.i.us, %right.019.i.us
%div.i.us = sdiv i32 %add.i.us, 2
%idxprom.i.us = sext i32 %div.i.us to i64
%arrayidx.i.us = getelementptr inbounds i32, ptr %8, i64 %idxprom.i.us
%10 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i32 %10, %9
br i1 %cmp1.i.us, label %binarySearch.exit.us, label %if.else.i.us
if.else.i.us: ; preds = %while.body.i.us
%cmp4.i.us = icmp sgt i32 %10, %9
%add7.i.us = add nsw i32 %div.i.us, 1
%left.1.i.us = select i1 %cmp4.i.us, i32 %left.018.i.us, i32 %add7.i.us
%right.1.i.us = select i1 %cmp4.i.us, i32 %div.i.us, i32 %right.019.i.us
%cmp.i.us = icmp slt i32 %left.1.i.us, %right.1.i.us
br i1 %cmp.i.us, label %while.body.i.us, label %for.cond51.us, !llvm.loop !13
binarySearch.exit.us: ; preds = %while.body.i.us
%inc59.us = add nsw i32 %cnt.097.us, 1
br label %for.cond51.us
for.cond51.us: ; preds = %if.else.i.us, %binarySearch.exit.us
%11 = phi i32 [ %inc59.us, %binarySearch.exit.us ], [ %cnt.097.us, %if.else.i.us ]
%indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
%exitcond113.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count
br i1 %exitcond113.not, label %for.end63, label %for.body54.us, !llvm.loop !14
for.body22: ; preds = %if.end15, %for.inc48
%indvars.iv107 = phi i64 [ %indvars.iv.next108, %for.inc48 ], [ 0, %if.end15 ]
%arrayidx24 = getelementptr inbounds i32, ptr %call18, i64 %indvars.iv107
%call25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx24)
%12 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %12, 1000000000
br i1 %cmp28, label %if.then30, label %for.cond32.preheader
for.cond32.preheader: ; preds = %for.body22
%cmp3392.not = icmp eq i64 %indvars.iv107, 0
br i1 %cmp3392.not, label %for.inc48, label %for.body35
if.then30: ; preds = %for.body22
call void @exit(i32 noundef 1) #8
unreachable
for.cond32: ; preds = %for.body35
%indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
%exitcond.not = icmp eq i64 %indvars.iv.next105, %indvars.iv107
br i1 %exitcond.not, label %for.inc48, label %for.body35, !llvm.loop !15
for.body35: ; preds = %for.cond32.preheader, %for.cond32
%indvars.iv104 = phi i64 [ %indvars.iv.next105, %for.cond32 ], [ 0, %for.cond32.preheader ]
%arrayidx39 = getelementptr inbounds i32, ptr %call18, i64 %indvars.iv104
%13 = load i32, ptr %arrayidx39, align 4, !tbaa !5
%cmp40 = icmp eq i32 %12, %13
br i1 %cmp40, label %if.then42, label %for.cond32
if.then42: ; preds = %for.body35
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
call void @exit(i32 noundef 1) #8
unreachable
for.inc48: ; preds = %for.cond32, %for.cond32.preheader
%indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
%14 = load i32, ptr %q, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp20 = icmp slt i64 %indvars.iv.next108, %15
br i1 %cmp20, label %for.body22, label %for.cond51.preheader, !llvm.loop !16
for.end63: ; preds = %for.cond51.us, %if.end15, %for.body54.lr.ph, %for.cond51.preheader
%cnt.0.lcssa = phi i32 [ 0, %for.cond51.preheader ], [ 0, %for.body54.lr.ph ], [ 0, %if.end15 ], [ %11, %for.cond51.us ]
%call64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp17 = icmp sgt i32 %0, 0
br i1 %cmp17, label %while.body.lr.ph, label %cleanup
while.body.lr.ph: ; preds = %entry
%1 = load ptr, ptr @S, align 8, !tbaa !9
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.else
%right.019 = phi i32 [ %0, %while.body.lr.ph ], [ %right.1, %if.else ]
%left.018 = phi i32 [ 0, %while.body.lr.ph ], [ %left.1, %if.else ]
%add = add nsw i32 %right.019, %left.018
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %1, i64 %idxprom
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %2, %key
br i1 %cmp1, label %cleanup, label %if.else
if.else: ; preds = %while.body
%cmp4 = icmp sgt i32 %2, %key
%add7 = add nsw i32 %div, 1
%left.1 = select i1 %cmp4, i32 %left.018, i32 %add7
%right.1 = select i1 %cmp4, i32 %div, i32 %right.019
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !13
cleanup: ; preds = %while.body, %if.else, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.else ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
|
#include<stdio.h>
#include<stdlib.h>
int BS(int *,int,int);
int main(){
int i,j,n,m,c=0;
int *P,*Q;
scanf("%d",&n);
P=(int *)malloc(n*sizeof(int));
for(i=0;i<n;i++){
scanf("%d",&P[i]);
}
scanf("%d",&m);
Q=(int *)malloc(m*sizeof(int));
for(i=0;i<m;i++){
scanf("%d",&Q[i]);
}
for(i=0;i<m;i++){
c+=BS(P,n,Q[i]);
}
printf("%d\n",c);
return 0;
}
int BS(int *P,int n,int k){
int r=n,l=0,t;
while(l<r){
t=(r+l)/2;
if(k==P[t]){
return 1;
}
if(k>P[t]){
l=t+1;
}
else if(k<P[t]){
r=t;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185418/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #6
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, 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 %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %m)
%3 = load i32, ptr %m, align 4, !tbaa !5
%conv5 = sext i32 %3 to i64
%mul6 = shl nsw i64 %conv5, 2
%call7 = call noalias ptr @malloc(i64 noundef %mul6) #6
%cmp942 = icmp sgt i32 %3, 0
br i1 %cmp942, label %for.body11, label %for.end27
for.cond18.preheader: ; preds = %for.body11
%cmp1944 = icmp sgt i32 %7, 0
br i1 %cmp1944, label %for.body21.lr.ph, label %for.end27
for.body21.lr.ph: ; preds = %for.cond18.preheader
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp25.i = icmp sgt i32 %4, 0
br i1 %cmp25.i, label %for.body21.us.preheader, label %for.end27
for.body21.us.preheader: ; preds = %for.body21.lr.ph
%wide.trip.count = zext i32 %7 to i64
br label %for.body21.us
for.body21.us: ; preds = %for.body21.us.preheader, %BS.exit.loopexit.us
%indvars.iv54 = phi i64 [ 0, %for.body21.us.preheader ], [ %indvars.iv.next55, %BS.exit.loopexit.us ]
%c.045.us = phi i32 [ 0, %for.body21.us.preheader ], [ %add.us, %BS.exit.loopexit.us ]
%arrayidx23.us = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv54
%5 = load i32, ptr %arrayidx23.us, align 4, !tbaa !5
br label %while.body.i.us
while.body.i.us: ; preds = %for.body21.us, %if.end.i.us
%l.027.i.us = phi i32 [ %l.1.i.us, %if.end.i.us ], [ 0, %for.body21.us ]
%r.026.i.us = phi i32 [ %r.1.i.us, %if.end.i.us ], [ %4, %for.body21.us ]
%add.i.us = add nsw i32 %r.026.i.us, %l.027.i.us
%div.i.us = sdiv i32 %add.i.us, 2
%idxprom.i.us = sext i32 %div.i.us to i64
%arrayidx.i.us = getelementptr inbounds i32, ptr %call1, i64 %idxprom.i.us
%6 = load i32, ptr %arrayidx.i.us, align 4, !tbaa !5
%cmp1.i.us = icmp eq i32 %6, %5
br i1 %cmp1.i.us, label %BS.exit.loopexit.us, label %if.end.i.us
if.end.i.us: ; preds = %while.body.i.us
%cmp4.i.us = icmp slt i32 %6, %5
%add6.i.us = add nsw i32 %div.i.us, 1
%cmp9.i.us = icmp sgt i32 %6, %5
%spec.select.i.us = select i1 %cmp9.i.us, i32 %div.i.us, i32 %r.026.i.us
%r.1.i.us = select i1 %cmp4.i.us, i32 %r.026.i.us, i32 %spec.select.i.us
%l.1.i.us = select i1 %cmp4.i.us, i32 %add6.i.us, i32 %l.027.i.us
%cmp.i.us = icmp slt i32 %l.1.i.us, %r.1.i.us
br i1 %cmp.i.us, label %while.body.i.us, label %BS.exit.loopexit.us, !llvm.loop !11
BS.exit.loopexit.us: ; preds = %if.end.i.us, %while.body.i.us
%retval.0.i.ph.us = phi i32 [ 1, %while.body.i.us ], [ 0, %if.end.i.us ]
%add.us = add nuw nsw i32 %retval.0.i.ph.us, %c.045.us
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count
br i1 %exitcond.not, label %for.end27, label %for.body21.us, !llvm.loop !12
for.body11: ; preds = %for.end, %for.body11
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.body11 ], [ 0, %for.end ]
%arrayidx13 = getelementptr inbounds i32, ptr %call7, i64 %indvars.iv51
%call14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx13)
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%7 = load i32, ptr %m, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp9 = icmp slt i64 %indvars.iv.next52, %8
br i1 %cmp9, label %for.body11, label %for.cond18.preheader, !llvm.loop !13
for.end27: ; preds = %BS.exit.loopexit.us, %for.end, %for.body21.lr.ph, %for.cond18.preheader
%c.0.lcssa = phi i32 [ 0, %for.cond18.preheader ], [ 0, %for.body21.lr.ph ], [ 0, %for.end ], [ %add.us, %BS.exit.loopexit.us ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @BS(ptr nocapture noundef readonly %P, i32 noundef %n, i32 noundef %k) local_unnamed_addr #4 {
entry:
%cmp25 = icmp sgt i32 %n, 0
br i1 %cmp25, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%l.027 = phi i32 [ %l.1, %if.end ], [ 0, %entry ]
%r.026 = phi i32 [ %r.1, %if.end ], [ %n, %entry ]
%add = add nsw i32 %l.027, %r.026
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %P, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %0, %k
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %0, %k
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %0, %k
%spec.select = select i1 %cmp9, i32 %div, i32 %r.026
%r.1 = select i1 %cmp4, i32 %r.026, i32 %spec.select
%l.1 = select i1 %cmp4, i32 %add6, i32 %l.027
%cmp = icmp slt i32 %l.1, %r.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !11
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#define N 100000
int cnt, n, q;
int s[N], t[N];
void binarySearch(int a) {
int left, right, mid;
right = n;
left = 0;
while (right >= left) {
mid = (right + left) / 2;
if (s[mid] == a) {
cnt++;
break;
} else if (s[mid] > a) {
right = mid - 1;
} else {
left = mid + 1;
}
}
}
void scanData() {
int i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &s[i]);
}
scanf("%d", &q);
for (i = 0; i < q; i++) {
scanf("%d", &t[i]);
binarySearch(t[i]);
}
}
int main() {
scanData();
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185476/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185476/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@s = dso_local global [100000 x i32] zeroinitializer, align 16
@cnt = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@q = dso_local global i32 0, align 4
@t = dso_local global [100000 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @binarySearch(i32 noundef %a) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not15 = icmp slt i32 %0, 0
br i1 %cmp.not15, label %while.end, label %while.body
while.body: ; preds = %entry, %if.else
%left.017 = phi i32 [ %left.1, %if.else ], [ 0, %entry ]
%right.016 = phi i32 [ %right.1, %if.else ], [ %0, %entry ]
%add = add nsw i32 %left.017, %right.016
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %a
br i1 %cmp1, label %if.then, label %if.else
if.then: ; preds = %while.body
%2 = load i32, ptr @cnt, align 4, !tbaa !5
%inc = add nsw i32 %2, 1
store i32 %inc, ptr @cnt, align 4, !tbaa !5
br label %while.end
if.else: ; preds = %while.body
%cmp4 = icmp sgt i32 %1, %a
%sub = add nsw i32 %div, -1
%add7 = add nsw i32 %div, 1
%right.1 = select i1 %cmp4, i32 %sub, i32 %right.016
%left.1 = select i1 %cmp4, i32 %left.017, i32 %add7
%cmp.not = icmp slt i32 %right.1, %left.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %if.else, %entry, %if.then
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @scanData() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp20 = icmp sgt i32 %0, 0
br i1 %cmp20, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
%3 = load i32, ptr @q, align 4, !tbaa !5
%cmp422 = icmp sgt i32 %3, 0
br i1 %cmp422, label %for.body5, label %for.end13
for.body5: ; preds = %for.end, %binarySearch.exit
%indvars.iv25 = phi i64 [ %indvars.iv.next26, %binarySearch.exit ], [ 0, %for.end ]
%arrayidx7 = getelementptr inbounds [100000 x i32], ptr @t, i64 0, i64 %indvars.iv25
%call8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not15.i = icmp slt i32 %5, 0
br i1 %cmp.not15.i, label %binarySearch.exit, label %while.body.i
while.body.i: ; preds = %for.body5, %if.else.i
%left.017.i = phi i32 [ %left.1.i, %if.else.i ], [ 0, %for.body5 ]
%right.016.i = phi i32 [ %right.1.i, %if.else.i ], [ %5, %for.body5 ]
%add.i = add nsw i32 %right.016.i, %left.017.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [100000 x i32], ptr @s, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %if.then.i, label %if.else.i
if.then.i: ; preds = %while.body.i
%7 = load i32, ptr @cnt, align 4, !tbaa !5
%inc.i = add nsw i32 %7, 1
store i32 %inc.i, ptr @cnt, align 4, !tbaa !5
br label %binarySearch.exit
if.else.i: ; preds = %while.body.i
%cmp4.i = icmp sgt i32 %6, %4
%sub.i = add nsw i32 %div.i, -1
%add7.i = add nsw i32 %div.i, 1
%right.1.i = select i1 %cmp4.i, i32 %sub.i, i32 %right.016.i
%left.1.i = select i1 %cmp4.i, i32 %left.017.i, i32 %add7.i
%cmp.not.i = icmp slt i32 %right.1.i, %left.1.i
br i1 %cmp.not.i, label %binarySearch.exit, label %while.body.i, !llvm.loop !9
binarySearch.exit: ; preds = %if.else.i, %for.body5, %if.then.i
%indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
%8 = load i32, ptr @q, align 4, !tbaa !5
%9 = sext i32 %8 to i64
%cmp4 = icmp slt i64 %indvars.iv.next26, %9
br i1 %cmp4, label %for.body5, label %for.end13, !llvm.loop !12
for.end13: ; preds = %binarySearch.exit, %for.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
tail call void @scanData()
%0 = load i32, ptr @cnt, align 4, !tbaa !5
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %0)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int main(void){
int i,n,q,left,right,mid,count=0;
int S[100000],T;
scanf("%d",&n);
for(i=0; i<n; i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
for(i=0; i<q; i++){
scanf("%d",&T);
left=0;
right=n;
while(left < right){
mid=(left + right)/2;
if(S[mid] == T){
count++;
break;
}
else if(S[mid] > T) right=mid;
else left=mid+1;
}
}
printf("%d\n",count);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185540/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185540/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%q = alloca i32, align 4
%S = alloca [100000 x i32], align 16
%T = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %S) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %T) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp34 = icmp sgt i32 %0, 0
br i1 %cmp34, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp439 = icmp sgt i32 %3, 0
br i1 %cmp439, label %for.body5, label %for.end21
for.body5: ; preds = %for.end, %for.inc19
%count.041 = phi i32 [ %count.1, %for.inc19 ], [ 0, %for.end ]
%i.140 = phi i32 [ %inc20, %for.inc19 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %T)
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp736 = icmp sgt i32 %4, 0
br i1 %cmp736, label %while.body.lr.ph, label %for.inc19
while.body.lr.ph: ; preds = %for.body5
%5 = load i32, ptr %T, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %if.else
%right.038 = phi i32 [ %4, %while.body.lr.ph ], [ %right.1, %if.else ]
%left.037 = phi i32 [ 0, %while.body.lr.ph ], [ %left.1, %if.else ]
%add = add nsw i32 %right.038, %left.037
%div = sdiv i32 %add, 2
%idxprom8 = sext i32 %div to i64
%arrayidx9 = getelementptr inbounds [100000 x i32], ptr %S, i64 0, i64 %idxprom8
%6 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %6, %5
br i1 %cmp10, label %if.then, label %if.else
if.then: ; preds = %while.body
%inc11 = add nsw i32 %count.041, 1
br label %for.inc19
if.else: ; preds = %while.body
%cmp14 = icmp sgt i32 %6, %5
%add17 = add nsw i32 %div, 1
%left.1 = select i1 %cmp14, i32 %left.037, i32 %add17
%right.1 = select i1 %cmp14, i32 %div, i32 %right.038
%cmp7 = icmp slt i32 %left.1, %right.1
br i1 %cmp7, label %while.body, label %for.inc19, !llvm.loop !11
for.inc19: ; preds = %if.else, %for.body5, %if.then
%count.1 = phi i32 [ %inc11, %if.then ], [ %count.041, %for.body5 ], [ %count.041, %if.else ]
%inc20 = add nuw nsw i32 %i.140, 1
%7 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc20, %7
br i1 %cmp4, label %for.body5, label %for.end21, !llvm.loop !12
for.end21: ; preds = %for.inc19, %for.end
%count.0.lcssa = phi i32 [ 0, %for.end ], [ %count.1, %for.inc19 ]
%call22 = 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 %T) #3
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %S) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int A[1000000], n;
int binarySearch(int key) {
int left = 0;
int right = n;
int mid;
while(left < right) {
mid = (left + right) / 2;
if(key == A[mid]) return 1;
if(key > A[mid]) left = mid + 1;
else if(key < A[mid]) right = mid;
}
return 0;
}
int main(void) {
int i, q, k, sum = 0;
scanf("%d",&n);
for(i=0; i<n; i++) {
scanf("%d",&A[i]);
}
scanf("%d",&q);
for(i=0;i<q;i++) {
scanf("%d",&k);
if(binarySearch(k))
sum++;
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185584/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185584/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@A = dso_local global [1000000 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: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binarySearch(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %while.body, label %cleanup
while.body: ; preds = %entry, %if.end
%right.025 = phi i32 [ %right.1, %if.end ], [ %0, %entry ]
%left.024 = phi i32 [ %left.1, %if.end ], [ 0, %entry ]
%add = add nsw i32 %right.025, %left.024
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp eq i32 %1, %key
br i1 %cmp1, label %cleanup, label %if.end
if.end: ; preds = %while.body
%cmp4 = icmp slt i32 %1, %key
%add6 = add nsw i32 %div, 1
%cmp9 = icmp sgt i32 %1, %key
%spec.select = select i1 %cmp9, i32 %div, i32 %right.025
%left.1 = select i1 %cmp4, i32 %add6, i32 %left.024
%right.1 = select i1 %cmp4, i32 %right.025, i32 %spec.select
%cmp = icmp slt i32 %left.1, %right.1
br i1 %cmp, label %while.body, label %cleanup, !llvm.loop !9
cleanup: ; preds = %while.body, %if.end, %entry
%retval.0 = phi i32 [ 0, %entry ], [ 0, %if.end ], [ 1, %while.body ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%q = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp21 = icmp sgt i32 %0, 0
br i1 %cmp21, 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 [1000000 x i32], ptr @A, i64 0, i64 %indvars.iv
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %entry
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp423 = icmp sgt i32 %3, 0
br i1 %cmp423, label %for.body5, label %for.end11
for.body5: ; preds = %for.end, %for.cond3
%sum.025 = phi i32 [ %7, %for.cond3 ], [ 0, %for.end ]
%i.124 = phi i32 [ %inc10, %for.cond3 ], [ 0, %for.end ]
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp23.i = icmp sgt i32 %5, 0
br i1 %cmp23.i, label %while.body.i, label %for.cond3
while.body.i: ; preds = %for.body5, %if.end.i
%right.025.i = phi i32 [ %right.1.i, %if.end.i ], [ %5, %for.body5 ]
%left.024.i = phi i32 [ %left.1.i, %if.end.i ], [ 0, %for.body5 ]
%add.i = add nsw i32 %left.024.i, %right.025.i
%div.i = sdiv i32 %add.i, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [1000000 x i32], ptr @A, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.i = icmp eq i32 %6, %4
br i1 %cmp1.i, label %binarySearch.exit, label %if.end.i
if.end.i: ; preds = %while.body.i
%cmp4.i = icmp slt i32 %6, %4
%add6.i = add nsw i32 %div.i, 1
%cmp9.i = icmp sgt i32 %6, %4
%spec.select.i = select i1 %cmp9.i, i32 %div.i, i32 %right.025.i
%left.1.i = select i1 %cmp4.i, i32 %add6.i, i32 %left.024.i
%right.1.i = select i1 %cmp4.i, i32 %right.025.i, i32 %spec.select.i
%cmp.i = icmp slt i32 %left.1.i, %right.1.i
br i1 %cmp.i, label %while.body.i, label %for.cond3, !llvm.loop !9
binarySearch.exit: ; preds = %while.body.i
%inc8 = add nsw i32 %sum.025, 1
br label %for.cond3
for.cond3: ; preds = %if.end.i, %for.body5, %binarySearch.exit
%7 = phi i32 [ %inc8, %binarySearch.exit ], [ %sum.025, %for.body5 ], [ %sum.025, %if.end.i ]
%inc10 = add nuw nsw i32 %i.124, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp slt i32 %inc10, %8
br i1 %cmp4, label %for.body5, label %for.end11, !llvm.loop !12
for.end11: ; preds = %for.cond3, %for.end
%sum.0.lcssa = phi i32 [ 0, %for.end ], [ %7, %for.cond3 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree norecurse nosync nounwind memory(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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
int n,S[1000000000];
int binary(int key){
int left = 0;
int right = n;
while(left < right){
int mid = (left + right) / 2;
if(S[mid] == key ){
return mid;
}
else if(key < S[mid]){
right = mid;
}
else{
left = mid + 1;
}
}
return -1;
}
int main(){
int q,key,i,count=0;
scanf("%d",&n);
if(n > 100000) return 0;
for(i = 0;i<n;i++){
scanf("%d",&S[i]);
}
scanf("%d",&q);
if(q> 50000) return 0;
for(i = 0;i<q;i++){
scanf("%d",&key);
if( binary(key) != -1){
count++;
}
}
printf("%d",count);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_185627/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_185627/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@S = dso_local global [1000000000 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @binary(i32 noundef %key) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.body, %entry
%left.0 = phi i32 [ 0, %entry ], [ %left.1, %while.body ]
%right.0 = phi i32 [ %0, %entry ], [ %right.1, %while.body ]
%cmp = icmp slt i32 %left.0, %right.0
br i1 %cmp, label %while.body, label %cleanup9
while.body: ; preds = %while.cond
%add = add nsw i32 %right.0, %left.0
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds [1000000000 x i32], ptr @S, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1.not = icmp eq i32 %1, %key
%cmp4 = icmp sgt i32 %1, %key
%add7 = add nsw i32 %div, 1
%left.1 = select i1 %cmp4, i32 %left.0, i32 %add7
%right.1 = select i1 %cmp4, i32 %div, i32 %right.0
br i1 %cmp1.not, label %cleanup9, label %while.cond, !llvm.loop !9
cleanup9: ; preds = %while.cond, %while.body
%retval.2 = phi i32 [ %div, %while.body ], [ -1, %while.cond ]
ret i32 %retval.2
}
; 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:
%q = alloca i32, align 4
%key = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %key) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 100000
br i1 %cmp, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp133 = icmp sgt i32 %0, 0
br i1 %cmp133, label %for.body, label %for.end
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx = getelementptr inbounds [1000000000 x i32], ptr @S, i64 0, i64 %indvars.iv
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = load i32, ptr @n, align 4, !tbaa !5
%2 = sext i32 %1 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %2
br i1 %cmp1, label %for.body, label %for.end, !llvm.loop !11
for.end: ; preds = %for.body, %for.cond.preheader
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %q)
%3 = load i32, ptr %q, align 4, !tbaa !5
%cmp4 = icmp sgt i32 %3, 50000
br i1 %cmp4, label %cleanup, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.end
%cmp835 = icmp sgt i32 %3, 0
br i1 %cmp835, label %for.body9, label %for.end18
for.body9: ; preds = %for.cond7.preheader, %for.cond7
%count.037 = phi i32 [ %7, %for.cond7 ], [ 0, %for.cond7.preheader ]
%i.136 = phi i32 [ %inc17, %for.cond7 ], [ 0, %for.cond7.preheader ]
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %key)
%4 = load i32, ptr %key, align 4, !tbaa !5
%5 = load i32, ptr @n, align 4, !tbaa !5
br label %while.cond.i
while.cond.i: ; preds = %while.body.i, %for.body9
%left.0.i = phi i32 [ 0, %for.body9 ], [ %left.1.i, %while.body.i ]
%right.0.i = phi i32 [ %5, %for.body9 ], [ %right.1.i, %while.body.i ]
%cmp.i = icmp slt i32 %left.0.i, %right.0.i
br i1 %cmp.i, label %while.body.i, label %binary.exit.thread
while.body.i: ; preds = %while.cond.i
%add.i = add nsw i32 %right.0.i, %left.0.i
%add.i.fr = freeze i32 %add.i
%div.i = sdiv i32 %add.i.fr, 2
%idxprom.i = sext i32 %div.i to i64
%arrayidx.i = getelementptr inbounds [1000000000 x i32], ptr @S, i64 0, i64 %idxprom.i
%6 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%cmp1.not.i = icmp eq i32 %6, %4
%cmp4.i = icmp sgt i32 %6, %4
%add7.i = add nsw i32 %div.i, 1
%left.1.i = select i1 %cmp4.i, i32 %left.0.i, i32 %add7.i
%right.1.i = select i1 %cmp4.i, i32 %div.i, i32 %right.0.i
br i1 %cmp1.not.i, label %binary.exit, label %while.cond.i, !llvm.loop !9
binary.exit: ; preds = %while.body.i
%add.i.off = add i32 %add.i.fr, 3
%cmp12.not = icmp ult i32 %add.i.off, 2
%inc14 = add nsw i32 %count.037, 1
br i1 %cmp12.not, label %binary.exit.thread, label %for.cond7
binary.exit.thread: ; preds = %while.cond.i, %binary.exit
br label %for.cond7
for.cond7: ; preds = %binary.exit, %binary.exit.thread
%7 = phi i32 [ %count.037, %binary.exit.thread ], [ %inc14, %binary.exit ]
%inc17 = add nuw nsw i32 %i.136, 1
%8 = load i32, ptr %q, align 4, !tbaa !5
%cmp8 = icmp slt i32 %inc17, %8
br i1 %cmp8, label %for.body9, label %for.end18, !llvm.loop !12
for.end18: ; preds = %for.cond7, %for.cond7.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond7.preheader ], [ %7, %for.cond7 ]
%call19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
%putchar = call i32 @putchar(i32 10)
br label %cleanup
cleanup: ; preds = %for.end, %entry, %for.end18
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %key) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.