Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#if 0
cat <<EOF >mistaken-paste
#endif
// thanks for @rsk0315_h4x
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#define BIG 2000000007
#define VERYBIG 2000000000000007LL
#define MOD 1000000007
#define FOD 998244353
typedef uint64_t ull;
typedef int64_t sll;
#define N_MAX 1048576
#ifdef __cplusplus
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <array>
using std::queue;
using std::priority_queue;
using std::stack;
using std::tuple;
using std::set;
using std::map;
using std::vector;
using std::greater;
using std::pair;
using std::string;
using std::get;
template <typename T, typename U>
pair<T, U> operator+(pair<T, U> l, pair<T, U> r) {
return pair<T, U>(l.first + r.first, l.second + r.second);
}
#endif
typedef struct {
sll a;
sll b;
} hwll;
typedef struct {
sll a;
sll b;
sll c;
} hwllc;
typedef struct {
hwll a;
hwll b;
} linell;
typedef struct {
double a;
double b;
} hwreal;
ull n, m;
ull h, w;
ull k;
ull q;
sll va, vb, vc, vd, ve, vf;
ull ua, ub, uc, ud, ue, uf;
long double vra, vrb, vrc;
double vda, vdb, vdc;
char ch, dh;
ull umin (ull x, ull y) {
return (x < y) ? x : y;
}
ull umax (ull x, ull y) {
return (x > y) ? x : y;
}
sll smin (sll x, sll y) {
return (x < y) ? x : y;
}
sll smax (sll x, sll y) {
return (x > y) ? x : y;
}
ull gcd (ull x, ull y) {
if (x < y) {
return gcd(y, x);
} else if (y == 0) {
return x;
} else {
return gcd(y, x % y);
}
}
ull bitpow (ull a, ull x, ull modulo) {
ull result = 1;
while (x) {
if (x & 1) {
result *= a;
result %= modulo;
}
x /= 2;
a = (a * a) % modulo;
}
return result;
}
ull divide (ull a, ull b, ull modulo) {
return (a * bitpow(b, modulo - 2, modulo)) % modulo;
}
ull udiff (ull a, ull b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
sll sdiff (sll a, sll b) {
if (a >= b) {
return a - b;
} else {
return b - a;
}
}
int bitcount (ull n) {
int result = 0;
while (n) {
if (n & 1) result++;
n /= 2;
}
return result;
}
#define BEGCMP(NAME) int32_t NAME (const void *left, const void *right)
#define DEFLR(TYPE) TYPE l=*(TYPE*)left,r=*(TYPE*)right
#define CMPRET(L, R) if((L)<(R))return-1;if((L)>(R))return+1
// int32_t pullcomp (const void *left, const void *right) {
// ull l = *(ull*)left;
// ull r = *(ull*)right;
// if (l < r) {
// return -1;
// }
// if (l > r) {
// return +1;
// }
// return 0;
// }
BEGCMP(pullcomp){
DEFLR(ull);
CMPRET(l, r);
return 0;
}
BEGCMP(prevcomp){
DEFLR(sll);
CMPRET(r, l);
return 0;
}
BEGCMP(psllcomp){
DEFLR(sll);
CMPRET(l, r);
return 0;
}
BEGCMP(pcharcomp){
DEFLR(char);
CMPRET(l, r);
return 0;
}
BEGCMP(pdoublecomp){
DEFLR(double);
CMPRET(l, r);
return 0;
}
int32_t pstrcomp (const void *left, const void *right) {
char* l = *(char**)left;
char* r = *(char**)right;
return strcmp(l, r);
}
BEGCMP(phwllABcomp){
DEFLR(hwll);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
BEGCMP(phwllREVcomp){
DEFLR(hwll);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
return 0;
}
BEGCMP(ptriplecomp){
DEFLR(hwllc);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(ptripleREVcomp){
DEFLR(hwllc);
CMPRET(l.b, r.b);
CMPRET(l.a, r.a);
CMPRET(l.c, r.c);
return 0;
}
BEGCMP(phwrealcomp){
DEFLR(hwreal);
CMPRET(l.a, r.a);
CMPRET(l.b, r.b);
return 0;
}
int32_t pquadcomp (const void *left, const void *right) {
linell l = *(linell*)left;
linell r = *(linell*)right;
sll ac = phwllABcomp(&(l.a), &(r.a));
if (ac) return ac;
sll bc = phwllABcomp(&(l.b), &(r.b));
if (bc) return bc;
return 0;
}
bool isinrange (sll left, sll x, sll right) {
return (left <= x && x <= right);
}
bool isinrange_soft (sll left, sll x, sll right) {
return (left <= x && x <= right) || (left >= x && x >= right);
}
sll a[N_MAX + 5];
// ull a[N_MAX + 5];
// sll a[3001][3001];
sll b[N_MAX + 5];
// ull b[N_MAX + 5];
// sll b[3001][3001];
sll c[N_MAX + 5];
sll d[N_MAX + 5];
sll e[N_MAX];
char s[N_MAX + 1];
// char s[3010][3010];
char t[N_MAX + 1];
// char t[3010][3010];
char u[N_MAX + 1];
hwll xy[N_MAX + 5];
hwllc tup[N_MAX + 5];
// sll table[3005][3005];
ull gin[N_MAX];
// here we go
ull dp[209][100009];
ull solve () {
sll i, j, ki, li;
// ull result = 0;
sll result = 0;
double dresult = 0;
// ull maybe = 0;
sll maybe = 0;
// ull sum = 0;
sll sum = 0;
sll item;
ull *dpcell;
sll left = -1, right = n;
for (i = q - 1; i >= 0; i--) {
if (u[i] == 'L') {
if (t[i] == s[left + 1]) {
left++;
}
} else {
if (left >= 0 && t[i] == s[left]) {
left--;
}
}
if (u[i] == 'R') {
if (right && t[i] == s[right - 1]) {
right--;
}
} else {
if (t[i] == s[right]) {
right++;
}
}
}
result = right - left - 1;
printf("%lld\n", result);
// printf("%.15lf\n", dresult);
// puts(s);
return 0;
success:
// puts("YES");
puts("Yes");
// printf("%llu\n", result);
// puts("0");
// puts("Hanako");
return 0;
fail:
// puts("NO");
puts("No");
// puts("0");
// puts("-1");
// puts("-1 -1 -1");
// puts("Jiro");
return 1;
}
int32_t main (int argc, char *argv[]) {
int32_t i, j;
n = 3;
m = 0;
// scanf("%llu%llu", &h, &w);
scanf("%llu", &n, &m);
// scanf("%llu", &k, &n, &m);
// scanf("%llu%llu", &h, &w);
scanf("%llu", &q);
scanf("%s", s);
// scanf("%lld%lld", &va, &vb, &vc, &vd);
// scanf("%llu%llu%llu", &ua, &ub, &uc, &ud, &ue);
// scanf("%s", t);
// scanf("%s", u);
// scanf("%llu", &k);
// scanf("%lld", &m);
// for (i = 0; i < n; i++) {
// scanf("%lld", &a[i]);
// // scanf("%lld", &d[i]);
// }
// scanf("%llu", &q);
// for (i = 0; i < n; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// // scanf("%lld%lld%lld", &tup[i].a, &tup[i].b, &tup[i].c);
// // scanf("%lld", &c[i]);
// scanf("%lld", &a[i]);
// // scanf("%lld", &b[i]);
// // scanf("%lld", &c[i]);
// // scanf("%lld", &d[i]);
// // a[i]--;
// // b[i]--;
// // c[i]--;
// // d[i]--;
// // xy[i].a--;
// // xy[i].b--;
// // tup[i].a--;
// // tup[i].b--;
// }
for (i = 0; i < q; i++) {
scanf(" %c %c", &t[i], &u[i]);
}
// for (i = 0; i < k; i++) {
// // scanf("%lld%lld", &a[i], &b[i]);
// // scanf("%lld", &b[i]);
// // a[i]--;
// // b[i]--;
// scanf("%lld", &d[i]);
// d[i]--;
// }
// for (i = 0; i < q; i++) {
// // scanf("%lld%lld", &xy[i].a, &xy[i].b);
// scanf("%lld", &c[i]);
// // xy[i].a--;
// // xy[i].b--;
// }
// for (i = 0; i < n; i++) {
// for (j = 0; j < m; j++) {
// scanf("%lld", &table[i][j]);
// // table[i][j]--;
// }
// }
// for (i = 0; i < n; i++) {
// scanf("%s", s[i]);
// }
// scanf("%llu", &q);
solve();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_125557/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_125557/source.c"
target datalayout = "e-m:e-p270: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.hwll = type { i64, i64 }
%struct.hwllc = type { i64, i64, i64 }
@n = dso_local global i64 0, align 8
@q = dso_local global i64 0, align 8
@u = dso_local global [1048577 x i8] zeroinitializer, align 16
@t = dso_local global [1048577 x i8] zeroinitializer, align 16
@s = dso_local global [1048577 x i8] zeroinitializer, align 16
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@m = dso_local global i64 0, align 8
@.str.3 = private unnamed_addr constant [5 x i8] c"%llu\00", align 1
@.str.4 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.5 = private unnamed_addr constant [7 x i8] c" %c %c\00", align 1
@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
@ua = dso_local local_unnamed_addr global i64 0, align 8
@ub = dso_local local_unnamed_addr global i64 0, align 8
@uc = dso_local local_unnamed_addr global i64 0, align 8
@ud = dso_local local_unnamed_addr global i64 0, align 8
@ue = dso_local local_unnamed_addr global i64 0, align 8
@uf = dso_local local_unnamed_addr global i64 0, align 8
@vra = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrb = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vrc = dso_local local_unnamed_addr global x86_fp80 0xK00000000000000000000, align 16
@vda = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdb = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@vdc = dso_local local_unnamed_addr global double 0.000000e+00, align 8
@ch = dso_local local_unnamed_addr global i8 0, align 1
@dh = dso_local local_unnamed_addr global i8 0, align 1
@a = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@b = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [1048581 x i64] zeroinitializer, align 16
@e = dso_local local_unnamed_addr global [1048576 x i64] zeroinitializer, align 16
@xy = dso_local local_unnamed_addr global [1048581 x %struct.hwll] zeroinitializer, align 16
@tup = dso_local local_unnamed_addr global [1048581 x %struct.hwllc] zeroinitializer, align 16
@gin = dso_local local_unnamed_addr global [1048576 x i64] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [209 x [100009 x i64]] zeroinitializer, align 16
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @umax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.umax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smin(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @smax(i64 noundef %x, i64 noundef %y) local_unnamed_addr #0 {
entry:
%cond = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
ret i64 %cond
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %x, i64 noundef %y) local_unnamed_addr #1 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse.backedge, %entry
%x.tr = phi i64 [ %x, %entry ], [ %y.tr, %tailrecurse.backedge ]
%y.tr = phi i64 [ %y, %entry ], [ %y.tr.be, %tailrecurse.backedge ]
%cmp = icmp ult i64 %x.tr, %y.tr
br i1 %cmp, label %tailrecurse.backedge, label %if.else
if.else: ; preds = %tailrecurse
%cmp1 = icmp eq i64 %y.tr, 0
br i1 %cmp1, label %return, label %if.else3
if.else3: ; preds = %if.else
%rem = urem i64 %x.tr, %y.tr
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.else3, %tailrecurse
%y.tr.be = phi i64 [ %rem, %if.else3 ], [ %x.tr, %tailrecurse ]
br label %tailrecurse
return: ; preds = %if.else
ret i64 %x.tr
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @bitpow(i64 noundef %a, i64 noundef %x, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%tobool.not12 = icmp eq i64 %x, 0
br i1 %tobool.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%result.015 = phi i64 [ %result.1, %if.end ], [ 1, %entry ]
%a.addr.014 = phi i64 [ %rem3, %if.end ], [ %a, %entry ]
%x.addr.013 = phi i64 [ %div11, %if.end ], [ %x, %entry ]
%and = and i64 %x.addr.013, 1
%tobool1.not = icmp eq i64 %and, 0
br i1 %tobool1.not, label %if.end, label %if.then
if.then: ; preds = %while.body
%mul = mul i64 %result.015, %a.addr.014
%rem = urem i64 %mul, %modulo
br label %if.end
if.end: ; preds = %if.then, %while.body
%result.1 = phi i64 [ %rem, %if.then ], [ %result.015, %while.body ]
%div11 = lshr i64 %x.addr.013, 1
%mul2 = mul i64 %a.addr.014, %a.addr.014
%rem3 = urem i64 %mul2, %modulo
%tobool.not = icmp ult i64 %x.addr.013, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %if.end, %entry
%result.0.lcssa = phi i64 [ 1, %entry ], [ %result.1, %if.end ]
ret i64 %result.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @divide(i64 noundef %a, i64 noundef %b, i64 noundef %modulo) local_unnamed_addr #1 {
entry:
%sub = add i64 %modulo, -2
%tobool.not12.i = icmp eq i64 %sub, 0
br i1 %tobool.not12.i, label %bitpow.exit, label %while.body.i
while.body.i: ; preds = %entry, %if.end.i
%result.015.i = phi i64 [ %result.1.i, %if.end.i ], [ 1, %entry ]
%a.addr.014.i = phi i64 [ %rem3.i, %if.end.i ], [ %b, %entry ]
%x.addr.013.i = phi i64 [ %div11.i, %if.end.i ], [ %sub, %entry ]
%and.i = and i64 %x.addr.013.i, 1
%tobool1.not.i = icmp eq i64 %and.i, 0
br i1 %tobool1.not.i, label %if.end.i, label %if.then.i
if.then.i: ; preds = %while.body.i
%mul.i = mul i64 %a.addr.014.i, %result.015.i
%rem.i = urem i64 %mul.i, %modulo
br label %if.end.i
if.end.i: ; preds = %if.then.i, %while.body.i
%result.1.i = phi i64 [ %rem.i, %if.then.i ], [ %result.015.i, %while.body.i ]
%div11.i = lshr i64 %x.addr.013.i, 1
%mul2.i = mul i64 %a.addr.014.i, %a.addr.014.i
%rem3.i = urem i64 %mul2.i, %modulo
%tobool.not.i = icmp ult i64 %x.addr.013.i, 2
br i1 %tobool.not.i, label %bitpow.exit, label %while.body.i, !llvm.loop !5
bitpow.exit: ; preds = %if.end.i, %entry
%result.0.lcssa.i = phi i64 [ 1, %entry ], [ %result.1.i, %if.end.i ]
%mul = mul i64 %result.0.lcssa.i, %a
%rem = urem i64 %mul, %modulo
ret i64 %rem
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @udiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not = icmp ult i64 %a, %b
%sub = sub i64 %a, %b
%sub1 = sub i64 %b, %a
%retval.0 = select i1 %cmp.not, i64 %sub1, i64 %sub
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @sdiff(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub = sub nsw i64 %a, %b
%retval.0 = tail call i64 @llvm.abs.i64(i64 %sub, i1 true)
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @bitcount(i64 noundef %n) local_unnamed_addr #1 {
entry:
%tobool.not6 = icmp eq i64 %n, 0
br i1 %tobool.not6, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%result.08 = phi i32 [ %spec.select, %while.body ], [ 0, %entry ]
%n.addr.07 = phi i64 [ %div5, %while.body ], [ %n, %entry ]
%0 = trunc i64 %n.addr.07 to i32
%1 = and i32 %0, 1
%spec.select = add i32 %1, %result.08
%div5 = lshr i64 %n.addr.07, 1
%tobool.not = icmp ult i64 %n.addr.07, 2
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !7
while.end: ; preds = %while.body, %entry
%result.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %while.body ]
ret i32 %result.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pullcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%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 @prevcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %1, %0
%cmp1 = icmp sgt i64 %1, %0
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @psllcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i64, ptr %left, align 8, !tbaa !8
%1 = load i64, ptr %right, align 8, !tbaa !8
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp sgt 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 @pcharcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load i8, ptr %left, align 1, !tbaa !12
%1 = load i8, ptr %right, align 1, !tbaa !12
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp sgt i8 %0, %1
%. = zext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pdoublecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%0 = load double, ptr %left, align 8, !tbaa !13
%1 = load double, ptr %right, align 8, !tbaa !13
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp ogt double %0, %1
%. = zext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @pstrcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #4 {
entry:
%0 = load ptr, ptr %left, align 8, !tbaa !15
%1 = load ptr, ptr %right, align 8, !tbaa !15
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #9
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllABcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwllREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !17
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !17
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptriplecomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @ptripleREVcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !19
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%l.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.7.0.copyload = load i64, ptr %l.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !19
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !17
%r.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.7.0.copyload = load i64, ptr %r.sroa.7.0..sroa_idx, align 8, !tbaa.struct !18
%cmp = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp13, label %cleanup, label %if.end15
if.end15: ; preds = %if.end10
%cmp17 = icmp slt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
br i1 %cmp17, label %cleanup, label %if.end19
if.end19: ; preds = %if.end15
%cmp22 = icmp sgt i64 %l.sroa.7.0.copyload, %r.sroa.7.0.copyload
%. = zext i1 %cmp22 to i32
br label %cleanup
cleanup: ; preds = %if.end19, %if.end15, %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ 1, %if.end10 ], [ -1, %if.end15 ], [ %., %if.end19 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @phwrealcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load double, ptr %left, align 8, !tbaa.struct !20
%l.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.5.0.copyload = load double, ptr %l.sroa.5.0..sroa_idx, align 8, !tbaa.struct !21
%r.sroa.0.0.copyload = load double, ptr %right, align 8, !tbaa.struct !20
%r.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.5.0.copyload = load double, ptr %r.sroa.5.0..sroa_idx, align 8, !tbaa.struct !21
%cmp = fcmp olt double %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%cmp4 = fcmp ogt double %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4, label %cleanup, label %if.end6
if.end6: ; preds = %if.end
%cmp8 = fcmp olt double %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp8, label %cleanup, label %if.end10
if.end10: ; preds = %if.end6
%cmp13 = fcmp ogt double %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
%. = zext i1 %cmp13 to i32
br label %cleanup
cleanup: ; preds = %if.end10, %if.end6, %if.end, %entry
%retval.0 = phi i32 [ -1, %entry ], [ 1, %if.end ], [ -1, %if.end6 ], [ %., %if.end10 ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @pquadcomp(ptr nocapture noundef readonly %left, ptr nocapture noundef readonly %right) local_unnamed_addr #3 {
entry:
%l.sroa.0.0.copyload = load i64, ptr %left, align 8, !tbaa.struct !22
%l.sroa.4.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 8
%l.sroa.4.0.copyload = load i64, ptr %l.sroa.4.0.left.sroa_idx, align 8, !tbaa.struct !19
%l.sroa.5.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 16
%l.sroa.5.0.copyload = load i64, ptr %l.sroa.5.0.left.sroa_idx, align 8, !tbaa.struct !17
%l.sroa.6.0.left.sroa_idx = getelementptr inbounds i8, ptr %left, i64 24
%l.sroa.6.0.copyload = load i64, ptr %l.sroa.6.0.left.sroa_idx, align 8, !tbaa.struct !18
%r.sroa.0.0.copyload = load i64, ptr %right, align 8, !tbaa.struct !22
%r.sroa.4.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 8
%r.sroa.4.0.copyload = load i64, ptr %r.sroa.4.0.right.sroa_idx, align 8, !tbaa.struct !19
%r.sroa.5.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 16
%r.sroa.5.0.copyload = load i64, ptr %r.sroa.5.0.right.sroa_idx, align 8, !tbaa.struct !17
%r.sroa.6.0.right.sroa_idx = getelementptr inbounds i8, ptr %right, i64 24
%r.sroa.6.0.copyload = load i64, ptr %r.sroa.6.0.right.sroa_idx, align 8, !tbaa.struct !18
%cmp.i = icmp slt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp.i, label %cleanup10, label %if.end.i
if.end.i: ; preds = %entry
%cmp4.i = icmp sgt i64 %l.sroa.0.0.copyload, %r.sroa.0.0.copyload
br i1 %cmp4.i, label %cleanup10, label %if.end6.i
if.end6.i: ; preds = %if.end.i
%cmp8.i = icmp slt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp8.i, label %cleanup10, label %phwllABcomp.exit
phwllABcomp.exit: ; preds = %if.end6.i
%cmp13.i.not = icmp sgt i64 %l.sroa.4.0.copyload, %r.sroa.4.0.copyload
br i1 %cmp13.i.not, label %cleanup10, label %if.end
if.end: ; preds = %phwllABcomp.exit
%cmp.i21 = icmp slt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp.i21, label %cleanup10, label %if.end.i22
if.end.i22: ; preds = %if.end
%cmp4.i23 = icmp sgt i64 %l.sroa.5.0.copyload, %r.sroa.5.0.copyload
br i1 %cmp4.i23, label %cleanup10, label %if.end6.i24
if.end6.i24: ; preds = %if.end.i22
%cmp8.i25 = icmp slt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
br i1 %cmp8.i25, label %cleanup10, label %if.end10.i26
if.end10.i26: ; preds = %if.end6.i24
%cmp13.i27 = icmp sgt i64 %l.sroa.6.0.copyload, %r.sroa.6.0.copyload
%..i28 = zext i1 %cmp13.i27 to i32
br label %cleanup10
cleanup10: ; preds = %if.end10.i26, %if.end6.i24, %if.end.i22, %if.end, %if.end6.i, %if.end.i, %entry, %phwllABcomp.exit
%retval.1 = phi i32 [ 1, %phwllABcomp.exit ], [ -1, %if.end6.i ], [ 1, %if.end.i ], [ -1, %entry ], [ -1, %if.end ], [ 1, %if.end.i22 ], [ -1, %if.end6.i24 ], [ %..i28, %if.end10.i26 ]
ret i32 %retval.1
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp = icmp sle i64 %left, %x
%cmp1 = icmp sle i64 %x, %right
%0 = and i1 %cmp, %cmp1
ret i1 %0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local zeroext i1 @isinrange_soft(i64 noundef %left, i64 noundef %x, i64 noundef %right) local_unnamed_addr #2 {
entry:
%cmp.not = icmp sgt i64 %left, %x
%cmp1.not = icmp sgt i64 %x, %right
%or.cond = or i1 %cmp.not, %cmp1.not
br i1 %or.cond, label %lor.rhs, label %lor.end
lor.rhs: ; preds = %entry
%cmp2 = icmp sge i64 %left, %x
%cmp3 = icmp sge i64 %x, %right
%0 = and i1 %cmp2, %cmp3
br label %lor.end
lor.end: ; preds = %entry, %lor.rhs
%1 = phi i1 [ %0, %lor.rhs ], [ true, %entry ]
ret i1 %1
}
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @solve() local_unnamed_addr #6 {
entry:
%0 = load i64, ptr @n, align 8, !tbaa !8
%1 = load i64, ptr @q, align 8, !tbaa !8
%i.088 = add i64 %1, -1
%cmp89 = icmp sgt i64 %i.088, -1
br i1 %cmp89, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%i.092 = phi i64 [ %i.0, %for.inc ], [ %i.088, %entry ]
%right.091 = phi i64 [ %right.1, %for.inc ], [ %0, %entry ]
%left.090 = phi i64 [ %left.186, %for.inc ], [ -1, %entry ]
%arrayidx = getelementptr inbounds [1048577 x i8], ptr @u, i64 0, i64 %i.092
%2 = load i8, ptr %arrayidx, align 1, !tbaa !12
%cmp1 = icmp eq i8 %2, 76
br i1 %cmp1, label %if.end20.thread, label %if.else
if.end20.thread: ; preds = %for.body
%arrayidx3 = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !12
%add = add nsw i64 %left.090, 1
%arrayidx5 = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %add
%4 = load i8, ptr %arrayidx5, align 1, !tbaa !12
%cmp7 = icmp eq i8 %3, %4
%spec.select = select i1 %cmp7, i64 %add, i64 %left.090
br label %if.else37
if.else: ; preds = %for.body
%cmp10 = icmp sgt i64 %left.090, -1
br i1 %cmp10, label %land.lhs.true, label %if.end20
land.lhs.true: ; preds = %if.else
%arrayidx12 = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092
%5 = load i8, ptr %arrayidx12, align 1, !tbaa !12
%arrayidx14 = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %left.090
%6 = load i8, ptr %arrayidx14, align 1, !tbaa !12
%cmp16 = icmp eq i8 %5, %6
%dec = sext i1 %cmp16 to i64
%spec.select81 = add nsw i64 %left.090, %dec
br label %if.end20
if.end20: ; preds = %land.lhs.true, %if.else
%left.1 = phi i64 [ %left.090, %if.else ], [ %spec.select81, %land.lhs.true ]
%cmp23 = icmp eq i8 %2, 82
br i1 %cmp23, label %if.then25, label %if.end20.if.else37_crit_edge
if.end20.if.else37_crit_edge: ; preds = %if.end20
%arrayidx38.phi.trans.insert = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092
%.pre = load i8, ptr %arrayidx38.phi.trans.insert, align 1, !tbaa !12
br label %if.else37
if.then25: ; preds = %if.end20
%tobool.not = icmp eq i64 %right.091, 0
br i1 %tobool.not, label %for.inc, label %land.lhs.true26
land.lhs.true26: ; preds = %if.then25
%arrayidx27 = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092
%7 = load i8, ptr %arrayidx27, align 1, !tbaa !12
%sub29 = add nsw i64 %right.091, -1
%arrayidx30 = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %sub29
%8 = load i8, ptr %arrayidx30, align 1, !tbaa !12
%cmp32 = icmp eq i8 %7, %8
%spec.select82 = select i1 %cmp32, i64 %sub29, i64 %right.091
br label %for.inc
if.else37: ; preds = %if.end20.if.else37_crit_edge, %if.end20.thread
%9 = phi i8 [ %3, %if.end20.thread ], [ %.pre, %if.end20.if.else37_crit_edge ]
%left.187 = phi i64 [ %spec.select, %if.end20.thread ], [ %left.1, %if.end20.if.else37_crit_edge ]
%arrayidx40 = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %right.091
%10 = load i8, ptr %arrayidx40, align 1, !tbaa !12
%cmp42 = icmp eq i8 %9, %10
%inc45 = zext i1 %cmp42 to i64
%spec.select83 = add nsw i64 %right.091, %inc45
br label %for.inc
for.inc: ; preds = %if.else37, %land.lhs.true26, %if.then25
%left.186 = phi i64 [ %left.1, %if.then25 ], [ %left.1, %land.lhs.true26 ], [ %left.187, %if.else37 ]
%right.1 = phi i64 [ 0, %if.then25 ], [ %spec.select82, %land.lhs.true26 ], [ %spec.select83, %if.else37 ]
%i.0 = add nsw i64 %i.092, -1
%cmp = icmp sgt i64 %i.092, 0
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !23
for.end.loopexit: ; preds = %for.inc
%11 = xor i64 %left.186, -1
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%left.0.lcssa = phi i64 [ 0, %entry ], [ %11, %for.end.loopexit ]
%right.0.lcssa = phi i64 [ %0, %entry ], [ %right.1, %for.end.loopexit ]
%sub50 = add i64 %right.0.lcssa, %left.0.lcssa
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub50)
ret i64 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #6 {
entry:
store i64 3, ptr @n, align 8, !tbaa !8
store i64 0, ptr @m, align 8, !tbaa !8
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m)
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @q)
%call2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @s)
%0 = load i64, ptr @q, align 8, !tbaa !8
%cmp11.not = icmp eq i64 %0, 0
br i1 %cmp11.not, label %for.end.thread, label %for.body
for.end.thread: ; preds = %entry
%1 = load i64, ptr @n, align 8, !tbaa !8
br label %solve.exit
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %indvars.iv
%arrayidx5 = getelementptr inbounds [1048577 x i8], ptr @u, i64 0, i64 %indvars.iv
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%2 = load i64, ptr @q, align 8, !tbaa !8
%cmp = icmp ugt i64 %2, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !24
for.end: ; preds = %for.body
%3 = add i64 %2, -1
%4 = load i64, ptr @n, align 8, !tbaa !8
%cmp89.i = icmp sgt i64 %3, -1
br i1 %cmp89.i, label %for.body.i, label %solve.exit
for.body.i: ; preds = %for.end, %for.inc.i
%i.092.i = phi i64 [ %i.0.i, %for.inc.i ], [ %3, %for.end ]
%right.091.i = phi i64 [ %right.1.i, %for.inc.i ], [ %4, %for.end ]
%left.090.i = phi i64 [ %left.186.i, %for.inc.i ], [ -1, %for.end ]
%arrayidx.i = getelementptr inbounds [1048577 x i8], ptr @u, i64 0, i64 %i.092.i
%5 = load i8, ptr %arrayidx.i, align 1, !tbaa !12
%cmp1.i = icmp eq i8 %5, 76
br i1 %cmp1.i, label %if.end20.thread.i, label %if.else.i
if.end20.thread.i: ; preds = %for.body.i
%arrayidx3.i = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092.i
%6 = load i8, ptr %arrayidx3.i, align 1, !tbaa !12
%add.i = add nsw i64 %left.090.i, 1
%arrayidx5.i = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %add.i
%7 = load i8, ptr %arrayidx5.i, align 1, !tbaa !12
%cmp7.i = icmp eq i8 %6, %7
%spec.select.i = select i1 %cmp7.i, i64 %add.i, i64 %left.090.i
br label %if.else37.i
if.else.i: ; preds = %for.body.i
%cmp10.i = icmp sgt i64 %left.090.i, -1
br i1 %cmp10.i, label %land.lhs.true.i, label %if.end20.i
land.lhs.true.i: ; preds = %if.else.i
%arrayidx12.i = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092.i
%8 = load i8, ptr %arrayidx12.i, align 1, !tbaa !12
%arrayidx14.i = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %left.090.i
%9 = load i8, ptr %arrayidx14.i, align 1, !tbaa !12
%cmp16.i = icmp eq i8 %8, %9
%dec.i = sext i1 %cmp16.i to i64
%spec.select81.i = add nsw i64 %left.090.i, %dec.i
br label %if.end20.i
if.end20.i: ; preds = %land.lhs.true.i, %if.else.i
%left.1.i = phi i64 [ %left.090.i, %if.else.i ], [ %spec.select81.i, %land.lhs.true.i ]
%cmp23.i = icmp eq i8 %5, 82
br i1 %cmp23.i, label %if.then25.i, label %if.end20.if.else37_crit_edge.i
if.end20.if.else37_crit_edge.i: ; preds = %if.end20.i
%arrayidx38.phi.trans.insert.i = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092.i
%.pre.i = load i8, ptr %arrayidx38.phi.trans.insert.i, align 1, !tbaa !12
br label %if.else37.i
if.then25.i: ; preds = %if.end20.i
%tobool.not.i = icmp eq i64 %right.091.i, 0
br i1 %tobool.not.i, label %for.inc.i, label %land.lhs.true26.i
land.lhs.true26.i: ; preds = %if.then25.i
%arrayidx27.i = getelementptr inbounds [1048577 x i8], ptr @t, i64 0, i64 %i.092.i
%10 = load i8, ptr %arrayidx27.i, align 1, !tbaa !12
%sub29.i = add nsw i64 %right.091.i, -1
%arrayidx30.i = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %sub29.i
%11 = load i8, ptr %arrayidx30.i, align 1, !tbaa !12
%cmp32.i = icmp eq i8 %10, %11
%spec.select82.i = select i1 %cmp32.i, i64 %sub29.i, i64 %right.091.i
br label %for.inc.i
if.else37.i: ; preds = %if.end20.if.else37_crit_edge.i, %if.end20.thread.i
%12 = phi i8 [ %6, %if.end20.thread.i ], [ %.pre.i, %if.end20.if.else37_crit_edge.i ]
%left.187.i = phi i64 [ %spec.select.i, %if.end20.thread.i ], [ %left.1.i, %if.end20.if.else37_crit_edge.i ]
%arrayidx40.i = getelementptr inbounds [1048577 x i8], ptr @s, i64 0, i64 %right.091.i
%13 = load i8, ptr %arrayidx40.i, align 1, !tbaa !12
%cmp42.i = icmp eq i8 %12, %13
%inc45.i = zext i1 %cmp42.i to i64
%spec.select83.i = add nsw i64 %right.091.i, %inc45.i
br label %for.inc.i
for.inc.i: ; preds = %if.else37.i, %land.lhs.true26.i, %if.then25.i
%left.186.i = phi i64 [ %left.1.i, %if.then25.i ], [ %left.1.i, %land.lhs.true26.i ], [ %left.187.i, %if.else37.i ]
%right.1.i = phi i64 [ 0, %if.then25.i ], [ %spec.select82.i, %land.lhs.true26.i ], [ %spec.select83.i, %if.else37.i ]
%i.0.i = add nsw i64 %i.092.i, -1
%cmp.i = icmp sgt i64 %i.092.i, 0
br i1 %cmp.i, label %for.body.i, label %for.end.loopexit.i, !llvm.loop !23
for.end.loopexit.i: ; preds = %for.inc.i
%14 = xor i64 %left.186.i, -1
br label %solve.exit
solve.exit: ; preds = %for.end.thread, %for.end, %for.end.loopexit.i
%left.0.lcssa.i = phi i64 [ 0, %for.end ], [ %14, %for.end.loopexit.i ], [ 0, %for.end.thread ]
%right.0.lcssa.i = phi i64 [ %4, %for.end ], [ %right.1.i, %for.end.loopexit.i ], [ %1, %for.end.thread ]
%sub50.i = add i64 %right.0.lcssa.i, %left.0.lcssa.i
%call.i = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub50.i)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #8
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #8
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 norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree 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 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!10, !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !10, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{i64 0, i64 8, !8, i64 8, i64 8, !8}
!18 = !{i64 0, i64 8, !8}
!19 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8}
!20 = !{i64 0, i64 8, !13, i64 8, i64 8, !13}
!21 = !{i64 0, i64 8, !13}
!22 = !{i64 0, i64 8, !8, i64 8, i64 8, !8, i64 16, i64 8, !8, i64 24, i64 8, !8}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
|
#include <stdio.h>
int main(void) {
int n,m,i,j,b,a[1024],v[1024] = {0},mv = 0,most = 0;
scanf("%d%d",&n,&m);
for(i = 1;i <= n;i++){
scanf("%d",&a[i]);
}
for(i = 1;i <= m;i++){
scanf("%d",&b);
for(j = 1;j <= n;j++){
if(a[j] <= b){v[j]++;break;}
}
}
for(i = 1;i <= n;i++){
if(v[i] > mv){mv = v[i];most = i;}
}
printf("%d\n",most);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_125607/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_125607/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%b = alloca i32, align 4
%a = alloca [1024 x i32], align 16
%v = alloca [1024 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %v) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4096) %v, i8 0, i64 4096, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not48 = icmp slt i32 %0, 1
br i1 %cmp.not48, label %for.cond2.preheader, label %for.body
for.cond2.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %3, %for.body ]
%2 = load i32, ptr %m, align 4, !tbaa !5
%cmp3.not52 = icmp slt i32 %2, 1
br i1 %cmp3.not52, label %for.cond21.preheader, label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [1024 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
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond21.preheader: ; preds = %for.inc18, %for.cond2.preheader
%5 = phi i32 [ %1, %for.cond2.preheader ], [ %10, %for.inc18 ]
%cmp22.not54 = icmp slt i32 %5, 1
br i1 %cmp22.not54, label %for.end33, label %for.body23.preheader
for.body23.preheader: ; preds = %for.cond21.preheader
%6 = add nuw i32 %5, 1
%wide.trip.count66 = zext i32 %6 to i64
%7 = add nsw i64 %wide.trip.count66, -1
%8 = add nsw i64 %wide.trip.count66, -2
%xtraiter = and i64 %7, 3
%9 = icmp ult i64 %8, 3
br i1 %9, label %for.end33.loopexit.unr-lcssa, label %for.body23.preheader.new
for.body23.preheader.new: ; preds = %for.body23.preheader
%unroll_iter = and i64 %7, -4
br label %for.body23
for.body4: ; preds = %for.cond2.preheader, %for.inc18
%i.153 = phi i32 [ %inc19, %for.inc18 ], [ 1, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %b)
%10 = load i32, ptr %n, align 4, !tbaa !5
%cmp7.not50 = icmp slt i32 %10, 1
br i1 %cmp7.not50, label %for.inc18, label %for.body8.lr.ph
for.body8.lr.ph: ; preds = %for.body4
%11 = load i32, ptr %b, align 4, !tbaa !5
%12 = add nuw i32 %10, 1
%wide.trip.count = zext i32 %12 to i64
br label %for.body8
for.cond6: ; preds = %for.body8
%indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
%exitcond.not = icmp eq i64 %indvars.iv.next61, %wide.trip.count
br i1 %exitcond.not, label %for.inc18, label %for.body8, !llvm.loop !11
for.body8: ; preds = %for.body8.lr.ph, %for.cond6
%indvars.iv60 = phi i64 [ 1, %for.body8.lr.ph ], [ %indvars.iv.next61, %for.cond6 ]
%arrayidx10 = getelementptr inbounds [1024 x i32], ptr %a, i64 0, i64 %indvars.iv60
%13 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11.not = icmp sgt i32 %13, %11
br i1 %cmp11.not, label %for.cond6, label %if.then
if.then: ; preds = %for.body8
%arrayidx13 = getelementptr inbounds [1024 x i32], ptr %v, i64 0, i64 %indvars.iv60
%14 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%inc14 = add nsw i32 %14, 1
store i32 %inc14, ptr %arrayidx13, align 4, !tbaa !5
br label %for.inc18
for.inc18: ; preds = %for.cond6, %for.body4, %if.then
%inc19 = add nuw nsw i32 %i.153, 1
%15 = load i32, ptr %m, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %i.153, %15
br i1 %cmp3.not.not, label %for.body4, label %for.cond21.preheader, !llvm.loop !12
for.body23: ; preds = %for.body23, %for.body23.preheader.new
%indvars.iv63 = phi i64 [ 1, %for.body23.preheader.new ], [ %indvars.iv.next64.3, %for.body23 ]
%most.057 = phi i32 [ 0, %for.body23.preheader.new ], [ %spec.select47.3, %for.body23 ]
%mv.056 = phi i32 [ 0, %for.body23.preheader.new ], [ %spec.select.3, %for.body23 ]
%niter = phi i64 [ 0, %for.body23.preheader.new ], [ %niter.next.3, %for.body23 ]
%arrayidx25 = getelementptr inbounds [1024 x i32], ptr %v, i64 0, i64 %indvars.iv63
%16 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%cmp26 = icmp sgt i32 %16, %mv.056
%spec.select = call i32 @llvm.smax.i32(i32 %16, i32 %mv.056)
%17 = trunc i64 %indvars.iv63 to i32
%spec.select47 = select i1 %cmp26, i32 %17, i32 %most.057
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%arrayidx25.1 = getelementptr inbounds [1024 x i32], ptr %v, i64 0, i64 %indvars.iv.next64
%18 = load i32, ptr %arrayidx25.1, align 4, !tbaa !5
%cmp26.1 = icmp sgt i32 %18, %spec.select
%spec.select.1 = call i32 @llvm.smax.i32(i32 %18, i32 %spec.select)
%19 = trunc i64 %indvars.iv.next64 to i32
%spec.select47.1 = select i1 %cmp26.1, i32 %19, i32 %spec.select47
%indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2
%arrayidx25.2 = getelementptr inbounds [1024 x i32], ptr %v, i64 0, i64 %indvars.iv.next64.1
%20 = load i32, ptr %arrayidx25.2, align 4, !tbaa !5
%cmp26.2 = icmp sgt i32 %20, %spec.select.1
%spec.select.2 = call i32 @llvm.smax.i32(i32 %20, i32 %spec.select.1)
%21 = trunc i64 %indvars.iv.next64.1 to i32
%spec.select47.2 = select i1 %cmp26.2, i32 %21, i32 %spec.select47.1
%indvars.iv.next64.2 = add nuw nsw i64 %indvars.iv63, 3
%arrayidx25.3 = getelementptr inbounds [1024 x i32], ptr %v, i64 0, i64 %indvars.iv.next64.2
%22 = load i32, ptr %arrayidx25.3, align 4, !tbaa !5
%cmp26.3 = icmp sgt i32 %22, %spec.select.2
%spec.select.3 = call i32 @llvm.smax.i32(i32 %22, i32 %spec.select.2)
%23 = trunc i64 %indvars.iv.next64.2 to i32
%spec.select47.3 = select i1 %cmp26.3, i32 %23, i32 %spec.select47.2
%indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 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.end33.loopexit.unr-lcssa, label %for.body23, !llvm.loop !13
for.end33.loopexit.unr-lcssa: ; preds = %for.body23, %for.body23.preheader
%spec.select47.lcssa.ph = phi i32 [ undef, %for.body23.preheader ], [ %spec.select47.3, %for.body23 ]
%indvars.iv63.unr = phi i64 [ 1, %for.body23.preheader ], [ %indvars.iv.next64.3, %for.body23 ]
%most.057.unr = phi i32 [ 0, %for.body23.preheader ], [ %spec.select47.3, %for.body23 ]
%mv.056.unr = phi i32 [ 0, %for.body23.preheader ], [ %spec.select.3, %for.body23 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end33, label %for.body23.epil
for.body23.epil: ; preds = %for.end33.loopexit.unr-lcssa, %for.body23.epil
%indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %for.body23.epil ], [ %indvars.iv63.unr, %for.end33.loopexit.unr-lcssa ]
%most.057.epil = phi i32 [ %spec.select47.epil, %for.body23.epil ], [ %most.057.unr, %for.end33.loopexit.unr-lcssa ]
%mv.056.epil = phi i32 [ %spec.select.epil, %for.body23.epil ], [ %mv.056.unr, %for.end33.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body23.epil ], [ 0, %for.end33.loopexit.unr-lcssa ]
%arrayidx25.epil = getelementptr inbounds [1024 x i32], ptr %v, i64 0, i64 %indvars.iv63.epil
%24 = load i32, ptr %arrayidx25.epil, align 4, !tbaa !5
%cmp26.epil = icmp sgt i32 %24, %mv.056.epil
%spec.select.epil = call i32 @llvm.smax.i32(i32 %24, i32 %mv.056.epil)
%25 = trunc i64 %indvars.iv63.epil to i32
%spec.select47.epil = select i1 %cmp26.epil, i32 %25, i32 %most.057.epil
%indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.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.end33, label %for.body23.epil, !llvm.loop !14
for.end33: ; preds = %for.end33.loopexit.unr-lcssa, %for.body23.epil, %for.cond21.preheader
%most.0.lcssa = phi i32 [ 0, %for.cond21.preheader ], [ %spec.select47.lcssa.ph, %for.end33.loopexit.unr-lcssa ], [ %spec.select47.epil, %for.body23.epil ]
%call34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %most.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
#include <stdlib.h>
int f(const void *a,const void *b){
return *(long long int*)b-*(long long int*)a;
}
int main(){
int N;
long long int A[200002]={};
long long int ans=0LL;
long long int T;
scanf("%d\n",&N);
for(int i=0;i<N;i++)
scanf("%lld",A+i);
qsort(A,N,sizeof(long long int),f);
for(int i=1;i<N;i++){
ans+=A[i/2];
}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_125672/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_125672/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @f(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %b, align 8, !tbaa !5
%1 = load i64, ptr %a, align 8, !tbaa !5
%sub = sub nsw i64 %0, %1
%conv = trunc i64 %sub to i32
ret i32 %conv
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
%A = alloca [200002 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
call void @llvm.lifetime.start.p0(i64 1600016, ptr nonnull %A) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600016) %A, i8 0, i64 1600016, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !9
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %6, %for.body ]
call void @qsort(ptr noundef nonnull %A, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @f) #6
%1 = load i32, ptr %N, align 4, !tbaa !9
%cmp521 = icmp sgt i32 %1, 1
br i1 %cmp521, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond.cleanup
%2 = add i32 %1, -1
%3 = add i32 %1, -2
%xtraiter = and i32 %2, 3
%4 = icmp ult i32 %3, 3
br i1 %4, label %for.cond.cleanup7.loopexit.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter = and i32 %2, -4
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i64, ptr %A, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !9
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond.cleanup7.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%add.lcssa.ph = phi i64 [ undef, %for.body8.preheader ], [ %add.3, %for.body8 ]
%i3.023.unr = phi i32 [ 1, %for.body8.preheader ], [ %inc10.3, %for.body8 ]
%ans.022.unr = phi i64 [ 0, %for.body8.preheader ], [ %add.3, %for.body8 ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond.cleanup7, label %for.body8.epil
for.body8.epil: ; preds = %for.cond.cleanup7.loopexit.unr-lcssa, %for.body8.epil
%i3.023.epil = phi i32 [ %inc10.epil, %for.body8.epil ], [ %i3.023.unr, %for.cond.cleanup7.loopexit.unr-lcssa ]
%ans.022.epil = phi i64 [ %add.epil, %for.body8.epil ], [ %ans.022.unr, %for.cond.cleanup7.loopexit.unr-lcssa ]
%epil.iter = phi i32 [ %epil.iter.next, %for.body8.epil ], [ 0, %for.cond.cleanup7.loopexit.unr-lcssa ]
%div18.epil = lshr i32 %i3.023.epil, 1
%idxprom.epil = zext i32 %div18.epil to i64
%arrayidx.epil = getelementptr inbounds [200002 x i64], ptr %A, i64 0, i64 %idxprom.epil
%7 = load i64, ptr %arrayidx.epil, align 8, !tbaa !5
%add.epil = add nsw i64 %7, %ans.022.epil
%inc10.epil = add nuw nsw i32 %i3.023.epil, 1
%epil.iter.next = add i32 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.cond.cleanup7, label %for.body8.epil, !llvm.loop !13
for.cond.cleanup7: ; preds = %for.cond.cleanup7.loopexit.unr-lcssa, %for.body8.epil, %for.cond.cleanup
%ans.0.lcssa = phi i64 [ 0, %for.cond.cleanup ], [ %add.lcssa.ph, %for.cond.cleanup7.loopexit.unr-lcssa ], [ %add.epil, %for.body8.epil ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 1600016, ptr nonnull %A) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%i3.023 = phi i32 [ 1, %for.body8.preheader.new ], [ %inc10.3, %for.body8 ]
%ans.022 = phi i64 [ 0, %for.body8.preheader.new ], [ %add.3, %for.body8 ]
%niter = phi i32 [ 0, %for.body8.preheader.new ], [ %niter.next.3, %for.body8 ]
%div18 = lshr i32 %i3.023, 1
%idxprom = zext i32 %div18 to i64
%arrayidx = getelementptr inbounds [200002 x i64], ptr %A, i64 0, i64 %idxprom
%8 = load i64, ptr %arrayidx, align 8, !tbaa !5
%add = add nsw i64 %8, %ans.022
%inc10 = add nuw nsw i32 %i3.023, 1
%div18.1 = lshr i32 %inc10, 1
%idxprom.1 = zext i32 %div18.1 to i64
%arrayidx.1 = getelementptr inbounds [200002 x i64], ptr %A, i64 0, i64 %idxprom.1
%9 = load i64, ptr %arrayidx.1, align 8, !tbaa !5
%add.1 = add nsw i64 %9, %add
%div18.2 = lshr i32 %inc10, 1
%idxprom.2 = zext i32 %div18.2 to i64
%arrayidx.2 = getelementptr inbounds [200002 x i64], ptr %A, i64 0, i64 %idxprom.2
%10 = load i64, ptr %arrayidx.2, align 8, !tbaa !5
%add.2 = add nsw i64 %10, %add.1
%inc10.2 = add nuw nsw i32 %i3.023, 3
%div18.3 = lshr i32 %inc10.2, 1
%idxprom.3 = zext i32 %div18.3 to i64
%arrayidx.3 = getelementptr inbounds [200002 x i64], ptr %A, i64 0, i64 %idxprom.3
%11 = load i64, ptr %arrayidx.3, align 8, !tbaa !5
%add.3 = add nsw i64 %11, %add.2
%inc10.3 = add nuw nsw i32 %i3.023, 4
%niter.next.3 = add nuw i32 %niter, 4
%niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.cond.cleanup7.loopexit.unr-lcssa, label %for.body8, !llvm.loop !15
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !12}
|
#include <stdio.h>
int main() {
int n, k;
scanf("%d %d", &n, &k);
int a[k];
int por = n / 2 + n % 2;
for (int i = 0; i < k; i++)
a[i] = 0;
for (int i = 0; i < n; i++)
{
int tmp;
scanf("%d", &tmp);
a[tmp-1]++;
}
for (int i = 0; i < k; i++)
{
while(a[i] > 1)
{
por--;
a[i] -= 2;
}
}
if (por > 0)
{
for (int i = 0; i < k; i++)
{
if (a[i] > 0 && por > 0)
{
a[i]--;
por--;
}
}
}
int res = 0;
for (int i = 0; i < k; i++)
{
res += a[i];
}
printf ("%d", n - res);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12573/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12573/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%tmp = 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 %k, 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
%div = sdiv i32 %3, 2
%rem = srem i32 %3, 2
%add = add nsw i32 %div, %rem
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp76 = icmp sgt i32 %4, 0
br i1 %cmp76, label %for.body.preheader, label %for.cond2.preheader
for.body.preheader: ; preds = %entry
%5 = zext i32 %4 to i64
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %6, i1 false), !tbaa !5
br label %for.cond2.preheader
for.cond2.preheader: ; preds = %for.body.preheader, %entry
%cmp378 = icmp sgt i32 %3, 0
br i1 %cmp378, label %for.body5, label %for.cond14.preheader
for.cond14.preheader.loopexit: ; preds = %for.body5
%.pre = load i32, ptr %k, align 4, !tbaa !5
br label %for.cond14.preheader
for.cond14.preheader: ; preds = %for.cond14.preheader.loopexit, %for.cond2.preheader
%7 = phi i32 [ %4, %for.cond2.preheader ], [ %.pre, %for.cond14.preheader.loopexit ]
%.lcssa75 = phi i32 [ %3, %for.cond2.preheader ], [ %35, %for.cond14.preheader.loopexit ]
%cmp1586 = icmp sgt i32 %7, 0
br i1 %cmp1586, label %while.cond.preheader.preheader, label %for.cond.cleanup49
while.cond.preheader.preheader: ; preds = %for.cond14.preheader
%wide.trip.count = zext i32 %7 to i64
%min.iters.check = icmp ult i32 %7, 8
br i1 %min.iters.check, label %while.cond.preheader.preheader138, label %vector.ph
vector.ph: ; preds = %while.cond.preheader.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
%8 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %add, i64 0
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %8, %vector.ph ], [ %predphi117, %vector.body ]
%vec.phi114 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %predphi118, %vector.body ]
%9 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load115 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = icmp sgt <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%12 = icmp sgt <4 x i32> %wide.load115, <i32 1, i32 1, i32 1, i32 1>
%13 = add nuw <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
%14 = add nuw <4 x i32> %wide.load115, <i32 1, i32 1, i32 1, i32 1>
%15 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load, <4 x i32> <i32 3, i32 3, i32 3, i32 3>)
%16 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %wide.load115, <4 x i32> <i32 3, i32 3, i32 3, i32 3>)
%17 = sub nuw <4 x i32> %13, %15
%18 = sub nuw <4 x i32> %14, %16
%19 = lshr <4 x i32> %17, <i32 1, i32 1, i32 1, i32 1>
%20 = lshr <4 x i32> %18, <i32 1, i32 1, i32 1, i32 1>
%21 = xor <4 x i32> %19, <i32 -1, i32 -1, i32 -1, i32 -1>
%22 = xor <4 x i32> %20, <i32 -1, i32 -1, i32 -1, i32 -1>
%23 = and <4 x i32> %17, <i32 -2, i32 -2, i32 -2, i32 -2>
%24 = and <4 x i32> %18, <i32 -2, i32 -2, i32 -2, i32 -2>
%25 = add nsw <4 x i32> %wide.load, <i32 -2, i32 -2, i32 -2, i32 -2>
%26 = add nsw <4 x i32> %wide.load115, <i32 -2, i32 -2, i32 -2, i32 -2>
%27 = sub nsw <4 x i32> %25, %23
%28 = sub nsw <4 x i32> %26, %24
%predphi = select <4 x i1> %11, <4 x i32> %27, <4 x i32> %wide.load
%predphi116 = select <4 x i1> %12, <4 x i32> %28, <4 x i32> %wide.load115
%29 = select <4 x i1> %11, <4 x i32> %21, <4 x i32> zeroinitializer
%predphi117 = add <4 x i32> %vec.phi, %29
%30 = select <4 x i1> %12, <4 x i32> %22, <4 x i32> zeroinitializer
%predphi118 = add <4 x i32> %vec.phi114, %30
store <4 x i32> %predphi, ptr %9, align 16, !tbaa !5
store <4 x i32> %predphi116, ptr %10, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%31 = icmp eq i64 %index.next, %n.vec
br i1 %31, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %predphi118, %predphi117
%32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup16, label %while.cond.preheader.preheader138
while.cond.preheader.preheader138: ; preds = %while.cond.preheader.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %while.cond.preheader.preheader ], [ %n.vec, %middle.block ]
%por.087.ph = phi i32 [ %add, %while.cond.preheader.preheader ], [ %32, %middle.block ]
br label %while.cond.preheader
for.body5: ; preds = %for.cond2.preheader, %for.body5
%i1.079 = phi i32 [ %inc11, %for.body5 ], [ 0, %for.cond2.preheader ]
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %tmp) #6
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %tmp)
%33 = load i32, ptr %tmp, align 4, !tbaa !5
%sub = add nsw i32 %33, -1
%idxprom7 = sext i32 %sub to i64
%arrayidx8 = getelementptr inbounds i32, ptr %vla, i64 %idxprom7
%34 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%inc9 = add nsw i32 %34, 1
store i32 %inc9, ptr %arrayidx8, align 4, !tbaa !5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %tmp) #6
%inc11 = add nuw nsw i32 %i1.079, 1
%35 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc11, %35
br i1 %cmp3, label %for.body5, label %for.cond14.preheader.loopexit, !llvm.loop !13
while.cond.preheader: ; preds = %while.cond.preheader.preheader138, %for.inc24
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc24 ], [ %indvars.iv.ph, %while.cond.preheader.preheader138 ]
%por.087 = phi i32 [ %por.1.lcssa, %for.inc24 ], [ %por.087.ph, %while.cond.preheader.preheader138 ]
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%arrayidx19.promoted = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp2081 = icmp sgt i32 %arrayidx19.promoted, 1
br i1 %cmp2081, label %while.body.preheader, label %for.inc24
while.body.preheader: ; preds = %while.cond.preheader
%36 = add nuw i32 %arrayidx19.promoted, 1
%smin = call i32 @llvm.smin.i32(i32 %arrayidx19.promoted, i32 3)
%37 = sub nuw i32 %36, %smin
%38 = lshr i32 %37, 1
%39 = xor i32 %38, -1
%40 = add i32 %por.087, %39
%41 = and i32 %37, -2
%42 = add nsw i32 %arrayidx19.promoted, -2
%43 = sub nsw i32 %42, %41
br label %for.inc24
for.cond.cleanup16: ; preds = %for.inc24, %middle.block
%por.1.lcssa.lcssa = phi i32 [ %32, %middle.block ], [ %por.1.lcssa, %for.inc24 ]
%cmp27 = icmp sgt i32 %por.1.lcssa.lcssa, 0
%or.cond98 = and i1 %cmp27, %cmp1586
br i1 %or.cond98, label %for.body32.preheader, label %if.end45
for.body32.preheader: ; preds = %for.cond.cleanup16
%xtraiter = and i64 %wide.trip.count, 1
%44 = icmp eq i32 %7, 1
br i1 %44, label %if.end45.loopexit.unr-lcssa, label %for.body32.preheader.new
for.body32.preheader.new: ; preds = %for.body32.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body32
for.inc24: ; preds = %while.body.preheader, %while.cond.preheader
%sub2380.lcssa = phi i32 [ %arrayidx19.promoted, %while.cond.preheader ], [ %43, %while.body.preheader ]
%por.1.lcssa = phi i32 [ %por.087, %while.cond.preheader ], [ %40, %while.body.preheader ]
store i32 %sub2380.lcssa, ptr %arrayidx19, 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.cond.cleanup16, label %while.cond.preheader, !llvm.loop !14
for.body32: ; preds = %for.inc42.1, %for.body32.preheader.new
%indvars.iv101 = phi i64 [ 0, %for.body32.preheader.new ], [ %indvars.iv.next102.1, %for.inc42.1 ]
%por.292 = phi i32 [ %por.1.lcssa.lcssa, %for.body32.preheader.new ], [ %por.3.1, %for.inc42.1 ]
%niter = phi i64 [ 0, %for.body32.preheader.new ], [ %niter.next.1, %for.inc42.1 ]
%arrayidx34 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv101
%45 = load i32, ptr %arrayidx34, align 8, !tbaa !5
%cmp35 = icmp sgt i32 %45, 0
%cmp36 = icmp sgt i32 %por.292, 0
%or.cond = select i1 %cmp35, i1 %cmp36, i1 false
br i1 %or.cond, label %if.then37, label %for.inc42
if.then37: ; preds = %for.body32
%dec40 = add nsw i32 %45, -1
store i32 %dec40, ptr %arrayidx34, align 8, !tbaa !5
%dec41 = add nsw i32 %por.292, -1
br label %for.inc42
for.inc42: ; preds = %for.body32, %if.then37
%por.3 = phi i32 [ %dec41, %if.then37 ], [ %por.292, %for.body32 ]
%indvars.iv.next102 = or i64 %indvars.iv101, 1
%arrayidx34.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next102
%46 = load i32, ptr %arrayidx34.1, align 4, !tbaa !5
%cmp35.1 = icmp sgt i32 %46, 0
%cmp36.1 = icmp sgt i32 %por.3, 0
%or.cond.1 = select i1 %cmp35.1, i1 %cmp36.1, i1 false
br i1 %or.cond.1, label %if.then37.1, label %for.inc42.1
if.then37.1: ; preds = %for.inc42
%dec40.1 = add nsw i32 %46, -1
store i32 %dec40.1, ptr %arrayidx34.1, align 4, !tbaa !5
%dec41.1 = add nsw i32 %por.3, -1
br label %for.inc42.1
for.inc42.1: ; preds = %if.then37.1, %for.inc42
%por.3.1 = phi i32 [ %dec41.1, %if.then37.1 ], [ %por.3, %for.inc42 ]
%indvars.iv.next102.1 = add nuw nsw i64 %indvars.iv101, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %if.end45.loopexit.unr-lcssa.loopexit, label %for.body32, !llvm.loop !15
if.end45.loopexit.unr-lcssa.loopexit: ; preds = %for.inc42.1
%47 = icmp sgt i32 %por.3.1, 0
br label %if.end45.loopexit.unr-lcssa
if.end45.loopexit.unr-lcssa: ; preds = %if.end45.loopexit.unr-lcssa.loopexit, %for.body32.preheader
%indvars.iv101.unr = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next102.1, %if.end45.loopexit.unr-lcssa.loopexit ]
%por.292.unr = phi i1 [ true, %for.body32.preheader ], [ %47, %if.end45.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %if.end45, label %for.body32.epil
for.body32.epil: ; preds = %if.end45.loopexit.unr-lcssa
%arrayidx34.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv101.unr
%48 = load i32, ptr %arrayidx34.epil, align 4, !tbaa !5
%cmp35.epil = icmp sgt i32 %48, 0
%or.cond.epil = select i1 %cmp35.epil, i1 %por.292.unr, i1 false
br i1 %or.cond.epil, label %if.then37.epil, label %if.end45
if.then37.epil: ; preds = %for.body32.epil
%dec40.epil = add nsw i32 %48, -1
store i32 %dec40.epil, ptr %arrayidx34.epil, align 4, !tbaa !5
br label %if.end45
if.end45: ; preds = %if.end45.loopexit.unr-lcssa, %if.then37.epil, %for.body32.epil, %for.cond.cleanup16
br i1 %cmp1586, label %for.body50.preheader, label %for.cond.cleanup49
for.body50.preheader: ; preds = %if.end45
%wide.trip.count109 = zext i32 %7 to i64
%min.iters.check121 = icmp ult i32 %7, 8
br i1 %min.iters.check121, label %for.body50.preheader136, label %vector.ph122
vector.ph122: ; preds = %for.body50.preheader
%n.vec124 = and i64 %wide.trip.count, 4294967288
br label %vector.body127
vector.body127: ; preds = %vector.body127, %vector.ph122
%index128 = phi i64 [ 0, %vector.ph122 ], [ %index.next133, %vector.body127 ]
%vec.phi129 = phi <4 x i32> [ zeroinitializer, %vector.ph122 ], [ %51, %vector.body127 ]
%vec.phi130 = phi <4 x i32> [ zeroinitializer, %vector.ph122 ], [ %52, %vector.body127 ]
%49 = getelementptr inbounds i32, ptr %vla, i64 %index128
%wide.load131 = load <4 x i32>, ptr %49, align 16, !tbaa !5
%50 = getelementptr inbounds i32, ptr %49, i64 4
%wide.load132 = load <4 x i32>, ptr %50, align 16, !tbaa !5
%51 = add <4 x i32> %wide.load131, %vec.phi129
%52 = add <4 x i32> %wide.load132, %vec.phi130
%index.next133 = add nuw i64 %index128, 8
%53 = icmp eq i64 %index.next133, %n.vec124
br i1 %53, label %middle.block119, label %vector.body127, !llvm.loop !16
middle.block119: ; preds = %vector.body127
%bin.rdx134 = add <4 x i32> %52, %51
%54 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx134)
%cmp.n126 = icmp eq i64 %n.vec124, %wide.trip.count
br i1 %cmp.n126, label %for.cond.cleanup49, label %for.body50.preheader136
for.body50.preheader136: ; preds = %for.body50.preheader, %middle.block119
%indvars.iv106.ph = phi i64 [ 0, %for.body50.preheader ], [ %n.vec124, %middle.block119 ]
%res.095.ph = phi i32 [ 0, %for.body50.preheader ], [ %54, %middle.block119 ]
br label %for.body50
for.cond.cleanup49: ; preds = %for.body50, %middle.block119, %for.cond14.preheader, %if.end45
%res.0.lcssa = phi i32 [ 0, %if.end45 ], [ 0, %for.cond14.preheader ], [ %54, %middle.block119 ], [ %add53, %for.body50 ]
%sub57 = sub nsw i32 %.lcssa75, %res.0.lcssa
%call58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub57)
call void @llvm.stackrestore.p0(ptr %2)
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
for.body50: ; preds = %for.body50.preheader136, %for.body50
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.body50 ], [ %indvars.iv106.ph, %for.body50.preheader136 ]
%res.095 = phi i32 [ %add53, %for.body50 ], [ %res.095.ph, %for.body50.preheader136 ]
%arrayidx52 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv106
%55 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%add53 = add nsw i32 %55, %res.095
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%exitcond110.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count109
br i1 %exitcond110.not, label %for.cond.cleanup49, label %for.body50, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree 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.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
|
#include <stdio.h>
#include<string.h>
int main()
{
char s[15];
scanf("%s",s);
int l=strlen(s);
if(l%2)
printf("No\n");
else
{
int flag=1,i=0;
while(i<l)
{
if(s[i]!='h'||s[i+1]!='i')
{
flag=0;
break;
}
i+=2;
}
if(flag==1)
printf("Yes\n");
else
printf("No\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_125816/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_125816/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.4 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [15 x i8], align 1
call void @llvm.lifetime.start.p0(i64 15, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%0 = and i32 %conv, 1
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %while.cond.preheader, label %if.end22
while.cond.preheader: ; preds = %entry
%cmp.not29 = icmp sgt i32 %conv, 0
br i1 %cmp.not29, label %while.body, label %if.end22
while.cond: ; preds = %lor.lhs.false
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%1 = trunc i64 %indvars.iv.next to i32
%cmp.not = icmp slt i32 %1, %conv
br i1 %cmp.not, label %while.body, label %if.end22, !llvm.loop !5
while.body: ; preds = %while.cond.preheader, %while.cond
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ 0, %while.cond.preheader ]
%arrayidx = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !7
%cmp6.not = icmp eq i8 %2, 104
br i1 %cmp6.not, label %lor.lhs.false, label %if.end22
lor.lhs.false: ; preds = %while.body
%3 = or i64 %indvars.iv, 1
%arrayidx9 = getelementptr inbounds [15 x i8], ptr %s, i64 0, i64 %3
%4 = load i8, ptr %arrayidx9, align 1, !tbaa !7
%cmp11.not = icmp eq i8 %4, 105
br i1 %cmp11.not, label %while.cond, label %if.end22
if.end22: ; preds = %while.body, %lor.lhs.false, %while.cond, %while.cond.preheader, %entry
%str.3.sink = phi ptr [ @str.4, %entry ], [ @str.3, %while.cond.preheader ], [ @str.3, %while.cond ], [ @str.4, %lor.lhs.false ], [ @str.4, %while.body ]
%puts27 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 15, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int n, k;
scanf("%d %d", &n, &k);
int final = -1, plus = 1, moves = 1, num = 1;
if (plus - (n - moves) == k){
printf("0\n");
return 0;
}
while (final != k){
plus += num + 1;
moves++;
final = plus - (n - moves);
num++;
}
printf("%d\n", n - moves);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12586/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12586/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [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
%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
%sub1 = sub nsw i32 2, %0
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp = icmp eq i32 %sub1, %1
br i1 %cmp, label %if.then, label %while.cond.preheader
while.cond.preheader: ; preds = %entry
%cmp3.not21 = icmp eq i32 %1, -1
br i1 %cmp3.not21, label %while.end, label %while.body
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
while.body: ; preds = %while.cond.preheader, %while.body
%num.024 = phi i32 [ %add, %while.body ], [ 1, %while.cond.preheader ]
%plus.022 = phi i32 [ %add4, %while.body ], [ 1, %while.cond.preheader ]
%add = add nuw nsw i32 %num.024, 1
%add4 = add nuw nsw i32 %add, %plus.022
%sub5.neg = sub i32 %add, %0
%sub6 = add i32 %sub5.neg, %add4
%cmp3.not = icmp eq i32 %sub6, %1
br i1 %cmp3.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%moves.0.lcssa = phi i32 [ 1, %while.cond.preheader ], [ %add, %while.body ]
%sub8 = sub nsw i32 %0, %moves.0.lcssa
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub8)
br label %cleanup
cleanup: ; preds = %while.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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 <string.h>
int main()
{
char s[11];
scanf("%s",s);
int len = strlen(s);
int i;
for (i = 0; i < len; i++)
{
if(len % 2 == 1)break;
if(i % 2 == 0)
{
if(s[i] != 'h')break;
}
else
{
if(s[i] != 'i')break;
}
}
if(i == len)printf("Yes");
else printf("No");
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_125917/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_125917/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"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:
%s = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %s) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #5
%call2.fr = freeze i64 %call2
%conv = trunc i64 %call2.fr to i32
%0 = and i32 %conv, -2147483647
%cmp4 = icmp eq i32 %0, 1
%cmp37 = icmp slt i32 %conv, 1
%or.cond38 = or i1 %cmp4, %cmp37
br i1 %or.cond38, label %for.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2.fr, 4294967295
br label %if.end
if.end: ; preds = %if.end.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %if.end.preheader ], [ %indvars.iv.next, %for.inc ]
%1 = trunc i64 %indvars.iv to i32
%rem6 = and i32 %1, 1
%cmp7 = icmp eq i32 %rem6, 0
%arrayidx = getelementptr inbounds [11 x i8], ptr %s, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
br i1 %cmp7, label %if.then9, label %if.else
if.then9: ; preds = %if.end
%cmp11.not = icmp eq i8 %2, 104
br i1 %cmp11.not, label %for.inc, label %for.end
if.else: ; preds = %if.end
%cmp18.not = icmp eq i8 %2, 105
br i1 %cmp18.not, label %for.inc, label %for.end
for.inc: ; preds = %if.then9, %if.else
%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.end29, label %if.end, !llvm.loop !8
for.end: ; preds = %if.then9, %if.else, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %1, %if.else ], [ %1, %if.then9 ]
%cmp23 = icmp eq i32 %i.0.lcssa, %conv
%spec.select = select i1 %cmp23, ptr @.str.1, ptr @.str.2
br label %if.end29
if.end29: ; preds = %for.inc, %for.end
%.str.2.sink = phi ptr [ %spec.select, %for.end ], [ @.str.1, %for.inc ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
call void @llvm.lifetime.end.p0(i64 11, 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n=0,y=0,sen=0,gosen=0,man=0;
scanf("%d %d",&n,&y);
for(sen=0;sen<=n;sen++){
for(gosen=0;gosen<=n;gosen++){
man=n-(sen+gosen);
if(sen*1000+gosen*5000+man*10000==y&&
sen+gosen+man==n&&man>=0){
printf("%d %d %d",man,gosen,sen); return 0; }
}
}
printf("-1 -1 -1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_125960/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_125960/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"-1 -1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
store i32 0, ptr %n, align 4, !tbaa !5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
store i32 0, ptr %y, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %y)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not40 = icmp slt i32 %0, 0
br i1 %cmp.not40, label %for.end17, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %y, align 4
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.cond1.for.inc15_crit_edge
%sen.041 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc16, %for.cond1.for.inc15_crit_edge ]
%mul = mul nuw nsw i32 %sen.041, 1000
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%gosen.039 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.inc ]
%2 = add nuw i32 %sen.041, %gosen.039
%sub = sub i32 %0, %2
%mul4 = mul nuw nsw i32 %gosen.039, 5000
%add5 = add nuw nsw i32 %mul4, %mul
%mul6 = mul nsw i32 %sub, 10000
%add7 = add nsw i32 %add5, %mul6
%cmp8 = icmp eq i32 %add7, %1
%cmp13 = icmp sgt i32 %sub, -1
%or.cond = and i1 %cmp13, %cmp8
br i1 %or.cond, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub, i32 noundef %gosen.039, i32 noundef %sen.041)
br label %cleanup
for.inc: ; preds = %for.body3
%inc = add nuw i32 %gosen.039, 1
%exitcond.not = icmp eq i32 %gosen.039, %0
br i1 %exitcond.not, label %for.cond1.for.inc15_crit_edge, label %for.body3, !llvm.loop !9
for.cond1.for.inc15_crit_edge: ; preds = %for.inc
%inc16 = add nuw i32 %sen.041, 1
%exitcond45.not = icmp eq i32 %sen.041, %0
br i1 %exitcond45.not, label %for.end17, label %for.cond1.preheader, !llvm.loop !11
for.end17: ; preds = %for.cond1.for.inc15_crit_edge, %entry
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup
cleanup: ; preds = %for.end17, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int n,i,k,drinks;
scanf("%d%d",&n,&k);
drinks=(n%2)?(n+1)/2:n/2;
int a[n],d[k];
memset(d,0,sizeof(d));
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
d[a[i]-1]++;
}
//for(i=0;i<k;i++)
// printf("%d\t",d[i]);
//printf("\n");
for(i=0;i<k && drinks;i++)
if(d[i]>=2)
{
drinks-=d[i]/2;
d[i]-=(d[i]/2)*2;
}
//for(i=0;i<k;i++)
//printf("%d\t",d[i]);
for(i=0;i<k && drinks;i++)
if(d[i]!=0)
{
drinks--;
d[i]--;
}
int ans=0;
for(i=0;i<k;i++)
{
if(d[i])
ans++;
}
printf("%d",n-ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12601/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12601/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #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
%1 = and i32 %0, 1
%cond.in = add i32 %1, %0
%cond = sdiv i32 %cond.in, 2
%2 = zext i32 %0 to i64
%3 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %2, align 16
%4 = load i32, ptr %k, align 4, !tbaa !5
%5 = zext i32 %4 to i64
%vla2 = alloca i32, i64 %5, align 16
%6 = shl nuw nsw i64 %5, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla2, i8 0, i64 %6, i1 false)
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp83 = icmp sgt i32 %7, 0
br i1 %cmp83, label %for.body, label %for.cond9.preheader
for.cond9.preheader.loopexit: ; preds = %for.body
%.pre = load i32, ptr %k, align 4, !tbaa !5
br label %for.cond9.preheader
for.cond9.preheader: ; preds = %for.cond9.preheader.loopexit, %entry
%8 = phi i32 [ %4, %entry ], [ %.pre, %for.cond9.preheader.loopexit ]
%.lcssa82 = phi i32 [ %7, %entry ], [ %14, %for.cond9.preheader.loopexit ]
%cmp1085 = icmp sgt i32 %8, 0
%9 = add i32 %cond.in, -2
%tobool1186 = icmp ult i32 %9, -3
%10 = select i1 %cmp1085, i1 %tobool1186, i1 false
br i1 %10, label %for.body12.preheader, label %for.cond29.preheader
for.body12.preheader: ; preds = %for.cond9.preheader
%11 = zext i32 %8 to i64
br label %for.body12
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
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%12 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub = add nsw i32 %12, -1
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom6
%13 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nsw i32 %13, 1
store i32 %inc, ptr %arrayidx7, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp = icmp slt i64 %indvars.iv.next, %15
br i1 %cmp, label %for.body, label %for.cond9.preheader.loopexit, !llvm.loop !9
for.cond29.preheader: ; preds = %for.inc26, %for.cond9.preheader
%drinks.0.lcssa = phi i32 [ %cond, %for.cond9.preheader ], [ %drinks.1, %for.inc26 ]
%tobool3292 = icmp ne i32 %drinks.0.lcssa, 0
%16 = select i1 %cmp1085, i1 %tobool3292, i1 false
br i1 %16, label %for.body34.preheader, label %for.cond46.preheader
for.body34.preheader: ; preds = %for.cond29.preheader
%17 = zext i32 %8 to i64
br label %for.body34
for.body12: ; preds = %for.body12.preheader, %for.inc26
%indvars.iv100 = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next101, %for.inc26 ]
%drinks.087 = phi i32 [ %cond, %for.body12.preheader ], [ %drinks.1, %for.inc26 ]
%arrayidx14 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv100
%18 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp sgt i32 %18, 1
br i1 %cmp15, label %if.then, label %for.inc26
if.then: ; preds = %for.body12
%div1881 = lshr i32 %18, 1
%sub19 = sub nsw i32 %drinks.087, %div1881
%sub25 = and i32 %18, 1
store i32 %sub25, ptr %arrayidx14, align 4, !tbaa !5
br label %for.inc26
for.inc26: ; preds = %for.body12, %if.then
%drinks.1 = phi i32 [ %sub19, %if.then ], [ %drinks.087, %for.body12 ]
%indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
%cmp10 = icmp ult i64 %indvars.iv.next101, %11
%tobool11 = icmp ne i32 %drinks.1, 0
%19 = select i1 %cmp10, i1 %tobool11, i1 false
br i1 %19, label %for.body12, label %for.cond29.preheader, !llvm.loop !11
for.cond46.preheader: ; preds = %for.inc43, %for.cond29.preheader
br i1 %cmp1085, label %for.body48.preheader, label %for.end57
for.body48.preheader: ; preds = %for.cond46.preheader
%wide.trip.count = zext i32 %8 to i64
%min.iters.check = icmp ult i32 %8, 8
br i1 %min.iters.check, label %for.body48.preheader111, label %vector.ph
vector.ph: ; preds = %for.body48.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
%vec.phi109 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %27, %vector.body ]
%20 = getelementptr inbounds i32, ptr %vla2, i64 %index
%wide.load = load <4 x i32>, ptr %20, align 16, !tbaa !5
%21 = getelementptr inbounds i32, ptr %20, i64 4
%wide.load110 = load <4 x i32>, ptr %21, align 16, !tbaa !5
%22 = icmp ne <4 x i32> %wide.load, zeroinitializer
%23 = icmp ne <4 x i32> %wide.load110, zeroinitializer
%24 = zext <4 x i1> %22 to <4 x i32>
%25 = zext <4 x i1> %23 to <4 x i32>
%26 = add <4 x i32> %vec.phi, %24
%27 = add <4 x i32> %vec.phi109, %25
%index.next = add nuw i64 %index, 8
%28 = icmp eq i64 %index.next, %n.vec
br i1 %28, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %27, %26
%29 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end57, label %for.body48.preheader111
for.body48.preheader111: ; preds = %for.body48.preheader, %middle.block
%indvars.iv106.ph = phi i64 [ 0, %for.body48.preheader ], [ %n.vec, %middle.block ]
%ans.097.ph = phi i32 [ 0, %for.body48.preheader ], [ %29, %middle.block ]
br label %for.body48
for.body34: ; preds = %for.body34.preheader, %for.inc43
%indvars.iv103 = phi i64 [ 0, %for.body34.preheader ], [ %indvars.iv.next104, %for.inc43 ]
%drinks.293 = phi i32 [ %drinks.0.lcssa, %for.body34.preheader ], [ %drinks.3, %for.inc43 ]
%arrayidx36 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv103
%30 = load i32, ptr %arrayidx36, align 4, !tbaa !5
%cmp37.not = icmp eq i32 %30, 0
br i1 %cmp37.not, label %for.inc43, label %if.then38
if.then38: ; preds = %for.body34
%dec = add nsw i32 %drinks.293, -1
%dec41 = add nsw i32 %30, -1
store i32 %dec41, ptr %arrayidx36, align 4, !tbaa !5
br label %for.inc43
for.inc43: ; preds = %for.body34, %if.then38
%drinks.3 = phi i32 [ %dec, %if.then38 ], [ %drinks.293, %for.body34 ]
%indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
%cmp30 = icmp ult i64 %indvars.iv.next104, %17
%tobool32 = icmp ne i32 %drinks.3, 0
%31 = select i1 %cmp30, i1 %tobool32, i1 false
br i1 %31, label %for.body34, label %for.cond46.preheader, !llvm.loop !15
for.body48: ; preds = %for.body48.preheader111, %for.body48
%indvars.iv106 = phi i64 [ %indvars.iv.next107, %for.body48 ], [ %indvars.iv106.ph, %for.body48.preheader111 ]
%ans.097 = phi i32 [ %spec.select, %for.body48 ], [ %ans.097.ph, %for.body48.preheader111 ]
%arrayidx50 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv106
%32 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%tobool51.not = icmp ne i32 %32, 0
%inc53 = zext i1 %tobool51.not to i32
%spec.select = add nuw nsw i32 %ans.097, %inc53
%indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
%exitcond.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count
br i1 %exitcond.not, label %for.end57, label %for.body48, !llvm.loop !16
for.end57: ; preds = %for.body48, %middle.block, %for.cond46.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond46.preheader ], [ %29, %middle.block ], [ %spec.select, %for.body48 ]
%sub58 = sub nsw i32 %.lcssa82, %ans.0.lcssa
%call59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub58)
call void @llvm.stackrestore.p0(ptr %3)
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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = 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}
!16 = distinct !{!16, !10, !14, !13}
|
#include <stdio.h>
int main(void) {
int n, sum, x;
scanf("%d %d", &n, &sum);
for (int i = 0; i <= n; i++)
{
x = n - i;
for (int j = 0; j <= n - i; j++)
{
if (i * 10000 + j * 5000 + x * 1000 == sum)
{
printf("%d %d %d", i, j, x);
return 0;
}
x--;
}
}
printf("-1 -1 -1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126053/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126053/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%d %d %d\00", align 1
@.str.2 = private unnamed_addr constant [9 x i8] c"-1 -1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%sum = 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 %sum) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %sum)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not38 = icmp slt i32 %0, 0
br i1 %cmp.not38, label %for.end15, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %sum, align 4
%2 = add nuw i32 %0, 1
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc11
%indvars.iv = phi i32 [ %2, %for.body.lr.ph ], [ %indvars.iv.next, %for.inc11 ]
%i.039 = phi i32 [ 0, %for.body.lr.ph ], [ %inc12, %for.inc11 ]
%sub = sub nsw i32 %0, %i.039
%cmp3.not35 = icmp slt i32 %sub, 0
br i1 %cmp3.not35, label %for.inc11, label %for.body5.lr.ph
for.body5.lr.ph: ; preds = %for.body
%mul = mul nsw i32 %i.039, 10000
br label %for.body5
for.body5: ; preds = %for.body5.lr.ph, %if.end
%j.037 = phi i32 [ 0, %for.body5.lr.ph ], [ %inc, %if.end ]
%x.036 = phi i32 [ %sub, %for.body5.lr.ph ], [ %dec, %if.end ]
%mul6 = mul nuw nsw i32 %j.037, 5000
%mul7 = mul nsw i32 %x.036, 1000
%add = add i32 %mul7, %mul
%add8 = add i32 %add, %mul6
%cmp9 = icmp eq i32 %add8, %1
br i1 %cmp9, label %cleanup13, label %if.end
if.end: ; preds = %for.body5
%dec = add nsw i32 %x.036, -1
%inc = add nuw i32 %j.037, 1
%exitcond.not = icmp eq i32 %inc, %indvars.iv
br i1 %exitcond.not, label %for.inc11, label %for.body5, !llvm.loop !9
for.inc11: ; preds = %if.end, %for.body
%inc12 = add nuw i32 %i.039, 1
%indvars.iv.next = add i32 %indvars.iv, -1
%exitcond43.not = icmp eq i32 %i.039, %0
br i1 %exitcond43.not, label %for.end15, label %for.body, !llvm.loop !11
cleanup13: ; preds = %for.body5
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.039, i32 noundef %j.037, i32 noundef %x.036)
br label %cleanup17
for.end15: ; preds = %for.inc11, %entry
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %cleanup17
cleanup17: ; preds = %cleanup13, %for.end15
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %sum) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(){
int N, Y, i, j, yen;
scanf("%d %d", &N, &Y);
for(i=0; i<=N; i++){
for(j=0; j+i<=N; j++){
yen = i*10000 + j*5000 + (N-i-j)*1000;
if(yen == Y){
printf("%d %d %d\n", i,j,N-i-j);
return 0;
}
}
}
printf("-1 -1 -1\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126097/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126097/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %d\0A\00", align 1
@str = private unnamed_addr constant [9 x i8] c"-1 -1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%Y = 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 %Y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %Y)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp.not36 = icmp slt i32 %0, 0
br i1 %cmp.not36, label %for.end15, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i32, ptr %Y, align 4, !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc13
%i.037 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc14, %for.inc13 ]
%mul = mul nuw nsw i32 %i.037, 10000
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%add35 = phi i32 [ %i.037, %for.cond1.preheader ], [ %add, %for.inc ]
%j.034 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.inc ]
%mul4 = mul nuw nsw i32 %j.034, 5000
%add5 = add nuw nsw i32 %mul4, %mul
%sub6 = sub i32 %0, %add35
%mul7 = mul nsw i32 %sub6, 1000
%add8 = add nsw i32 %add5, %mul7
%cmp9 = icmp eq i32 %add8, %1
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.037, i32 noundef %j.034, i32 noundef %sub6)
br label %cleanup
for.inc: ; preds = %for.body3
%inc = add nuw nsw i32 %j.034, 1
%add = add nuw nsw i32 %inc, %i.037
%cmp2.not = icmp sgt i32 %add, %0
br i1 %cmp2.not, label %for.inc13, label %for.body3, !llvm.loop !9
for.inc13: ; preds = %for.inc
%inc14 = add nuw i32 %i.037, 1
%exitcond.not = icmp eq i32 %i.037, %0
br i1 %exitcond.not, label %for.end15, label %for.cond1.preheader, !llvm.loop !11
for.end15: ; preds = %for.inc13, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %for.end15, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int hh,mm;
double degh,degm;
scanf("%d:%d",&hh,&mm);
degh=hh%12*30+0.5*mm;
degm=6*mm;
printf("%f %f\n",degh,degm);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12614/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12614/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"%f %f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%hh = alloca i32, align 4
%mm = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %hh) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %mm) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %hh, ptr noundef nonnull %mm)
%0 = load i32, ptr %hh, align 4, !tbaa !5
%rem = srem i32 %0, 12
%mul = mul nsw i32 %rem, 30
%conv = sitofp i32 %mul to double
%1 = load i32, ptr %mm, align 4, !tbaa !5
%conv1 = sitofp i32 %1 to double
%2 = call double @llvm.fmuladd.f64(double %conv1, double 5.000000e-01, double %conv)
%mul3 = mul nsw i32 %1, 6
%conv4 = sitofp i32 %mul3 to double
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %2, double noundef %conv4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %mm) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %hh) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(){
long n,i,j;
long y;
scanf("%ld %ld",&n,&y);
for(i=0;i<=n;i++){
for(j=0;i+j<=n;j++){
if(i*10000+j*5000+(n-i-j)*1000==y){
printf("%ld %ld %ld\n",i,j,n-i-j);
return 0;
}
}
}
printf("-1 -1 -1\n");
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126183/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126183/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [13 x i8] c"%ld %ld %ld\0A\00", align 1
@str = private unnamed_addr constant [9 x i8] c"-1 -1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%y = 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 %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %y)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not35 = icmp slt i64 %0, 0
br i1 %cmp.not35, label %for.end15, label %for.cond1.preheader.lr.ph
for.cond1.preheader.lr.ph: ; preds = %entry
%1 = load i64, ptr %y, align 8, !tbaa !5
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.lr.ph, %for.inc13
%i.036 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %inc14, %for.inc13 ]
%mul = mul nuw nsw i64 %i.036, 10000
br label %for.body3
for.body3: ; preds = %for.cond1.preheader, %for.inc
%add34 = phi i64 [ %i.036, %for.cond1.preheader ], [ %add, %for.inc ]
%j.033 = phi i64 [ 0, %for.cond1.preheader ], [ %inc, %for.inc ]
%mul4 = mul nuw nsw i64 %j.033, 5000
%add5 = add nuw nsw i64 %mul4, %mul
%sub6 = sub i64 %0, %add34
%mul7 = mul nsw i64 %sub6, 1000
%add8 = add nsw i64 %add5, %mul7
%cmp9 = icmp eq i64 %add8, %1
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body3
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %i.036, i64 noundef %j.033, i64 noundef %sub6)
br label %cleanup
for.inc: ; preds = %for.body3
%inc = add nuw nsw i64 %j.033, 1
%add = add nuw nsw i64 %inc, %i.036
%cmp2.not = icmp sgt i64 %add, %0
br i1 %cmp2.not, label %for.inc13, label %for.body3, !llvm.loop !9
for.inc13: ; preds = %for.inc
%inc14 = add nuw i64 %i.036, 1
%exitcond.not = icmp eq i64 %i.036, %0
br i1 %exitcond.not, label %for.end15, label %for.cond1.preheader, !llvm.loop !11
for.end15: ; preds = %for.inc13, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
cleanup: ; preds = %for.end15, %if.then
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void)
{
int n, y;
int a, b, c;
int flg = 0;
scanf("%d %d", &n, &y);
for (a = 0;a <= n && flg != 1;a++) {
for (b = 0;b <= n && flg != 1;b++) {
c = n - a - b;
if (-1 < c) {
if ((y == (10000 * a + 5000 * b + 1000 * c)) && n == (a + b + c)) {
printf("%d %d %d\n", a, b, c);
flg = 1;
break;
}
}
}
}
if (flg != 1) {
printf("-1 -1 -1\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126226/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126226/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [10 x i8] c"%d %d %d\0A\00", align 1
@str = private unnamed_addr constant [9 x i8] c"-1 -1 -1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%y = 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 %y) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %y)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp45 = icmp sgt i32 %0, -1
br i1 %cmp45, label %for.cond2.preheader.preheader, label %if.then24
for.cond2.preheader.preheader: ; preds = %entry
%1 = load i32, ptr %y, align 4
br label %for.body7.lr.ph
for.body7.lr.ph: ; preds = %for.inc20, %for.cond2.preheader.preheader
%a.046 = phi i32 [ %inc21, %for.inc20 ], [ 0, %for.cond2.preheader.preheader ]
%mul = mul nsw i32 %a.046, 10000
br label %for.body7
for.body7: ; preds = %for.body7.lr.ph, %for.inc
%b.044 = phi i32 [ 0, %for.body7.lr.ph ], [ %inc, %for.inc ]
%2 = add nuw i32 %a.046, %b.044
%sub8 = sub i32 %0, %2
%cmp9 = icmp sgt i32 %sub8, -1
br i1 %cmp9, label %if.then, label %for.inc
if.then: ; preds = %for.body7
%mul10 = mul nsw i32 %b.044, 5000
%add = add nuw nsw i32 %mul10, %mul
%mul11 = mul nsw i32 %sub8, 1000
%add12 = add nsw i32 %add, %mul11
%cmp13 = icmp eq i32 %1, %add12
br i1 %cmp13, label %for.end22, label %for.inc
for.inc: ; preds = %for.body7, %if.then
%inc = add nuw i32 %b.044, 1
%exitcond.not = icmp eq i32 %b.044, %0
br i1 %exitcond.not, label %for.inc20, label %for.body7, !llvm.loop !9
for.inc20: ; preds = %for.inc
%inc21 = add nuw nsw i32 %a.046, 1
%cmp = icmp slt i32 %a.046, %0
br i1 %cmp, label %for.body7.lr.ph, label %if.then24, !llvm.loop !11
for.end22: ; preds = %if.then
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.046, i32 noundef %b.044, i32 noundef %sub8)
br label %if.end26
if.then24: ; preds = %for.inc20, %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end26
if.end26: ; preds = %for.end22, %if.then24
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<stdlib.h>
#define MIN(a,b) ((a)<(b)?(a):(b))
#define POS(i,j) ((i)*(h+1)+(j))
void run(void){
int h,w;
scanf("%d%d",&h,&w);
char *s=(char *)calloc(h*w+1,sizeof(char));
int i,j,k;
for(i=0;i<h;i++) scanf("%s",s+i*w);
char *x=(char *)calloc(h,sizeof(char));
char *y=(char *)calloc(h,sizeof(char));
int *cost=(int *)calloc((h+1)*(h+1),sizeof(int));
int *dp=(int *)calloc((h+1)*(h+1),sizeof(int));
int ans=0;
for(i=0;i+1<w;i++){
for(j=0;j<h;j++){
x[j]=s[j*w+i];
y[j]=s[j*w+i+1];
}
for(j=1;j<=h;j++){
for(k=1;k<=h;k++){
cost[POS(j,k)]=cost[POS(j-1,k-1)]+(x[j-1]==y[k-1]?1:0);
dp[POS(j,k)]=MIN(dp[POS(j-1,k)],dp[POS(j,k-1)])+cost[POS(j,k)];
}
}
ans+=dp[POS(h,h)];
}
printf("%d\n",ans);
}
int main(void){
run();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126277/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126277/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @run() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%w = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %w) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %w)
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = load i32, ptr %w, align 4, !tbaa !5
%mul = mul nsw i32 %1, %0
%add = add nsw i32 %mul, 1
%conv = sext i32 %add to i64
%call1 = call noalias ptr @calloc(i64 noundef %conv, i64 noundef 1) #6
%cmp174 = icmp sgt i32 %0, 0
br i1 %cmp174, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.0175 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
%2 = load i32, ptr %w, align 4, !tbaa !5
%mul3 = mul nsw i32 %2, %i.0175
%idx.ext = sext i32 %mul3 to i64
%add.ptr = getelementptr inbounds i8, ptr %call1, i64 %idx.ext
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %add.ptr)
%inc = add nuw nsw i32 %i.0175, 1
%3 = load i32, ptr %h, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %3
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr %w, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%4 = phi i32 [ %1, %entry ], [ %.pre, %for.end.loopexit ]
%.lcssa = phi i32 [ %0, %entry ], [ %3, %for.end.loopexit ]
%conv5 = sext i32 %.lcssa to i64
%call6 = call noalias ptr @calloc(i64 noundef %conv5, i64 noundef 1) #6
%call8 = call noalias ptr @calloc(i64 noundef %conv5, i64 noundef 1) #6
%add9 = add nsw i32 %.lcssa, 1
%mul11 = mul nsw i32 %add9, %add9
%conv12 = zext i32 %mul11 to i64
%call13 = call noalias ptr @calloc(i64 noundef %conv12, i64 noundef 4) #6
%call18 = call noalias ptr @calloc(i64 noundef %conv12, i64 noundef 4) #6
%cmp21182 = icmp sgt i32 %4, 1
br i1 %cmp21182, label %for.cond24.preheader.lr.ph, label %for.end124
for.cond24.preheader.lr.ph: ; preds = %for.end
%cmp43.not180 = icmp slt i32 %.lcssa, 1
%5 = add i32 %.lcssa, 2
%add118 = mul i32 %5, %.lcssa
%idxprom119 = sext i32 %add118 to i64
%arrayidx120 = getelementptr inbounds i32, ptr %call18, i64 %idxprom119
br i1 %cmp43.not180, label %for.cond24.preheader.us.preheader, label %for.cond24.preheader.us187.preheader
for.cond24.preheader.us.preheader: ; preds = %for.cond24.preheader.lr.ph
%6 = load i32, ptr %arrayidx120, align 4, !tbaa !5
%7 = add nsw i32 %4, -1
%8 = mul i32 %6, %7
br label %for.end124
for.cond24.preheader.us187.preheader: ; preds = %for.cond24.preheader.lr.ph
%9 = zext i32 %4 to i64
%10 = zext i32 %add9 to i64
%11 = add nsw i32 %4, -1
%wide.trip.count266 = zext i32 %11 to i64
%wide.trip.count239 = zext i32 %.lcssa to i64
%invariant.gep = getelementptr i8, ptr %call1, i64 1
%wide.trip.count257 = zext i32 %add9 to i64
%12 = shl nuw nsw i64 %wide.trip.count257, 2
%13 = shl nuw nsw i64 %wide.trip.count257, 2
%min.iters.check = icmp ugt i32 %.lcssa, 7
%ident.check.not = icmp eq i32 %4, 1
%or.cond = and i1 %min.iters.check, %ident.check.not
%min.iters.check294 = icmp ult i32 %.lcssa, 32
%n.vec = and i64 %wide.trip.count239, 4294967264
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count239
%n.vec.remaining = and i64 %wide.trip.count239, 24
%min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
%n.vec299 = and i64 %wide.trip.count239, 4294967288
%cmp.n300 = icmp eq i64 %n.vec299, %wide.trip.count239
%xtraiter = and i64 %wide.trip.count239, 1
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
%14 = sub nsw i64 0, %wide.trip.count239
%15 = getelementptr i8, ptr %call18, i64 %12
br label %iter.check
iter.check: ; preds = %for.cond24.preheader.us187.preheader, %for.cond42.for.end115_crit_edge.split.us
%indvars.iv261 = phi i64 [ 0, %for.cond24.preheader.us187.preheader ], [ %indvars.iv.next262, %for.cond42.for.end115_crit_edge.split.us ]
%ans.0184.us189 = phi i32 [ 0, %for.cond24.preheader.us187.preheader ], [ %add121.us208, %for.cond42.for.end115_crit_edge.split.us ]
%indvars.iv.next262 = add nuw nsw i64 %indvars.iv261, 1
br i1 %or.cond, label %vector.main.loop.iter.check, label %for.body27.us191.preheader
vector.main.loop.iter.check: ; preds = %iter.check
br i1 %min.iters.check294, label %vec.epilog.ph, label %vector.body
vector.body: ; preds = %vector.main.loop.iter.check, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
%16 = mul nsw i64 %index, %9
%17 = add nuw nsw i64 %16, %indvars.iv261
%18 = getelementptr inbounds i8, ptr %call1, i64 %17
%wide.load = load <16 x i8>, ptr %18, align 1, !tbaa !11
%19 = getelementptr inbounds i8, ptr %18, i64 16
%wide.load295 = load <16 x i8>, ptr %19, align 1, !tbaa !11
%20 = getelementptr inbounds i8, ptr %call6, i64 %index
store <16 x i8> %wide.load, ptr %20, align 1, !tbaa !11
%21 = getelementptr inbounds i8, ptr %20, i64 16
store <16 x i8> %wide.load295, ptr %21, align 1, !tbaa !11
%22 = getelementptr i8, ptr %invariant.gep, i64 %17
%wide.load296 = load <16 x i8>, ptr %22, align 1, !tbaa !11
%23 = getelementptr i8, ptr %22, i64 16
%wide.load297 = load <16 x i8>, ptr %23, align 1, !tbaa !11
%24 = getelementptr inbounds i8, ptr %call8, i64 %index
store <16 x i8> %wide.load296, ptr %24, align 1, !tbaa !11
%25 = getelementptr inbounds i8, ptr %24, i64 16
store <16 x i8> %wide.load297, ptr %25, align 1, !tbaa !11
%index.next = add nuw i64 %index, 32
%26 = icmp eq i64 %index.next, %n.vec
br i1 %26, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond46.preheader.us.preheader, label %vec.epilog.iter.check
vec.epilog.iter.check: ; preds = %middle.block
br i1 %min.epilog.iters.check, label %for.body27.us191.preheader, label %vec.epilog.ph
vec.epilog.ph: ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
%vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
br label %vec.epilog.vector.body
vec.epilog.vector.body: ; preds = %vec.epilog.vector.body, %vec.epilog.ph
%index301 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next304, %vec.epilog.vector.body ]
%27 = mul nsw i64 %index301, %9
%28 = add nuw nsw i64 %27, %indvars.iv261
%29 = getelementptr inbounds i8, ptr %call1, i64 %28
%wide.load302 = load <8 x i8>, ptr %29, align 1, !tbaa !11
%30 = getelementptr inbounds i8, ptr %call6, i64 %index301
store <8 x i8> %wide.load302, ptr %30, align 1, !tbaa !11
%31 = getelementptr i8, ptr %invariant.gep, i64 %28
%wide.load303 = load <8 x i8>, ptr %31, align 1, !tbaa !11
%32 = getelementptr inbounds i8, ptr %call8, i64 %index301
store <8 x i8> %wide.load303, ptr %32, align 1, !tbaa !11
%index.next304 = add nuw i64 %index301, 8
%33 = icmp eq i64 %index.next304, %n.vec299
br i1 %33, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !15
vec.epilog.middle.block: ; preds = %vec.epilog.vector.body
br i1 %cmp.n300, label %for.cond46.preheader.us.preheader, label %for.body27.us191.preheader
for.body27.us191.preheader: ; preds = %iter.check, %vec.epilog.iter.check, %vec.epilog.middle.block
%indvars.iv233.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec299, %vec.epilog.middle.block ]
br i1 %lcmp.mod.not, label %for.body27.us191.prol.loopexit, label %for.body27.us191.prol
for.body27.us191.prol: ; preds = %for.body27.us191.preheader
%34 = mul nuw nsw i64 %indvars.iv233.ph, %9
%35 = add nuw nsw i64 %34, %indvars.iv261
%arrayidx.us196.prol = getelementptr inbounds i8, ptr %call1, i64 %35
%36 = load i8, ptr %arrayidx.us196.prol, align 1, !tbaa !11
%arrayidx31.us198.prol = getelementptr inbounds i8, ptr %call6, i64 %indvars.iv233.ph
store i8 %36, ptr %arrayidx31.us198.prol, align 1, !tbaa !11
%gep.prol = getelementptr i8, ptr %invariant.gep, i64 %35
%37 = load i8, ptr %gep.prol, align 1, !tbaa !11
%arrayidx38.us202.prol = getelementptr inbounds i8, ptr %call8, i64 %indvars.iv233.ph
store i8 %37, ptr %arrayidx38.us202.prol, align 1, !tbaa !11
%indvars.iv.next234.prol = or i64 %indvars.iv233.ph, 1
br label %for.body27.us191.prol.loopexit
for.body27.us191.prol.loopexit: ; preds = %for.body27.us191.prol, %for.body27.us191.preheader
%indvars.iv233.unr = phi i64 [ %indvars.iv233.ph, %for.body27.us191.preheader ], [ %indvars.iv.next234.prol, %for.body27.us191.prol ]
%38 = xor i64 %indvars.iv233.ph, %14
%39 = icmp eq i64 %38, -1
br i1 %39, label %for.cond46.preheader.us.preheader, label %for.body27.us191
for.body49.us: ; preds = %for.cond46.preheader.us, %for.body49.us
%store_forwarded = phi i32 [ %load_initial, %for.cond46.preheader.us ], [ %add104.us, %for.body49.us ]
%indvars.iv241 = phi i64 [ 1, %for.cond46.preheader.us ], [ %indvars.iv.next242, %for.body49.us ]
%40 = add nsw i64 %indvars.iv241, -1
%gep288 = getelementptr i32, ptr %invariant.gep287, i64 %40
%41 = load i32, ptr %gep288, align 4, !tbaa !5
%arrayidx62.us = getelementptr inbounds i8, ptr %call8, i64 %40
%42 = load i8, ptr %arrayidx62.us, align 1, !tbaa !11
%cmp64.us = icmp eq i8 %56, %42
%cond.us = zext i1 %cmp64.us to i32
%add66.us = add nsw i32 %41, %cond.us
%43 = add nuw nsw i64 %indvars.iv241, %57
%arrayidx71.us = getelementptr inbounds i32, ptr %call13, i64 %43
store i32 %add66.us, ptr %arrayidx71.us, align 4, !tbaa !5
%gep290 = getelementptr i32, ptr %invariant.gep289, i64 %indvars.iv241
%44 = load i32, ptr %gep290, align 4, !tbaa !5
%..us = call i32 @llvm.smin.i32(i32 %44, i32 %store_forwarded)
%add104.us = add nsw i32 %..us, %add66.us
%arrayidx109.us = getelementptr inbounds i32, ptr %call18, i64 %43
store i32 %add104.us, ptr %arrayidx109.us, align 4, !tbaa !5
%indvars.iv.next242 = add nuw nsw i64 %indvars.iv241, 1
%exitcond250.not = icmp eq i64 %indvars.iv.next242, %wide.trip.count257
br i1 %exitcond250.not, label %for.cond46.for.inc113_crit_edge.us, label %for.body49.us, !llvm.loop !16
for.body27.us191: ; preds = %for.body27.us191.prol.loopexit, %for.body27.us191
%indvars.iv233 = phi i64 [ %indvars.iv.next234.1, %for.body27.us191 ], [ %indvars.iv233.unr, %for.body27.us191.prol.loopexit ]
%45 = mul nsw i64 %indvars.iv233, %9
%46 = add nuw nsw i64 %45, %indvars.iv261
%arrayidx.us196 = getelementptr inbounds i8, ptr %call1, i64 %46
%47 = load i8, ptr %arrayidx.us196, align 1, !tbaa !11
%arrayidx31.us198 = getelementptr inbounds i8, ptr %call6, i64 %indvars.iv233
store i8 %47, ptr %arrayidx31.us198, align 1, !tbaa !11
%gep = getelementptr i8, ptr %invariant.gep, i64 %46
%48 = load i8, ptr %gep, align 1, !tbaa !11
%arrayidx38.us202 = getelementptr inbounds i8, ptr %call8, i64 %indvars.iv233
store i8 %48, ptr %arrayidx38.us202, align 1, !tbaa !11
%indvars.iv.next234 = add nuw nsw i64 %indvars.iv233, 1
%49 = mul nsw i64 %indvars.iv.next234, %9
%50 = add nuw nsw i64 %49, %indvars.iv261
%arrayidx.us196.1 = getelementptr inbounds i8, ptr %call1, i64 %50
%51 = load i8, ptr %arrayidx.us196.1, align 1, !tbaa !11
%arrayidx31.us198.1 = getelementptr inbounds i8, ptr %call6, i64 %indvars.iv.next234
store i8 %51, ptr %arrayidx31.us198.1, align 1, !tbaa !11
%gep.1 = getelementptr i8, ptr %invariant.gep, i64 %50
%52 = load i8, ptr %gep.1, align 1, !tbaa !11
%arrayidx38.us202.1 = getelementptr inbounds i8, ptr %call8, i64 %indvars.iv.next234
store i8 %52, ptr %arrayidx38.us202.1, align 1, !tbaa !11
%indvars.iv.next234.1 = add nuw nsw i64 %indvars.iv233, 2
%exitcond240.not.1 = icmp eq i64 %indvars.iv.next234.1, %wide.trip.count239
br i1 %exitcond240.not.1, label %for.cond46.preheader.us.preheader, label %for.body27.us191, !llvm.loop !17
for.cond46.preheader.us.preheader: ; preds = %for.body27.us191.prol.loopexit, %for.body27.us191, %vec.epilog.middle.block, %middle.block
br label %for.cond46.preheader.us
for.cond46.preheader.us: ; preds = %for.cond46.preheader.us.preheader, %for.cond46.for.inc113_crit_edge.us
%indvar = phi i64 [ %indvar.next, %for.cond46.for.inc113_crit_edge.us ], [ 0, %for.cond46.preheader.us.preheader ]
%indvars.iv251 = phi i64 [ %indvars.iv.next252, %for.cond46.for.inc113_crit_edge.us ], [ 1, %for.cond46.preheader.us.preheader ]
%53 = mul i64 %13, %indvar
%scevgep = getelementptr i8, ptr %15, i64 %53
%54 = add nsw i64 %indvars.iv251, -1
%55 = mul nsw i64 %54, %10
%arrayidx58.us = getelementptr inbounds i8, ptr %call6, i64 %54
%56 = load i8, ptr %arrayidx58.us, align 1, !tbaa !11
%57 = mul nsw i64 %indvars.iv251, %10
%invariant.gep287 = getelementptr i32, ptr %call13, i64 %55
%invariant.gep289 = getelementptr i32, ptr %call18, i64 %55
%load_initial = load i32, ptr %scevgep, align 4
br label %for.body49.us
for.cond46.for.inc113_crit_edge.us: ; preds = %for.body49.us
%indvars.iv.next252 = add nuw nsw i64 %indvars.iv251, 1
%exitcond258.not = icmp eq i64 %indvars.iv.next252, %wide.trip.count257
%indvar.next = add i64 %indvar, 1
br i1 %exitcond258.not, label %for.cond42.for.end115_crit_edge.split.us, label %for.cond46.preheader.us, !llvm.loop !18
for.cond42.for.end115_crit_edge.split.us: ; preds = %for.cond46.for.inc113_crit_edge.us
%58 = load i32, ptr %arrayidx120, align 4, !tbaa !5
%add121.us208 = add nsw i32 %58, %ans.0184.us189
%exitcond267.not = icmp eq i64 %indvars.iv.next262, %wide.trip.count266
br i1 %exitcond267.not, label %for.end124, label %iter.check, !llvm.loop !19
for.end124: ; preds = %for.cond42.for.end115_crit_edge.split.us, %for.cond24.preheader.us.preheader, %for.end
%ans.0.lcssa = phi i32 [ 0, %for.end ], [ %8, %for.cond24.preheader.us.preheader ], [ %add121.us208, %for.cond42.for.end115_crit_edge.split.us ]
%call125 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %w) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #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 @__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 uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
tail call void @run()
ret i32 0
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10, !13, !14}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !13}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
|
#include<stdio.h>
long long ans[ 100 + 1 - 2 ][ 20 + 1 ] ;
int main()
{
int n ;
scanf( "%d" ,&n ) ;
int kale[ 100 ] ;
int i ,j ,pp ,mp ;
for( i = 0 ; i < n ; ++i )
{
scanf( "%d" ,&kale[ i ] ) ;
}
ans[ 0 ][ kale[ 0 ] ] = 1 ;
for( i = 0 ; i < n - 2 ; ++i )
{
for( j = 0 ; j <= 20 ; ++j )
{
if( ans[ i ][ j ] > 0 )
{
pp = j + kale[ i + 1 ] ;
mp = j - kale[ i + 1 ] ;
if( pp < 21 )
ans[ i + 1 ][ pp ] += ans[ i ][ j ] ;
if( mp >= 0 )
ans[ i + 1 ][ mp ] += ans[ i ][ j ] ;
}
}
}
printf( "%lld\n" ,ans[ i ][ kale[ n - 1 ] ] ) ;
return 0 ;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126327/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126327/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@ans = dso_local local_unnamed_addr global [99 x [21 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
%kale = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %kale) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp83 = icmp sgt i32 %0, 0
br i1 %cmp83, label %for.body, label %for.end.thread
for.end.thread: ; preds = %entry
store i64 1, ptr @ans, align 16, !tbaa !9
br label %for.end54
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %kale, 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 !11
for.end: ; preds = %for.body
%.pre = load i32, ptr %kale, align 16, !tbaa !5
%3 = sext i32 %.pre to i64
%arrayidx4 = getelementptr inbounds [21 x i64], ptr @ans, i64 0, i64 %3
store i64 1, ptr %arrayidx4, align 8, !tbaa !9
%sub = add i32 %1, -2
%cmp686 = icmp sgt i32 %1, 2
br i1 %cmp686, label %for.cond8.preheader.preheader, label %for.end54
for.cond8.preheader.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %sub to i64
br label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.cond8.preheader.preheader, %for.inc52
%indvars.iv94 = phi i64 [ 0, %for.cond8.preheader.preheader ], [ %indvars.iv.next95, %for.inc52 ]
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%arrayidx17 = getelementptr inbounds [100 x i32], ptr %kale, i64 0, i64 %indvars.iv.next95
br label %for.body10
for.body10: ; preds = %for.cond8.preheader, %for.inc49
%indvars.iv91 = phi i64 [ 0, %for.cond8.preheader ], [ %indvars.iv.next92, %for.inc49 ]
%arrayidx14 = getelementptr inbounds [99 x [21 x i64]], ptr @ans, i64 0, i64 %indvars.iv94, i64 %indvars.iv91
%4 = load i64, ptr %arrayidx14, align 8, !tbaa !9
%cmp15 = icmp sgt i64 %4, 0
br i1 %cmp15, label %if.then, label %for.inc49
if.then: ; preds = %for.body10
%5 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%6 = trunc i64 %indvars.iv91 to i32
%add18 = add nsw i32 %5, %6
%sub22 = sub nsw i32 %6, %5
%cmp23 = icmp slt i32 %add18, 21
br i1 %cmp23, label %if.then24, label %if.end
if.then24: ; preds = %if.then
%idxprom32 = sext i32 %add18 to i64
%arrayidx33 = getelementptr inbounds [99 x [21 x i64]], ptr @ans, i64 0, i64 %indvars.iv.next95, i64 %idxprom32
%7 = load i64, ptr %arrayidx33, align 8, !tbaa !9
%add34 = add nsw i64 %7, %4
store i64 %add34, ptr %arrayidx33, align 8, !tbaa !9
br label %if.end
if.end: ; preds = %if.then24, %if.then
%cmp35 = icmp sgt i32 %sub22, -1
br i1 %cmp35, label %if.then36, label %for.inc49
if.then36: ; preds = %if.end
%8 = load i64, ptr %arrayidx14, align 8, !tbaa !9
%idxprom44 = zext i32 %sub22 to i64
%arrayidx45 = getelementptr inbounds [99 x [21 x i64]], ptr @ans, i64 0, i64 %indvars.iv.next95, i64 %idxprom44
%9 = load i64, ptr %arrayidx45, align 8, !tbaa !9
%add46 = add nsw i64 %9, %8
store i64 %add46, ptr %arrayidx45, align 8, !tbaa !9
br label %for.inc49
for.inc49: ; preds = %for.body10, %if.then36, %if.end
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond.not = icmp eq i64 %indvars.iv.next92, 21
br i1 %exitcond.not, label %for.inc52, label %for.body10, !llvm.loop !13
for.inc52: ; preds = %for.inc49
%exitcond97.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count
br i1 %exitcond97.not, label %for.end54.loopexit, label %for.cond8.preheader, !llvm.loop !14
for.end54.loopexit: ; preds = %for.inc52
%10 = zext i32 %sub to i64
br label %for.end54
for.end54: ; preds = %for.end, %for.end.thread, %for.end54.loopexit
%.lcssa103 = phi i32 [ %1, %for.end54.loopexit ], [ %0, %for.end.thread ], [ %1, %for.end ]
%i.1.lcssa = phi i64 [ %10, %for.end54.loopexit ], [ 0, %for.end.thread ], [ 0, %for.end ]
%sub57 = add nsw i32 %.lcssa103, -1
%idxprom58 = sext i32 %sub57 to i64
%arrayidx59 = getelementptr inbounds [100 x i32], ptr %kale, i64 0, i64 %idxprom58
%11 = load i32, ptr %arrayidx59, align 4, !tbaa !5
%idxprom60 = sext i32 %11 to i64
%arrayidx61 = getelementptr inbounds [99 x [21 x i64]], ptr @ans, i64 0, i64 %i.1.lcssa, i64 %idxprom60
%12 = load i64, ptr %arrayidx61, align 8, !tbaa !9
%call62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %12)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %kale) #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 = !{!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}
|
#include<stdio.h>
#include<stdlib.h>
int gcd(int a, int b){
int r=1;
while(r!=0){
r=a%b;
a=b;
b=r;
}
return a;
}
int main(){
int sum=0;
int K;
scanf("%d",&K);
for(int i=1;i<=K;i++){
for(int j=1;j<=K;j++){
for(int k=1;k<=K;k++){
sum+=gcd(k,gcd(i,j));
}
}
}
printf("%d",sum);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126442/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126442/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %while.body
while.body: ; preds = %entry, %while.body
%b.addr.05 = phi i32 [ %b, %entry ], [ %rem, %while.body ]
%a.addr.04 = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
%rem = srem i32 %a.addr.04, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body
ret i32 %b.addr.05
}
; 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:
%K = alloca i32, align 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 %K)
%0 = load i32, ptr %K, align 4, !tbaa !7
%cmp.not38 = icmp slt i32 %0, 1
br i1 %cmp.not38, label %for.cond.cleanup, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.for.cond.cleanup3_crit_edge.split
%i.040 = phi i32 [ %inc15, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 1, %entry ]
%sum.039 = phi i32 [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 0, %entry ]
br label %for.cond5.preheader
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.split, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
ret i32 0
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond5.for.cond.cleanup7_crit_edge
%j.036 = phi i32 [ 1, %for.cond1.preheader ], [ %inc12, %for.cond5.for.cond.cleanup7_crit_edge ]
%sum.135 = phi i32 [ %sum.039, %for.cond1.preheader ], [ %add, %for.cond5.for.cond.cleanup7_crit_edge ]
br label %while.body.i.preheader
for.cond1.for.cond.cleanup3_crit_edge.split: ; preds = %for.cond5.for.cond.cleanup7_crit_edge
%inc15 = add nuw i32 %i.040, 1
%exitcond43.not = icmp eq i32 %i.040, %0
br i1 %exitcond43.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !11
while.body.i.preheader: ; preds = %for.cond5.preheader, %gcd.exit30
%k.033 = phi i32 [ 1, %for.cond5.preheader ], [ %inc, %gcd.exit30 ]
%sum.232 = phi i32 [ %sum.135, %for.cond5.preheader ], [ %add, %gcd.exit30 ]
br label %while.body.i
for.cond5.for.cond.cleanup7_crit_edge: ; preds = %gcd.exit30
%inc12 = add nuw i32 %j.036, 1
%exitcond42.not = icmp eq i32 %j.036, %0
br i1 %exitcond42.not, label %for.cond1.for.cond.cleanup3_crit_edge.split, label %for.cond5.preheader, !llvm.loop !12
while.body.i: ; preds = %while.body.i.preheader, %while.body.i
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %j.036, %while.body.i.preheader ]
%a.addr.04.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %i.040, %while.body.i.preheader ]
%rem.i = srem i32 %a.addr.04.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %while.body.i25, label %while.body.i, !llvm.loop !5
while.body.i25: ; preds = %while.body.i, %while.body.i25
%b.addr.05.i26 = phi i32 [ %rem.i28, %while.body.i25 ], [ %b.addr.05.i, %while.body.i ]
%a.addr.04.i27 = phi i32 [ %b.addr.05.i26, %while.body.i25 ], [ %k.033, %while.body.i ]
%rem.i28 = srem i32 %a.addr.04.i27, %b.addr.05.i26
%cmp.not.i29 = icmp eq i32 %rem.i28, 0
br i1 %cmp.not.i29, label %gcd.exit30, label %while.body.i25, !llvm.loop !5
gcd.exit30: ; preds = %while.body.i25
%add = add nsw i32 %b.addr.05.i26, %sum.232
%inc = add nuw i32 %k.033, 1
%exitcond.not = icmp eq i32 %k.033, %0
br i1 %exitcond.not, label %for.cond5.for.cond.cleanup7_crit_edge, label %while.body.i.preheader, !llvm.loop !13
}
; 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>
int gcd2(int,int);
int gcd3(int,int,int);
int main(){
int K;
int count = 0;
scanf("%d",&K);
for(int i=1;i<=K;i++){
for(int j=1;j<=K;j++){
for(int k=1;k<=K;k++){
count += gcd3(i,j,k);
}
}
}
printf("%d",count);
return 0;
}
int gcd2(int a,int b){
int temp;
if(a<b){
temp = a;
a = b;
b = temp;
}
while(b>0){
temp = b;
b = a%b;
a = temp;
}
return a;
}
int gcd3(int a,int b,int c){
int d;
d = gcd2(b,c);
d = gcd2(a,d);
return d;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126486/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126486/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%0 = load i32, ptr %K, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %for.cond.cleanup, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.for.cond.cleanup3_crit_edge.split
%i.033 = phi i32 [ %inc14, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 1, %entry ]
%count.032 = phi i32 [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 0, %entry ]
br label %for.cond5.preheader
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.split, %entry
%count.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #5
ret i32 0
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond5.for.cond.cleanup7_crit_edge
%j.029 = phi i32 [ 1, %for.cond1.preheader ], [ %inc11, %for.cond5.for.cond.cleanup7_crit_edge ]
%count.128 = phi i32 [ %count.032, %for.cond1.preheader ], [ %add, %for.cond5.for.cond.cleanup7_crit_edge ]
br label %for.body8
for.cond1.for.cond.cleanup3_crit_edge.split: ; preds = %for.cond5.for.cond.cleanup7_crit_edge
%inc14 = add nuw i32 %i.033, 1
%exitcond36.not = icmp eq i32 %i.033, %0
br i1 %exitcond36.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !9
for.cond5.for.cond.cleanup7_crit_edge: ; preds = %gcd3.exit
%inc11 = add nuw i32 %j.029, 1
%exitcond35.not = icmp eq i32 %j.029, %0
br i1 %exitcond35.not, label %for.cond1.for.cond.cleanup3_crit_edge.split, label %for.cond5.preheader, !llvm.loop !11
for.body8: ; preds = %for.cond5.preheader, %gcd3.exit
%k.026 = phi i32 [ 1, %for.cond5.preheader ], [ %inc, %gcd3.exit ]
%count.225 = phi i32 [ %count.128, %for.cond5.preheader ], [ %add, %gcd3.exit ]
%spec.select.i.i = call i32 @llvm.smax.i32(i32 %j.029, i32 %k.026)
%spec.select10.i.i = call i32 @llvm.smin.i32(i32 %j.029, i32 %k.026)
br label %while.body.i.i
while.body.i.i: ; preds = %while.body.i.i, %for.body8
%b.addr.113.i.i = phi i32 [ %rem.i.i, %while.body.i.i ], [ %spec.select10.i.i, %for.body8 ]
%a.addr.112.i.i = phi i32 [ %b.addr.113.i.i, %while.body.i.i ], [ %spec.select.i.i, %for.body8 ]
%rem.i.i = srem i32 %a.addr.112.i.i, %b.addr.113.i.i
%cmp1.i.i = icmp sgt i32 %rem.i.i, 0
br i1 %cmp1.i.i, label %while.body.i.i, label %gcd2.exit.i, !llvm.loop !12
gcd2.exit.i: ; preds = %while.body.i.i
%spec.select.i3.i = call i32 @llvm.smax.i32(i32 %i.033, i32 %b.addr.113.i.i)
%cmp111.i5.i = icmp sgt i32 %b.addr.113.i.i, 0
br i1 %cmp111.i5.i, label %while.body.i7.i.preheader, label %gcd3.exit
while.body.i7.i.preheader: ; preds = %gcd2.exit.i
%spec.select10.i4.i = call i32 @llvm.smin.i32(i32 %i.033, i32 %b.addr.113.i.i)
br label %while.body.i7.i
while.body.i7.i: ; preds = %while.body.i7.i.preheader, %while.body.i7.i
%b.addr.113.i8.i = phi i32 [ %rem.i10.i, %while.body.i7.i ], [ %spec.select10.i4.i, %while.body.i7.i.preheader ]
%a.addr.112.i9.i = phi i32 [ %b.addr.113.i8.i, %while.body.i7.i ], [ %spec.select.i3.i, %while.body.i7.i.preheader ]
%rem.i10.i = srem i32 %a.addr.112.i9.i, %b.addr.113.i8.i
%cmp1.i11.i = icmp sgt i32 %rem.i10.i, 0
br i1 %cmp1.i11.i, label %while.body.i7.i, label %gcd3.exit, !llvm.loop !12
gcd3.exit: ; preds = %while.body.i7.i, %gcd2.exit.i
%a.addr.1.lcssa.i6.i = phi i32 [ %spec.select.i3.i, %gcd2.exit.i ], [ %b.addr.113.i8.i, %while.body.i7.i ]
%add = add nsw i32 %a.addr.1.lcssa.i6.i, %count.225
%inc = add nuw i32 %k.026, 1
%exitcond.not = icmp eq i32 %k.026, %0
br i1 %exitcond.not, label %for.cond5.for.cond.cleanup7_crit_edge, label %for.body8, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd3(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #3 {
entry:
%spec.select.i = tail call i32 @llvm.smax.i32(i32 %b, i32 %c)
%spec.select10.i = tail call i32 @llvm.smin.i32(i32 %b, i32 %c)
%cmp111.i = icmp sgt i32 %spec.select10.i, 0
br i1 %cmp111.i, label %while.body.i, label %gcd2.exit
while.body.i: ; preds = %entry, %while.body.i
%b.addr.113.i = phi i32 [ %rem.i, %while.body.i ], [ %spec.select10.i, %entry ]
%a.addr.112.i = phi i32 [ %b.addr.113.i, %while.body.i ], [ %spec.select.i, %entry ]
%rem.i = srem i32 %a.addr.112.i, %b.addr.113.i
%cmp1.i = icmp sgt i32 %rem.i, 0
br i1 %cmp1.i, label %while.body.i, label %gcd2.exit, !llvm.loop !12
gcd2.exit: ; preds = %while.body.i, %entry
%a.addr.1.lcssa.i = phi i32 [ %spec.select.i, %entry ], [ %b.addr.113.i, %while.body.i ]
%spec.select.i3 = tail call i32 @llvm.smax.i32(i32 %a, i32 %a.addr.1.lcssa.i)
%spec.select10.i4 = tail call i32 @llvm.smin.i32(i32 %a, i32 %a.addr.1.lcssa.i)
%cmp111.i5 = icmp sgt i32 %spec.select10.i4, 0
br i1 %cmp111.i5, label %while.body.i7, label %gcd2.exit12
while.body.i7: ; preds = %gcd2.exit, %while.body.i7
%b.addr.113.i8 = phi i32 [ %rem.i10, %while.body.i7 ], [ %spec.select10.i4, %gcd2.exit ]
%a.addr.112.i9 = phi i32 [ %b.addr.113.i8, %while.body.i7 ], [ %spec.select.i3, %gcd2.exit ]
%rem.i10 = srem i32 %a.addr.112.i9, %b.addr.113.i8
%cmp1.i11 = icmp sgt i32 %rem.i10, 0
br i1 %cmp1.i11, label %while.body.i7, label %gcd2.exit12, !llvm.loop !12
gcd2.exit12: ; preds = %while.body.i7, %gcd2.exit
%a.addr.1.lcssa.i6 = phi i32 [ %spec.select.i3, %gcd2.exit ], [ %b.addr.113.i8, %while.body.i7 ]
ret i32 %a.addr.1.lcssa.i6
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd2(i32 noundef %a, i32 noundef %b) local_unnamed_addr #3 {
entry:
%spec.select = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%spec.select10 = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%cmp111 = icmp sgt i32 %spec.select10, 0
br i1 %cmp111, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%b.addr.113 = phi i32 [ %rem, %while.body ], [ %spec.select10, %entry ]
%a.addr.112 = phi i32 [ %b.addr.113, %while.body ], [ %spec.select, %entry ]
%rem = srem i32 %a.addr.112, %b.addr.113
%cmp1 = icmp sgt i32 %rem, 0
br i1 %cmp1, label %while.body, label %while.end, !llvm.loop !12
while.end: ; preds = %while.body, %entry
%a.addr.1.lcssa = phi i32 [ %spec.select, %entry ], [ %b.addr.113, %while.body ]
ret i32 %a.addr.1.lcssa
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
int gcd(int a, int b){
int tmp;
if(a < b){
tmp = a;
a = b;
b = tmp;
}
if(a%b == 0){
return b;
}else{
return gcd(b,a%b);
}
}
int main(){
int N;
long int sum = 0;
int i, j, k, tmp;
scanf("%d",&N);
for(i = 1; i <= N; i++){
for(j = 1; j <= N; j++){
for(k = 1; k <= N; k++){
tmp = gcd(i,j);
sum += gcd(tmp,k);
}
}
}
printf("%ld\n",sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126529/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126529/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %tailrecurse, %entry
%a.tr = phi i32 [ %a, %entry ], [ %spec.select12, %tailrecurse ]
%b.tr = phi i32 [ %b, %entry ], [ %rem, %tailrecurse ]
%spec.select = tail call i32 @llvm.smax.i32(i32 %a.tr, i32 %b.tr)
%spec.select12 = tail call i32 @llvm.smin.i32(i32 %a.tr, i32 %b.tr)
%rem = srem i32 %spec.select, %spec.select12
%cmp1 = icmp eq i32 %rem, 0
br i1 %cmp1, label %cleanup, label %tailrecurse
cleanup: ; preds = %tailrecurse
ret i32 %spec.select12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
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
%cmp.not38 = icmp slt i32 %0, 1
br i1 %cmp.not38, label %for.end14, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.for.inc12_crit_edge.split
%sum.040 = phi i64 [ %add, %for.cond1.for.inc12_crit_edge.split ], [ 0, %entry ]
%i.039 = phi i32 [ %inc13, %for.cond1.for.inc12_crit_edge.split ], [ 1, %entry ]
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond1.preheader, %for.cond4.for.inc9_crit_edge
%sum.136 = phi i64 [ %sum.040, %for.cond1.preheader ], [ %add, %for.cond4.for.inc9_crit_edge ]
%j.035 = phi i32 [ 1, %for.cond1.preheader ], [ %inc10, %for.cond4.for.inc9_crit_edge ]
br label %tailrecurse.i.preheader
tailrecurse.i.preheader: ; preds = %for.cond4.preheader, %gcd.exit30
%sum.233 = phi i64 [ %sum.136, %for.cond4.preheader ], [ %add, %gcd.exit30 ]
%k.032 = phi i32 [ 1, %for.cond4.preheader ], [ %inc, %gcd.exit30 ]
br label %tailrecurse.i
tailrecurse.i: ; preds = %tailrecurse.i.preheader, %tailrecurse.i
%a.tr.i = phi i32 [ %spec.select12.i, %tailrecurse.i ], [ %i.039, %tailrecurse.i.preheader ]
%b.tr.i = phi i32 [ %rem.i, %tailrecurse.i ], [ %j.035, %tailrecurse.i.preheader ]
%spec.select.i = call i32 @llvm.smax.i32(i32 %a.tr.i, i32 %b.tr.i)
%spec.select12.i = call i32 @llvm.smin.i32(i32 %a.tr.i, i32 %b.tr.i)
%rem.i = srem i32 %spec.select.i, %spec.select12.i
%cmp1.i = icmp eq i32 %rem.i, 0
br i1 %cmp1.i, label %tailrecurse.i23, label %tailrecurse.i
tailrecurse.i23: ; preds = %tailrecurse.i, %tailrecurse.i23
%a.tr.i24 = phi i32 [ %spec.select12.i27, %tailrecurse.i23 ], [ %spec.select12.i, %tailrecurse.i ]
%b.tr.i25 = phi i32 [ %rem.i28, %tailrecurse.i23 ], [ %k.032, %tailrecurse.i ]
%spec.select.i26 = call i32 @llvm.smax.i32(i32 %a.tr.i24, i32 %b.tr.i25)
%spec.select12.i27 = call i32 @llvm.smin.i32(i32 %a.tr.i24, i32 %b.tr.i25)
%rem.i28 = srem i32 %spec.select.i26, %spec.select12.i27
%cmp1.i29 = icmp eq i32 %rem.i28, 0
br i1 %cmp1.i29, label %gcd.exit30, label %tailrecurse.i23
gcd.exit30: ; preds = %tailrecurse.i23
%conv = sext i32 %spec.select12.i27 to i64
%add = add nsw i64 %sum.233, %conv
%inc = add nuw i32 %k.032, 1
%exitcond.not = icmp eq i32 %k.032, %0
br i1 %exitcond.not, label %for.cond4.for.inc9_crit_edge, label %tailrecurse.i.preheader, !llvm.loop !9
for.cond4.for.inc9_crit_edge: ; preds = %gcd.exit30
%inc10 = add nuw i32 %j.035, 1
%exitcond42.not = icmp eq i32 %j.035, %0
br i1 %exitcond42.not, label %for.cond1.for.inc12_crit_edge.split, label %for.cond4.preheader, !llvm.loop !11
for.cond1.for.inc12_crit_edge.split: ; preds = %for.cond4.for.inc9_crit_edge
%inc13 = add nuw i32 %i.039, 1
%exitcond43.not = icmp eq i32 %i.039, %0
br i1 %exitcond43.not, label %for.end14, label %for.cond1.preheader, !llvm.loop !12
for.end14: ; preds = %for.cond1.for.inc12_crit_edge.split, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.cond1.for.inc12_crit_edge.split ]
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!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>
#include <float.h>
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define i_cout(X) printf("%d\n",X)
#define f_cout(X) printf("%g\n",X)
#define i_cout2(X,Y) printf("%d %d\n",X,Y)
#define l_cout(X) printf("%ld\n",X)
#define s_cout(X) printf("%s\n",X)
#define ll_cout(X) printf("%lld\n",X)
typedef long long int lli;
#define rept(x, s, n) for (int x = s; x < n; x++)
#define Yes_RTN s_cout("Yes");return 0
#define No_RTN s_cout("No");return 0
#define YES_RTN s_cout("YES");return 0
#define NO_RTN s_cout("NO");return 0
int i_cins(int n, int* A);
int l_cins2(int n, long* A,long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);
int gcd(int a, int b, int c);
int main(void) {
int N;
long long a,b,c,tmp = 0;
int s,l;
i_cin(N);
for (a = 1; a < N+1; a++) {
for (b = 1; b < N+1; b++) {
for (c = 1; c < N+1; c++) {
tmp += (long long)gcd(a, b, c);
}
}
}
ll_cout(tmp); return 0;
}
int gcd(int a, int b, int c) {
int r,tmp;
if (a < b) { tmp = a; a = b; b = tmp; }
r = a % b;
while (r) {
if (!r) break;
a = b; b = r;
r = a % b;
}
if (c < b) { tmp = c; c = b; b = tmp; }
r = c % b;
while (r) {
if (!r) break;
c = b; b = r;
r = c % b;
}
return(b);
}
int s_dsort(const void* a, const void* b) {
return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
return(*(int*)a -*(int*)b);
}
int l_cins2(int n, long* a, long* b) {
int i;
rept(i, 0, n) {
l_cin2(*(a + i), *(b + i));
}
return 0;
}
int i_cins(int n, int* a) {
int i;
rept(i, 0, n) {
i_cin(*(a + i));
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126587/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126587/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@.str.2 = private unnamed_addr constant [8 x i8] c"%ld %ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp67 = icmp sgt i32 %0, 0
br i1 %cmp67, label %for.cond2.preheader.us.preheader, label %for.end25
for.cond2.preheader.us.preheader: ; preds = %entry
%add = add nuw i32 %0, 1
%1 = call i32 @llvm.smax.i32(i32 %add, i32 2)
%smax = zext i32 %1 to i64
br label %for.cond2.preheader.us
for.cond2.preheader.us: ; preds = %for.cond2.preheader.us.preheader, %for.cond2.for.inc23_crit_edge.split.us.us
%a.069.us = phi i64 [ %inc24.us, %for.cond2.for.inc23_crit_edge.split.us.us ], [ 1, %for.cond2.preheader.us.preheader ]
%tmp.068.us = phi i64 [ %.us-phi.us.us, %for.cond2.for.inc23_crit_edge.split.us.us ], [ 0, %for.cond2.preheader.us.preheader ]
%conv14.us = trunc i64 %a.069.us to i32
br label %for.cond8.preheader.us.us
for.cond8.preheader.us.us: ; preds = %for.cond8.for.inc20_crit_edge.us.us, %for.cond2.preheader.us
%b.039.us.us = phi i64 [ 1, %for.cond2.preheader.us ], [ %inc21.us.us, %for.cond8.for.inc20_crit_edge.us.us ]
%tmp.138.us.us = phi i64 [ %tmp.068.us, %for.cond2.preheader.us ], [ %.us-phi.us.us, %for.cond8.for.inc20_crit_edge.us.us ]
%conv15.us.us = trunc i64 %b.039.us.us to i32
%spec.select.i.us.us = call i32 @llvm.smax.i32(i32 %conv14.us, i32 %conv15.us.us)
%spec.select40.i.us.us = call i32 @llvm.smin.i32(i32 %conv14.us, i32 %conv15.us.us)
%rem.i.us.us = srem i32 %spec.select.i.us.us, %spec.select40.i.us.us
%tobool.not43.i.us.us = icmp eq i32 %rem.i.us.us, 0
br i1 %tobool.not43.i.us.us, label %for.body13.us.us.us, label %for.body13.us41.us
for.body13.us41.us: ; preds = %for.cond8.preheader.us.us, %gcd.exit.us50.us
%tmp.236.us42.us = phi i64 [ %add19.us53.us, %gcd.exit.us50.us ], [ %tmp.138.us.us, %for.cond8.preheader.us.us ]
%c.035.us43.us = phi i64 [ %inc.us54.us, %gcd.exit.us50.us ], [ 1, %for.cond8.preheader.us.us ]
br label %if.end3.i.us.us
if.end3.i.us.us: ; preds = %if.end3.i.us.us, %for.body13.us41.us
%r.045.i.us.us = phi i32 [ %rem4.i.us.us, %if.end3.i.us.us ], [ %rem.i.us.us, %for.body13.us41.us ]
%b.addr.144.i.us.us = phi i32 [ %r.045.i.us.us, %if.end3.i.us.us ], [ %spec.select40.i.us.us, %for.body13.us41.us ]
%rem4.i.us.us = srem i32 %b.addr.144.i.us.us, %r.045.i.us.us
%tobool.not.i.us.us = icmp eq i32 %rem4.i.us.us, 0
br i1 %tobool.not.i.us.us, label %while.end.i.loopexit.us.us, label %if.end3.i.us.us, !llvm.loop !9
if.end14.i.us45.us: ; preds = %while.end.i.loopexit.us.us, %if.end14.i.us45.us
%r.148.i.us46.us = phi i32 [ %rem15.i.us48.us, %if.end14.i.us45.us ], [ %rem8.i.us61.us, %while.end.i.loopexit.us.us ]
%b.addr.347.i.us47.us = phi i32 [ %r.148.i.us46.us, %if.end14.i.us45.us ], [ %spec.select41.i.us59.us, %while.end.i.loopexit.us.us ]
%rem15.i.us48.us = srem i32 %b.addr.347.i.us47.us, %r.148.i.us46.us
%tobool10.not.i.us49.us = icmp eq i32 %rem15.i.us48.us, 0
br i1 %tobool10.not.i.us49.us, label %gcd.exit.us50.us, label %if.end14.i.us45.us, !llvm.loop !11
gcd.exit.us50.us: ; preds = %if.end14.i.us45.us, %while.end.i.loopexit.us.us
%b.addr.3.lcssa.i.us51.us = phi i32 [ %spec.select41.i.us59.us, %while.end.i.loopexit.us.us ], [ %r.148.i.us46.us, %if.end14.i.us45.us ]
%conv18.us52.us = sext i32 %b.addr.3.lcssa.i.us51.us to i64
%add19.us53.us = add nsw i64 %tmp.236.us42.us, %conv18.us52.us
%inc.us54.us = add nuw nsw i64 %c.035.us43.us, 1
%exitcond.not = icmp eq i64 %inc.us54.us, %smax
br i1 %exitcond.not, label %for.cond8.for.inc20_crit_edge.us.us, label %for.body13.us41.us, !llvm.loop !12
while.end.i.loopexit.us.us: ; preds = %if.end3.i.us.us
%conv16.us44.us = trunc i64 %c.035.us43.us to i32
%spec.select41.i.us59.us = call i32 @llvm.smin.i32(i32 %r.045.i.us.us, i32 %conv16.us44.us)
%spec.select42.i.us60.us = call i32 @llvm.smax.i32(i32 %r.045.i.us.us, i32 %conv16.us44.us)
%rem8.i.us61.us = srem i32 %spec.select42.i.us60.us, %spec.select41.i.us59.us
%tobool10.not46.i.us62.us = icmp eq i32 %rem8.i.us61.us, 0
br i1 %tobool10.not46.i.us62.us, label %gcd.exit.us50.us, label %if.end14.i.us45.us
for.cond8.for.inc20_crit_edge.us.us: ; preds = %gcd.exit.us50.us, %gcd.exit.us.us.us
%.us-phi.us.us = phi i64 [ %add19.us.us.us, %gcd.exit.us.us.us ], [ %add19.us53.us, %gcd.exit.us50.us ]
%inc21.us.us = add nuw nsw i64 %b.039.us.us, 1
%exitcond74.not = icmp eq i64 %inc21.us.us, %smax
br i1 %exitcond74.not, label %for.cond2.for.inc23_crit_edge.split.us.us, label %for.cond8.preheader.us.us, !llvm.loop !13
for.body13.us.us.us: ; preds = %for.cond8.preheader.us.us, %gcd.exit.us.us.us
%tmp.236.us.us.us = phi i64 [ %add19.us.us.us, %gcd.exit.us.us.us ], [ %tmp.138.us.us, %for.cond8.preheader.us.us ]
%c.035.us.us.us = phi i64 [ %inc.us.us.us, %gcd.exit.us.us.us ], [ 1, %for.cond8.preheader.us.us ]
%conv16.us.us.us = trunc i64 %c.035.us.us.us to i32
%spec.select41.i.us.us.us = call i32 @llvm.smin.i32(i32 %spec.select40.i.us.us, i32 %conv16.us.us.us)
%spec.select42.i.us.us.us = call i32 @llvm.smax.i32(i32 %spec.select40.i.us.us, i32 %conv16.us.us.us)
%rem8.i.us.us.us = srem i32 %spec.select42.i.us.us.us, %spec.select41.i.us.us.us
%tobool10.not46.i.us.us.us = icmp eq i32 %rem8.i.us.us.us, 0
br i1 %tobool10.not46.i.us.us.us, label %gcd.exit.us.us.us, label %if.end14.i.us.us.us
if.end14.i.us.us.us: ; preds = %for.body13.us.us.us, %if.end14.i.us.us.us
%r.148.i.us.us.us = phi i32 [ %rem15.i.us.us.us, %if.end14.i.us.us.us ], [ %rem8.i.us.us.us, %for.body13.us.us.us ]
%b.addr.347.i.us.us.us = phi i32 [ %r.148.i.us.us.us, %if.end14.i.us.us.us ], [ %spec.select41.i.us.us.us, %for.body13.us.us.us ]
%rem15.i.us.us.us = srem i32 %b.addr.347.i.us.us.us, %r.148.i.us.us.us
%tobool10.not.i.us.us.us = icmp eq i32 %rem15.i.us.us.us, 0
br i1 %tobool10.not.i.us.us.us, label %gcd.exit.us.us.us, label %if.end14.i.us.us.us, !llvm.loop !11
gcd.exit.us.us.us: ; preds = %if.end14.i.us.us.us, %for.body13.us.us.us
%b.addr.3.lcssa.i.us.us.us = phi i32 [ %spec.select41.i.us.us.us, %for.body13.us.us.us ], [ %r.148.i.us.us.us, %if.end14.i.us.us.us ]
%conv18.us.us.us = sext i32 %b.addr.3.lcssa.i.us.us.us to i64
%add19.us.us.us = add nsw i64 %tmp.236.us.us.us, %conv18.us.us.us
%inc.us.us.us = add nuw nsw i64 %c.035.us.us.us, 1
%exitcond72.not = icmp eq i64 %inc.us.us.us, %smax
br i1 %exitcond72.not, label %for.cond8.for.inc20_crit_edge.us.us, label %for.body13.us.us.us, !llvm.loop !12
for.cond2.for.inc23_crit_edge.split.us.us: ; preds = %for.cond8.for.inc20_crit_edge.us.us
%inc24.us = add nuw nsw i64 %a.069.us, 1
%exitcond75.not = icmp eq i64 %inc24.us, %smax
br i1 %exitcond75.not, label %for.end25, label %for.cond2.preheader.us, !llvm.loop !14
for.end25: ; preds = %for.cond2.for.inc23_crit_edge.split.us.us, %entry
%tmp.0.lcssa = phi i64 [ 0, %entry ], [ %.us-phi.us.us, %for.cond2.for.inc23_crit_edge.split.us.us ]
%call26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %tmp.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b, i32 noundef %c) local_unnamed_addr #3 {
entry:
%spec.select = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
%spec.select40 = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
%rem = srem i32 %spec.select, %spec.select40
%tobool.not43 = icmp eq i32 %rem, 0
br i1 %tobool.not43, label %while.end, label %if.end3
if.end3: ; preds = %entry, %if.end3
%r.045 = phi i32 [ %rem4, %if.end3 ], [ %rem, %entry ]
%b.addr.144 = phi i32 [ %r.045, %if.end3 ], [ %spec.select40, %entry ]
%rem4 = srem i32 %b.addr.144, %r.045
%tobool.not = icmp eq i32 %rem4, 0
br i1 %tobool.not, label %while.end, label %if.end3, !llvm.loop !9
while.end: ; preds = %if.end3, %entry
%b.addr.1.lcssa = phi i32 [ %spec.select40, %entry ], [ %r.045, %if.end3 ]
%spec.select41 = tail call i32 @llvm.smin.i32(i32 %b.addr.1.lcssa, i32 %c)
%spec.select42 = tail call i32 @llvm.smax.i32(i32 %b.addr.1.lcssa, i32 %c)
%rem8 = srem i32 %spec.select42, %spec.select41
%tobool10.not46 = icmp eq i32 %rem8, 0
br i1 %tobool10.not46, label %while.end16, label %if.end14
if.end14: ; preds = %while.end, %if.end14
%r.148 = phi i32 [ %rem15, %if.end14 ], [ %rem8, %while.end ]
%b.addr.347 = phi i32 [ %r.148, %if.end14 ], [ %spec.select41, %while.end ]
%rem15 = srem i32 %b.addr.347, %r.148
%tobool10.not = icmp eq i32 %rem15, 0
br i1 %tobool10.not, label %while.end16, label %if.end14, !llvm.loop !11
while.end16: ; preds = %if.end14, %while.end
%b.addr.3.lcssa = phi i32 [ %spec.select41, %while.end ], [ %r.148, %if.end14 ]
ret i32 %b.addr.3.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_dsort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @s_asort(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #4 {
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 @l_cins2(i32 noundef %n, ptr noundef %a, ptr noundef %b) local_unnamed_addr #0 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i64, ptr %a, i64 %indvars.iv
%add.ptr3 = getelementptr inbounds i64, ptr %b, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef %add.ptr, ptr noundef %add.ptr3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !15
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @i_cins(i32 noundef %n, ptr noundef %a) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %n, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
br label %for.body
for.cond.cleanup: ; preds = %for.body, %entry
ret i32 0
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !16
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
|
#include <stdio.h>
int gcd(int i,int j,int k)
{
int min;
if(i<j)
min=i;
else
min=j;
if(k<min)
min=k;
for(int cnt=min;cnt>0;cnt--)
{
if (i%cnt==0 && j%cnt==0 && k%cnt==0)
return (cnt);
}
return(0);
}
int main()
{
int num;
long ans=0;
scanf("%d",&num);
for(int i=1;i<=num;i++)
{
for(int j=1;j<=num;j++)
{
for(int k=1;k<=num;k++)
{
ans+=gcd(i,j,k);
}
}
}
printf("%lu",ans);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126637/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126637/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lu\00", align 1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %i, i32 noundef %j, i32 noundef %k) local_unnamed_addr #0 {
entry:
%i.j = tail call i32 @llvm.smin.i32(i32 %i, i32 %j)
%min.1 = tail call i32 @llvm.smin.i32(i32 %i.j, i32 %k)
%cmp426 = icmp slt i32 %min.1, 1
br i1 %cmp426, label %cleanup, label %for.body
for.body: ; preds = %entry, %for.inc
%cnt.027 = phi i32 [ %dec, %for.inc ], [ %min.1, %entry ]
%rem = srem i32 %i, %cnt.027
%cmp5 = icmp eq i32 %rem, 0
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%rem6 = srem i32 %j, %cnt.027
%cmp7 = icmp eq i32 %rem6, 0
br i1 %cmp7, label %land.lhs.true8, label %for.inc
land.lhs.true8: ; preds = %land.lhs.true
%rem9 = srem i32 %k, %cnt.027
%cmp10 = icmp eq i32 %rem9, 0
br i1 %cmp10, label %cleanup, label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %land.lhs.true8
%dec = add nsw i32 %cnt.027, -1
%cmp4 = icmp slt i32 %cnt.027, 2
br i1 %cmp4, label %cleanup, label %for.body, !llvm.loop !5
cleanup: ; preds = %for.inc, %land.lhs.true8, %entry
%spec.select = phi i32 [ 0, %entry ], [ %cnt.027, %land.lhs.true8 ], [ 0, %for.inc ]
ret i32 %spec.select
}
; 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:
%num = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i32, ptr %num, align 4, !tbaa !7
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %for.cond.cleanup, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.for.cond.cleanup3_crit_edge.split
%i.033 = phi i32 [ %inc14, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 1, %entry ]
%ans.032 = phi i64 [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 0, %entry ]
br label %for.cond5.preheader
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.split, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ]
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #5
ret i32 0
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond5.for.cond.cleanup7_crit_edge
%j.029 = phi i32 [ 1, %for.cond1.preheader ], [ %inc11, %for.cond5.for.cond.cleanup7_crit_edge ]
%ans.128 = phi i64 [ %ans.032, %for.cond1.preheader ], [ %add, %for.cond5.for.cond.cleanup7_crit_edge ]
%i.j.i = call i32 @llvm.smin.i32(i32 %i.033, i32 %j.029)
br label %for.body8
for.cond1.for.cond.cleanup3_crit_edge.split: ; preds = %for.cond5.for.cond.cleanup7_crit_edge
%inc14 = add nuw i32 %i.033, 1
%exitcond36.not = icmp eq i32 %i.033, %0
br i1 %exitcond36.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !11
for.cond5.for.cond.cleanup7_crit_edge: ; preds = %gcd.exit
%inc11 = add nuw i32 %j.029, 1
%exitcond35.not = icmp eq i32 %j.029, %0
br i1 %exitcond35.not, label %for.cond1.for.cond.cleanup3_crit_edge.split, label %for.cond5.preheader, !llvm.loop !12
for.body8: ; preds = %for.cond5.preheader, %gcd.exit
%k.026 = phi i32 [ 1, %for.cond5.preheader ], [ %inc, %gcd.exit ]
%ans.225 = phi i64 [ %ans.128, %for.cond5.preheader ], [ %add, %gcd.exit ]
%min.1.i = call i32 @llvm.smin.i32(i32 %i.j.i, i32 %k.026)
br label %for.body.i
for.body.i: ; preds = %for.body8, %for.inc.i
%cnt.027.i = phi i32 [ %dec.i, %for.inc.i ], [ %min.1.i, %for.body8 ]
%rem.i = srem i32 %i.033, %cnt.027.i
%cmp5.i = icmp eq i32 %rem.i, 0
br i1 %cmp5.i, label %land.lhs.true.i, label %for.inc.i
land.lhs.true.i: ; preds = %for.body.i
%rem6.i = srem i32 %j.029, %cnt.027.i
%cmp7.i = icmp eq i32 %rem6.i, 0
br i1 %cmp7.i, label %land.lhs.true8.i, label %for.inc.i
land.lhs.true8.i: ; preds = %land.lhs.true.i
%rem9.i = srem i32 %k.026, %cnt.027.i
%cmp10.i = icmp eq i32 %rem9.i, 0
br i1 %cmp10.i, label %gcd.exit, label %for.inc.i
for.inc.i: ; preds = %land.lhs.true8.i, %land.lhs.true.i, %for.body.i
%dec.i = add nsw i32 %cnt.027.i, -1
%cmp4.i = icmp slt i32 %cnt.027.i, 2
br i1 %cmp4.i, label %gcd.exit, label %for.body.i, !llvm.loop !5
gcd.exit: ; preds = %land.lhs.true8.i, %for.inc.i
%spec.select.i = phi i32 [ %cnt.027.i, %land.lhs.true8.i ], [ 0, %for.inc.i ]
%conv = zext i32 %spec.select.i to i64
%add = add nsw i64 %ans.225, %conv
%inc = add nuw i32 %k.026, 1
%exitcond.not = icmp eq i32 %k.026, %0
br i1 %exitcond.not, label %for.cond5.for.cond.cleanup7_crit_edge, label %for.body8, !llvm.loop !13
}
; 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.smin.i32(i32, i32) #4
attributes #0 = { nofree nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!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>
int main(void) {
int K;
long sum = 0;
int min;
int tmp;
scanf("%d", &K);
for(int a = 1; a <= K; a++) {
for(int b = 1; b <= K; b++) {
for(int c = 1; c <= K; c++) {
min = a;
if( min > b ) min = b;
if( min > c ) min = c;
for(int i = 1; i <= min; i++) {
if( (a % i) != 0 ) continue;
if( (b % i) != 0 ) continue;
if( (c % i) != 0 ) continue;
tmp = i;
}
sum += tmp;
}
}
}
printf("%ld\n", sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126680/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126680/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%K = alloca i32, align 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 %K)
%0 = load i32, ptr %K, align 4, !tbaa !5
%cmp.not74 = icmp slt i32 %0, 1
br i1 %cmp.not74, label %for.cond.cleanup, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.cond1.for.cond.cleanup3_crit_edge.split
%a.077 = phi i32 [ %inc35, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 1, %entry ]
%tmp.076 = phi i32 [ %tmp.4, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ undef, %entry ]
%sum.075 = phi i64 [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 0, %entry ]
br label %for.cond5.preheader
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.split, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ]
%call37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
ret i32 0
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond5.for.cond.cleanup7_crit_edge
%b.070 = phi i32 [ 1, %for.cond1.preheader ], [ %inc32, %for.cond5.for.cond.cleanup7_crit_edge ]
%tmp.169 = phi i32 [ %tmp.076, %for.cond1.preheader ], [ %tmp.4, %for.cond5.for.cond.cleanup7_crit_edge ]
%sum.168 = phi i64 [ %sum.075, %for.cond1.preheader ], [ %add, %for.cond5.for.cond.cleanup7_crit_edge ]
%umin = call i32 @llvm.umin.i32(i32 %a.077, i32 %b.070)
br label %for.body16.preheader
for.cond1.for.cond.cleanup3_crit_edge.split: ; preds = %for.cond5.for.cond.cleanup7_crit_edge
%inc35 = add nuw i32 %a.077, 1
%exitcond82.not = icmp eq i32 %a.077, %0
br i1 %exitcond82.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !9
for.cond5.for.cond.cleanup7_crit_edge: ; preds = %for.cond.cleanup15
%inc32 = add nuw i32 %b.070, 1
%exitcond81.not = icmp eq i32 %b.070, %0
br i1 %exitcond81.not, label %for.cond1.for.cond.cleanup3_crit_edge.split, label %for.cond5.preheader, !llvm.loop !11
for.body16.preheader: ; preds = %for.cond.cleanup15, %for.cond5.preheader
%c.064 = phi i32 [ 1, %for.cond5.preheader ], [ %inc29, %for.cond.cleanup15 ]
%tmp.263 = phi i32 [ %tmp.169, %for.cond5.preheader ], [ %tmp.4, %for.cond.cleanup15 ]
%sum.262 = phi i64 [ %sum.168, %for.cond5.preheader ], [ %add, %for.cond.cleanup15 ]
%umin79 = call i32 @llvm.umin.i32(i32 %umin, i32 %c.064)
br label %for.body16
for.cond.cleanup15: ; preds = %for.inc
%conv = sext i32 %tmp.4 to i64
%add = add nsw i64 %sum.262, %conv
%inc29 = add nuw i32 %c.064, 1
%exitcond80.not = icmp eq i32 %c.064, %0
br i1 %exitcond80.not, label %for.cond5.for.cond.cleanup7_crit_edge, label %for.body16.preheader, !llvm.loop !12
for.body16: ; preds = %for.body16.preheader, %for.inc
%i.060 = phi i32 [ %inc, %for.inc ], [ 1, %for.body16.preheader ]
%tmp.359 = phi i32 [ %tmp.4, %for.inc ], [ %tmp.263, %for.body16.preheader ]
%rem = urem i32 %a.077, %i.060
%cmp17.not = icmp eq i32 %rem, 0
br i1 %cmp17.not, label %if.end19, label %for.inc
if.end19: ; preds = %for.body16
%rem20 = urem i32 %b.070, %i.060
%cmp21.not = icmp eq i32 %rem20, 0
br i1 %cmp21.not, label %if.end23, label %for.inc
if.end23: ; preds = %if.end19
%rem24 = urem i32 %c.064, %i.060
%cmp25.not = icmp eq i32 %rem24, 0
%spec.select57 = select i1 %cmp25.not, i32 %i.060, i32 %tmp.359
br label %for.inc
for.inc: ; preds = %if.end23, %if.end19, %for.body16
%tmp.4 = phi i32 [ %tmp.359, %for.body16 ], [ %tmp.359, %if.end19 ], [ %spec.select57, %if.end23 ]
%inc = add nuw i32 %i.060, 1
%exitcond.not = icmp eq i32 %i.060, %umin79
br i1 %exitcond.not, label %for.cond.cleanup15, label %for.body16, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ll long long int
ll gcd2(ll a,ll b){
if(b==1){
return 1;}
if(a==1){
return 1;}
if(a%b==0){
return b;}
if(b%a==0){
return a;}
return gcd2(b,a%b);
}
ll gcd3(ll a,ll b,ll c){
return gcd2(a,gcd2(b,c));
}
int kumi(int i,int j,int k){
if(i==j && j==k) return 1;
if(i==j || j==k || k==i) return 3;
return 6;
}
int main(){
ll n;
scanf("%lld",&n);
ll ans=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
for(int k=1;k<=j;k++){
ans += gcd3(i,j,k)*kumi(i,j,k);
//printf("%d %d %d %lld\n",i,j,k,ans);
}}}
printf("%lld\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126723/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126723/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd2(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
br label %tailrecurse
tailrecurse: ; preds = %if.end6, %entry
%a.tr = phi i64 [ %a, %entry ], [ %b.tr, %if.end6 ]
%b.tr = phi i64 [ %b, %entry ], [ %rem, %if.end6 ]
%cmp = icmp eq i64 %b.tr, 1
%cmp1 = icmp eq i64 %a.tr, 1
%or.cond = or i1 %cmp1, %cmp
br i1 %or.cond, label %return, label %if.end3
if.end3: ; preds = %tailrecurse
%rem = srem i64 %a.tr, %b.tr
%cmp4 = icmp eq i64 %rem, 0
br i1 %cmp4, label %return, label %if.end6
if.end6: ; preds = %if.end3
%rem7 = srem i64 %b.tr, %a.tr
%cmp8 = icmp eq i64 %rem7, 0
br i1 %cmp8, label %return, label %tailrecurse
return: ; preds = %if.end6, %if.end3, %tailrecurse
%retval.0 = phi i64 [ 1, %tailrecurse ], [ %b.tr, %if.end3 ], [ %a.tr, %if.end6 ]
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd3(i64 noundef %a, i64 noundef %b, i64 noundef %c) local_unnamed_addr #0 {
entry:
br label %tailrecurse.i
tailrecurse.i: ; preds = %if.end6.i, %entry
%a.tr.i = phi i64 [ %b, %entry ], [ %b.tr.i, %if.end6.i ]
%b.tr.i = phi i64 [ %c, %entry ], [ %rem.i, %if.end6.i ]
%cmp.i = icmp eq i64 %b.tr.i, 1
%cmp1.i = icmp eq i64 %a.tr.i, 1
%or.cond.i = or i1 %cmp1.i, %cmp.i
br i1 %or.cond.i, label %tailrecurse.i2.preheader, label %if.end3.i
if.end3.i: ; preds = %tailrecurse.i
%rem.i = srem i64 %a.tr.i, %b.tr.i
%cmp4.i = icmp eq i64 %rem.i, 0
br i1 %cmp4.i, label %tailrecurse.i2.preheader, label %if.end6.i
if.end6.i: ; preds = %if.end3.i
%rem7.i = srem i64 %b.tr.i, %a.tr.i
%cmp8.i = icmp eq i64 %rem7.i, 0
br i1 %cmp8.i, label %tailrecurse.i2.preheader, label %tailrecurse.i
tailrecurse.i2.preheader: ; preds = %tailrecurse.i, %if.end3.i, %if.end6.i
%b.tr.i4.ph = phi i64 [ %a.tr.i, %if.end6.i ], [ %b.tr.i, %if.end3.i ], [ 1, %tailrecurse.i ]
br label %tailrecurse.i2
tailrecurse.i2: ; preds = %tailrecurse.i2.preheader, %if.end6.i11
%a.tr.i3 = phi i64 [ %b.tr.i4, %if.end6.i11 ], [ %a, %tailrecurse.i2.preheader ]
%b.tr.i4 = phi i64 [ %rem.i9, %if.end6.i11 ], [ %b.tr.i4.ph, %tailrecurse.i2.preheader ]
%cmp.i5 = icmp eq i64 %b.tr.i4, 1
%cmp1.i6 = icmp eq i64 %a.tr.i3, 1
%or.cond.i7 = or i1 %cmp1.i6, %cmp.i5
br i1 %or.cond.i7, label %gcd2.exit15, label %if.end3.i8
if.end3.i8: ; preds = %tailrecurse.i2
%rem.i9 = srem i64 %a.tr.i3, %b.tr.i4
%cmp4.i10 = icmp eq i64 %rem.i9, 0
br i1 %cmp4.i10, label %gcd2.exit15, label %if.end6.i11
if.end6.i11: ; preds = %if.end3.i8
%rem7.i12 = srem i64 %b.tr.i4, %a.tr.i3
%cmp8.i13 = icmp eq i64 %rem7.i12, 0
br i1 %cmp8.i13, label %gcd2.exit15, label %tailrecurse.i2
gcd2.exit15: ; preds = %tailrecurse.i2, %if.end3.i8, %if.end6.i11
%retval.0.i14 = phi i64 [ 1, %tailrecurse.i2 ], [ %b.tr.i4, %if.end3.i8 ], [ %a.tr.i3, %if.end6.i11 ]
ret i64 %retval.0.i14
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @kumi(i32 noundef %i, i32 noundef %j, i32 noundef %k) local_unnamed_addr #1 {
entry:
%cmp = icmp eq i32 %i, %j
%cmp1 = icmp eq i32 %j, %k
%or.cond = and i1 %cmp, %cmp1
%cmp5 = icmp eq i32 %k, %i
%0 = or i1 %cmp1, %cmp5
%or.cond16 = or i1 %cmp, %0
%spec.select = select i1 %or.cond16, i32 3, i32 6
%retval.0 = select i1 %or.cond, i32 1, i32 %spec.select
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not41 = icmp slt i64 %0, 1
br i1 %cmp.not41, label %for.cond.cleanup, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.cond.cleanup5
%indvars.iv67 = phi i64 [ %indvars.iv.next68, %for.cond.cleanup5 ], [ 1, %entry ]
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.cond.cleanup5 ], [ 2, %entry ]
%ans.042 = phi i64 [ %.us-phi, %for.cond.cleanup5 ], [ 0, %entry ]
br label %for.cond7.preheader
for.cond.cleanup: ; preds = %for.cond.cleanup5, %entry
%ans.0.lcssa = phi i64 [ 0, %entry ], [ %.us-phi, %for.cond.cleanup5 ]
%call24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #5
ret i32 0
for.cond7.preheader: ; preds = %for.cond2.preheader, %for.cond.cleanup10
%indvars.iv56 = phi i64 [ 1, %for.cond2.preheader ], [ %indvars.iv.next57, %for.cond.cleanup10 ]
%indvars.iv54 = phi i64 [ 2, %for.cond2.preheader ], [ %indvars.iv.next55, %for.cond.cleanup10 ]
%ans.139 = phi i64 [ %ans.042, %for.cond2.preheader ], [ %.us-phi, %for.cond.cleanup10 ]
%cmp.i = icmp eq i64 %indvars.iv67, %indvars.iv56
%cmp.i.fr = freeze i1 %cmp.i
br i1 %cmp.i.fr, label %for.body11.us, label %for.body11
for.body11.us: ; preds = %for.cond7.preheader, %gcd3.exit.us
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %gcd3.exit.us ], [ 1, %for.cond7.preheader ]
%ans.237.us = phi i64 [ %add.us, %gcd3.exit.us ], [ %ans.139, %for.cond7.preheader ]
br label %tailrecurse.i.i.us
tailrecurse.i.i.us: ; preds = %if.end6.i.i.us, %for.body11.us
%a.tr.i.i.us = phi i64 [ %indvars.iv56, %for.body11.us ], [ %b.tr.i.i.us, %if.end6.i.i.us ]
%b.tr.i.i.us = phi i64 [ %indvars.iv49, %for.body11.us ], [ %rem.i.i.us, %if.end6.i.i.us ]
%cmp.i.i.us = icmp eq i64 %b.tr.i.i.us, 1
%cmp1.i.i.us = icmp eq i64 %a.tr.i.i.us, 1
%or.cond.i.i.us = or i1 %cmp1.i.i.us, %cmp.i.i.us
br i1 %or.cond.i.i.us, label %tailrecurse.i2.i.us.preheader, label %if.end3.i.i.us
if.end3.i.i.us: ; preds = %tailrecurse.i.i.us
%rem.i.i.us = srem i64 %a.tr.i.i.us, %b.tr.i.i.us
%cmp4.i.i.us = icmp eq i64 %rem.i.i.us, 0
br i1 %cmp4.i.i.us, label %tailrecurse.i2.i.us.preheader, label %if.end6.i.i.us
if.end6.i.i.us: ; preds = %if.end3.i.i.us
%rem7.i.i.us = srem i64 %b.tr.i.i.us, %a.tr.i.i.us
%cmp8.i.i.us = icmp eq i64 %rem7.i.i.us, 0
br i1 %cmp8.i.i.us, label %tailrecurse.i2.i.us.preheader, label %tailrecurse.i.i.us
tailrecurse.i2.i.us.preheader: ; preds = %if.end6.i.i.us, %if.end3.i.i.us, %tailrecurse.i.i.us
%b.tr.i4.i.us.ph = phi i64 [ 1, %tailrecurse.i.i.us ], [ %b.tr.i.i.us, %if.end3.i.i.us ], [ %a.tr.i.i.us, %if.end6.i.i.us ]
br label %tailrecurse.i2.i.us
tailrecurse.i2.i.us: ; preds = %tailrecurse.i2.i.us.preheader, %if.end6.i11.i.us
%a.tr.i3.i.us = phi i64 [ %b.tr.i4.i.us, %if.end6.i11.i.us ], [ %indvars.iv67, %tailrecurse.i2.i.us.preheader ]
%b.tr.i4.i.us = phi i64 [ %rem.i9.i.us, %if.end6.i11.i.us ], [ %b.tr.i4.i.us.ph, %tailrecurse.i2.i.us.preheader ]
%cmp.i5.i.us = icmp eq i64 %b.tr.i4.i.us, 1
%cmp1.i6.i.us = icmp eq i64 %a.tr.i3.i.us, 1
%or.cond.i7.i.us = or i1 %cmp1.i6.i.us, %cmp.i5.i.us
br i1 %or.cond.i7.i.us, label %gcd3.exit.us, label %if.end3.i8.i.us
if.end3.i8.i.us: ; preds = %tailrecurse.i2.i.us
%rem.i9.i.us = srem i64 %a.tr.i3.i.us, %b.tr.i4.i.us
%cmp4.i10.i.us = icmp eq i64 %rem.i9.i.us, 0
br i1 %cmp4.i10.i.us, label %gcd3.exit.us, label %if.end6.i11.i.us
if.end6.i11.i.us: ; preds = %if.end3.i8.i.us
%rem7.i12.i.us = srem i64 %b.tr.i4.i.us, %a.tr.i3.i.us
%cmp8.i13.i.us = icmp eq i64 %rem7.i12.i.us, 0
br i1 %cmp8.i13.i.us, label %gcd3.exit.us, label %tailrecurse.i2.i.us
gcd3.exit.us: ; preds = %if.end6.i11.i.us, %if.end3.i8.i.us, %tailrecurse.i2.i.us
%retval.0.i14.i.us = phi i64 [ 1, %tailrecurse.i2.i.us ], [ %b.tr.i4.i.us, %if.end3.i8.i.us ], [ %a.tr.i3.i.us, %if.end6.i11.i.us ]
%cmp1.i.us = icmp eq i64 %indvars.iv56, %indvars.iv49
%conv17.us = select i1 %cmp1.i.us, i64 1, i64 3
%mul.us = mul nsw i64 %retval.0.i14.i.us, %conv17.us
%add.us = add nsw i64 %mul.us, %ans.237.us
%indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
%exitcond53.not = icmp eq i64 %indvars.iv.next50, %indvars.iv54
br i1 %exitcond53.not, label %for.cond.cleanup10, label %for.body11.us, !llvm.loop !9
for.cond.cleanup5: ; preds = %for.cond.cleanup10
%indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
%indvars.iv.next66 = add nuw i64 %indvars.iv65, 1
%exitcond72 = icmp eq i64 %indvars.iv67, %0
br i1 %exitcond72, label %for.cond.cleanup, label %for.cond2.preheader, !llvm.loop !11
for.cond.cleanup10: ; preds = %gcd3.exit, %gcd3.exit.us
%.us-phi = phi i64 [ %add.us, %gcd3.exit.us ], [ %add, %gcd3.exit ]
%indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%exitcond64.not = icmp eq i64 %indvars.iv.next57, %indvars.iv65
br i1 %exitcond64.not, label %for.cond.cleanup5, label %for.cond7.preheader, !llvm.loop !12
for.body11: ; preds = %for.cond7.preheader, %gcd3.exit
%indvars.iv = phi i64 [ %indvars.iv.next, %gcd3.exit ], [ 1, %for.cond7.preheader ]
%ans.237 = phi i64 [ %add, %gcd3.exit ], [ %ans.139, %for.cond7.preheader ]
br label %tailrecurse.i.i
tailrecurse.i.i: ; preds = %if.end6.i.i, %for.body11
%a.tr.i.i = phi i64 [ %indvars.iv56, %for.body11 ], [ %b.tr.i.i, %if.end6.i.i ]
%b.tr.i.i = phi i64 [ %indvars.iv, %for.body11 ], [ %rem.i.i, %if.end6.i.i ]
%cmp.i.i = icmp eq i64 %b.tr.i.i, 1
%cmp1.i.i = icmp eq i64 %a.tr.i.i, 1
%or.cond.i.i = or i1 %cmp1.i.i, %cmp.i.i
br i1 %or.cond.i.i, label %tailrecurse.i2.i.preheader, label %if.end3.i.i
if.end3.i.i: ; preds = %tailrecurse.i.i
%rem.i.i = srem i64 %a.tr.i.i, %b.tr.i.i
%cmp4.i.i = icmp eq i64 %rem.i.i, 0
br i1 %cmp4.i.i, label %tailrecurse.i2.i.preheader, label %if.end6.i.i
if.end6.i.i: ; preds = %if.end3.i.i
%rem7.i.i = srem i64 %b.tr.i.i, %a.tr.i.i
%cmp8.i.i = icmp eq i64 %rem7.i.i, 0
br i1 %cmp8.i.i, label %tailrecurse.i2.i.preheader, label %tailrecurse.i.i
tailrecurse.i2.i.preheader: ; preds = %if.end6.i.i, %if.end3.i.i, %tailrecurse.i.i
%b.tr.i4.i.ph = phi i64 [ 1, %tailrecurse.i.i ], [ %b.tr.i.i, %if.end3.i.i ], [ %a.tr.i.i, %if.end6.i.i ]
br label %tailrecurse.i2.i
tailrecurse.i2.i: ; preds = %tailrecurse.i2.i.preheader, %if.end6.i11.i
%a.tr.i3.i = phi i64 [ %b.tr.i4.i, %if.end6.i11.i ], [ %indvars.iv67, %tailrecurse.i2.i.preheader ]
%b.tr.i4.i = phi i64 [ %rem.i9.i, %if.end6.i11.i ], [ %b.tr.i4.i.ph, %tailrecurse.i2.i.preheader ]
%cmp.i5.i = icmp eq i64 %b.tr.i4.i, 1
%cmp1.i6.i = icmp eq i64 %a.tr.i3.i, 1
%or.cond.i7.i = or i1 %cmp1.i6.i, %cmp.i5.i
br i1 %or.cond.i7.i, label %gcd3.exit, label %if.end3.i8.i
if.end3.i8.i: ; preds = %tailrecurse.i2.i
%rem.i9.i = srem i64 %a.tr.i3.i, %b.tr.i4.i
%cmp4.i10.i = icmp eq i64 %rem.i9.i, 0
br i1 %cmp4.i10.i, label %gcd3.exit, label %if.end6.i11.i
if.end6.i11.i: ; preds = %if.end3.i8.i
%rem7.i12.i = srem i64 %b.tr.i4.i, %a.tr.i3.i
%cmp8.i13.i = icmp eq i64 %rem7.i12.i, 0
br i1 %cmp8.i13.i, label %gcd3.exit, label %tailrecurse.i2.i
gcd3.exit: ; preds = %tailrecurse.i2.i, %if.end3.i8.i, %if.end6.i11.i
%retval.0.i14.i = phi i64 [ 1, %tailrecurse.i2.i ], [ %b.tr.i4.i, %if.end3.i8.i ], [ %a.tr.i3.i, %if.end6.i11.i ]
%cmp1.i = icmp eq i64 %indvars.iv56, %indvars.iv
%cmp5.i = icmp eq i64 %indvars.iv, %indvars.iv67
%1 = or i1 %cmp1.i, %cmp5.i
%spec.select = select i1 %1, i64 3, i64 6
%mul = mul nsw i64 %retval.0.i14.i, %spec.select
%add = add nsw i64 %mul, %ans.237
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv54
br i1 %exitcond.not, label %for.cond.cleanup10, label %for.body11, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{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}
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>
#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))
#define SWAP(type, a, b) { const type tmp = a; a = b; b = tmp; }
int compare_sz_asc(const void* a, const void* b) {
return *((size_t*)a) < *((size_t*)b) ? -1 : 1;
}
int compare_sz_desc(const void* a, const void* b) {
return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}
int compare_i64_asc(const void* a, const void* b) {
return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}
int compare_i64_desc(const void* a, const void* b) {
return *((int64_t*)a) > * ((int64_t*)b) ? -1 : 1;
}
int compare_u64_asc(const void* a, const void* b) {
return *((uint64_t*)a) < *((uint64_t*)b) ? -1 : 1;
}
int compare_u64_desc(const void* a, const void* b) {
return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}
int compare_c_asc(const void* a, const void* b) {
return *((char*)a) < *((char*)b) ? -1 : 1;
}
int compare_c_desc(const void* a, const void* b) {
return *((char*)a) > * ((char*)b) ? -1 : 1;
}
int compare_dp_asc(const void* a, const void* b) {
return *((double*)a) < *((double*)b) ? -1 : 1;
}
static uint64_t modinvU64(const uint64_t a, const uint64_t m) {
int64_t aa = (int64_t)a;
const int64_t mm = (int64_t)m;
int64_t b = mm;
int64_t u = 1;
int64_t v = 0;
while (b != 0) {
const int64_t t = aa / b;
aa -= t * b;
SWAP(uint64_t, aa, b);
u -= t * v;
SWAP(uint64_t, u, v);
}
u %= mm;
if (u < 0) {
u += m;
}
return (uint64_t)u;
}
static size_t powSz(const size_t base, const size_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powSz(base * base, exp / 2);
}
else {
return base * powSz(base, exp - 1);
}
}
static uint64_t powU64(const uint64_t base, const uint64_t exp) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base;
}
if (exp % 2 == 0) {
return powU64(base * base, exp / 2);
}
else {
return base * powU64(base, exp - 1);
}
}
static uint64_t powU64WMod(const uint64_t base, const uint64_t exp, const uint64_t m) {
if (exp == 0) {
return 1;
}
if (exp == 1) {
return base % m;
}
if (exp % 2 == 0) {
return powU64WMod(base * base % m, exp / 2, m);
}
else {
return base * powU64WMod(base, exp - 1, m) % m;
}
}
static size_t combSz(const size_t n, const size_t r) {
size_t result = 1;
for (size_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64(const uint64_t n, const uint64_t r) {
uint64_t result = 1;
for (uint64_t i = 0; i < r; i++) {
result *= n - i;
result /= i + 1;
}
return result;
}
static uint64_t combU64WMod(const uint64_t n, const uint64_t r, const uint64_t m) {
uint64_t result = 1;
uint64_t inv = 1;
for (uint64_t i = 0; i < r; i++) {
result = result * (n - i) % m;
inv = inv * (i + 1) % m;
}
return result * modinvU64(inv, m) % m;
}
static uint64_t permU64(const uint64_t n) {
uint64_t result = 1;
for (uint64_t v = 2; v <= n; v++) {
result *= v;
}
return result;
}
static uint64_t permU64WMod(const uint64_t n, const uint64_t m) {
uint64_t result = 1;
for (uint64_t v = 2; v <= n; v++) {
result *= v;
result %= m;
}
return result;
}
static size_t gcdZu(size_t m, size_t n) {
size_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t gcdU64(uint64_t m, uint64_t n)
{
uint64_t temp;
while (m % n != 0) {
temp = n;
n = m % n;
m = temp;
}
return n;
}
static uint64_t popcntU64(uint64_t val) {
uint64_t cnt = 0;
while (val != 0) {
if ((val & UINT64_C(0x1)) != 0) {
cnt++;
}
val >>= UINT64_C(0x1);
}
return cnt;
}
typedef struct {
uint64_t val;
}BHeap_Val;
#define BHEAP_VAL_TYPE BHeap_Val
#define BHEAP_INVALID_NODE ((size_t)100000000)
typedef struct {
BHEAP_VAL_TYPE val;
} BHeap_Node;
struct _BHeap_Ctx {
size_t size;
int (*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node);
void(*notifyNodeChange)(const struct _BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList);
BHeap_Node* node;
};
typedef struct _BHeap_Ctx BHeap_Ctx;
static void bHeap_Init(BHeap_Ctx* const ctx, int(*compare)(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node), void(*notifyNodeChange)(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList), BHeap_Node* const nodes) {
ctx->size = 0;
ctx->compare = compare;
ctx->notifyNodeChange = notifyNodeChange;
ctx->node = nodes;
}
static void bHeap_Swap(BHeap_Ctx* const ctx, const size_t node0, const size_t node1) {
const BHEAP_VAL_TYPE tmp = ctx->node[node0].val;
ctx->node[node0].val = ctx->node[node1].val;
ctx->node[node1].val = tmp;
if (ctx->notifyNodeChange != NULL) {
const size_t nodeList[2] = { node0,node1 };
ctx->notifyNodeChange(ctx, 2, nodeList);
}
}
static void bHeap_UpHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
if (nodeIdx == 0) {
return;
}
const size_t parentIdx = (nodeIdx + 1) / 2 - 1;
const int compareResult = ctx->compare(&(ctx->node[parentIdx].val), &(ctx->node[nodeIdx].val));
if (0 < compareResult) {
bHeap_Swap(ctx, nodeIdx, parentIdx);
if (parentIdx != 0) {
bHeap_UpHeap(ctx, parentIdx);
}
}
}
static void bHeap_DownHeap(BHeap_Ctx* const ctx, const size_t nodeIdx) {
if (ctx->size - 1 <= nodeIdx) {
return;
}
const size_t leftIdx = 2 * (nodeIdx + 1) - 1;
if (leftIdx < ctx->size) {
const int leftResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[leftIdx].val));
size_t swapTarget = leftResult < 0 ? BHEAP_INVALID_NODE : leftIdx;
const size_t rightIdx = leftIdx + 1;
if (rightIdx < ctx->size) {
const int rightResult = ctx->compare(&(ctx->node[nodeIdx].val), &(ctx->node[rightIdx].val));
if (swapTarget == BHEAP_INVALID_NODE) {
if (0 < rightResult) {
swapTarget = rightIdx;
}
}
else {
if (0 < rightResult) {
const int rightLeftResult = ctx->compare(&(ctx->node[leftIdx].val), &(ctx->node[rightIdx].val));
if (0 < rightLeftResult) {
swapTarget = rightIdx;
}
}
}
}
if (swapTarget != BHEAP_INVALID_NODE) {
bHeap_Swap(ctx, nodeIdx, swapTarget);
bHeap_DownHeap(ctx, swapTarget);
}
}
}
static void bHeap_Add(BHeap_Ctx* const ctx, const BHEAP_VAL_TYPE val) {
ctx->node[ctx->size].val = val;
ctx->size++;
if (ctx->notifyNodeChange != NULL) {
const size_t node = ctx->size - 1;
ctx->notifyNodeChange(ctx, 1, &node);
}
bHeap_UpHeap(ctx, ctx->size - 1);
}
static void bHeap_RemoveTop(BHeap_Ctx* const ctx) {
if (ctx->size == 0) {
return;
}
if (ctx->size == 1) {
ctx->size--;
return;
}
ctx->node[0].val = ctx->node[ctx->size - 1].val;
if (ctx->notifyNodeChange != NULL) {
const size_t node = 0;
ctx->notifyNodeChange(ctx, 1, &node);
}
ctx->size--;
bHeap_DownHeap(ctx, 0);
}
static void bHeap_RemoveNode(BHeap_Ctx* const ctx, const size_t node) {
if (node == ctx->size - 1) {
ctx->size--;
}
else {
ctx->node[node].val = ctx->node[ctx->size - 1].val;
ctx->size--;
if (ctx->notifyNodeChange != NULL) {
ctx->notifyNodeChange(ctx, 1, &node);
}
bHeap_DownHeap(ctx, node);
bHeap_UpHeap(ctx, node);
}
}
static BHEAP_VAL_TYPE* bHeap_GetTopVal(const BHeap_Ctx* const ctx) {
return ctx->size == 0 ? NULL : &(ctx->node[0].val);
}
typedef struct {
uint64_t cnt;
size_t* child;
size_t numChild;
size_t maxNumChild;
} Tree_Node;
#define TREE_INIT_ALLOC (128)
static Tree_Node tree_Node[200000];
static void tree_Init(const uint64_t N) {
for (uint64_t i = 0; i < N; i++) {
tree_Node[i].cnt = 0;
tree_Node[i].numChild = 0;
tree_Node[i].child = malloc(sizeof(size_t) * TREE_INIT_ALLOC);
tree_Node[i].maxNumChild = TREE_INIT_ALLOC;
}
}
static void tree_AddChild(const size_t parent, const size_t child) {
if (tree_Node[parent].maxNumChild <= tree_Node[parent].numChild) {
tree_Node[parent].child = realloc(tree_Node[parent].child, sizeof(size_t) * tree_Node[parent].maxNumChild * 2);
tree_Node[parent].maxNumChild *= 2;
}
tree_Node[parent].child[tree_Node[parent].numChild] = child;
tree_Node[parent].numChild++;
}
static BHeap_Node BN_Asc[200000];
static BHeap_Node BN_Desc[200000];
static int _bHeap_Compare_Asc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
return parent->val <= node->val ? -1 : 1;
}
static int _bHeap_Compare_Desc(const BHEAP_VAL_TYPE* parent, const BHEAP_VAL_TYPE* node) {
return parent->val >= node->val ? -1 : 1;
}
static size_t PBHeap_Asc_Idx[200000];
static size_t PBHeap_Desc_Idx[200000];
static void _bHeap_NotifyNodeChange_Asc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
for (size_t i = 0; i < nodeListSize; i++) {
PBHeap_Asc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
}
}
static void _bHeap_NotifyNodeChange_Desc(const BHeap_Ctx* const ctx, const size_t nodeListSize, const size_t* const nodeList) {
for (size_t i = 0; i < nodeListSize; i++) {
PBHeap_Desc_Idx[ctx->node[nodeList[i]].val.val] = nodeList[i];
}
}
#define UF_ROOT ((size_t)10000000)
typedef struct {
size_t parent;
uint64_t w;
uint64_t v;
uint64_t wSum;
uint64_t vSum;
} UF_Node;
static UF_Node uf_Node[101];
static size_t uf_GetRoot(const size_t idx) {
if (uf_Node[idx].parent == UF_ROOT) {
return idx;
}
const size_t root = uf_GetRoot(uf_Node[idx].parent);
uf_Node[idx].parent = root;
return root;
}
static void uf_Merge(const size_t a, const size_t b) {
const size_t aRoot = uf_GetRoot(a);
const size_t bRoot = uf_GetRoot(b);
if (aRoot != bRoot) {
uf_Node[aRoot].parent = bRoot;
uf_Node[bRoot].wSum += uf_Node[aRoot].wSum;
uf_Node[bRoot].vSum += uf_Node[aRoot].vSum;
}
}
#define MOD_VAL (UINT64_C(1000000007))
int main(void) {
uint64_t K;
scanf("%"PRIu64, &K);
uint64_t r = 0;
for (uint64_t a = 1; a <= K; a++) {
for (uint64_t b = 1; b <= K; b++) {
for (uint64_t c = 1; c <= K; c++) {
r += gcdU64(gcdU64(a, b), c);
}
}
}
printf("%"PRIu64, r);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126767/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126767/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%lu\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_sz_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_i64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp slt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_i64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_u64_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ult i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_u64_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp ugt i64 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_c_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp slt i8 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_c_desc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !9
%1 = load i8, ptr %b, align 1, !tbaa !9
%cmp = icmp sgt i8 %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @compare_dp_asc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !10
%1 = load double, ptr %b, align 8, !tbaa !10
%cmp = fcmp olt double %0, %1
%cond = select i1 %cmp, i32 -1, i32 1
ret i32 %cond
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%K = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %K) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %K)
%0 = load i64, ptr %K, align 8, !tbaa !5
%cmp.not38 = icmp eq i64 %0, 0
br i1 %cmp.not38, label %for.cond.cleanup, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%1 = add i64 %0, 1
%umax = call i64 @llvm.umax.i64(i64 %1, i64 2)
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.preheader, %for.cond1.for.cond.cleanup3_crit_edge.split
%a.040 = phi i64 [ %inc15, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 1, %for.cond1.preheader.preheader ]
%r.039 = phi i64 [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ], [ 0, %for.cond1.preheader.preheader ]
br label %for.cond5.preheader
for.cond.cleanup: ; preds = %for.cond1.for.cond.cleanup3_crit_edge.split, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %for.cond1.for.cond.cleanup3_crit_edge.split ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %r.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %K) #5
ret i32 0
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond5.for.cond.cleanup7_crit_edge
%b.036 = phi i64 [ 1, %for.cond1.preheader ], [ %inc12, %for.cond5.for.cond.cleanup7_crit_edge ]
%r.135 = phi i64 [ %r.039, %for.cond1.preheader ], [ %add, %for.cond5.for.cond.cleanup7_crit_edge ]
br label %while.cond.i.preheader
for.cond1.for.cond.cleanup3_crit_edge.split: ; preds = %for.cond5.for.cond.cleanup7_crit_edge
%inc15 = add nuw i64 %a.040, 1
%exitcond43 = icmp eq i64 %inc15, %umax
br i1 %exitcond43, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !12
while.cond.i.preheader: ; preds = %for.cond5.preheader, %gcdU64.exit30
%c.033 = phi i64 [ 1, %for.cond5.preheader ], [ %inc, %gcdU64.exit30 ]
%r.232 = phi i64 [ %r.135, %for.cond5.preheader ], [ %add, %gcdU64.exit30 ]
br label %while.cond.i
for.cond5.for.cond.cleanup7_crit_edge: ; preds = %gcdU64.exit30
%inc12 = add nuw i64 %b.036, 1
%exitcond42 = icmp eq i64 %inc12, %umax
br i1 %exitcond42, label %for.cond1.for.cond.cleanup3_crit_edge.split, label %for.cond5.preheader, !llvm.loop !14
while.cond.i: ; preds = %while.cond.i.preheader, %while.cond.i
%n.addr.0.i = phi i64 [ %rem.i, %while.cond.i ], [ %b.036, %while.cond.i.preheader ]
%m.addr.0.i = phi i64 [ %n.addr.0.i, %while.cond.i ], [ %a.040, %while.cond.i.preheader ]
%rem.i = urem i64 %m.addr.0.i, %n.addr.0.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %while.cond.i25, label %while.cond.i, !llvm.loop !15
while.cond.i25: ; preds = %while.cond.i, %while.cond.i25
%n.addr.0.i26 = phi i64 [ %rem.i28, %while.cond.i25 ], [ %c.033, %while.cond.i ]
%m.addr.0.i27 = phi i64 [ %n.addr.0.i26, %while.cond.i25 ], [ %n.addr.0.i, %while.cond.i ]
%rem.i28 = urem i64 %m.addr.0.i27, %n.addr.0.i26
%cmp.not.i29 = icmp eq i64 %rem.i28, 0
br i1 %cmp.not.i29, label %gcdU64.exit30, label %while.cond.i25, !llvm.loop !15
gcdU64.exit30: ; preds = %while.cond.i25
%add = add i64 %n.addr.0.i26, %r.232
%inc = add nuw i64 %c.033, 1
%exitcond = icmp eq i64 %inc, %umax
br i1 %exitcond, label %for.cond5.for.cond.cleanup7_crit_edge, label %while.cond.i.preheader, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #4
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int i,j,k;
int n,tim[61];
long long int ans;
int main(){
while(scanf("%d",&n)*n){
ans=0;
for(i=0;i<61;i++)tim[i]=0;
for(i=0;i<n;i++){
scanf("%d",&k);
tim[k]++;
}
for(i=0;i<61 && n>1;i++){
for(;tim[i]>0 && n>1;tim[i]--){
n--;
ans+=i*n;
}
}
printf("%lld\n",ans);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126817/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126817/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@ans = dso_local local_unnamed_addr global i64 0, align 8
@i = dso_local local_unnamed_addr global i32 0, align 4
@tim = dso_local local_unnamed_addr global [61 x i32] zeroinitializer, align 16
@k = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
@j = dso_local local_unnamed_addr global i32 0, align 4
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call56 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4
%mul57 = mul nsw i32 %0, %call56
%tobool.not58 = icmp eq i32 %mul57, 0
br i1 %tobool.not58, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end31
%1 = phi i32 [ %26, %for.end31 ], [ %0, %entry ]
store i64 0, ptr @ans, align 8, !tbaa !5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(244) @tim, i8 0, i64 244, i1 false), !tbaa !9
store i32 0, ptr @i, align 4, !tbaa !9
%cmp237 = icmp sgt i32 %1, 0
br i1 %cmp237, label %for.body3, label %for.end31
for.cond11.preheader: ; preds = %for.body3
%ans.promoted49.pre = load i64, ptr @ans, align 8, !tbaa !5
%cmp1352 = icmp sgt i32 %5, 1
br i1 %cmp1352, label %for.cond15.preheader, label %for.end31
for.body3: ; preds = %while.body, %for.body3
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @k)
%2 = load i32, ptr @k, align 4, !tbaa !9
%idxprom5 = sext i32 %2 to i64
%arrayidx6 = getelementptr inbounds [61 x i32], ptr @tim, i64 0, i64 %idxprom5
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !9
%inc7 = add nsw i32 %3, 1
store i32 %inc7, ptr %arrayidx6, align 4, !tbaa !9
%4 = load i32, ptr @i, align 4, !tbaa !9
%inc9 = add nsw i32 %4, 1
store i32 %inc9, ptr @i, align 4, !tbaa !9
%5 = load i32, ptr @n, align 4
%cmp2 = icmp slt i32 %inc9, %5
br i1 %cmp2, label %for.body3, label %for.cond11.preheader, !llvm.loop !11
for.cond15.preheader: ; preds = %for.cond11.preheader, %for.inc29
%indvars.iv62 = phi i64 [ %indvars.iv.next63, %for.inc29 ], [ 0, %for.cond11.preheader ]
%dec.lcssa4854 = phi i32 [ %dec.lcssa47, %for.inc29 ], [ %5, %for.cond11.preheader ]
%add.lcssa5153 = phi i64 [ %add.lcssa50, %for.inc29 ], [ %ans.promoted49.pre, %for.cond11.preheader ]
%dec.lcssa4854.fr = freeze i32 %dec.lcssa4854
%arrayidx17 = getelementptr inbounds [61 x i32], ptr @tim, i64 0, i64 %indvars.iv62
%arrayidx17.promoted = load i32, ptr %arrayidx17, align 4, !tbaa !9
%cmp1841 = icmp sgt i32 %arrayidx17.promoted, 0
br i1 %cmp1841, label %for.body22.preheader, label %for.inc29
for.body22.preheader: ; preds = %for.cond15.preheader
%6 = zext i32 %dec.lcssa4854.fr to i64
%7 = tail call i64 @llvm.usub.sat.i64(i64 %6, i64 2)
%8 = add i32 %arrayidx17.promoted, -1
%9 = zext i32 %8 to i64
%umin70 = tail call i64 @llvm.umin.i64(i64 %7, i64 %9)
%10 = add nuw nsw i64 %umin70, 1
%min.iters.check = icmp ult i64 %umin70, 3
br i1 %min.iters.check, label %for.body22.preheader76, label %vector.ph
vector.ph: ; preds = %for.body22.preheader
%n.vec = and i64 %10, 8589934588
%ind.end = sub nsw i64 %6, %n.vec
%.cast = trunc i64 %n.vec to i32
%ind.end71 = sub i32 %arrayidx17.promoted, %.cast
%.splatinsert = insertelement <2 x i64> poison, i64 %6, i64 0
%.splat = shufflevector <2 x i64> %.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
%induction = add nsw <2 x i64> %.splat, <i64 0, i64 -1>
%11 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %add.lcssa5153, i64 0
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %indvars.iv62, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i64> [ %induction, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <2 x i64> [ %11, %vector.ph ], [ %16, %vector.body ]
%vec.phi74 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%12 = add nsw <2 x i64> %vec.ind, <i64 -1, i64 -1>
%13 = add <2 x i64> %vec.ind, <i64 -3, i64 -3>
%14 = mul nsw <2 x i64> %12, %broadcast.splat
%15 = mul nsw <2 x i64> %13, %broadcast.splat
%16 = add <2 x i64> %vec.phi, %14
%17 = add <2 x i64> %vec.phi74, %15
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i64> %vec.ind, <i64 -4, i64 -4>
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %17, %16
%19 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %10, %n.vec
br i1 %cmp.n, label %for.cond15.for.inc29_crit_edge, label %for.body22.preheader76
for.body22.preheader76: ; preds = %for.body22.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %6, %for.body22.preheader ], [ %ind.end, %middle.block ]
%dec273845.ph = phi i32 [ %arrayidx17.promoted, %for.body22.preheader ], [ %ind.end71, %middle.block ]
%add4043.ph = phi i64 [ %add.lcssa5153, %for.body22.preheader ], [ %19, %middle.block ]
br label %for.body22
for.body22: ; preds = %for.body22.preheader76, %for.body22
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body22 ], [ %indvars.iv.ph, %for.body22.preheader76 ]
%dec273845 = phi i32 [ %dec27, %for.body22 ], [ %dec273845.ph, %for.body22.preheader76 ]
%add4043 = phi i64 [ %add, %for.body22 ], [ %add4043.ph, %for.body22.preheader76 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%20 = mul nsw i64 %indvars.iv.next, %indvars.iv62
%add = add nsw i64 %add4043, %20
%dec27 = add nsw i32 %dec273845, -1
%cmp18 = icmp ugt i32 %dec273845, 1
%cmp20 = icmp ugt i64 %indvars.iv, 2
%21 = select i1 %cmp18, i1 %cmp20, i1 false
br i1 %21, label %for.body22, label %for.cond15.for.inc29_crit_edge, !llvm.loop !16
for.cond15.for.inc29_crit_edge: ; preds = %for.body22, %middle.block
%indvars.iv.next.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next, %for.body22 ]
%add.lcssa = phi i64 [ %19, %middle.block ], [ %add, %for.body22 ]
%dec27.lcssa = phi i32 [ %ind.end71, %middle.block ], [ %dec27, %for.body22 ]
%22 = trunc i64 %indvars.iv.next.lcssa to i32
store i32 %22, ptr @n, align 4, !tbaa !9
store i64 %add.lcssa, ptr @ans, align 8, !tbaa !5
store i32 %dec27.lcssa, ptr %arrayidx17, align 4, !tbaa !9
br label %for.inc29
for.inc29: ; preds = %for.cond15.for.inc29_crit_edge, %for.cond15.preheader
%add.lcssa50 = phi i64 [ %add.lcssa, %for.cond15.for.inc29_crit_edge ], [ %add.lcssa5153, %for.cond15.preheader ]
%dec.lcssa47 = phi i32 [ %22, %for.cond15.for.inc29_crit_edge ], [ %dec.lcssa4854.fr, %for.cond15.preheader ]
%indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
%cmp12 = icmp ult i64 %indvars.iv62, 60
%cmp13 = icmp sgt i32 %dec.lcssa47, 1
%23 = select i1 %cmp12, i1 %cmp13, i1 false
br i1 %23, label %for.cond15.preheader, label %for.end31.loopexit, !llvm.loop !17
for.end31.loopexit: ; preds = %for.inc29
%24 = trunc i64 %indvars.iv.next63 to i32
br label %for.end31
for.end31: ; preds = %while.body, %for.end31.loopexit, %for.cond11.preheader
%25 = phi i64 [ %ans.promoted49.pre, %for.cond11.preheader ], [ %add.lcssa50, %for.end31.loopexit ], [ 0, %while.body ]
%storemerge35.lcssa = phi i32 [ 0, %for.cond11.preheader ], [ %24, %for.end31.loopexit ], [ 0, %while.body ]
store i32 %storemerge35.lcssa, ptr @i, align 4, !tbaa !9
%call32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %25)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%26 = load i32, ptr @n, align 4
%mul = mul nsw i32 %26, %call
%tobool.not = icmp eq i32 %mul, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !18
while.end: ; preds = %for.end31, %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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.usub.sat.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 = { nofree nounwind "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12, !15, !14}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
|
#include <stdio.h>
#include <stdlib.h>
int comp(const void *a, const void *b)
{
long *A = (long *)a;
long *B = (long *)b;
if(*A > *B) return 1;
if(*A < *B) return -1;
return 0;
}
int main(void)
{
int N;
scanf("%d", &N);
long A[N];
for(int i = 0; i < N; i++){
scanf("%ld", &A[i]);
A[i] -= i+1;
}
qsort(A, N, sizeof(long), comp);
long ans = 0;
for(int i = 0; i < N; i++)
ans += abs(A[N/2]-A[i]);
printf("%ld\n", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126882/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126882/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !5
%1 = load i64, ptr %b, align 8, !tbaa !5
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp slt i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%N = alloca i32, align 4
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
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !9
%cmp31 = icmp sgt i32 %3, 0
br i1 %cmp31, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %3 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv4.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %22, %for.body ]
call void @qsort(ptr noundef nonnull %vla, i64 noundef %conv4.pre-phi, i64 noundef 8, ptr noundef nonnull @comp) #8
%4 = load i32, ptr %N, align 4, !tbaa !9
%cmp733 = icmp sgt i32 %4, 0
br i1 %cmp733, label %for.body10.lr.ph, label %for.cond.cleanup9
for.body10.lr.ph: ; preds = %for.cond.cleanup
%div4243 = lshr i32 %4, 1
%idxprom11 = zext i32 %div4243 to i64
%arrayidx12 = getelementptr inbounds i64, ptr %vla, i64 %idxprom11
%5 = load i64, ptr %arrayidx12, align 8, !tbaa !5
%wide.trip.count = zext i32 %4 to i64
%min.iters.check = icmp ult i32 %4, 4
br i1 %min.iters.check, label %for.body10.preheader, label %vector.ph
vector.ph: ; preds = %for.body10.lr.ph
%n.vec = and i64 %wide.trip.count, 4294967292
%broadcast.splatinsert = insertelement <2 x i64> poison, i64 %5, i64 0
%broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%vec.phi44 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%6 = getelementptr inbounds i64, ptr %vla, i64 %index
%wide.load = load <2 x i64>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i64, ptr %6, i64 2
%wide.load45 = load <2 x i64>, ptr %7, align 16, !tbaa !5
%8 = sub nsw <2 x i64> %broadcast.splat, %wide.load
%9 = sub nsw <2 x i64> %broadcast.splat, %wide.load45
%10 = trunc <2 x i64> %8 to <2 x i32>
%11 = trunc <2 x i64> %9 to <2 x i32>
%12 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %10, i1 true)
%13 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> %11, i1 true)
%14 = zext <2 x i32> %12 to <2 x i64>
%15 = zext <2 x i32> %13 to <2 x i64>
%16 = add <2 x i64> %vec.phi, %14
%17 = add <2 x i64> %vec.phi44, %15
%index.next = add nuw i64 %index, 4
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %17, %16
%19 = 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.cond.cleanup9, label %for.body10.preheader
for.body10.preheader: ; preds = %for.body10.lr.ph, %middle.block
%indvars.iv39.ph = phi i64 [ 0, %for.body10.lr.ph ], [ %n.vec, %middle.block ]
%ans.034.ph = phi i64 [ 0, %for.body10.lr.ph ], [ %19, %middle.block ]
br label %for.body10
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = load i64, ptr %arrayidx, align 8, !tbaa !5
%sub = sub nsw i64 %20, %indvars.iv.next
store i64 %sub, ptr %arrayidx, align 8, !tbaa !5
%21 = load i32, ptr %N, align 4, !tbaa !9
%22 = sext i32 %21 to i64
%cmp = icmp slt i64 %indvars.iv.next, %22
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !15
for.cond.cleanup9: ; preds = %for.body10, %middle.block, %for.cond.cleanup
%ans.0.lcssa = phi i64 [ 0, %for.cond.cleanup ], [ %19, %middle.block ], [ %add18, %for.body10 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
ret i32 0
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body10 ], [ %indvars.iv39.ph, %for.body10.preheader ]
%ans.034 = phi i64 [ %add18, %for.body10 ], [ %ans.034.ph, %for.body10.preheader ]
%arrayidx14 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv39
%23 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%sub15 = sub nsw i64 %5, %23
%conv16 = trunc i64 %sub15 to i32
%24 = call i32 @llvm.abs.i32(i32 %conv16, i1 true)
%conv17 = zext i32 %24 to i64
%add18 = add nuw nsw i64 %ans.034, %conv17
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup9, label %for.body10, !llvm.loop !16
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6
; Function Attrs: 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !14, !13}
|
// Aizu Vol-0 0099: Surf Smelt Fishing Contest II
// 2017.8.19 bal4u@uu
// ????????????????????£????????\???
#include <stdio.h>
#define QSIZE 110000
#define PARENT(i) ((i)>>1)
#define LEFT(i) ((i)<<1)
#define RIGHT(i) (((i)<<1)+1)
typedef struct { int id, key, c; } QUE;
QUE que[QSIZE + 5];
int qsize;
#define MAX 1000000
typedef struct { int f, c; } T;
T tbl[MAX + 5];
void max_heapify(int i)
{
int l, r, largest;
l = LEFT(i), r = RIGHT(i);
if (l < qsize &&
(que[l].key > que[i].key || (que[l].key == que[i].key && que[l].id < que[i].id)))
largest = l;
else largest = i;
if (r < qsize &&
(que[r].key > que[largest].key ||
(que[r].key == que[largest].key && que[r].id < que[largest].id)))
largest = r;
// else largest = i;
if (largest != i) {
QUE t = que[i]; que[i] = que[largest], que[largest] = t;
max_heapify(largest);
}
}
void deq(void)
{
if (qsize == 0) return;
que[0] = que[--qsize];
max_heapify(0);
}
void enq(void)
{
int i, max;
i = qsize++;
while (i > 0 && (que[max = PARENT(i)].key < que[i].key
|| (que[max].key == que[i].key && que[max].id > que[i].id))) {
QUE t = que[i]; que[i] = que[max], que[max] = t;
i = max;
}
}
int main()
{
int n, q, a, v;
scanf("%d%d", &n, &q);
qsize = 0;
while (q--) {
scanf("%d%d", &a, &v);
tbl[a].f += v, tbl[a].c++;
que[qsize].id = a, que[qsize].key = tbl[a].f, que[qsize].c = tbl[a].c;
enq();
while (1) {
a = que[0].id;
if (tbl[a].c == que[0].c) {
printf("%d %d\n", que[0].id, que[0].key);
break;
}
deq();
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126932/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126932/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.QUE = type { i32, i32, i32 }
%struct.T = type { i32, i32 }
@qsize = dso_local local_unnamed_addr global i32 0, align 4
@que = dso_local local_unnamed_addr global [110005 x %struct.QUE] zeroinitializer, align 16
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@tbl = dso_local local_unnamed_addr global [1000005 x %struct.T] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @max_heapify(i32 noundef %i) local_unnamed_addr #0 {
entry:
%t = alloca %struct.QUE, align 4
%0 = load i32, ptr @qsize, align 4, !tbaa !5
br label %tailrecurse
tailrecurse: ; preds = %if.then48, %entry
%i.tr = phi i32 [ %i, %entry ], [ %largest.1, %if.then48 ]
%shl = shl i32 %i.tr, 1
%add = or i32 %shl, 1
%cmp = icmp slt i32 %shl, %0
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %tailrecurse
%idxprom = sext i32 %shl to i64
%arrayidx = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom
%key = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %key, align 4, !tbaa !9
%idxprom2 = sext i32 %i.tr to i64
%arrayidx3 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2
%key4 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2, i32 1
%2 = load i32, ptr %key4, align 4, !tbaa !9
%cmp5 = icmp sgt i32 %1, %2
br i1 %cmp5, label %if.end, label %lor.lhs.false
lor.lhs.false: ; preds = %land.lhs.true
%cmp12 = icmp eq i32 %1, %2
br i1 %cmp12, label %land.lhs.true13, label %if.else
land.lhs.true13: ; preds = %lor.lhs.false
%3 = load i32, ptr %arrayidx, align 8, !tbaa !11
%4 = load i32, ptr %arrayidx3, align 4, !tbaa !11
%cmp19 = icmp slt i32 %3, %4
br i1 %cmp19, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true13, %lor.lhs.false, %tailrecurse
br label %if.end
if.end: ; preds = %land.lhs.true, %land.lhs.true13, %if.else
%largest.0 = phi i32 [ %i.tr, %if.else ], [ %shl, %land.lhs.true13 ], [ %shl, %land.lhs.true ]
%cmp20 = icmp slt i32 %add, %0
br i1 %cmp20, label %land.lhs.true21, label %if.end46
land.lhs.true21: ; preds = %if.end
%idxprom22 = sext i32 %add to i64
%arrayidx23 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22
%key24 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22, i32 1
%5 = load i32, ptr %key24, align 8, !tbaa !9
%idxprom25 = sext i32 %largest.0 to i64
%arrayidx26 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25
%key27 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25, i32 1
%6 = load i32, ptr %key27, align 4, !tbaa !9
%cmp28 = icmp sgt i32 %5, %6
br i1 %cmp28, label %if.then45, label %lor.lhs.false29
lor.lhs.false29: ; preds = %land.lhs.true21
%cmp36 = icmp eq i32 %5, %6
br i1 %cmp36, label %land.lhs.true37, label %if.end46
land.lhs.true37: ; preds = %lor.lhs.false29
%7 = load i32, ptr %arrayidx23, align 4, !tbaa !11
%8 = load i32, ptr %arrayidx26, align 4, !tbaa !11
%cmp44 = icmp slt i32 %7, %8
br i1 %cmp44, label %if.then45, label %if.end46
if.then45: ; preds = %land.lhs.true37, %land.lhs.true21
br label %if.end46
if.end46: ; preds = %if.then45, %land.lhs.true37, %lor.lhs.false29, %if.end
%largest.1 = phi i32 [ %add, %if.then45 ], [ %largest.0, %land.lhs.true37 ], [ %largest.0, %lor.lhs.false29 ], [ %largest.0, %if.end ]
%cmp47.not = icmp eq i32 %largest.1, %i.tr
br i1 %cmp47.not, label %if.end57, label %if.then48
if.then48: ; preds = %if.end46
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %t)
%idxprom49 = sext i32 %i.tr to i64
%arrayidx50 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom49
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %t, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50, i64 12, i1 false), !tbaa.struct !12
%idxprom53 = sext i32 %largest.1 to i64
%arrayidx54 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom53
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54, ptr noundef nonnull align 4 dereferenceable(12) %t, i64 12, i1 false), !tbaa.struct !12
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %t)
br label %tailrecurse
if.end57: ; preds = %if.end46
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @deq() local_unnamed_addr #0 {
entry:
%t.i = alloca %struct.QUE, align 4
%0 = load i32, ptr @qsize, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 0
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%dec = add nsw i32 %0, -1
store i32 %dec, ptr @qsize, align 4, !tbaa !5
%idxprom = sext i32 %dec to i64
%arrayidx = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) @que, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false), !tbaa.struct !12
br label %tailrecurse.i
tailrecurse.i: ; preds = %if.then48.i, %if.end
%i.tr.i = phi i32 [ 0, %if.end ], [ %largest.1.i, %if.then48.i ]
%shl.i = shl i32 %i.tr.i, 1
%add.i = or i32 %shl.i, 1
%cmp.i = icmp slt i32 %shl.i, %dec
br i1 %cmp.i, label %land.lhs.true.i, label %if.else.i
land.lhs.true.i: ; preds = %tailrecurse.i
%idxprom.i = sext i32 %shl.i to i64
%arrayidx.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i
%key.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i, i32 1
%1 = load i32, ptr %key.i, align 4, !tbaa !9
%idxprom2.i = sext i32 %i.tr.i to i64
%arrayidx3.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2.i
%key4.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2.i, i32 1
%2 = load i32, ptr %key4.i, align 4, !tbaa !9
%cmp5.i = icmp sgt i32 %1, %2
br i1 %cmp5.i, label %if.end.i, label %lor.lhs.false.i
lor.lhs.false.i: ; preds = %land.lhs.true.i
%cmp12.i = icmp eq i32 %1, %2
br i1 %cmp12.i, label %land.lhs.true13.i, label %if.else.i
land.lhs.true13.i: ; preds = %lor.lhs.false.i
%3 = load i32, ptr %arrayidx.i, align 8, !tbaa !11
%4 = load i32, ptr %arrayidx3.i, align 4, !tbaa !11
%cmp19.i = icmp slt i32 %3, %4
br i1 %cmp19.i, label %if.end.i, label %if.else.i
if.else.i: ; preds = %land.lhs.true13.i, %lor.lhs.false.i, %tailrecurse.i
br label %if.end.i
if.end.i: ; preds = %if.else.i, %land.lhs.true13.i, %land.lhs.true.i
%largest.0.i = phi i32 [ %i.tr.i, %if.else.i ], [ %shl.i, %land.lhs.true13.i ], [ %shl.i, %land.lhs.true.i ]
%cmp20.i = icmp slt i32 %add.i, %dec
br i1 %cmp20.i, label %land.lhs.true21.i, label %if.end46.i
land.lhs.true21.i: ; preds = %if.end.i
%idxprom22.i = sext i32 %add.i to i64
%arrayidx23.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22.i
%key24.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22.i, i32 1
%5 = load i32, ptr %key24.i, align 8, !tbaa !9
%idxprom25.i = sext i32 %largest.0.i to i64
%arrayidx26.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25.i
%key27.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25.i, i32 1
%6 = load i32, ptr %key27.i, align 4, !tbaa !9
%cmp28.i = icmp sgt i32 %5, %6
br i1 %cmp28.i, label %if.then45.i, label %lor.lhs.false29.i
lor.lhs.false29.i: ; preds = %land.lhs.true21.i
%cmp36.i = icmp eq i32 %5, %6
br i1 %cmp36.i, label %land.lhs.true37.i, label %if.end46.i
land.lhs.true37.i: ; preds = %lor.lhs.false29.i
%7 = load i32, ptr %arrayidx23.i, align 4, !tbaa !11
%8 = load i32, ptr %arrayidx26.i, align 4, !tbaa !11
%cmp44.i = icmp slt i32 %7, %8
br i1 %cmp44.i, label %if.then45.i, label %if.end46.i
if.then45.i: ; preds = %land.lhs.true37.i, %land.lhs.true21.i
br label %if.end46.i
if.end46.i: ; preds = %if.then45.i, %land.lhs.true37.i, %lor.lhs.false29.i, %if.end.i
%largest.1.i = phi i32 [ %add.i, %if.then45.i ], [ %largest.0.i, %land.lhs.true37.i ], [ %largest.0.i, %lor.lhs.false29.i ], [ %largest.0.i, %if.end.i ]
%cmp47.not.i = icmp eq i32 %largest.1.i, %i.tr.i
br i1 %cmp47.not.i, label %return, label %if.then48.i
if.then48.i: ; preds = %if.end46.i
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %t.i)
%idxprom49.i = sext i32 %i.tr.i to i64
%arrayidx50.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom49.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %t.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50.i, i64 12, i1 false), !tbaa.struct !12
%idxprom53.i = sext i32 %largest.1.i to i64
%arrayidx54.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom53.i
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54.i, ptr noundef nonnull align 4 dereferenceable(12) %t.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %t.i)
br label %tailrecurse.i
return: ; preds = %if.end46.i, %entry
ret void
}
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @enq() local_unnamed_addr #0 {
entry:
%t = alloca %struct.QUE, align 4
%0 = load i32, ptr @qsize, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @qsize, align 4, !tbaa !5
%cmp39 = icmp sgt i32 %0, 0
br i1 %cmp39, label %land.rhs, label %while.end
land.rhs: ; preds = %entry, %while.body
%i.040 = phi i32 [ %shr, %while.body ], [ %0, %entry ]
%shr = lshr i32 %i.040, 1
%idxprom = zext i32 %shr to i64
%arrayidx = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom
%key = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom, i32 1
%1 = load i32, ptr %key, align 4, !tbaa !9
%idxprom1 = zext i32 %i.040 to i64
%arrayidx2 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom1
%key3 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom1, i32 1
%2 = load i32, ptr %key3, align 4, !tbaa !9
%cmp4 = icmp slt i32 %1, %2
br i1 %cmp4, label %while.body, label %lor.rhs
lor.rhs: ; preds = %land.rhs
%cmp11 = icmp eq i32 %1, %2
br i1 %cmp11, label %land.rhs12, label %while.end
land.rhs12: ; preds = %lor.rhs
%3 = load i32, ptr %arrayidx, align 4, !tbaa !11
%4 = load i32, ptr %arrayidx2, align 4, !tbaa !11
%cmp18 = icmp sgt i32 %3, %4
br i1 %cmp18, label %while.body, label %while.end
while.body: ; preds = %land.rhs, %land.rhs12
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %t)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %t, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx2, i64 12, i1 false), !tbaa.struct !12
tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx2, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx, ptr noundef nonnull align 4 dereferenceable(12) %t, i64 12, i1 false), !tbaa.struct !12
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %t)
%cmp.not = icmp ult i32 %i.040, 2
br i1 %cmp.not, label %while.end, label %land.rhs, !llvm.loop !13
while.end: ; preds = %land.rhs12, %lor.rhs, %while.body, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%t.i.i = alloca %struct.QUE, align 4
%t.i = alloca %struct.QUE, align 4
%n = alloca i32, align 4
%q = alloca i32, align 4
%a = alloca i32, align 4
%v = 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 %q) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %q)
store i32 0, ptr @qsize, align 4, !tbaa !5
%0 = load i32, ptr %q, align 4, !tbaa !5
%dec34 = add nsw i32 %0, -1
store i32 %dec34, ptr %q, align 4, !tbaa !5
%tobool.not35 = icmp eq i32 %0, 0
br i1 %tobool.not35, label %while.end23, label %while.body
while.body: ; preds = %entry, %if.then
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %v)
%1 = load i32, ptr %v, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [1000005 x %struct.T], ptr @tbl, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 8, !tbaa !15
%add = add nsw i32 %3, %1
store i32 %add, ptr %arrayidx, align 8, !tbaa !15
%c = getelementptr inbounds [1000005 x %struct.T], ptr @tbl, i64 0, i64 %idxprom, i32 1
%4 = load i32, ptr %c, align 4, !tbaa !17
%inc = add nsw i32 %4, 1
store i32 %inc, ptr %c, align 4, !tbaa !17
%5 = load i32, ptr @qsize, align 4, !tbaa !5
%idxprom4 = sext i32 %5 to i64
%arrayidx5 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom4
store i32 %2, ptr %arrayidx5, align 4, !tbaa !11
%key = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom4, i32 1
store i32 %add, ptr %key, align 4, !tbaa !9
%c16 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom4, i32 2
store i32 %inc, ptr %c16, align 4, !tbaa !18
%inc.i = add nsw i32 %5, 1
store i32 %inc.i, ptr @qsize, align 4, !tbaa !5
%cmp39.i = icmp sgt i32 %5, 0
br i1 %cmp39.i, label %land.rhs.i, label %enq.exit
land.rhs.i: ; preds = %while.body, %while.body.i
%i.040.i = phi i32 [ %shr.i, %while.body.i ], [ %5, %while.body ]
%shr.i = lshr i32 %i.040.i, 1
%idxprom.i = zext i32 %shr.i to i64
%arrayidx.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i
%key.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i, i32 1
%6 = load i32, ptr %key.i, align 4, !tbaa !9
%idxprom1.i = zext i32 %i.040.i to i64
%arrayidx2.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom1.i
%key3.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom1.i, i32 1
%7 = load i32, ptr %key3.i, align 4, !tbaa !9
%cmp4.i = icmp slt i32 %6, %7
br i1 %cmp4.i, label %while.body.i, label %lor.rhs.i
lor.rhs.i: ; preds = %land.rhs.i
%cmp11.i = icmp eq i32 %6, %7
br i1 %cmp11.i, label %land.rhs12.i, label %enq.exit
land.rhs12.i: ; preds = %lor.rhs.i
%8 = load i32, ptr %arrayidx.i, align 4, !tbaa !11
%9 = load i32, ptr %arrayidx2.i, align 4, !tbaa !11
%cmp18.i = icmp sgt i32 %8, %9
br i1 %cmp18.i, label %while.body.i, label %enq.exit
while.body.i: ; preds = %land.rhs12.i, %land.rhs.i
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %t.i)
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %t.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx2.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx2.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i, ptr noundef nonnull align 4 dereferenceable(12) %t.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %t.i)
%cmp.not.i = icmp ult i32 %i.040.i, 2
br i1 %cmp.not.i, label %enq.exit, label %land.rhs.i, !llvm.loop !13
enq.exit: ; preds = %lor.rhs.i, %land.rhs12.i, %while.body.i, %while.body
%10 = load i32, ptr @que, align 16, !tbaa !11
%idxprom1929 = sext i32 %10 to i64
%c2130 = getelementptr inbounds [1000005 x %struct.T], ptr @tbl, i64 0, i64 %idxprom1929, i32 1
%11 = load i32, ptr %c2130, align 4, !tbaa !17
%12 = load i32, ptr getelementptr inbounds ([110005 x %struct.QUE], ptr @que, i64 0, i64 0, i32 2), align 8, !tbaa !18
%cmp31 = icmp eq i32 %11, %12
br i1 %cmp31, label %if.then, label %if.end
if.then: ; preds = %deq.exit, %enq.exit
%.lcssa26 = phi i32 [ %10, %enq.exit ], [ %26, %deq.exit ]
store i32 %.lcssa26, ptr %a, align 4, !tbaa !5
%13 = load i32, ptr getelementptr inbounds ([110005 x %struct.QUE], ptr @que, i64 0, i64 0, i32 1), align 4, !tbaa !9
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.lcssa26, i32 noundef %13)
%14 = load i32, ptr %q, align 4, !tbaa !5
%dec = add nsw i32 %14, -1
store i32 %dec, ptr %q, align 4, !tbaa !5
%tobool.not = icmp eq i32 %14, 0
br i1 %tobool.not, label %while.end23, label %while.body, !llvm.loop !19
if.end: ; preds = %enq.exit, %deq.exit
%15 = phi i32 [ %25, %deq.exit ], [ %12, %enq.exit ]
%16 = phi i32 [ %26, %deq.exit ], [ %10, %enq.exit ]
%dec.i2832 = phi i32 [ %dec.i27, %deq.exit ], [ %inc.i, %enq.exit ]
%cmp.i = icmp eq i32 %dec.i2832, 0
br i1 %cmp.i, label %deq.exit, label %if.end.i
if.end.i: ; preds = %if.end
%dec.i = add nsw i32 %dec.i2832, -1
store i32 %dec.i, ptr @qsize, align 4, !tbaa !5
%idxprom.i24 = sext i32 %dec.i to i64
%arrayidx.i25 = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i24
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(12) @que, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx.i25, i64 12, i1 false), !tbaa.struct !12
br label %tailrecurse.i.i
tailrecurse.i.i: ; preds = %if.then48.i.i, %if.end.i
%i.tr.i.i = phi i32 [ 0, %if.end.i ], [ %largest.1.i.i, %if.then48.i.i ]
%shl.i.i = shl i32 %i.tr.i.i, 1
%add.i.i = or i32 %shl.i.i, 1
%cmp.i.i = icmp slt i32 %shl.i.i, %dec.i
br i1 %cmp.i.i, label %land.lhs.true.i.i, label %if.else.i.i
land.lhs.true.i.i: ; preds = %tailrecurse.i.i
%idxprom.i.i = sext i32 %shl.i.i to i64
%arrayidx.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i.i
%key.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom.i.i, i32 1
%17 = load i32, ptr %key.i.i, align 4, !tbaa !9
%idxprom2.i.i = sext i32 %i.tr.i.i to i64
%arrayidx3.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2.i.i
%key4.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom2.i.i, i32 1
%18 = load i32, ptr %key4.i.i, align 4, !tbaa !9
%cmp5.i.i = icmp sgt i32 %17, %18
br i1 %cmp5.i.i, label %if.end.i.i, label %lor.lhs.false.i.i
lor.lhs.false.i.i: ; preds = %land.lhs.true.i.i
%cmp12.i.i = icmp eq i32 %17, %18
br i1 %cmp12.i.i, label %land.lhs.true13.i.i, label %if.else.i.i
land.lhs.true13.i.i: ; preds = %lor.lhs.false.i.i
%19 = load i32, ptr %arrayidx.i.i, align 8, !tbaa !11
%20 = load i32, ptr %arrayidx3.i.i, align 4, !tbaa !11
%cmp19.i.i = icmp slt i32 %19, %20
br i1 %cmp19.i.i, label %if.end.i.i, label %if.else.i.i
if.else.i.i: ; preds = %land.lhs.true13.i.i, %lor.lhs.false.i.i, %tailrecurse.i.i
br label %if.end.i.i
if.end.i.i: ; preds = %if.else.i.i, %land.lhs.true13.i.i, %land.lhs.true.i.i
%largest.0.i.i = phi i32 [ %i.tr.i.i, %if.else.i.i ], [ %shl.i.i, %land.lhs.true13.i.i ], [ %shl.i.i, %land.lhs.true.i.i ]
%cmp20.i.i = icmp slt i32 %add.i.i, %dec.i
br i1 %cmp20.i.i, label %land.lhs.true21.i.i, label %if.end46.i.i
land.lhs.true21.i.i: ; preds = %if.end.i.i
%idxprom22.i.i = sext i32 %add.i.i to i64
%arrayidx23.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22.i.i
%key24.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom22.i.i, i32 1
%21 = load i32, ptr %key24.i.i, align 8, !tbaa !9
%idxprom25.i.i = sext i32 %largest.0.i.i to i64
%arrayidx26.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25.i.i
%key27.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom25.i.i, i32 1
%22 = load i32, ptr %key27.i.i, align 4, !tbaa !9
%cmp28.i.i = icmp sgt i32 %21, %22
br i1 %cmp28.i.i, label %if.then45.i.i, label %lor.lhs.false29.i.i
lor.lhs.false29.i.i: ; preds = %land.lhs.true21.i.i
%cmp36.i.i = icmp eq i32 %21, %22
br i1 %cmp36.i.i, label %land.lhs.true37.i.i, label %if.end46.i.i
land.lhs.true37.i.i: ; preds = %lor.lhs.false29.i.i
%23 = load i32, ptr %arrayidx23.i.i, align 4, !tbaa !11
%24 = load i32, ptr %arrayidx26.i.i, align 4, !tbaa !11
%cmp44.i.i = icmp slt i32 %23, %24
br i1 %cmp44.i.i, label %if.then45.i.i, label %if.end46.i.i
if.then45.i.i: ; preds = %land.lhs.true37.i.i, %land.lhs.true21.i.i
br label %if.end46.i.i
if.end46.i.i: ; preds = %if.then45.i.i, %land.lhs.true37.i.i, %lor.lhs.false29.i.i, %if.end.i.i
%largest.1.i.i = phi i32 [ %add.i.i, %if.then45.i.i ], [ %largest.0.i.i, %land.lhs.true37.i.i ], [ %largest.0.i.i, %lor.lhs.false29.i.i ], [ %largest.0.i.i, %if.end.i.i ]
%cmp47.not.i.i = icmp eq i32 %largest.1.i.i, %i.tr.i.i
br i1 %cmp47.not.i.i, label %deq.exit.loopexit, label %if.then48.i.i
if.then48.i.i: ; preds = %if.end46.i.i
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %t.i.i)
%idxprom49.i.i = sext i32 %i.tr.i.i to i64
%arrayidx50.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom49.i.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %t.i.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50.i.i, i64 12, i1 false), !tbaa.struct !12
%idxprom53.i.i = sext i32 %largest.1.i.i to i64
%arrayidx54.i.i = getelementptr inbounds [110005 x %struct.QUE], ptr @que, i64 0, i64 %idxprom53.i.i
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx50.i.i, ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54.i.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %arrayidx54.i.i, ptr noundef nonnull align 4 dereferenceable(12) %t.i.i, i64 12, i1 false), !tbaa.struct !12
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %t.i.i)
br label %tailrecurse.i.i
deq.exit.loopexit: ; preds = %if.end46.i.i
%.pre = load i32, ptr @que, align 16, !tbaa !11
%.pre36 = load i32, ptr getelementptr inbounds ([110005 x %struct.QUE], ptr @que, i64 0, i64 0, i32 2), align 8, !tbaa !18
br label %deq.exit
deq.exit: ; preds = %deq.exit.loopexit, %if.end
%25 = phi i32 [ %15, %if.end ], [ %.pre36, %deq.exit.loopexit ]
%26 = phi i32 [ %16, %if.end ], [ %.pre, %deq.exit.loopexit ]
%dec.i27 = phi i32 [ 0, %if.end ], [ %dec.i, %deq.exit.loopexit ]
%idxprom19 = sext i32 %26 to i64
%c21 = getelementptr inbounds [1000005 x %struct.T], ptr @tbl, i64 0, i64 %idxprom19, i32 1
%27 = load i32, ptr %c21, align 4, !tbaa !17
%cmp = icmp eq i32 %27, %25
br i1 %cmp, label %if.then, label %if.end
while.end23: ; preds = %if.then, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %q) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 0}
!12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !6, i64 0}
!16 = !{!"", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = !{!10, !6, i64 8}
!19 = distinct !{!19, !14}
|
#include<stdio.h>
#include<string.h>
int main(){
int i;
char s[2000000];
scanf("%s",&s);
for(i=0;i<strlen(s);i+=2)
printf("%c",s[i]);
printf("\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_126976/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_126976/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [2000000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 2000000, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%char0 = load i8, ptr %s, align 16
%cmp10.not = icmp eq i8 %char0, 0
br i1 %cmp10.not, label %for.end, label %for.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [2000000 x i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 2, !tbaa !5
%conv3 = sext i8 %0 to i32
%putchar8 = call i32 @putchar(i32 %conv3)
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%call1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%cmp = icmp ugt i64 %call1, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 2000000, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void){
char s[100000];
char ans[100000];
int i=0, j=0;
scanf("%s", s);
while(s[i] != '\0'){
if(i%2 == 0){
ans[j] = s[i];
j++;
}
i++;
}
i++;
ans[j] = '\0';
printf("%s", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127018/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127018/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100000 x i8], align 16
%ans = alloca [100000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 100000, ptr nonnull %ans) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%0 = load i8, ptr %s, align 16, !tbaa !5
%cmp.not20 = icmp eq i8 %0, 0
br i1 %cmp.not20, label %while.end, label %while.body
while.body: ; preds = %entry, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 0, %entry ]
%1 = phi i8 [ %2, %if.end ], [ %0, %entry ]
%j.022 = phi i32 [ %j.1, %if.end ], [ 0, %entry ]
%rem23 = and i64 %indvars.iv, 1
%cmp2 = icmp eq i64 %rem23, 0
br i1 %cmp2, label %if.then, label %if.end
if.then: ; preds = %while.body
%idxprom6 = sext i32 %j.022 to i64
%arrayidx7 = getelementptr inbounds [100000 x i8], ptr %ans, i64 0, i64 %idxprom6
store i8 %1, ptr %arrayidx7, align 1, !tbaa !5
%inc = add nsw i32 %j.022, 1
br label %if.end
if.end: ; preds = %if.then, %while.body
%j.1 = phi i32 [ %inc, %if.then ], [ %j.022, %while.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [100000 x i8], ptr %s, i64 0, i64 %indvars.iv.next
%2 = load i8, ptr %arrayidx, align 1, !tbaa !5
%cmp.not = icmp eq i8 %2, 0
br i1 %cmp.not, label %while.end.loopexit, label %while.body, !llvm.loop !8
while.end.loopexit: ; preds = %if.end
%3 = sext i32 %j.1 to i64
br label %while.end
while.end: ; preds = %while.end.loopexit, %entry
%j.0.lcssa = phi i64 [ 0, %entry ], [ %3, %while.end.loopexit ]
%arrayidx11 = getelementptr inbounds [100000 x i8], ptr %ans, i64 0, i64 %j.0.lcssa
store i8 0, ptr %arrayidx11, align 1, !tbaa !5
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %ans)
call void @llvm.lifetime.end.p0(i64 100000, ptr nonnull %ans) #3
call void @llvm.lifetime.end.p0(i64 100000, 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
int i;
char s[100001];
scanf("%s",s);
int len=strlen(s);
for(i=0;i<=len-1;i+=2)
{printf("%c",s[i]);}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127069/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127069/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #6
%conv = trunc i64 %call2 to i32
%cmp.not.not10 = icmp sgt i32 %conv, 0
br i1 %cmp.not.not10, 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 i8], ptr %s, i64 0, i64 %indvars.iv
%0 = load i8, ptr %arrayidx, align 2, !tbaa !5
%conv4 = sext i8 %0 to i32
%putchar9 = call i32 @putchar(i32 %conv4)
%indvars.iv.next = add nuw i64 %indvars.iv, 2
%1 = trunc i64 %indvars.iv.next to i32
%cmp.not.not = icmp slt i32 %1, %conv
br i1 %cmp.not.not, label %for.body, label %for.end, !llvm.loop !8
for.end: ; preds = %for.body, %entry
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 100001
char *oddstr(char *s, int len)
{
int i;
char *o = (char *) malloc(len/2 + 8);
for (i = 0; i < len; i+=2) {
o[i/2] = s[i];
}
o[i/2] = '\0';
return o;
}
int main(int argc, char **argv)
{
char s[SIZE];
scanf("%s", s);
printf("%s\n", oddstr(s, strlen(s)));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127133/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127133/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 memory(write, argmem: read, inaccessiblemem: readwrite) uwtable
define dso_local noalias ptr @oddstr(ptr nocapture noundef readonly %s, i32 noundef %len) local_unnamed_addr #0 {
entry:
%div = sdiv i32 %len, 2
%add = add nsw i32 %div, 8
%conv = sext i32 %add to i64
%call = tail call noalias ptr @malloc(i64 noundef %conv) #7
%cmp16 = icmp sgt i32 %len, 0
br i1 %cmp16, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%0 = zext i32 %len to i64
%min.iters.check = icmp ult i32 %len, 33
br i1 %min.iters.check, label %for.body.preheader20, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%1 = add nsw i64 %0, -1
%2 = lshr i64 %1, 1
%3 = add nuw i64 %2, 1
%n.mod.vf = and i64 %3, 15
%4 = icmp eq i64 %n.mod.vf, 0
%5 = select i1 %4, i64 16, i64 %n.mod.vf
%n.vec = sub i64 %3, %5
%ind.end = shl i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = shl i64 %index, 1
%6 = or i64 %offset.idx, 2
%7 = or i64 %offset.idx, 4
%8 = or i64 %offset.idx, 6
%9 = or i64 %offset.idx, 8
%10 = or i64 %offset.idx, 10
%11 = or i64 %offset.idx, 12
%12 = or i64 %offset.idx, 14
%13 = or i64 %offset.idx, 16
%14 = or i64 %offset.idx, 18
%15 = or i64 %offset.idx, 20
%16 = or i64 %offset.idx, 22
%17 = or i64 %offset.idx, 24
%18 = or i64 %offset.idx, 26
%19 = or i64 %offset.idx, 28
%20 = or i64 %offset.idx, 30
%21 = getelementptr inbounds i8, ptr %s, i64 %offset.idx
%22 = getelementptr inbounds i8, ptr %s, i64 %6
%23 = getelementptr inbounds i8, ptr %s, i64 %7
%24 = getelementptr inbounds i8, ptr %s, i64 %8
%25 = getelementptr inbounds i8, ptr %s, i64 %9
%26 = getelementptr inbounds i8, ptr %s, i64 %10
%27 = getelementptr inbounds i8, ptr %s, i64 %11
%28 = getelementptr inbounds i8, ptr %s, i64 %12
%29 = getelementptr inbounds i8, ptr %s, i64 %13
%30 = getelementptr inbounds i8, ptr %s, i64 %14
%31 = getelementptr inbounds i8, ptr %s, i64 %15
%32 = getelementptr inbounds i8, ptr %s, i64 %16
%33 = getelementptr inbounds i8, ptr %s, i64 %17
%34 = getelementptr inbounds i8, ptr %s, i64 %18
%35 = getelementptr inbounds i8, ptr %s, i64 %19
%36 = getelementptr inbounds i8, ptr %s, i64 %20
%37 = load i8, ptr %21, align 1, !tbaa !5
%38 = load i8, ptr %22, align 1, !tbaa !5
%39 = load i8, ptr %23, align 1, !tbaa !5
%40 = load i8, ptr %24, align 1, !tbaa !5
%41 = load i8, ptr %25, align 1, !tbaa !5
%42 = load i8, ptr %26, align 1, !tbaa !5
%43 = load i8, ptr %27, align 1, !tbaa !5
%44 = load i8, ptr %28, align 1, !tbaa !5
%45 = load i8, ptr %29, align 1, !tbaa !5
%46 = load i8, ptr %30, align 1, !tbaa !5
%47 = load i8, ptr %31, align 1, !tbaa !5
%48 = load i8, ptr %32, align 1, !tbaa !5
%49 = load i8, ptr %33, align 1, !tbaa !5
%50 = load i8, ptr %34, align 1, !tbaa !5
%51 = load i8, ptr %35, align 1, !tbaa !5
%52 = load i8, ptr %36, align 1, !tbaa !5
%53 = insertelement <16 x i8> poison, i8 %37, i64 0
%54 = insertelement <16 x i8> %53, i8 %38, i64 1
%55 = insertelement <16 x i8> %54, i8 %39, i64 2
%56 = insertelement <16 x i8> %55, i8 %40, i64 3
%57 = insertelement <16 x i8> %56, i8 %41, i64 4
%58 = insertelement <16 x i8> %57, i8 %42, i64 5
%59 = insertelement <16 x i8> %58, i8 %43, i64 6
%60 = insertelement <16 x i8> %59, i8 %44, i64 7
%61 = insertelement <16 x i8> %60, i8 %45, i64 8
%62 = insertelement <16 x i8> %61, i8 %46, i64 9
%63 = insertelement <16 x i8> %62, i8 %47, i64 10
%64 = insertelement <16 x i8> %63, i8 %48, i64 11
%65 = insertelement <16 x i8> %64, i8 %49, i64 12
%66 = insertelement <16 x i8> %65, i8 %50, i64 13
%67 = insertelement <16 x i8> %66, i8 %51, i64 14
%68 = insertelement <16 x i8> %67, i8 %52, i64 15
%69 = and i64 %index, 9223372036854775792
%70 = getelementptr inbounds i8, ptr %call, i64 %69
store <16 x i8> %68, ptr %70, align 1, !tbaa !5
%index.next = add nuw i64 %index, 16
%71 = icmp eq i64 %index.next, %n.vec
br i1 %71, label %for.body.preheader20, label %vector.body, !llvm.loop !8
for.body.preheader20: ; preds = %vector.body, %for.body.preheader
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %ind.end, %vector.body ]
br label %for.body
for.body: ; preds = %for.body.preheader20, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader20 ]
%arrayidx = getelementptr inbounds i8, ptr %s, i64 %indvars.iv
%72 = load i8, ptr %arrayidx, align 1, !tbaa !5
%73 = lshr exact i64 %indvars.iv, 1
%arrayidx4 = getelementptr inbounds i8, ptr %call, i64 %73
store i8 %72, ptr %arrayidx4, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
%cmp = icmp ult i64 %indvars.iv.next, %0
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !12
for.end.loopexit: ; preds = %for.body
%74 = lshr exact i64 %indvars.iv.next, 1
%75 = and i64 %74, 2147483647
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%i.0.lcssa = phi i64 [ 0, %entry ], [ %75, %for.end.loopexit ]
%arrayidx8 = getelementptr inbounds i8, ptr %call, i64 %i.0.lcssa
store i8 0, ptr %arrayidx8, align 1, !tbaa !5
ret ptr %call
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #3 {
entry:
%s = alloca [100001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100001, ptr nonnull %s) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %s) #9
%conv = trunc i64 %call3 to i32
%div.i = sdiv i32 %conv, 2
%add.i = add nsw i32 %div.i, 8
%conv.i = sext i32 %add.i to i64
%call.i = call noalias ptr @malloc(i64 noundef %conv.i) #7
%cmp16.i = icmp sgt i32 %conv, 0
br i1 %cmp16.i, label %for.body.preheader.i, label %oddstr.exit
for.body.preheader.i: ; preds = %entry
%0 = and i64 %call3, 4294967295
%1 = add nsw i64 %0, -1
%min.iters.check = icmp ult i64 %1, 32
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%2 = lshr i64 %1, 1
%3 = add nuw i64 %2, 1
%n.mod.vf = and i64 %3, 15
%4 = icmp eq i64 %n.mod.vf, 0
%5 = select i1 %4, i64 16, i64 %n.mod.vf
%n.vec = sub i64 %3, %5
%ind.end = shl i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = shl i64 %index, 1
%6 = or i64 %offset.idx, 2
%7 = or i64 %offset.idx, 4
%8 = or i64 %offset.idx, 6
%9 = or i64 %offset.idx, 8
%10 = or i64 %offset.idx, 10
%11 = or i64 %offset.idx, 12
%12 = or i64 %offset.idx, 14
%13 = or i64 %offset.idx, 16
%14 = or i64 %offset.idx, 18
%15 = or i64 %offset.idx, 20
%16 = or i64 %offset.idx, 22
%17 = or i64 %offset.idx, 24
%18 = or i64 %offset.idx, 26
%19 = or i64 %offset.idx, 28
%20 = or i64 %offset.idx, 30
%21 = getelementptr inbounds i8, ptr %s, i64 %offset.idx
%22 = getelementptr inbounds i8, ptr %s, i64 %6
%23 = getelementptr inbounds i8, ptr %s, i64 %7
%24 = getelementptr inbounds i8, ptr %s, i64 %8
%25 = getelementptr inbounds i8, ptr %s, i64 %9
%26 = getelementptr inbounds i8, ptr %s, i64 %10
%27 = getelementptr inbounds i8, ptr %s, i64 %11
%28 = getelementptr inbounds i8, ptr %s, i64 %12
%29 = getelementptr inbounds i8, ptr %s, i64 %13
%30 = getelementptr inbounds i8, ptr %s, i64 %14
%31 = getelementptr inbounds i8, ptr %s, i64 %15
%32 = getelementptr inbounds i8, ptr %s, i64 %16
%33 = getelementptr inbounds i8, ptr %s, i64 %17
%34 = getelementptr inbounds i8, ptr %s, i64 %18
%35 = getelementptr inbounds i8, ptr %s, i64 %19
%36 = getelementptr inbounds i8, ptr %s, i64 %20
%37 = load i8, ptr %21, align 16, !tbaa !5
%38 = load i8, ptr %22, align 2, !tbaa !5
%39 = load i8, ptr %23, align 4, !tbaa !5
%40 = load i8, ptr %24, align 2, !tbaa !5
%41 = load i8, ptr %25, align 8, !tbaa !5
%42 = load i8, ptr %26, align 2, !tbaa !5
%43 = load i8, ptr %27, align 4, !tbaa !5
%44 = load i8, ptr %28, align 2, !tbaa !5
%45 = load i8, ptr %29, align 16, !tbaa !5
%46 = load i8, ptr %30, align 2, !tbaa !5
%47 = load i8, ptr %31, align 4, !tbaa !5
%48 = load i8, ptr %32, align 2, !tbaa !5
%49 = load i8, ptr %33, align 8, !tbaa !5
%50 = load i8, ptr %34, align 2, !tbaa !5
%51 = load i8, ptr %35, align 4, !tbaa !5
%52 = load i8, ptr %36, align 2, !tbaa !5
%53 = insertelement <16 x i8> poison, i8 %37, i64 0
%54 = insertelement <16 x i8> %53, i8 %38, i64 1
%55 = insertelement <16 x i8> %54, i8 %39, i64 2
%56 = insertelement <16 x i8> %55, i8 %40, i64 3
%57 = insertelement <16 x i8> %56, i8 %41, i64 4
%58 = insertelement <16 x i8> %57, i8 %42, i64 5
%59 = insertelement <16 x i8> %58, i8 %43, i64 6
%60 = insertelement <16 x i8> %59, i8 %44, i64 7
%61 = insertelement <16 x i8> %60, i8 %45, i64 8
%62 = insertelement <16 x i8> %61, i8 %46, i64 9
%63 = insertelement <16 x i8> %62, i8 %47, i64 10
%64 = insertelement <16 x i8> %63, i8 %48, i64 11
%65 = insertelement <16 x i8> %64, i8 %49, i64 12
%66 = insertelement <16 x i8> %65, i8 %50, i64 13
%67 = insertelement <16 x i8> %66, i8 %51, i64 14
%68 = insertelement <16 x i8> %67, i8 %52, i64 15
%69 = and i64 %index, 9223372036854775792
%70 = getelementptr inbounds i8, ptr %call.i, i64 %69
store <16 x i8> %68, ptr %70, align 1, !tbaa !5
%index.next = add nuw i64 %index, 16
%71 = icmp eq i64 %index.next, %n.vec
br i1 %71, label %for.body.i.preheader, label %vector.body, !llvm.loop !13
for.body.i.preheader: ; preds = %vector.body, %for.body.preheader.i
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %ind.end, %vector.body ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i8, ptr %s, i64 %indvars.iv.i
%72 = load i8, ptr %arrayidx.i, align 2, !tbaa !5
%73 = lshr exact i64 %indvars.iv.i, 1
%arrayidx4.i = getelementptr inbounds i8, ptr %call.i, i64 %73
store i8 %72, ptr %arrayidx4.i, align 1, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 2
%cmp.i = icmp ult i64 %indvars.iv.next.i, %0
br i1 %cmp.i, label %for.body.i, label %for.end.loopexit.i, !llvm.loop !14
for.end.loopexit.i: ; preds = %for.body.i
%74 = lshr exact i64 %indvars.iv.next.i, 1
%75 = and i64 %74, 2147483647
br label %oddstr.exit
oddstr.exit: ; preds = %entry, %for.end.loopexit.i
%i.0.lcssa.i = phi i64 [ 0, %entry ], [ %75, %for.end.loopexit.i ]
%arrayidx8.i = getelementptr inbounds i8, ptr %call.i, i64 %i.0.lcssa.i
store i8 0, ptr %arrayidx8.i, align 1, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %call.i)
call void @llvm.lifetime.end.p0(i64 100001, ptr nonnull %s) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6
attributes #0 = { nofree nounwind memory(write, argmem: read, inaccessiblemem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9, !10, !11}
!14 = distinct !{!14, !9, !11, !10}
|
#include<stdio.h>
int main()
{
char s[100005];
char out[50005];
int i;
int count = 0;
for(i=0; i<100000; i++)
{
scanf("%c",&s[i]);
if((s[i]<'a')|(s[i]>'z')) break;
if(i%2 == 0)
{
out[i/2]=s[i];
count++;
}
}
for(i=0; i<count; i++) printf("%c",out[i]);
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127191/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127191/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%s = alloca [100005 x i8], align 16
%out = alloca [50005 x i8], align 16
call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %s) #4
call void @llvm.lifetime.start.p0(i64 50005, ptr nonnull %out) #4
br label %for.body
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.inc ]
%count.046 = phi i32 [ 0, %entry ], [ %count.1, %for.inc ]
%arrayidx = getelementptr inbounds [100005 x i8], ptr %s, i64 0, i64 %indvars.iv
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%1 = add i8 %0, -123
%or42 = icmp ult i8 %1, -26
br i1 %or42, label %for.end, label %if.end
if.end: ; preds = %for.body
%rem54 = and i64 %indvars.iv, 1
%cmp10 = icmp eq i64 %rem54, 0
br i1 %cmp10, label %if.then12, label %for.inc
if.then12: ; preds = %if.end
%div43 = lshr i64 %indvars.iv, 1
%idxprom15 = and i64 %div43, 2147483647
%arrayidx16 = getelementptr inbounds [50005 x i8], ptr %out, i64 0, i64 %idxprom15
store i8 %0, ptr %arrayidx16, align 1, !tbaa !5
%inc = add nsw i32 %count.046, 1
br label %for.inc
for.inc: ; preds = %if.end, %if.then12
%count.1 = phi i32 [ %inc, %if.then12 ], [ %count.046, %if.end ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 100000
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %for.inc
%count.0.lcssa = phi i32 [ %count.046, %for.body ], [ %count.1, %for.inc ]
%cmp2047 = icmp sgt i32 %count.0.lcssa, 0
br i1 %cmp2047, label %for.body22.preheader, label %for.end29
for.body22.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %count.0.lcssa to i64
br label %for.body22
for.body22: ; preds = %for.body22.preheader, %for.body22
%indvars.iv50 = phi i64 [ 0, %for.body22.preheader ], [ %indvars.iv.next51, %for.body22 ]
%arrayidx24 = getelementptr inbounds [50005 x i8], ptr %out, i64 0, i64 %indvars.iv50
%2 = load i8, ptr %arrayidx24, align 1, !tbaa !5
%conv25 = sext i8 %2 to i32
%putchar44 = call i32 @putchar(i32 %conv25)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond53.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count
br i1 %exitcond53.not, label %for.end29, label %for.body22, !llvm.loop !10
for.end29: ; preds = %for.body22, %for.end
%putchar = call i32 @putchar(i32 10)
call void @llvm.lifetime.end.p0(i64 50005, ptr nonnull %out) #4
call void @llvm.lifetime.end.p0(i64 100005, 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>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MOD 1000000009
#define MAX(a,b) (a>b?a:b)
#define MAX3(a,b,c) MAX(a,MAX(b,c))
#define MIN(a,b) (a<b?a:b)
#define MIN3(a,b,c) MIN(a, MIN(b,c))
#define top(i,j) val[i*m+j]
#define s(a,b) strcmp(a,b)
typedef long long lli;
typedef unsigned short int usi;
typedef struct {
int a;
int b;
int c;
} dish;
// (a+b)の値の降順にソート
int cmp(const void *a, const void *b) {
return ((dish*)b)->c - ((dish*)a)->c;
}
int main()
{
int n;
int i;
lli taka=0, aoki=0;
scanf("%d",&n);
dish *d = (dish*)malloc(n * sizeof(dish));
for(i=0; i<n; i++) {
scanf("%d %d",&d[i].a, &d[i].b);
d[i].c = d[i].a + d[i].b;
}
qsort(d,n,sizeof(dish),cmp);
for(i=0; i<n/2; i++) {
taka += d[2*i].a;
aoki += d[2*i+1].b;
//printf("%lld %lld\n",taka,aoki);
}
if(n%2==1)taka+=d[n-1].a;
printf("%lld",taka-aoki);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127234/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127234/source.c"
target datalayout = "e-m:e-p270: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.dish = type { i32, i32, i32 }
@.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 [5 x i8] c"%lld\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #0 {
entry:
%c = getelementptr inbounds %struct.dish, ptr %b, i64 0, i32 2
%0 = load i32, ptr %c, align 4, !tbaa !5
%c1 = getelementptr inbounds %struct.dish, ptr %a, i64 0, i32 2
%1 = load i32, ptr %c1, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !10
%conv = sext i32 %0 to i64
%mul = mul nsw i64 %conv, 12
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp66 = icmp sgt i32 %0, 0
br i1 %cmp66, 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 %struct.dish, ptr %call1, i64 %indvars.iv
%b = getelementptr inbounds %struct.dish, ptr %call1, i64 %indvars.iv, i32 1
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef %arrayidx, ptr noundef nonnull %b)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !11
%2 = load i32, ptr %b, align 4, !tbaa !12
%add = add nsw i32 %2, %1
%c = getelementptr inbounds %struct.dish, ptr %call1, i64 %indvars.iv, i32 2
store i32 %add, ptr %c, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%3 = load i32, ptr %n, align 4, !tbaa !10
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !13
for.end: ; preds = %for.body, %entry
%conv14.pre-phi = phi i64 [ %conv, %entry ], [ %4, %for.body ]
call void @qsort(ptr noundef %call1, i64 noundef %conv14.pre-phi, i64 noundef 12, ptr noundef nonnull @cmp) #6
%5 = load i32, ptr %n, align 4, !tbaa !10
%cmp1668 = icmp sgt i32 %5, 1
br i1 %cmp1668, label %for.body18.preheader, label %for.end34
for.body18.preheader: ; preds = %for.end
%div8182 = lshr i32 %5, 1
%wide.trip.count = zext i32 %div8182 to i64
%xtraiter = and i64 %wide.trip.count, 1
%6 = icmp eq i32 %div8182, 1
br i1 %6, label %for.end34.loopexit.unr-lcssa, label %for.body18.preheader.new
for.body18.preheader.new: ; preds = %for.body18.preheader
%unroll_iter = and i64 %wide.trip.count, 2147483646
br label %for.body18
for.body18: ; preds = %for.body18, %for.body18.preheader.new
%indvars.iv76 = phi i64 [ 0, %for.body18.preheader.new ], [ %indvars.iv.next77.1, %for.body18 ]
%aoki.070 = phi i64 [ 0, %for.body18.preheader.new ], [ %add31.1, %for.body18 ]
%taka.069 = phi i64 [ 0, %for.body18.preheader.new ], [ %add24.1, %for.body18 ]
%niter = phi i64 [ 0, %for.body18.preheader.new ], [ %niter.next.1, %for.body18 ]
%7 = shl nuw nsw i64 %indvars.iv76, 1
%arrayidx21 = getelementptr inbounds %struct.dish, ptr %call1, i64 %7
%8 = load i32, ptr %arrayidx21, align 4, !tbaa !11
%conv23 = sext i32 %8 to i64
%add24 = add nsw i64 %taka.069, %conv23
%9 = or i64 %7, 1
%b29 = getelementptr inbounds %struct.dish, ptr %call1, i64 %9, i32 1
%10 = load i32, ptr %b29, align 4, !tbaa !12
%conv30 = sext i32 %10 to i64
%add31 = add nsw i64 %aoki.070, %conv30
%indvars.iv.next77 = shl nuw i64 %indvars.iv76, 1
%11 = or i64 %indvars.iv.next77, 2
%arrayidx21.1 = getelementptr inbounds %struct.dish, ptr %call1, i64 %11
%12 = load i32, ptr %arrayidx21.1, align 4, !tbaa !11
%conv23.1 = sext i32 %12 to i64
%add24.1 = add nsw i64 %add24, %conv23.1
%13 = or i64 %indvars.iv.next77, 3
%b29.1 = getelementptr inbounds %struct.dish, ptr %call1, i64 %13, i32 1
%14 = load i32, ptr %b29.1, align 4, !tbaa !12
%conv30.1 = sext i32 %14 to i64
%add31.1 = add nsw i64 %add31, %conv30.1
%indvars.iv.next77.1 = add nuw nsw i64 %indvars.iv76, 2
%niter.next.1 = add nuw i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end34.loopexit.unr-lcssa.loopexit, label %for.body18, !llvm.loop !15
for.end34.loopexit.unr-lcssa.loopexit: ; preds = %for.body18
%15 = shl nuw nsw i64 %indvars.iv.next77.1, 1
br label %for.end34.loopexit.unr-lcssa
for.end34.loopexit.unr-lcssa: ; preds = %for.end34.loopexit.unr-lcssa.loopexit, %for.body18.preheader
%add24.lcssa.ph = phi i64 [ undef, %for.body18.preheader ], [ %add24.1, %for.end34.loopexit.unr-lcssa.loopexit ]
%add31.lcssa.ph = phi i64 [ undef, %for.body18.preheader ], [ %add31.1, %for.end34.loopexit.unr-lcssa.loopexit ]
%indvars.iv76.unr = phi i64 [ 0, %for.body18.preheader ], [ %15, %for.end34.loopexit.unr-lcssa.loopexit ]
%aoki.070.unr = phi i64 [ 0, %for.body18.preheader ], [ %add31.1, %for.end34.loopexit.unr-lcssa.loopexit ]
%taka.069.unr = phi i64 [ 0, %for.body18.preheader ], [ %add24.1, %for.end34.loopexit.unr-lcssa.loopexit ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end34, label %for.body18.epil
for.body18.epil: ; preds = %for.end34.loopexit.unr-lcssa
%arrayidx21.epil = getelementptr inbounds %struct.dish, ptr %call1, i64 %indvars.iv76.unr
%16 = load i32, ptr %arrayidx21.epil, align 4, !tbaa !11
%conv23.epil = sext i32 %16 to i64
%add24.epil = add nsw i64 %taka.069.unr, %conv23.epil
%17 = or i64 %indvars.iv76.unr, 1
%b29.epil = getelementptr inbounds %struct.dish, ptr %call1, i64 %17, i32 1
%18 = load i32, ptr %b29.epil, align 4, !tbaa !12
%conv30.epil = sext i32 %18 to i64
%add31.epil = add nsw i64 %aoki.070.unr, %conv30.epil
br label %for.end34
for.end34: ; preds = %for.body18.epil, %for.end34.loopexit.unr-lcssa, %for.end
%taka.0.lcssa = phi i64 [ 0, %for.end ], [ %add24.lcssa.ph, %for.end34.loopexit.unr-lcssa ], [ %add24.epil, %for.body18.epil ]
%aoki.0.lcssa = phi i64 [ 0, %for.end ], [ %add31.lcssa.ph, %for.end34.loopexit.unr-lcssa ], [ %add31.epil, %for.body18.epil ]
%19 = and i32 %5, -2147483647
%cmp35 = icmp eq i32 %19, 1
br i1 %cmp35, label %if.then, label %if.end
if.then: ; preds = %for.end34
%sub = add nsw i32 %5, -1
%idxprom37 = zext i32 %sub to i64
%arrayidx38 = getelementptr inbounds %struct.dish, ptr %call1, i64 %idxprom37
%20 = load i32, ptr %arrayidx38, align 4, !tbaa !11
%conv40 = sext i32 %20 to i64
%add41 = add nsw i64 %taka.0.lcssa, %conv40
br label %if.end
if.end: ; preds = %if.then, %for.end34
%taka.1 = phi i64 [ %add41, %if.then ], [ %taka.0.lcssa, %for.end34 ]
%sub42 = sub nsw i64 %taka.1, %aoki.0.lcssa
%call43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %sub42)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
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, !7, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
|
#include<stdio.h>
#include<string.h>
int main()
{
char num[1005];
int sum=0;
while(1)
{
scanf("%s",num);
sum=0;
if (num[0]=='0') break;
int i, sz=strlen(num);
for(i=0;i<sz;i++)
{
sum+=num[i] - '0';
}
printf("%d\n",sum);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127278/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127278/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [1005 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1005, ptr nonnull %num) #5
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i8, ptr %num, align 16, !tbaa !5
%cmp17 = icmp eq i8 %0, 48
br i1 %cmp17, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num) #6
%conv4 = trunc i64 %call3 to i32
%cmp513 = icmp sgt i32 %conv4, 0
br i1 %cmp513, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %if.end
%wide.trip.count = and i64 %call3, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader21, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call3, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi19 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [1005 x i8], ptr %num, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load20 = load <4 x i8>, ptr %2, align 4, !tbaa !5
%3 = sext <4 x i8> %wide.load to <4 x i32>
%4 = sext <4 x i8> %wide.load20 to <4 x i32>
%5 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%6 = add <4 x i32> %vec.phi19, <i32 -48, i32 -48, i32 -48, i32 -48>
%7 = add <4 x i32> %5, %3
%8 = add <4 x i32> %6, %4
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader21
for.body.preheader21: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%sum.015.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader21, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader21 ]
%sum.015 = phi i32 [ %add, %for.body ], [ %sum.015.ph, %for.body.preheader21 ]
%arrayidx7 = getelementptr inbounds [1005 x i8], ptr %num, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx7, align 1, !tbaa !5
%conv8 = sext i8 %11 to i32
%sub = add i32 %sum.015, -48
%add = add i32 %sub, %conv8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %if.end
%sum.0.lcssa = phi i32 [ 0, %if.end ], [ %10, %middle.block ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%12 = load i8, ptr %num, align 16, !tbaa !5
%cmp = icmp eq i8 %12, 48
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1005, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include <stdio.h>
#include <string.h>
int main(void){
int i;
while(1){
char number[1001]={0};
scanf("%s",number);
int len;
len=strlen(number);
int sum=0;
for(i=0;i<len;i++){
sum+=number[i]-'0';
}
if(sum==0) break;
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127328/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127328/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%number = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %number) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1001) %number, i8 0, i64 1001, i1 false)
%call23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%call224 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %number) #7
%conv25 = trunc i64 %call224 to i32
%cmp1726 = icmp sgt i32 %conv25, 0
br i1 %cmp1726, label %for.body.preheader, label %while.end
for.body.preheader: ; preds = %entry, %cleanup
%call227 = phi i64 [ %call2, %cleanup ], [ %call224, %entry ]
%wide.trip.count = and i64 %call227, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader30, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call227, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%0 = getelementptr inbounds [1001 x i8], ptr %number, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load29 = load <4 x i8>, ptr %1, align 4, !tbaa !5
%2 = sext <4 x i8> %wide.load to <4 x i32>
%3 = sext <4 x i8> %wide.load29 to <4 x i32>
%4 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%5 = add <4 x i32> %vec.phi28, <i32 -48, i32 -48, i32 -48, i32 -48>
%6 = add <4 x i32> %4, %2
%7 = add <4 x i32> %5, %3
%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 !8
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.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader30
for.body.preheader30: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%sum.019.ph = phi i32 [ 0, %for.body.preheader ], [ %9, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader30, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ]
%sum.019 = phi i32 [ %add, %for.body ], [ %sum.019.ph, %for.body.preheader30 ]
%arrayidx = getelementptr inbounds [1001 x i8], ptr %number, i64 0, i64 %indvars.iv
%10 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv4 = sext i8 %10 to i32
%sub = add i32 %sum.019, -48
%add = add i32 %sub, %conv4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block
%add.lcssa = phi i32 [ %9, %middle.block ], [ %add, %for.body ]
%cmp5 = icmp eq i32 %add.lcssa, 0
br i1 %cmp5, label %while.end, label %cleanup
cleanup: ; preds = %for.end
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.lcssa)
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %number) #6
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %number) #6
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1001) %number, i8 0, i64 1001, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%call2 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %number) #7
%conv = trunc i64 %call2 to i32
%cmp17 = icmp sgt i32 %conv, 0
br i1 %cmp17, label %for.body.preheader, label %while.end
while.end: ; preds = %for.end, %cleanup, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %number) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(void) {
char i_str[1000];
int i, len, tmp;
while(1) {
scanf("%s", i_str);
if(*i_str=='0') break;
len = strlen(i_str);
tmp=0;
for(i=0;i<len;i++) {
tmp+=i_str[i] - '0';
}
printf("%d\n", tmp);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127371/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127371/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%i_str = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %i_str) #5
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i_str)
%0 = load i8, ptr %i_str, align 16, !tbaa !5
%cmp17 = icmp eq i8 %0, 48
br i1 %cmp17, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %i_str) #6
%conv5 = trunc i64 %call4 to i32
%cmp613 = icmp sgt i32 %conv5, 0
br i1 %cmp613, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %if.end
%wide.trip.count = and i64 %call4, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader21, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call4, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%vec.phi19 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%1 = getelementptr inbounds [1000 x i8], ptr %i_str, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %1, align 8, !tbaa !5
%2 = getelementptr inbounds i8, ptr %1, i64 4
%wide.load20 = load <4 x i8>, ptr %2, align 4, !tbaa !5
%3 = sext <4 x i8> %wide.load to <4 x i32>
%4 = sext <4 x i8> %wide.load20 to <4 x i32>
%5 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%6 = add <4 x i32> %vec.phi19, <i32 -48, i32 -48, i32 -48, i32 -48>
%7 = add <4 x i32> %5, %3
%8 = add <4 x i32> %6, %4
%index.next = add nuw i64 %index, 8
%9 = icmp eq i64 %index.next, %n.vec
br i1 %9, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %8, %7
%10 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader21
for.body.preheader21: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%tmp.015.ph = phi i32 [ 0, %for.body.preheader ], [ %10, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader21, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader21 ]
%tmp.015 = phi i32 [ %add, %for.body ], [ %tmp.015.ph, %for.body.preheader21 ]
%arrayidx = getelementptr inbounds [1000 x i8], ptr %i_str, i64 0, i64 %indvars.iv
%11 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv8 = sext i8 %11 to i32
%sub = add i32 %tmp.015, -48
%add = add i32 %sub, %conv8
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %if.end
%tmp.0.lcssa = phi i32 [ 0, %if.end ], [ %10, %middle.block ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %tmp.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %i_str)
%12 = load i8, ptr %i_str, align 16, !tbaa !5
%cmp = icmp eq i8 %12, 48
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %i_str) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include<stdio.h>
int main(void)
{
int a,b;
char c;
do{
a=0;
c='a';
while(c!='\n'){
scanf("%c",&c);
switch(c){
case '1':
a+=1;
break;
case '2':
a+=2;
break;
case '3':
a+=3;
break;
case '4':
a+=4;
break;
case '5':
a+=5;
break;
case '6':
a+=6;
break;
case '7':
a+=7;
break;
case '8':
a+=8;
break;
case '9':
a+=9;
break;
}
}
if(a!=0){
printf("%d\n",a);
}
}while(a!=0);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127421/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127421/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %c) #3
br label %do.body
do.body: ; preds = %if.then, %entry
store i8 97, ptr %c, align 1, !tbaa !5
br label %while.body
while.body: ; preds = %do.body, %sw.epilog
%a.035 = phi i32 [ 0, %do.body ], [ %a.1, %sw.epilog ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 1, !tbaa !5
%conv2 = sext i8 %0 to i32
switch i32 %conv2, label %sw.epilog [
i32 49, label %sw.bb
i32 50, label %sw.bb3
i32 51, label %sw.bb5
i32 52, label %sw.bb7
i32 53, label %sw.bb9
i32 54, label %sw.bb11
i32 55, label %sw.bb13
i32 56, label %sw.bb15
i32 57, label %sw.bb17
]
sw.bb: ; preds = %while.body
%add = add nsw i32 %a.035, 1
br label %sw.epilog
sw.bb3: ; preds = %while.body
%add4 = add nsw i32 %a.035, 2
br label %sw.epilog
sw.bb5: ; preds = %while.body
%add6 = add nsw i32 %a.035, 3
br label %sw.epilog
sw.bb7: ; preds = %while.body
%add8 = add nsw i32 %a.035, 4
br label %sw.epilog
sw.bb9: ; preds = %while.body
%add10 = add nsw i32 %a.035, 5
br label %sw.epilog
sw.bb11: ; preds = %while.body
%add12 = add nsw i32 %a.035, 6
br label %sw.epilog
sw.bb13: ; preds = %while.body
%add14 = add nsw i32 %a.035, 7
br label %sw.epilog
sw.bb15: ; preds = %while.body
%add16 = add nsw i32 %a.035, 8
br label %sw.epilog
sw.bb17: ; preds = %while.body
%add18 = add nsw i32 %a.035, 9
br label %sw.epilog
sw.epilog: ; preds = %while.body, %sw.bb17, %sw.bb15, %sw.bb13, %sw.bb11, %sw.bb9, %sw.bb7, %sw.bb5, %sw.bb3, %sw.bb
%a.1 = phi i32 [ %a.035, %while.body ], [ %add18, %sw.bb17 ], [ %add16, %sw.bb15 ], [ %add14, %sw.bb13 ], [ %add12, %sw.bb11 ], [ %add10, %sw.bb9 ], [ %add8, %sw.bb7 ], [ %add6, %sw.bb5 ], [ %add4, %sw.bb3 ], [ %add, %sw.bb ]
%cmp.not = icmp eq i8 %0, 10
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !8
while.end: ; preds = %sw.epilog
%cmp19.not = icmp eq i32 %a.1, 0
br i1 %cmp19.not, label %do.end, label %if.then
if.then: ; preds = %while.end
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %a.1)
br label %do.body, !llvm.loop !10
do.end: ; preds = %while.end
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %c) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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>
#include<stdlib.h>
#include<string.h>
int main(void){
char num_str[1002];
int num;
long sum=0;
int i;
char tmp;
while(1){
fgets(num_str,sizeof(num_str),stdin);
if(num_str[0]=='0')break;
for(i=0;i<strlen(num_str)-1;i++){
tmp=num_str[i];
num=atoi(&tmp);
sum=sum+num;
}
printf("%d\n",sum);
sum=0;
memset(num_str,1002,0);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127472/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127472/source.c"
target datalayout = "e-m:e-p270: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 [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_str = alloca [1002 x i8], align 16
%tmp = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1002, ptr nonnull %num_str) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %tmp) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call21 = call ptr @fgets(ptr noundef nonnull %num_str, i32 noundef 1002, ptr noundef %0)
%1 = load i8, ptr %num_str, align 16, !tbaa !9
%cmp22 = icmp eq i8 %1, 48
br i1 %cmp22, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%call415 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num_str) #6
%cmp517.not = icmp eq i64 %call415, 1
br i1 %cmp517.not, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%sum.118 = phi i64 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx7 = getelementptr inbounds [1002 x i8], ptr %num_str, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !9
store i8 %2, ptr %tmp, align 1, !tbaa !9
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #5
%sext = shl i64 %call.i, 32
%conv9 = ashr exact i64 %sext, 32
%add = add nsw i64 %conv9, %sum.118
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num_str) #6
%sub = add i64 %call4, -1
%cmp5 = icmp ugt i64 %sub, %indvars.iv.next
br i1 %cmp5, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %for.cond.preheader
%sum.1.lcssa = phi i64 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sum.1.lcssa)
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %num_str, i32 noundef 1002, ptr noundef %3)
%4 = load i8, ptr %num_str, align 16, !tbaa !9
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %tmp) #5
call void @llvm.lifetime.end.p0(i64 1002, ptr nonnull %num_str) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
char num_str[1002];
int num;
long sum=0;
int i;
char tmp;
while(1)
{
fgets(num_str,sizeof(num_str),stdin);
if(num_str[0]=='0')break;
for(i=0;i<strlen(num_str)-1; i++)
{
tmp=num_str[i];
num=atoi(&tmp);
sum=sum+num;
}
printf("%ld\n",sum);
sum=0;
memset(num_str,1002,0);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127522/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127522/source.c"
target datalayout = "e-m:e-p270: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 [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num_str = alloca [1002 x i8], align 16
%tmp = alloca i8, align 1
call void @llvm.lifetime.start.p0(i64 1002, ptr nonnull %num_str) #5
call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %tmp) #5
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call21 = call ptr @fgets(ptr noundef nonnull %num_str, i32 noundef 1002, ptr noundef %0)
%1 = load i8, ptr %num_str, align 16, !tbaa !9
%cmp22 = icmp eq i8 %1, 48
br i1 %cmp22, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%call415 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num_str) #6
%cmp517.not = icmp eq i64 %call415, 1
br i1 %cmp517.not, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%sum.118 = phi i64 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%arrayidx7 = getelementptr inbounds [1002 x i8], ptr %num_str, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx7, align 1, !tbaa !9
store i8 %2, ptr %tmp, align 1, !tbaa !9
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %tmp, ptr noundef null, i32 noundef 10) #5
%sext = shl i64 %call.i, 32
%conv9 = ashr exact i64 %sext, 32
%add = add nsw i64 %conv9, %sum.118
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%call4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num_str) #6
%sub = add i64 %call4, -1
%cmp5 = icmp ugt i64 %sub, %indvars.iv.next
br i1 %cmp5, label %for.body, label %for.end, !llvm.loop !10
for.end: ; preds = %for.body, %for.cond.preheader
%sum.1.lcssa = phi i64 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sum.1.lcssa)
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %num_str, i32 noundef 1002, ptr noundef %3)
%4 = load i8, ptr %num_str, align 16, !tbaa !9
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %tmp) #5
call void @llvm.lifetime.end.p0(i64 1002, ptr nonnull %num_str) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main (void)
{
char c[1001];
int i,sum;
while(1)
{
scanf("%s",c);
sum=0;
if(c[0]=='0')
{
break;
}
for(i=0;c[i]!='\0';i++)
{
sum+=c[i]-'0';
}
printf("%d\n",sum);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127573/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127573/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%c = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %c) #3
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i8, ptr %c, align 16, !tbaa !5
%cmp17 = icmp eq i8 %0, 48
br i1 %cmp17, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i8 [ %4, %for.end ], [ %0, %entry ]
%cmp4.not13 = icmp eq i8 %1, 0
br i1 %cmp4.not13, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%2 = phi i8 [ %3, %for.body ], [ %1, %for.cond.preheader ]
%sum.015 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%conv3 = sext i8 %2 to i32
%sub = add i32 %sum.015, -48
%add = add i32 %sub, %conv3
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds [1001 x i8], ptr %c, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4.not = icmp eq i8 %3, 0
br i1 %cmp4.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%4 = load i8, ptr %c, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %c) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
char str[1010];
int i,sum;
scanf("%s",str);
while(str[0]!='0'){
i=0; sum=0;
while(str[i]){
sum+=str[i]-'0';i++;
}
printf("%d\n",sum);
scanf("%s",str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127623/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127623/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1010 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1010, ptr nonnull %str) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not18 = icmp eq i8 %0, 48
br i1 %cmp.not18, label %while.end11, label %while.cond2.preheader
while.cond2.preheader: ; preds = %entry, %while.end
%1 = phi i8 [ %4, %while.end ], [ %0, %entry ]
%tobool.not15 = icmp eq i8 %1, 0
br i1 %tobool.not15, label %while.end, label %while.body4
while.body4: ; preds = %while.cond2.preheader, %while.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body4 ], [ 0, %while.cond2.preheader ]
%2 = phi i8 [ %3, %while.body4 ], [ %1, %while.cond2.preheader ]
%sum.017 = phi i32 [ %add, %while.body4 ], [ 0, %while.cond2.preheader ]
%conv7 = sext i8 %2 to i32
%sub = add i32 %sum.017, -48
%add = add i32 %sub, %conv7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [1010 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %while.end, label %while.body4, !llvm.loop !8
while.end: ; preds = %while.body4, %while.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %while.cond2.preheader ], [ %add, %while.body4 ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%4 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not = icmp eq i8 %4, 48
br i1 %cmp.not, label %while.end11, label %while.cond2.preheader, !llvm.loop !10
while.end11: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 1010, ptr nonnull %str) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
int main (void)
{
int sum[1000];
int i;
int j;
int k=0;
char array[1000];
char n[10]={'0','1','2','3','4','5','6','7','8','9'};
for(i=0;i<1000;i++){
sum[i]=0;
}
while(1){
for(i=0;i<1000;i++){
array[i]='0';
}
scanf("%s",array);
if(array[0]=='0'){
break;
}
for(i=0;i<1000;i++){
for(j=0;j<10;j++){
if(n[j]==array[i]){
sum[k]+=j;
}
}
}
k++;
}
for(i=0;i<=k;i++){
if(sum[i]==0){
break;
}
printf("%d\n",sum[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127696/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127696/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%sum = alloca [1000 x i32], align 16
%array = alloca [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %sum) #4
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %array) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %sum, i8 0, i64 4000, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %array, i8 48, i64 1000, i1 false), !tbaa !9
%call99 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %array)
%0 = load i8, ptr %array, align 16, !tbaa !9
%cmp10100 = icmp eq i8 %0, 48
br i1 %cmp10100, label %for.cond39.preheader, label %for.cond12.preheader
for.cond12.preheader: ; preds = %entry, %for.end37
%indvars.iv81102 = phi i64 [ %indvars.iv.next82, %for.end37 ], [ 0, %entry ]
%indvars.iv87101 = phi i32 [ %indvars.iv.next88, %for.end37 ], [ 1, %entry ]
%arrayidx30 = getelementptr inbounds [1000 x i32], ptr %sum, i64 0, i64 %indvars.iv81102
br label %for.cond16.preheader
while.cond.for.cond39.preheader_crit_edge: ; preds = %for.end37
%1 = zext i32 %indvars.iv.next88 to i64
br label %for.cond39.preheader
for.cond39.preheader: ; preds = %while.cond.for.cond39.preheader_crit_edge, %entry
%indvars.iv87.lcssa = phi i64 [ %1, %while.cond.for.cond39.preheader_crit_edge ], [ 1, %entry ]
br label %for.body42
for.cond16.preheader: ; preds = %for.inc32.9.1, %for.cond12.preheader
%indvars.iv = phi i64 [ 0, %for.cond12.preheader ], [ %indvars.iv.next.1, %for.inc32.9.1 ]
%arrayidx24 = getelementptr inbounds [1000 x i8], ptr %array, i64 0, i64 %indvars.iv
%2 = load i8, ptr %arrayidx24, align 2, !tbaa !9
%switch.tableidx = add i8 %2, -49
%3 = icmp ult i8 %switch.tableidx, 9
br i1 %3, label %switch.lookup, label %for.inc32.9
switch.lookup: ; preds = %for.cond16.preheader
%switch.idx.cast = zext i8 %switch.tableidx to i32
%switch.offset = add nuw nsw i32 %switch.idx.cast, 1
%4 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%add.2 = add nsw i32 %4, %switch.offset
store i32 %add.2, ptr %arrayidx30, align 4, !tbaa !5
br label %for.inc32.9
for.inc32.9: ; preds = %for.cond16.preheader, %switch.lookup
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx24.1 = getelementptr inbounds [1000 x i8], ptr %array, i64 0, i64 %indvars.iv.next
%5 = load i8, ptr %arrayidx24.1, align 1, !tbaa !9
%switch.tableidx.1 = add i8 %5, -49
%6 = icmp ult i8 %switch.tableidx.1, 9
br i1 %6, label %switch.lookup.1, label %for.inc32.9.1
switch.lookup.1: ; preds = %for.inc32.9
%switch.idx.cast.1 = zext i8 %switch.tableidx.1 to i32
%switch.offset.1 = add nuw nsw i32 %switch.idx.cast.1, 1
%7 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%add.2.1 = add nsw i32 %7, %switch.offset.1
store i32 %add.2.1, ptr %arrayidx30, align 4, !tbaa !5
br label %for.inc32.9.1
for.inc32.9.1: ; preds = %switch.lookup.1, %for.inc32.9
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 1000
br i1 %exitcond.not.1, label %for.end37, label %for.cond16.preheader, !llvm.loop !10
for.end37: ; preds = %for.inc32.9.1
%indvars.iv.next82 = add nuw i64 %indvars.iv81102, 1
%indvars.iv.next88 = add nuw i32 %indvars.iv87101, 1
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %array, i8 48, i64 1000, i1 false), !tbaa !9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %array)
%8 = load i8, ptr %array, align 16, !tbaa !9
%cmp10 = icmp eq i8 %8, 48
br i1 %cmp10, label %while.cond.for.cond39.preheader_crit_edge, label %for.cond12.preheader
for.body42: ; preds = %for.cond39.preheader, %if.end48
%indvars.iv84 = phi i64 [ 0, %for.cond39.preheader ], [ %indvars.iv.next85, %if.end48 ]
%arrayidx44 = getelementptr inbounds [1000 x i32], ptr %sum, i64 0, i64 %indvars.iv84
%9 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%cmp45 = icmp eq i32 %9, 0
br i1 %cmp45, label %for.end54, label %if.end48
if.end48: ; preds = %for.body42
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
%exitcond89.not = icmp eq i64 %indvars.iv.next85, %indvars.iv87.lcssa
br i1 %exitcond89.not, label %for.end54, label %for.body42, !llvm.loop !12
for.end54: ; preds = %for.body42, %if.end48
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %array) #4
call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %sum) #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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
|
#include <stdio.h>
int main(void)
{
char x[1001];
int sum, i;
while(scanf("%s", &x) != EOF)
{
if(x[0] == '0')
{
return 0;
}
sum = 0;
for(i = 0; x[i] != '\0'; ++i)
{
sum += x[i] - '0';
}
printf("%d\n", sum);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127739/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127739/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %x) #3
%call19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not20 = icmp eq i32 %call19, -1
%0 = load i8, ptr %x, align 16
%cmp121 = icmp eq i8 %0, 48
%or.cond22 = select i1 %cmp.not20, i1 true, i1 %cmp121
br i1 %or.cond22, label %cleanup, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i8 [ %4, %for.end ], [ %0, %entry ]
%cmp5.not16 = icmp eq i8 %1, 0
br i1 %cmp5.not16, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%2 = phi i8 [ %3, %for.body ], [ %1, %for.cond.preheader ]
%sum.017 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%conv4 = sext i8 %2 to i32
%sub = add i32 %sum.017, -48
%add = add i32 %sub, %conv4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [1001 x i8], ptr %x, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5.not = icmp eq i8 %3, 0
br i1 %cmp5.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%cmp.not = icmp eq i32 %call, -1
%4 = load i8, ptr %x, align 16
%cmp1 = icmp eq i8 %4, 48
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp1
br i1 %or.cond, label %cleanup, label %for.cond.preheader, !llvm.loop !10
cleanup: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, 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 = !{!"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){
int i,sum;
char num[1001];
for(;;){
scanf("%s", &num);
if(num[0] == '0') break;
sum = 0;
for(i=0;num[i]!='\0';i++)
sum += num[i] - '0';
printf("%d\n", sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127782/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127782/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %num) #3
%call18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%0 = load i8, ptr %num, align 16, !tbaa !5
%cmp19 = icmp eq i8 %0, 48
br i1 %cmp19, label %for.end11, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.end
%1 = phi i8 [ %4, %for.end ], [ %0, %entry ]
%cmp5.not15 = icmp eq i8 %1, 0
br i1 %cmp5.not15, label %for.end, label %for.body
for.body: ; preds = %for.cond2.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond2.preheader ]
%2 = phi i8 [ %3, %for.body ], [ %1, %for.cond2.preheader ]
%sum.017 = phi i32 [ %add, %for.body ], [ 0, %for.cond2.preheader ]
%conv4 = sext i8 %2 to i32
%sub = add i32 %sum.017, -48
%add = add i32 %sub, %conv4
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [1001 x i8], ptr %num, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%cmp5.not = icmp eq i8 %3, 0
br i1 %cmp5.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %for.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond2.preheader ], [ %add, %for.body ]
%call10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%4 = load i8, ptr %num, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %for.end11, label %for.cond2.preheader
for.end11: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %num) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
char number[1001];
int i, sum;
while(1)
{
scanf("%s", number);
if(number[0]=='0')break;
sum=0;
for(i=0;
number[i]!='\0';
i++)
{
sum+=number[i]-'0';
}
printf("%d\n", sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127832/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127832/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%number = alloca [1001 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %number) #3
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%0 = load i8, ptr %number, align 16, !tbaa !5
%cmp17 = icmp eq i8 %0, 48
br i1 %cmp17, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%1 = phi i8 [ %4, %for.end ], [ %0, %entry ]
%cmp4.not13 = icmp eq i8 %1, 0
br i1 %cmp4.not13, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.cond.preheader ]
%2 = phi i8 [ %3, %for.body ], [ %1, %for.cond.preheader ]
%sum.015 = phi i32 [ %add, %for.body ], [ 0, %for.cond.preheader ]
%conv3 = sext i8 %2 to i32
%sub = add i32 %sum.015, -48
%add = add i32 %sub, %conv3
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx2 = getelementptr inbounds [1001 x i8], ptr %number, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx2, align 1, !tbaa !5
%cmp4.not = icmp eq i8 %3, 0
br i1 %cmp4.not, label %for.end, label %for.body, !llvm.loop !8
for.end: ; preds = %for.body, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number)
%4 = load i8, ptr %number, align 16, !tbaa !5
%cmp = icmp eq i8 %4, 48
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %number) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(void) {
int ch, sum = 0;
while (1) {
ch = getchar();
if ((ch == '0') && (sum == 0)) {
break;
}
if ((ch >= '0') && (ch <= '9')) {
sum += ch - '0';
} else if (sum > 0) {
printf("%d\n", sum);
sum = 0;
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127890/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127890/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i18 = tail call i32 @getc(ptr noundef %0)
%cmp19 = icmp eq i32 %call.i18, 48
br i1 %cmp19, label %while.end, label %if.end
if.end: ; preds = %entry, %if.end10
%call.i21 = phi i32 [ %call.i, %if.end10 ], [ %call.i18, %entry ]
%sum.020 = phi i32 [ %sum.1, %if.end10 ], [ 0, %entry ]
%1 = add i32 %call.i21, -48
%or.cond11 = icmp ult i32 %1, 10
br i1 %or.cond11, label %if.then5, label %if.else
if.then5: ; preds = %if.end
%add = add nsw i32 %1, %sum.020
br label %if.end10
if.else: ; preds = %if.end
%cmp6 = icmp sgt i32 %sum.020, 0
br i1 %cmp6, label %if.then7, label %if.end10
if.then7: ; preds = %if.else
%call8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.020)
br label %if.end10
if.end10: ; preds = %if.else, %if.then7, %if.then5
%sum.1 = phi i32 [ %add, %if.then5 ], [ 0, %if.then7 ], [ %sum.020, %if.else ]
%2 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %2)
%cmp = icmp eq i32 %call.i, 48
%cmp1 = icmp eq i32 %sum.1, 0
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
br i1 %or.cond, label %while.end, label %if.end
while.end: ; preds = %if.end10, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(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" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(){
char num[1005];
int sum, i;
while(1){
scanf("%s", &num);
sum = 0;
i = strlen(num);
if(i == 1 && num[0] == '0') break;
for(i=i-1;i>=0;i--){
sum += num[i] - '0';
}
printf("%d\n", sum);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127933/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127933/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca [1005 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1005, ptr nonnull %num) #5
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%call121 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num) #6
%conv22 = trunc i64 %call121 to i32
%cmp23 = icmp eq i32 %conv22, 1
%0 = load i8, ptr %num, align 16
%cmp424 = icmp eq i8 %0, 48
%or.cond25 = select i1 %cmp23, i1 %cmp424, i1 false
br i1 %or.cond25, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%conv26 = phi i32 [ %conv, %for.end ], [ %conv22, %entry ]
%cmp617 = icmp sgt i32 %conv26, 0
br i1 %cmp617, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%1 = zext i32 %conv26 to i64
%min.iters.check = icmp ult i32 %conv26, 16
br i1 %min.iters.check, label %for.body.preheader31, label %vector.scevcheck
vector.scevcheck: ; preds = %for.body.preheader
%2 = add nsw i64 %1, -1
%3 = add i32 %conv26, -1
%4 = trunc i64 %2 to i32
%5 = icmp ult i32 %3, %4
%6 = icmp ugt i64 %2, 4294967295
%7 = or i1 %5, %6
br i1 %7, label %for.body.preheader31, label %vector.ph
vector.ph: ; preds = %vector.scevcheck
%n.vec = and i64 %1, 4294967288
%ind.end = and i64 %1, 7
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 ], [ %18, %vector.body ]
%vec.phi28 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%8 = xor i64 %index, -1
%9 = add i64 %8, %1
%10 = and i64 %9, 4294967295
%11 = getelementptr inbounds [1005 x i8], ptr %num, i64 0, i64 %10
%12 = getelementptr inbounds i8, ptr %11, i64 -3
%wide.load = load <4 x i8>, ptr %12, align 1, !tbaa !5
%reverse = shufflevector <4 x i8> %wide.load, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%13 = getelementptr inbounds i8, ptr %11, i64 -7
%wide.load29 = load <4 x i8>, ptr %13, align 1, !tbaa !5
%reverse30 = shufflevector <4 x i8> %wide.load29, <4 x i8> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%14 = sext <4 x i8> %reverse to <4 x i32>
%15 = sext <4 x i8> %reverse30 to <4 x i32>
%16 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%17 = add <4 x i32> %vec.phi28, <i32 -48, i32 -48, i32 -48, i32 -48>
%18 = add <4 x i32> %16, %14
%19 = add <4 x i32> %17, %15
%index.next = add nuw i64 %index, 8
%20 = icmp eq i64 %index.next, %n.vec
br i1 %20, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %19, %18
%21 = 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 %for.end, label %for.body.preheader31
for.body.preheader31: ; preds = %vector.scevcheck, %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %1, %vector.scevcheck ], [ %1, %for.body.preheader ], [ %ind.end, %middle.block ]
%sum.018.ph = phi i32 [ 0, %vector.scevcheck ], [ 0, %for.body.preheader ], [ %21, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader31, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader31 ]
%sum.018 = phi i32 [ %add, %for.body ], [ %sum.018.ph, %for.body.preheader31 ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%idxprom = and i64 %indvars.iv.next, 4294967295
%arrayidx8 = getelementptr inbounds [1005 x i8], ptr %num, i64 0, i64 %idxprom
%22 = load i8, ptr %arrayidx8, align 1, !tbaa !5
%conv9 = sext i8 %22 to i32
%sub10 = add i32 %sum.018, -48
%add = add i32 %sub10, %conv9
%cmp6 = icmp ugt i64 %indvars.iv, 1
br i1 %cmp6, label %for.body, label %for.end, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %21, %middle.block ], [ %add, %for.body ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num)
%call1 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %num) #6
%conv = trunc i64 %call1 to i32
%cmp = icmp eq i32 %conv, 1
%23 = load i8, ptr %num, align 16
%cmp4 = icmp eq i8 %23, 48
%or.cond = select i1 %cmp, i1 %cmp4, i1 false
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 1005, ptr nonnull %num) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define NUM_LIMIT 1001
#define ARR_LIMIT 200
void SumString(char number[][NUM_LIMIT], int *result, int size);
int main(void) {
int idx;
char input[NUM_LIMIT];
char arr[ARR_LIMIT][NUM_LIMIT];
int* result;
int size;
for (size = 0; size < ARR_LIMIT; size++) {
scanf("%s", input);
if (*input == '0') {
break;
}
int i = 0;
do {
arr[size][i] = *(input + i);
i++;
} while (*(input + i) != '\0');
}
result = (int*)malloc(sizeof(int) * size);
SumString(arr, result, size);
for (idx = 0; idx < size; idx++) {
printf("%d\n", *(result + idx));
}
free(result);
}
void SumString(char number[][NUM_LIMIT], int *result, int size) {
int idx;
for (idx = 0; idx < size; idx++) {
char* tmpC = number[idx];
int tmpSum = 0;
do {
tmpSum += (int)(*tmpC - 48);
} while (*++tmpC != '\0');
*result++ = tmpSum;
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_127977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_127977/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%input = alloca [1001 x i8], align 16
%arr = alloca [200 x [1001 x i8]], align 16
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %input) #6
call void @llvm.lifetime.start.p0(i64 200200, ptr nonnull %arr) #6
br label %for.body
for.body: ; preds = %entry, %do.end
%indvars.iv43 = phi i64 [ 0, %entry ], [ %indvars.iv.next44, %do.end ]
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i8, ptr %input, align 16, !tbaa !5
%cmp2 = icmp eq i8 %0, 48
br i1 %cmp2, label %for.end, label %do.body
do.body: ; preds = %for.body, %do.body
%1 = phi i8 [ %2, %do.body ], [ %0, %for.body ]
%indvars.iv = phi i64 [ %indvars.iv.next, %do.body ], [ 0, %for.body ]
%arrayidx6 = getelementptr inbounds [200 x [1001 x i8]], ptr %arr, i64 0, i64 %indvars.iv43, i64 %indvars.iv
store i8 %1, ptr %arrayidx6, align 1, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%add.ptr9 = getelementptr inbounds i8, ptr %input, i64 %indvars.iv.next
%2 = load i8, ptr %add.ptr9, align 1, !tbaa !5
%cmp11.not = icmp eq i8 %2, 0
br i1 %cmp11.not, label %do.end, label %do.body, !llvm.loop !8
do.end: ; preds = %do.body
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%exitcond.not = icmp eq i64 %indvars.iv.next44, 200
br i1 %exitcond.not, label %for.end.thread, label %for.body, !llvm.loop !10
for.end.thread: ; preds = %do.end
%call1553 = call noalias dereferenceable_or_null(800) ptr @malloc(i64 noundef 800) #7
br label %for.body.i.preheader
for.end: ; preds = %for.body
%conv14 = and i64 %indvars.iv43, 4294967295
%mul = shl nuw nsw i64 %conv14, 2
%call15 = call noalias ptr @malloc(i64 noundef %mul) #7
%3 = and i64 %indvars.iv43, 4294967295
%cmp9.i.not = icmp eq i64 %3, 0
br i1 %cmp9.i.not, label %for.end26, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.end.thread, %for.end
%call1557 = phi ptr [ %call1553, %for.end.thread ], [ %call15, %for.end ]
%conv1455 = phi i64 [ 200, %for.end.thread ], [ %conv14, %for.end ]
%xtraiter = and i64 %conv1455, 1
%4 = icmp eq i64 %conv1455, 1
br i1 %4, label %for.body20.preheader.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %conv1455, 4294967294
br label %for.body.i
for.body.i: ; preds = %do.end.i.1, %for.body.i.preheader.new
%indvars.iv.i = phi i64 [ 0, %for.body.i.preheader.new ], [ %indvars.iv.next.i.1, %do.end.i.1 ]
%result.addr.010.i = phi ptr [ %call1557, %for.body.i.preheader.new ], [ %incdec.ptr4.i.1, %do.end.i.1 ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %do.end.i.1 ]
%arrayidx.i = getelementptr inbounds [1001 x i8], ptr %arr, i64 %indvars.iv.i
%.pre.i = load i8, ptr %arrayidx.i, align 2, !tbaa !5
br label %do.body.i
do.body.i: ; preds = %do.body.i, %for.body.i
%5 = phi i8 [ %.pre.i, %for.body.i ], [ %6, %do.body.i ]
%tmpC.0.i = phi ptr [ %arrayidx.i, %for.body.i ], [ %incdec.ptr.i, %do.body.i ]
%tmpSum.0.i = phi i32 [ 0, %for.body.i ], [ %add.i, %do.body.i ]
%conv.i = sext i8 %5 to i32
%sub.i = add nsw i32 %conv.i, -48
%add.i = add i32 %sub.i, %tmpSum.0.i
%incdec.ptr.i = getelementptr inbounds i8, ptr %tmpC.0.i, i64 1
%6 = load i8, ptr %incdec.ptr.i, align 1, !tbaa !5
%cmp2.not.i = icmp eq i8 %6, 0
br i1 %cmp2.not.i, label %do.end.i, label %do.body.i, !llvm.loop !11
do.end.i: ; preds = %do.body.i
%incdec.ptr4.i = getelementptr inbounds i32, ptr %result.addr.010.i, i64 1
store i32 %add.i, ptr %result.addr.010.i, align 4, !tbaa !12
%indvars.iv.next.i = or i64 %indvars.iv.i, 1
%arrayidx.i.1 = getelementptr inbounds [1001 x i8], ptr %arr, i64 %indvars.iv.next.i
%.pre.i.1 = load i8, ptr %arrayidx.i.1, align 1, !tbaa !5
br label %do.body.i.1
do.body.i.1: ; preds = %do.body.i.1, %do.end.i
%7 = phi i8 [ %.pre.i.1, %do.end.i ], [ %8, %do.body.i.1 ]
%tmpC.0.i.1 = phi ptr [ %arrayidx.i.1, %do.end.i ], [ %incdec.ptr.i.1, %do.body.i.1 ]
%tmpSum.0.i.1 = phi i32 [ 0, %do.end.i ], [ %add.i.1, %do.body.i.1 ]
%conv.i.1 = sext i8 %7 to i32
%sub.i.1 = add nsw i32 %conv.i.1, -48
%add.i.1 = add i32 %sub.i.1, %tmpSum.0.i.1
%incdec.ptr.i.1 = getelementptr inbounds i8, ptr %tmpC.0.i.1, i64 1
%8 = load i8, ptr %incdec.ptr.i.1, align 1, !tbaa !5
%cmp2.not.i.1 = icmp eq i8 %8, 0
br i1 %cmp2.not.i.1, label %do.end.i.1, label %do.body.i.1, !llvm.loop !11
do.end.i.1: ; preds = %do.body.i.1
%incdec.ptr4.i.1 = getelementptr inbounds i32, ptr %result.addr.010.i, i64 2
store i32 %add.i.1, ptr %incdec.ptr4.i, align 4, !tbaa !12
%indvars.iv.next.i.1 = add nuw nsw i64 %indvars.iv.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.body20.preheader.unr-lcssa, label %for.body.i, !llvm.loop !14
for.body20.preheader.unr-lcssa: ; preds = %do.end.i.1, %for.body.i.preheader
%indvars.iv.i.unr = phi i64 [ 0, %for.body.i.preheader ], [ %indvars.iv.next.i.1, %do.end.i.1 ]
%result.addr.010.i.unr = phi ptr [ %call1557, %for.body.i.preheader ], [ %incdec.ptr4.i.1, %do.end.i.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body20.preheader, label %for.body.i.epil
for.body.i.epil: ; preds = %for.body20.preheader.unr-lcssa
%arrayidx.i.epil = getelementptr inbounds [1001 x i8], ptr %arr, i64 %indvars.iv.i.unr
%.pre.i.epil = load i8, ptr %arrayidx.i.epil, align 1, !tbaa !5
br label %do.body.i.epil
do.body.i.epil: ; preds = %do.body.i.epil, %for.body.i.epil
%9 = phi i8 [ %.pre.i.epil, %for.body.i.epil ], [ %10, %do.body.i.epil ]
%tmpC.0.i.epil = phi ptr [ %arrayidx.i.epil, %for.body.i.epil ], [ %incdec.ptr.i.epil, %do.body.i.epil ]
%tmpSum.0.i.epil = phi i32 [ 0, %for.body.i.epil ], [ %add.i.epil, %do.body.i.epil ]
%conv.i.epil = sext i8 %9 to i32
%sub.i.epil = add nsw i32 %conv.i.epil, -48
%add.i.epil = add i32 %sub.i.epil, %tmpSum.0.i.epil
%incdec.ptr.i.epil = getelementptr inbounds i8, ptr %tmpC.0.i.epil, i64 1
%10 = load i8, ptr %incdec.ptr.i.epil, align 1, !tbaa !5
%cmp2.not.i.epil = icmp eq i8 %10, 0
br i1 %cmp2.not.i.epil, label %do.end.i.epil, label %do.body.i.epil, !llvm.loop !11
do.end.i.epil: ; preds = %do.body.i.epil
store i32 %add.i.epil, ptr %result.addr.010.i.unr, align 4, !tbaa !12
br label %for.body20.preheader
for.body20.preheader: ; preds = %for.body20.preheader.unr-lcssa, %do.end.i.epil
br label %for.body20
for.body20: ; preds = %for.body20.preheader, %for.body20
%indvars.iv46 = phi i64 [ %indvars.iv.next47, %for.body20 ], [ 0, %for.body20.preheader ]
%add.ptr22 = getelementptr inbounds i32, ptr %call1557, i64 %indvars.iv46
%11 = load i32, ptr %add.ptr22, align 4, !tbaa !12
%call23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
%indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
%exitcond49.not = icmp eq i64 %indvars.iv.next47, %conv1455
br i1 %exitcond49.not, label %for.end26, label %for.body20, !llvm.loop !15
for.end26: ; preds = %for.body20, %for.end
%call155864 = phi ptr [ %call15, %for.end ], [ %call1557, %for.body20 ]
call void @free(ptr noundef %call155864) #6
call void @llvm.lifetime.end.p0(i64 200200, ptr nonnull %arr) #6
call void @llvm.lifetime.end.p0(i64 1001, 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
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: 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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @SumString(ptr nocapture noundef readonly %number, ptr nocapture noundef writeonly %result, i32 noundef %size) local_unnamed_addr #4 {
entry:
%cmp9 = icmp sgt i32 %size, 0
br i1 %cmp9, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %size to i64
%xtraiter = and i64 %wide.trip.count, 1
%0 = icmp eq i32 %size, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967294
br label %for.body
for.body: ; preds = %do.end.1, %for.body.preheader.new
%indvars.iv = phi i64 [ 0, %for.body.preheader.new ], [ %indvars.iv.next.1, %do.end.1 ]
%result.addr.010 = phi ptr [ %result, %for.body.preheader.new ], [ %incdec.ptr4.1, %do.end.1 ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.1, %do.end.1 ]
%arrayidx = getelementptr inbounds [1001 x i8], ptr %number, i64 %indvars.iv
%.pre = load i8, ptr %arrayidx, align 1, !tbaa !5
br label %do.body
do.body: ; preds = %do.body, %for.body
%1 = phi i8 [ %.pre, %for.body ], [ %2, %do.body ]
%tmpC.0 = phi ptr [ %arrayidx, %for.body ], [ %incdec.ptr, %do.body ]
%tmpSum.0 = phi i32 [ 0, %for.body ], [ %add, %do.body ]
%conv = sext i8 %1 to i32
%sub = add i32 %tmpSum.0, -48
%add = add i32 %sub, %conv
%incdec.ptr = getelementptr inbounds i8, ptr %tmpC.0, i64 1
%2 = load i8, ptr %incdec.ptr, align 1, !tbaa !5
%cmp2.not = icmp eq i8 %2, 0
br i1 %cmp2.not, label %do.end, label %do.body, !llvm.loop !11
do.end: ; preds = %do.body
%incdec.ptr4 = getelementptr inbounds i32, ptr %result.addr.010, i64 1
store i32 %add, ptr %result.addr.010, align 4, !tbaa !12
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx.1 = getelementptr inbounds [1001 x i8], ptr %number, i64 %indvars.iv.next
%.pre.1 = load i8, ptr %arrayidx.1, align 1, !tbaa !5
br label %do.body.1
do.body.1: ; preds = %do.body.1, %do.end
%3 = phi i8 [ %.pre.1, %do.end ], [ %4, %do.body.1 ]
%tmpC.0.1 = phi ptr [ %arrayidx.1, %do.end ], [ %incdec.ptr.1, %do.body.1 ]
%tmpSum.0.1 = phi i32 [ 0, %do.end ], [ %add.1, %do.body.1 ]
%conv.1 = sext i8 %3 to i32
%sub.1 = add i32 %tmpSum.0.1, -48
%add.1 = add i32 %sub.1, %conv.1
%incdec.ptr.1 = getelementptr inbounds i8, ptr %tmpC.0.1, i64 1
%4 = load i8, ptr %incdec.ptr.1, align 1, !tbaa !5
%cmp2.not.1 = icmp eq i8 %4, 0
br i1 %cmp2.not.1, label %do.end.1, label %do.body.1, !llvm.loop !11
do.end.1: ; preds = %do.body.1
%incdec.ptr4.1 = getelementptr inbounds i32, ptr %result.addr.010, i64 2
store i32 %add.1, ptr %incdec.ptr4, align 4, !tbaa !12
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !14
for.end.loopexit.unr-lcssa: ; preds = %do.end.1, %for.body.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next.1, %do.end.1 ]
%result.addr.010.unr = phi ptr [ %result, %for.body.preheader ], [ %incdec.ptr4.1, %do.end.1 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%arrayidx.epil = getelementptr inbounds [1001 x i8], ptr %number, i64 %indvars.iv.unr
%.pre.epil = load i8, ptr %arrayidx.epil, align 1, !tbaa !5
br label %do.body.epil
do.body.epil: ; preds = %do.body.epil, %for.body.epil
%5 = phi i8 [ %.pre.epil, %for.body.epil ], [ %6, %do.body.epil ]
%tmpC.0.epil = phi ptr [ %arrayidx.epil, %for.body.epil ], [ %incdec.ptr.epil, %do.body.epil ]
%tmpSum.0.epil = phi i32 [ 0, %for.body.epil ], [ %add.epil, %do.body.epil ]
%conv.epil = sext i8 %5 to i32
%sub.epil = add i32 %tmpSum.0.epil, -48
%add.epil = add i32 %sub.epil, %conv.epil
%incdec.ptr.epil = getelementptr inbounds i8, ptr %tmpC.0.epil, i64 1
%6 = load i8, ptr %incdec.ptr.epil, align 1, !tbaa !5
%cmp2.not.epil = icmp eq i8 %6, 0
br i1 %cmp2.not.epil, label %do.end.epil, label %do.body.epil, !llvm.loop !11
do.end.epil: ; preds = %do.body.epil
store i32 %add.epil, ptr %result.addr.010.unr, align 4, !tbaa !12
br label %for.end
for.end: ; preds = %do.end.epil, %for.end.loopexit.unr-lcssa, %entry
ret void
}
; 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 #5
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !6, i64 0}
!14 = distinct !{!14, !9}
!15 = distinct !{!15, !9}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
const int N = 1300;
int main (void)
{
char str[N];
while(fgets(str, 1300 , stdin))
{
int sum = 0;
if(str[0] == '0')
{
break;
}
for(int i = 0 ; i < strlen(str)-1 ; i++)
{
sum += str[i] - '0';
}
printf("%d\n" , sum);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128019/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128019/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@N = dso_local local_unnamed_addr constant i32 1300, align 4
@stdin = external local_unnamed_addr global ptr, align 8
@.str = 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:
%vla14 = alloca [1300 x i8], align 16
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call21 = call ptr @fgets(ptr noundef nonnull %vla14, i32 noundef 1300, ptr noundef %0)
%tobool.not22 = icmp eq ptr %call21, null
%1 = load i8, ptr %vla14, align 16
%cmp23 = icmp eq i8 %1, 48
%or.cond24 = select i1 %tobool.not22, i1 true, i1 %cmp23
br i1 %or.cond24, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %cleanup
%call3 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %vla14) #4
%sub = add i64 %call3, -1
%cmp417.not = icmp eq i64 %sub, 0
br i1 %cmp417.not, label %cleanup, label %for.body.preheader
for.body.preheader: ; preds = %for.cond.preheader
%min.iters.check = icmp ult i64 %sub, 8
br i1 %min.iters.check, label %for.body.preheader28, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %sub, -8
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 ], [ %8, %vector.body ]
%vec.phi26 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%2 = getelementptr inbounds i8, ptr %vla14, i64 %index
%wide.load = load <4 x i8>, ptr %2, align 8, !tbaa !9
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load27 = load <4 x i8>, ptr %3, align 4, !tbaa !9
%4 = sext <4 x i8> %wide.load to <4 x i32>
%5 = sext <4 x i8> %wide.load27 to <4 x i32>
%6 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%7 = add <4 x i32> %vec.phi26, <i32 -48, i32 -48, i32 -48, i32 -48>
%8 = add <4 x i32> %6, %4
%9 = add <4 x i32> %7, %5
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !10
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %sub, %n.vec
br i1 %cmp.n, label %cleanup, label %for.body.preheader28
for.body.preheader28: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%sum.018.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader28, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader28 ]
%sum.018 = phi i32 [ %add, %for.body ], [ %sum.018.ph, %for.body.preheader28 ]
%arrayidx6 = getelementptr inbounds i8, ptr %vla14, i64 %indvars.iv
%12 = load i8, ptr %arrayidx6, align 1, !tbaa !9
%conv7 = sext i8 %12 to i32
%sub8 = add i32 %sum.018, -48
%add = add i32 %sub8, %conv7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %sub
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !14
cleanup: ; preds = %for.body, %middle.block, %for.cond.preheader
%sum.0.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %11, %middle.block ], [ %add, %for.body ]
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sum.0.lcssa)
%13 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %vla14, i32 noundef 1300, ptr noundef %13)
%tobool.not = icmp eq ptr %call, null
%14 = load i8, ptr %vla14, align 16
%cmp = icmp eq i8 %14, 48
%or.cond = select i1 %tobool.not, i1 true, i1 %cmp
br i1 %or.cond, label %while.end, label %for.cond.preheader
while.end: ; preds = %cleanup, %entry
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11, !12, !13}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !11, !13, !12}
|
#include<stdio.h>
int main(void){
char str[1010];
int i,sum;
scanf("%s",str);
while(str[0]!='0'){
i=0;
sum=0;
while(str[i]){
sum+=str[i]-'0';
i++;
}
printf("%d\n",sum);
scanf("%s",str);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128062/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128062/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1010 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1010, ptr nonnull %str) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%0 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not18 = icmp eq i8 %0, 48
br i1 %cmp.not18, label %while.end11, label %while.cond2.preheader
while.cond2.preheader: ; preds = %entry, %while.end
%1 = phi i8 [ %4, %while.end ], [ %0, %entry ]
%tobool.not15 = icmp eq i8 %1, 0
br i1 %tobool.not15, label %while.end, label %while.body4
while.body4: ; preds = %while.cond2.preheader, %while.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body4 ], [ 0, %while.cond2.preheader ]
%2 = phi i8 [ %3, %while.body4 ], [ %1, %while.cond2.preheader ]
%sum.017 = phi i32 [ %add, %while.body4 ], [ 0, %while.cond2.preheader ]
%conv7 = sext i8 %2 to i32
%sub = add i32 %sum.017, -48
%add = add i32 %sub, %conv7
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx3 = getelementptr inbounds [1010 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%3 = load i8, ptr %arrayidx3, align 1, !tbaa !5
%tobool.not = icmp eq i8 %3, 0
br i1 %tobool.not, label %while.end, label %while.body4, !llvm.loop !8
while.end: ; preds = %while.body4, %while.cond2.preheader
%sum.0.lcssa = phi i32 [ 0, %while.cond2.preheader ], [ %add, %while.body4 ]
%call8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
%call10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%4 = load i8, ptr %str, align 16, !tbaa !5
%cmp.not = icmp eq i8 %4, 48
br i1 %cmp.not, label %while.end11, label %while.cond2.preheader, !llvm.loop !10
while.end11: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 1010, ptr nonnull %str) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
|
#include <stdio.h>
int main(void){
char x[1000];
int y = 0;
int j = 0;
int q, k;
while(1){
scanf("%c", &x[j]);
if(x[0] == '0')
break;
if(x[j] == 10){
for(q = 0; q < j; q++){
y += (x[q] - '0');
}
printf("%d\n", y);
j = 0;
y = 0;
continue;
}
j++;
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128105/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128105/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%c\00", align 1
@.str.1 = private unnamed_addr constant [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 [1000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %x) #4
%call26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%0 = load i8, ptr %x, align 16, !tbaa !5
%cmp27 = icmp eq i8 %0, 48
br i1 %cmp27, label %while.end, label %if.end
if.endthread-pre-split: ; preds = %while.cond.backedge
%.pr = load i8, ptr %arrayidx, align 1, !tbaa !5
br label %if.end
if.end: ; preds = %entry, %if.endthread-pre-split
%1 = phi i8 [ %.pr, %if.endthread-pre-split ], [ %0, %entry ]
%j.028 = phi i32 [ %j.0.be, %if.endthread-pre-split ], [ 0, %entry ]
%cmp6 = icmp eq i8 %1, 10
br i1 %cmp6, label %for.cond.preheader, label %if.end15
for.cond.preheader: ; preds = %if.end
%cmp923 = icmp sgt i32 %j.028, 0
br i1 %cmp923, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %j.028 to i64
%min.iters.check = icmp ult i32 %j.028, 8
br i1 %min.iters.check, label %for.body.preheader33, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %8, %vector.body ]
%vec.phi31 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
%2 = getelementptr inbounds [1000 x i8], ptr %x, i64 0, i64 %index
%wide.load = load <4 x i8>, ptr %2, align 8, !tbaa !5
%3 = getelementptr inbounds i8, ptr %2, i64 4
%wide.load32 = load <4 x i8>, ptr %3, align 4, !tbaa !5
%4 = sext <4 x i8> %wide.load to <4 x i32>
%5 = sext <4 x i8> %wide.load32 to <4 x i32>
%6 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%7 = add <4 x i32> %vec.phi31, <i32 -48, i32 -48, i32 -48, i32 -48>
%8 = add <4 x i32> %6, %4
%9 = add <4 x i32> %7, %5
%index.next = add nuw i64 %index, 8
%10 = icmp eq i64 %index.next, %n.vec
br i1 %10, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader33
for.body.preheader33: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%y.125.ph = phi i32 [ 0, %for.body.preheader ], [ %11, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader33, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader33 ]
%y.125 = phi i32 [ %add, %for.body ], [ %y.125.ph, %for.body.preheader33 ]
%arrayidx12 = getelementptr inbounds [1000 x i8], ptr %x, i64 0, i64 %indvars.iv
%12 = load i8, ptr %arrayidx12, align 1, !tbaa !5
%conv13 = sext i8 %12 to i32
%sub = add i32 %y.125, -48
%add = add i32 %sub, %conv13
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !12
for.end: ; preds = %for.body, %middle.block, %for.cond.preheader
%y.1.lcssa = phi i32 [ 0, %for.cond.preheader ], [ %11, %middle.block ], [ %add, %for.body ]
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %y.1.lcssa)
br label %while.cond.backedge
while.cond.backedge: ; preds = %for.end, %if.end15
%j.0.be = phi i32 [ 0, %for.end ], [ %inc16, %if.end15 ]
%idxprom = sext i32 %j.0.be to i64
%arrayidx = getelementptr inbounds [1000 x i8], ptr %x, i64 0, i64 %idxprom
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%13 = load i8, ptr %x, align 16, !tbaa !5
%cmp = icmp eq i8 %13, 48
br i1 %cmp, label %while.end, label %if.endthread-pre-split
if.end15: ; preds = %if.end
%inc16 = add nsw i32 %j.028, 1
br label %while.cond.backedge
while.end: ; preds = %while.cond.backedge, %entry
call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %x) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
|
#include<stdio.h>
#include<string.h>
#define LEN 2000
int toSum(char*);
int main(void)
{
char str[LEN];
int sum;
for(;;)
{
scanf("%s",str);
sum=toSum(str);
if(sum==0) break;
else printf("%d\n",sum);
}
return 0;
}
int toSum(char *str)
{
int i;
int len=strlen(str);
int ret=0;
for(i=0;i<len;i++) ret+=str[i]-'0';
return ret;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128149/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128149/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [2000 x i8], align 16
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %str) #6
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%call.i8 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%conv.i9 = trunc i64 %call.i8 to i32
%cmp7.i10 = icmp sgt i32 %conv.i9, 0
br i1 %cmp7.i10, label %for.body.preheader.i, label %for.end
for.body.preheader.i: ; preds = %entry, %if.else
%call.i11 = phi i64 [ %call.i, %if.else ], [ %call.i8, %entry ]
%wide.trip.count.i = and i64 %call.i11, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count.i, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.preheader.i
%n.mod.vf = and i64 %call.i11, 7
%n.vec = sub nsw i64 %wide.trip.count.i, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi12 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%0 = getelementptr inbounds i8, ptr %str, i64 %index
%wide.load = load <4 x i8>, ptr %0, align 8, !tbaa !5
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load13 = load <4 x i8>, ptr %1, align 4, !tbaa !5
%2 = sext <4 x i8> %wide.load to <4 x i32>
%3 = sext <4 x i8> %wide.load13 to <4 x i32>
%4 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%5 = add <4 x i32> %vec.phi12, <i32 -48, i32 -48, i32 -48, i32 -48>
%6 = add <4 x i32> %4, %2
%7 = add <4 x i32> %5, %3
%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 !8
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.mod.vf, 0
br i1 %cmp.n, label %toSum.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 0, %for.body.preheader.i ], [ %n.vec, %middle.block ]
%ret.09.i.ph = phi i32 [ 0, %for.body.preheader.i ], [ %9, %middle.block ]
br label %for.body.i
for.body.i: ; preds = %for.body.i.preheader, %for.body.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.body.i ], [ %indvars.iv.i.ph, %for.body.i.preheader ]
%ret.09.i = phi i32 [ %add.i, %for.body.i ], [ %ret.09.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i8, ptr %str, i64 %indvars.iv.i
%10 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%conv2.i = sext i8 %10 to i32
%sub.i = add i32 %ret.09.i, -48
%add.i = add i32 %sub.i, %conv2.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %toSum.exit, label %for.body.i, !llvm.loop !12
toSum.exit: ; preds = %for.body.i, %middle.block
%add.i.lcssa = phi i32 [ %9, %middle.block ], [ %add.i, %for.body.i ]
%cmp = icmp eq i32 %add.i.lcssa, 0
br i1 %cmp, label %for.end, label %if.else
if.else: ; preds = %toSum.exit
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add.i.lcssa)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %str)
%call.i = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%conv.i = trunc i64 %call.i to i32
%cmp7.i = icmp sgt i32 %conv.i, 0
br i1 %cmp7.i, label %for.body.preheader.i, label %for.end
for.end: ; preds = %toSum.exit, %if.else, %entry
call void @llvm.lifetime.end.p0(i64 2000, ptr nonnull %str) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind memory(argmem: read) uwtable
define dso_local i32 @toSum(ptr nocapture noundef readonly %str) local_unnamed_addr #3 {
entry:
%call = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%conv = trunc i64 %call to i32
%cmp7 = icmp sgt i32 %conv, 0
br i1 %cmp7, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call, 4294967295
%min.iters.check = icmp ult i64 %wide.trip.count, 8
br i1 %min.iters.check, label %for.body.preheader13, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.mod.vf = and i64 %call, 7
%n.vec = sub nsw i64 %wide.trip.count, %n.mod.vf
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi11 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%0 = getelementptr inbounds i8, ptr %str, i64 %index
%wide.load = load <4 x i8>, ptr %0, align 1, !tbaa !5
%1 = getelementptr inbounds i8, ptr %0, i64 4
%wide.load12 = load <4 x i8>, ptr %1, align 1, !tbaa !5
%2 = sext <4 x i8> %wide.load to <4 x i32>
%3 = sext <4 x i8> %wide.load12 to <4 x i32>
%4 = add <4 x i32> %vec.phi, <i32 -48, i32 -48, i32 -48, i32 -48>
%5 = add <4 x i32> %vec.phi11, <i32 -48, i32 -48, i32 -48, i32 -48>
%6 = add <4 x i32> %4, %2
%7 = add <4 x i32> %5, %3
%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 !13
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %7, %6
%9 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.mod.vf, 0
br i1 %cmp.n, label %for.end, label %for.body.preheader13
for.body.preheader13: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%ret.09.ph = phi i32 [ 0, %for.body.preheader ], [ %9, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader13, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader13 ]
%ret.09 = phi i32 [ %add, %for.body ], [ %ret.09.ph, %for.body.preheader13 ]
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %indvars.iv
%10 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv2 = sext i8 %10 to i32
%sub = add i32 %ret.09, -48
%add = add i32 %sub, %conv2
%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 !14
for.end: ; preds = %for.body, %middle.block, %entry
%ret.0.lcssa = phi i32 [ 0, %entry ], [ %9, %middle.block ], [ %add, %for.body ]
ret i32 %ret.0.lcssa
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = distinct !{!13, !9, !10, !11}
!14 = distinct !{!14, !9, !11, !10}
|
#include <stdio.h>
int main(void){
int a,b,i;
int c[200000];
scanf("%d",&a);
for(i=0;i<a;i++){
c[i]=0;
}
for(i=0;i<a-1;i++){
scanf("%d",&b);
c[b-1]++;
}
for(i=0;i<a;i++){
printf("%d\n",c[i]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128192/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128192/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %0, 0
br i1 %cmp28, label %for.cond1.preheader, label %for.end20
for.cond1.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %c, i8 0, i64 %2, i1 false), !tbaa !5
%cmp231.not = icmp eq i32 %0, 1
br i1 %cmp231.not, label %for.body14.preheader, label %for.body3
for.cond12.preheader: ; preds = %for.body3
%cmp1333 = icmp sgt i32 %5, 0
br i1 %cmp1333, label %for.body14.preheader, label %for.end20
for.body14.preheader: ; preds = %for.cond1.preheader, %for.cond12.preheader
br label %for.body14
for.body3: ; preds = %for.cond1.preheader, %for.body3
%i.132 = phi i32 [ %inc10, %for.body3 ], [ 0, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%3 = load i32, ptr %b, align 4, !tbaa !5
%sub5 = add nsw i32 %3, -1
%idxprom6 = sext i32 %sub5 to i64
%arrayidx7 = getelementptr inbounds [200000 x i32], ptr %c, i64 0, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%inc8 = add nsw i32 %4, 1
store i32 %inc8, ptr %arrayidx7, align 4, !tbaa !5
%inc10 = add nuw nsw i32 %i.132, 1
%5 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %5, -1
%cmp2 = icmp slt i32 %inc10, %sub
br i1 %cmp2, label %for.body3, label %for.cond12.preheader, !llvm.loop !9
for.body14: ; preds = %for.body14.preheader, %for.body14
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body14 ], [ 0, %for.body14.preheader ]
%arrayidx16 = getelementptr inbounds [200000 x i32], ptr %c, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = load i32, ptr %a, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp13 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp13, label %for.body14, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.body14, %entry, %for.cond12.preheader
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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}
|
#include<stdio.h>
int main(void){
int N,i;
int A[200000];
int B[200000]={0};
scanf("%d",&N);
for(i=0;i<N-1;i++){
scanf("%d",&A[i]);
B[A[i]-1]=B[A[i]-1]+1;}
for(i=0;i<N;i++)
printf("%d\n",B[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128235/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128235/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [200000 x i32], align 16
%B = alloca [200000 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 800000, ptr nonnull %B) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800000) %B, i8 0, i64 800000, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp29 = icmp sgt i32 %0, 1
br i1 %cmp29, label %for.body, label %for.cond12.preheader
for.cond12.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %4, %for.body ]
%cmp1331 = icmp sgt i32 %1, 0
br i1 %cmp1331, label %for.body14, label %for.end20
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [200000 x i32], ptr %A, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%2 = load i32, ptr %arrayidx, align 4, !tbaa !5
%sub4 = add nsw i32 %2, -1
%idxprom5 = sext i32 %sub4 to i64
%arrayidx6 = getelementptr inbounds [200000 x i32], ptr %B, i64 0, i64 %idxprom5
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%add = add nsw i32 %3, 1
store i32 %add, ptr %arrayidx6, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%sub = add nsw i32 %4, -1
%5 = sext i32 %sub to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond12.preheader, !llvm.loop !9
for.body14: ; preds = %for.cond12.preheader, %for.body14
%indvars.iv34 = phi i64 [ %indvars.iv.next35, %for.body14 ], [ 0, %for.cond12.preheader ]
%arrayidx16 = getelementptr inbounds [200000 x i32], ptr %B, i64 0, i64 %indvars.iv34
%6 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %6)
%indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
%7 = load i32, ptr %N, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp13 = icmp slt i64 %indvars.iv.next35, %8
br i1 %cmp13, label %for.body14, label %for.end20, !llvm.loop !11
for.end20: ; preds = %for.body14, %for.cond12.preheader
call void @llvm.lifetime.end.p0(i64 800000, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 800000, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#define MAX_N 200001
int main(void){
int N,A[MAX_N],i,ans[MAX_N] = {0};
scanf("%d",&N);
for(i = 2;i <= N;i++) scanf("%d",&A[i]);
for(i = 2;i <= N;i++) ans[A[i]]++;
for(i = 1;i <= N;i++) printf("%d\n",ans[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128293/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128293/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [200001 x i32], align 16
%ans = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %ans) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800004) %ans, i8 0, i64 800004, 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
%cmp.not30 = icmp slt i32 %0, 2
br i1 %cmp.not30, label %for.cond13.preheader, label %for.body
for.cond2.preheader: ; preds = %for.body
%cmp3.not32 = icmp slt i32 %5, 2
br i1 %cmp3.not32, label %for.cond13.preheader, label %for.body4.preheader
for.body4.preheader: ; preds = %for.cond2.preheader
%1 = add nuw i32 %5, 1
%wide.trip.count = zext i32 %1 to i64
%2 = add nsw i64 %wide.trip.count, -2
%3 = add nsw i64 %wide.trip.count, -3
%xtraiter = and i64 %2, 3
%4 = icmp ult i64 %3, 3
br i1 %4, label %for.cond13.preheader.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %2, -4
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 2, %entry ]
%arrayidx = getelementptr inbounds [200001 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
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %6
br i1 %cmp.not.not, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond13.preheader.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%indvars.iv38.unr = phi i64 [ 2, %for.body4.preheader ], [ %indvars.iv.next39.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond13.preheader, label %for.body4.epil
for.body4.epil: ; preds = %for.cond13.preheader.loopexit.unr-lcssa, %for.body4.epil
%indvars.iv38.epil = phi i64 [ %indvars.iv.next39.epil, %for.body4.epil ], [ %indvars.iv38.unr, %for.cond13.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.cond13.preheader.loopexit.unr-lcssa ]
%arrayidx6.epil = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv38.epil
%7 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%idxprom7.epil = sext i32 %7 to i64
%arrayidx8.epil = getelementptr inbounds [200001 x i32], ptr %ans, i64 0, i64 %idxprom7.epil
%8 = load i32, ptr %arrayidx8.epil, align 4, !tbaa !5
%inc9.epil = add nsw i32 %8, 1
store i32 %inc9.epil, ptr %arrayidx8.epil, align 4, !tbaa !5
%indvars.iv.next39.epil = add nuw nsw i64 %indvars.iv38.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.cond13.preheader, label %for.body4.epil, !llvm.loop !11
for.cond13.preheader: ; preds = %for.cond13.preheader.loopexit.unr-lcssa, %for.body4.epil, %entry, %for.cond2.preheader
%9 = phi i32 [ %5, %for.cond2.preheader ], [ %0, %entry ], [ %5, %for.body4.epil ], [ %5, %for.cond13.preheader.loopexit.unr-lcssa ]
%cmp14.not34 = icmp slt i32 %9, 1
br i1 %cmp14.not34, label %for.end21, label %for.body15
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv38 = phi i64 [ 2, %for.body4.preheader.new ], [ %indvars.iv.next39.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx6 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv38
%10 = load i32, ptr %arrayidx6, align 8, !tbaa !5
%idxprom7 = sext i32 %10 to i64
%arrayidx8 = getelementptr inbounds [200001 x i32], ptr %ans, i64 0, i64 %idxprom7
%11 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%inc9 = add nsw i32 %11, 1
store i32 %inc9, ptr %arrayidx8, align 4, !tbaa !5
%indvars.iv.next39 = or i64 %indvars.iv38, 1
%arrayidx6.1 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv.next39
%12 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%idxprom7.1 = sext i32 %12 to i64
%arrayidx8.1 = getelementptr inbounds [200001 x i32], ptr %ans, i64 0, i64 %idxprom7.1
%13 = load i32, ptr %arrayidx8.1, align 4, !tbaa !5
%inc9.1 = add nsw i32 %13, 1
store i32 %inc9.1, ptr %arrayidx8.1, align 4, !tbaa !5
%indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38, 2
%arrayidx6.2 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv.next39.1
%14 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%idxprom7.2 = sext i32 %14 to i64
%arrayidx8.2 = getelementptr inbounds [200001 x i32], ptr %ans, i64 0, i64 %idxprom7.2
%15 = load i32, ptr %arrayidx8.2, align 4, !tbaa !5
%inc9.2 = add nsw i32 %15, 1
store i32 %inc9.2, ptr %arrayidx8.2, align 4, !tbaa !5
%indvars.iv.next39.2 = add nuw nsw i64 %indvars.iv38, 3
%arrayidx6.3 = getelementptr inbounds [200001 x i32], ptr %A, i64 0, i64 %indvars.iv.next39.2
%16 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%idxprom7.3 = sext i32 %16 to i64
%arrayidx8.3 = getelementptr inbounds [200001 x i32], ptr %ans, i64 0, i64 %idxprom7.3
%17 = load i32, ptr %arrayidx8.3, align 4, !tbaa !5
%inc9.3 = add nsw i32 %17, 1
store i32 %inc9.3, ptr %arrayidx8.3, align 4, !tbaa !5
%indvars.iv.next39.3 = add nuw nsw i64 %indvars.iv38, 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.cond13.preheader.loopexit.unr-lcssa, label %for.body4, !llvm.loop !13
for.body15: ; preds = %for.cond13.preheader, %for.body15
%indvars.iv41 = phi i64 [ %indvars.iv.next42, %for.body15 ], [ 1, %for.cond13.preheader ]
%arrayidx17 = getelementptr inbounds [200001 x i32], ptr %ans, i64 0, i64 %indvars.iv41
%18 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
%19 = load i32, ptr %N, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp14.not.not = icmp slt i64 %indvars.iv41, %20
br i1 %cmp14.not.not, label %for.body15, label %for.end21, !llvm.loop !14
for.end21: ; preds = %for.body15, %for.cond13.preheader
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %ans) #4
call void @llvm.lifetime.end.p0(i64 800004, 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: 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main()
{
long int n,i,x,a[200000],sum,j;
scanf("%ld",&n);
for(i=0;i<=n;i++)
{
a[i]=0;
}
for(i=1;i<n;i++)
{
scanf("%ld",&x);
a[x]++;
}
a[n]=0;
for(j=1;j<=n;j++)
{
printf("%ld\n",a[j]);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128343/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128343/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i64, align 8
%x = alloca i64, align 8
%a = alloca [200000 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.start.p0(i64 1600000, ptr nonnull %a) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !5
%cmp.not25 = icmp slt i64 %0, 0
br i1 %cmp.not25, label %for.end18, label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry
%1 = shl i64 %0, 3
%2 = add i64 %1, 8
call void @llvm.memset.p0.i64(ptr nonnull align 16 %a, i8 0, i64 %2, i1 false), !tbaa !5
%cmp227 = icmp ugt i64 %0, 1
br i1 %cmp227, label %for.body3, label %for.end9
for.body3: ; preds = %for.cond1.preheader, %for.body3
%i.128 = phi i64 [ %inc8, %for.body3 ], [ 1, %for.cond1.preheader ]
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x)
%3 = load i64, ptr %x, align 8, !tbaa !5
%arrayidx5 = getelementptr inbounds [200000 x i64], ptr %a, i64 0, i64 %3
%4 = load i64, ptr %arrayidx5, align 8, !tbaa !5
%inc6 = add nsw i64 %4, 1
store i64 %inc6, ptr %arrayidx5, align 8, !tbaa !5
%inc8 = add nuw nsw i64 %i.128, 1
%5 = load i64, ptr %n, align 8, !tbaa !5
%cmp2 = icmp slt i64 %inc8, %5
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !9
for.end9: ; preds = %for.body3, %for.cond1.preheader
%6 = phi i64 [ %0, %for.cond1.preheader ], [ %5, %for.body3 ]
%arrayidx10 = getelementptr inbounds [200000 x i64], ptr %a, i64 0, i64 %6
store i64 0, ptr %arrayidx10, align 8, !tbaa !5
%cmp12.not29 = icmp slt i64 %6, 1
br i1 %cmp12.not29, label %for.end18, label %for.body13
for.body13: ; preds = %for.end9, %for.body13
%j.030 = phi i64 [ %inc17, %for.body13 ], [ 1, %for.end9 ]
%arrayidx14 = getelementptr inbounds [200000 x i64], ptr %a, i64 0, i64 %j.030
%7 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%call15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %7)
%inc17 = add nuw nsw i64 %j.030, 1
%8 = load i64, ptr %n, align 8, !tbaa !5
%cmp12.not.not = icmp slt i64 %j.030, %8
br i1 %cmp12.not.not, label %for.body13, label %for.end18, !llvm.loop !11
for.end18: ; preds = %for.body13, %entry, %for.end9
call void @llvm.lifetime.end.p0(i64 1600000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
int main(void){
int numWorker;
int senpai[200001]={0};
int indexCheck = 1;
int counter;
//入力部分
scanf("%d",&numWorker);
for(int i=1;i<numWorker;i++){
scanf("%d",&counter);
senpai[counter]++;
}
//計算部分
//出力部分
for(int j=1;j<=numWorker;j++){
printf("%d\n",senpai[j]);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128387/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128387/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%numWorker = alloca i32, align 4
%senpai = alloca [200001 x i32], align 16
%counter = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %numWorker) #4
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %senpai) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800004) %senpai, i8 0, i64 800004, i1 false)
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %counter) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %numWorker)
%0 = load i32, ptr %numWorker, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 1
br i1 %cmp16, label %for.body, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body, %entry
%1 = phi i32 [ %0, %entry ], [ %4, %for.body ]
%cmp4.not18 = icmp slt i32 %1, 1
br i1 %cmp4.not18, label %for.cond.cleanup5, label %for.body6
for.body: ; preds = %entry, %for.body
%i.017 = phi i32 [ %inc2, %for.body ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %counter)
%2 = load i32, ptr %counter, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [200001 x i32], ptr %senpai, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc2 = add nuw nsw i32 %i.017, 1
%4 = load i32, ptr %numWorker, align 4, !tbaa !5
%cmp = icmp slt i32 %inc2, %4
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond.cleanup5: ; preds = %for.body6, %for.cond3.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %counter) #4
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %senpai) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %numWorker) #4
ret i32 0
for.body6: ; preds = %for.cond3.preheader, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 1, %for.cond3.preheader ]
%arrayidx8 = getelementptr inbounds [200001 x i32], ptr %senpai, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %numWorker, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp4.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp4.not.not, label %for.body6, label %for.cond.cleanup5, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
int main()
{
int a[4];
int sum=0;
scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]);
getchar();
char c=getchar();
while(c!='\n')
{
int i=c-'0';
sum+=a[i-1];
c=getchar();
}
printf("%d\n",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12843/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12843/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [4 x i32], align 16
call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %a) #3
%arrayidx1 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3)
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = call i32 @getc(ptr noundef %0)
%1 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i16 = call i32 @getc(ptr noundef %1)
%sext18 = shl i32 %call.i16, 24
%cmp.not19 = icmp eq i32 %sext18, 167772160
br i1 %cmp.not19, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%sext21 = phi i32 [ %sext, %while.body ], [ %sext18, %entry ]
%sum.020 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%conv6 = ashr exact i32 %sext21, 24
%sub9 = add nsw i32 %conv6, -49
%idxprom = sext i32 %sub9 to i64
%arrayidx10 = getelementptr inbounds [4 x i32], ptr %a, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx10, align 4, !tbaa !9
%add = add nsw i32 %2, %sum.020
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i17 = call i32 @getc(ptr noundef %3)
%sext = shl i32 %call.i17, 24
%cmp.not = icmp eq i32 %sext, 167772160
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %while.body, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sum.0.lcssa)
call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
unsigned long N;
scanf("%lu",&N);
unsigned long A[N],B[N];
int i;
for(i=0;i<N-1;i++){
scanf("%lu",&A[i]);
B[i]=0;
}
B[N-1]=0;
unsigned long j;
for(i=0;i<N-1;i++){
j=A[i];
B[j-1]=B[j-1]+1;
}
for(i=0;i<N;i++){
printf("%lu\n",B[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128473/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128473/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c"%lu\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lu\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %N) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i64, ptr %N, align 8, !tbaa !5
%1 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %0, align 16
%2 = load i64, ptr %N, align 8, !tbaa !5
%vla1 = alloca i64, i64 %2, align 16
%cmp45.not = icmp eq i64 %2, 1
br i1 %cmp45.not, label %for.cond23.preheader.thread, label %for.body
for.cond23.preheader.thread: ; preds = %entry
store i64 0, ptr %vla1, align 16, !tbaa !5
br label %for.body27.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%arrayidx5 = getelementptr inbounds i64, ptr %vla1, i64 %indvars.iv
store i64 0, ptr %arrayidx5, align 8, !tbaa !5
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%3 = load i64, ptr %N, align 8, !tbaa !5
%sub = add i64 %3, -1
%cmp = icmp ugt i64 %sub, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%4 = icmp eq i64 %3, 0
%arrayidx7 = getelementptr inbounds i64, ptr %vla1, i64 %sub
store i64 0, ptr %arrayidx7, align 8, !tbaa !5
%invariant.gep = getelementptr i64, ptr %vla1, i64 -1
%cmp1148.not = icmp eq i64 %sub, 0
br i1 %cmp1148.not, label %for.cond23.preheader, label %for.body13.preheader
for.body13.preheader: ; preds = %for.end
%5 = add i64 %3, -2
%xtraiter = and i64 %sub, 3
%6 = icmp ult i64 %5, 3
br i1 %6, label %for.cond23.preheader.loopexit.unr-lcssa, label %for.body13.preheader.new
for.body13.preheader.new: ; preds = %for.body13.preheader
%unroll_iter = and i64 %sub, -4
br label %for.body13
for.cond23.preheader.loopexit.unr-lcssa: ; preds = %for.body13, %for.body13.preheader
%indvars.iv56.unr = phi i64 [ 0, %for.body13.preheader ], [ %indvars.iv.next57.3, %for.body13 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond23.preheader, label %for.body13.epil
for.body13.epil: ; preds = %for.cond23.preheader.loopexit.unr-lcssa, %for.body13.epil
%indvars.iv56.epil = phi i64 [ %indvars.iv.next57.epil, %for.body13.epil ], [ %indvars.iv56.unr, %for.cond23.preheader.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body13.epil ], [ 0, %for.cond23.preheader.loopexit.unr-lcssa ]
%arrayidx15.epil = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv56.epil
%7 = load i64, ptr %arrayidx15.epil, align 8, !tbaa !5
%gep.epil = getelementptr i64, ptr %invariant.gep, i64 %7
%8 = load i64, ptr %gep.epil, align 8, !tbaa !5
%add.epil = add i64 %8, 1
store i64 %add.epil, ptr %gep.epil, align 8, !tbaa !5
%indvars.iv.next57.epil = add nuw nsw i64 %indvars.iv56.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.cond23.preheader, label %for.body13.epil, !llvm.loop !11
for.cond23.preheader: ; preds = %for.cond23.preheader.loopexit.unr-lcssa, %for.body13.epil, %for.end
br i1 %4, label %for.end33, label %for.body27.preheader
for.body27.preheader: ; preds = %for.cond23.preheader.thread, %for.cond23.preheader
br label %for.body27
for.body13: ; preds = %for.body13, %for.body13.preheader.new
%indvars.iv56 = phi i64 [ 0, %for.body13.preheader.new ], [ %indvars.iv.next57.3, %for.body13 ]
%niter = phi i64 [ 0, %for.body13.preheader.new ], [ %niter.next.3, %for.body13 ]
%arrayidx15 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv56
%9 = load i64, ptr %arrayidx15, align 16, !tbaa !5
%gep = getelementptr i64, ptr %invariant.gep, i64 %9
%10 = load i64, ptr %gep, align 8, !tbaa !5
%add = add i64 %10, 1
store i64 %add, ptr %gep, align 8, !tbaa !5
%indvars.iv.next57 = or i64 %indvars.iv56, 1
%arrayidx15.1 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next57
%11 = load i64, ptr %arrayidx15.1, align 8, !tbaa !5
%gep.1 = getelementptr i64, ptr %invariant.gep, i64 %11
%12 = load i64, ptr %gep.1, align 8, !tbaa !5
%add.1 = add i64 %12, 1
store i64 %add.1, ptr %gep.1, align 8, !tbaa !5
%indvars.iv.next57.1 = or i64 %indvars.iv56, 2
%arrayidx15.2 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next57.1
%13 = load i64, ptr %arrayidx15.2, align 16, !tbaa !5
%gep.2 = getelementptr i64, ptr %invariant.gep, i64 %13
%14 = load i64, ptr %gep.2, align 8, !tbaa !5
%add.2 = add i64 %14, 1
store i64 %add.2, ptr %gep.2, align 8, !tbaa !5
%indvars.iv.next57.2 = or i64 %indvars.iv56, 3
%arrayidx15.3 = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv.next57.2
%15 = load i64, ptr %arrayidx15.3, align 8, !tbaa !5
%gep.3 = getelementptr i64, ptr %invariant.gep, i64 %15
%16 = load i64, ptr %gep.3, align 8, !tbaa !5
%add.3 = add i64 %16, 1
store i64 %add.3, ptr %gep.3, align 8, !tbaa !5
%indvars.iv.next57.3 = add nuw nsw i64 %indvars.iv56, 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.cond23.preheader.loopexit.unr-lcssa, label %for.body13, !llvm.loop !13
for.body27: ; preds = %for.body27.preheader, %for.body27
%indvars.iv59 = phi i64 [ %indvars.iv.next60, %for.body27 ], [ 0, %for.body27.preheader ]
%arrayidx29 = getelementptr inbounds i64, ptr %vla1, i64 %indvars.iv59
%17 = load i64, ptr %arrayidx29, align 8, !tbaa !5
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %17)
%indvars.iv.next60 = add nuw i64 %indvars.iv59, 1
%18 = load i64, ptr %N, align 8, !tbaa !5
%cmp25 = icmp ugt i64 %18, %indvars.iv.next60
br i1 %cmp25, label %for.body27, label %for.end33, !llvm.loop !14
for.end33: ; preds = %for.body27, %for.cond23.preheader
call void @llvm.stackrestore.p0(ptr %1)
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 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 = !{!"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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main(){
int N;
scanf("%d",&N);
int i;
int a[N];
int count[200001]={0};
for(i=1;i<N;i++){
scanf("%d",&a[i]);
count[a[i]]++;
}
for(i=1;i<=N;i++){
printf("%d\n",count[i]);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128516/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128516/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%count = alloca [200001 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%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
call void @llvm.lifetime.start.p0(i64 800004, ptr nonnull %count) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(800004) %count, i8 0, i64 800004, i1 false)
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %3, 1
br i1 %cmp22, label %for.body, label %for.cond7.preheader
for.cond7.preheader: ; preds = %for.body, %entry
%4 = phi i32 [ %3, %entry ], [ %7, %for.body ]
%cmp8.not24 = icmp slt i32 %4, 1
br i1 %cmp8.not24, label %for.end15, label %for.body9
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%idxprom4 = sext i32 %5 to i64
%arrayidx5 = getelementptr inbounds [200001 x i32], ptr %count, i64 0, i64 %idxprom4
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%inc = add nsw i32 %6, 1
store i32 %inc, ptr %arrayidx5, 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.cond7.preheader, !llvm.loop !9
for.body9: ; preds = %for.cond7.preheader, %for.body9
%indvars.iv27 = phi i64 [ %indvars.iv.next28, %for.body9 ], [ 1, %for.cond7.preheader ]
%arrayidx11 = getelementptr inbounds [200001 x i32], ptr %count, i64 0, i64 %indvars.iv27
%9 = load i32, ptr %arrayidx11, align 4, !tbaa !5
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%10 = load i32, ptr %N, align 4, !tbaa !5
%11 = sext i32 %10 to i64
%cmp8.not.not = icmp slt i64 %indvars.iv27, %11
br i1 %cmp8.not.not, label %for.body9, label %for.end15, !llvm.loop !11
for.end15: ; preds = %for.body9, %for.cond7.preheader
call void @llvm.lifetime.end.p0(i64 800004, ptr nonnull %count) #5
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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @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 = { mustprogress 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
char str[100005];
int arr[5];int i;
for(i=1;i<=4;i++)
arr[i]=0;
int barr[5];
scanf("%d%d%d%d",&barr[1],&barr[2],&barr[3],&barr[4]);
scanf("%s",str);
int x=strlen(str);
for(i=0;i<x;i++)
arr[str[i]-'0']++;
int sum=0;
for(i=1;i<=4;i++)
sum+=arr[i]*barr[i];
printf("%d",sum);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12856/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12856/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [100005 x i8], align 16
%arr = alloca [5 x i32], align 16
%barr = alloca [5 x i32], align 16
call void @llvm.lifetime.start.p0(i64 100005, ptr nonnull %str) #6
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %arr) #6
%scevgep = getelementptr inbounds i8, ptr %arr, i64 4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %scevgep, i8 0, i64 16, i1 false), !tbaa !5
call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %barr) #6
%arrayidx1 = getelementptr inbounds [5 x i32], ptr %barr, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [5 x i32], ptr %barr, i64 0, i64 2
%arrayidx3 = getelementptr inbounds [5 x i32], ptr %barr, i64 0, i64 3
%arrayidx4 = getelementptr inbounds [5 x i32], ptr %barr, i64 0, i64 4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2, ptr noundef nonnull %arrayidx3, ptr noundef nonnull %arrayidx4)
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %str)
%call7 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %str) #7
%conv = trunc i64 %call7 to i32
%cmp944 = icmp sgt i32 %conv, 0
br i1 %cmp944, label %for.body11.preheader, label %for.cond21.preheader
for.body11.preheader: ; preds = %entry
%wide.trip.count = and i64 %call7, 4294967295
%xtraiter = and i64 %call7, 1
%0 = icmp eq i64 %wide.trip.count, 1
br i1 %0, label %for.cond21.preheader.loopexit.unr-lcssa, label %for.body11.preheader.new
for.body11.preheader.new: ; preds = %for.body11.preheader
%unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
br label %for.body11
for.cond21.preheader.loopexit.unr-lcssa: ; preds = %for.body11, %for.body11.preheader
%indvars.iv.unr = phi i64 [ 0, %for.body11.preheader ], [ %indvars.iv.next.1, %for.body11 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond21.preheader.loopexit, label %for.body11.epil
for.body11.epil: ; preds = %for.cond21.preheader.loopexit.unr-lcssa
%arrayidx13.epil = getelementptr inbounds [100005 x i8], ptr %str, i64 0, i64 %indvars.iv.unr
%1 = load i8, ptr %arrayidx13.epil, align 1, !tbaa !9
%conv14.epil = sext i8 %1 to i64
%sub.epil = add nsw i64 %conv14.epil, -48
%arrayidx16.epil = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 %sub.epil
%2 = load i32, ptr %arrayidx16.epil, align 4, !tbaa !5
%inc17.epil = add nsw i32 %2, 1
store i32 %inc17.epil, ptr %arrayidx16.epil, align 4, !tbaa !5
br label %for.cond21.preheader.loopexit
for.cond21.preheader.loopexit: ; preds = %for.cond21.preheader.loopexit.unr-lcssa, %for.body11.epil
%3 = load <4 x i32>, ptr %scevgep, align 4, !tbaa !5
br label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.cond21.preheader.loopexit, %entry
%4 = phi <4 x i32> [ %3, %for.cond21.preheader.loopexit ], [ zeroinitializer, %entry ]
%5 = load <4 x i32>, ptr %arrayidx1, align 4, !tbaa !5
%6 = mul nsw <4 x i32> %5, %4
%7 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %6)
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %barr) #6
call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %arr) #6
call void @llvm.lifetime.end.p0(i64 100005, ptr nonnull %str) #6
ret i32 0
for.body11: ; preds = %for.body11, %for.body11.preheader.new
%indvars.iv = phi i64 [ 0, %for.body11.preheader.new ], [ %indvars.iv.next.1, %for.body11 ]
%niter = phi i64 [ 0, %for.body11.preheader.new ], [ %niter.next.1, %for.body11 ]
%arrayidx13 = getelementptr inbounds [100005 x i8], ptr %str, i64 0, i64 %indvars.iv
%8 = load i8, ptr %arrayidx13, align 2, !tbaa !9
%conv14 = sext i8 %8 to i64
%sub = add nsw i64 %conv14, -48
%arrayidx16 = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 %sub
%9 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%inc17 = add nsw i32 %9, 1
store i32 %inc17, ptr %arrayidx16, align 4, !tbaa !5
%indvars.iv.next = or i64 %indvars.iv, 1
%arrayidx13.1 = getelementptr inbounds [100005 x i8], ptr %str, i64 0, i64 %indvars.iv.next
%10 = load i8, ptr %arrayidx13.1, align 1, !tbaa !9
%conv14.1 = sext i8 %10 to i64
%sub.1 = add nsw i64 %conv14.1, -48
%arrayidx16.1 = getelementptr inbounds [5 x i32], ptr %arr, i64 0, i64 %sub.1
%11 = load i32, ptr %arrayidx16.1, align 4, !tbaa !5
%inc17.1 = add nsw i32 %11, 1
store i32 %inc17.1, ptr %arrayidx16.1, align 4, !tbaa !5
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond21.preheader.loopexit.unr-lcssa, label %for.body11, !llvm.loop !10
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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>) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int ice[11];
int main(void)
{
int n, k;
int i, j;
while (1){
for (i = 0; i < 10; i++){
ice[i] = 0;
}
scanf("%d", &n);
if (n == 0){
return (0);
}
for (i = 0; i < n; i++){
scanf("%d", &k);
ice[k]++;
}
for (i = 0; i < 10; i++){
if (ice[i] == 0){
printf("-\n");
}
else {
for (j = 0; j < ice[i]; j++){
printf("*");
}
printf("\n");
}
}
}
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128602/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128602/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@ice = dso_local local_unnamed_addr global [11 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"-\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) @ice, i8 0, i64 40, i1 false), !tbaa !5
%call52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp153 = icmp eq i32 %0, 0
br i1 %cmp153, label %if.then, label %for.cond2.preheader
for.cond2.preheader: ; preds = %entry, %for.inc31.9
%1 = phi i32 [ %25, %for.inc31.9 ], [ %0, %entry ]
%cmp345 = icmp sgt i32 %1, 0
br i1 %cmp345, label %for.body4, label %for.cond12.preheader
if.then: ; preds = %for.inc31.9, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.cond12.preheader: ; preds = %for.body4, %for.cond2.preheader
%2 = load i32, ptr @ice, align 16, !tbaa !5
%cmp17 = icmp eq i32 %2, 0
br i1 %cmp17, label %if.then18, label %for.cond20.preheader
for.body4: ; preds = %for.cond2.preheader, %for.body4
%i.146 = phi i32 [ %inc10, %for.body4 ], [ 0, %for.cond2.preheader ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%3 = load i32, ptr %k, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds [11 x i32], ptr @ice, i64 0, i64 %idxprom6
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%inc8 = add nsw i32 %4, 1
store i32 %inc8, ptr %arrayidx7, align 4, !tbaa !5
%inc10 = add nuw nsw i32 %i.146, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp slt i32 %inc10, %5
br i1 %cmp3, label %for.body4, label %for.cond12.preheader, !llvm.loop !9
for.cond20.preheader: ; preds = %for.cond12.preheader
%cmp2347 = icmp sgt i32 %2, 0
br i1 %cmp2347, label %for.body24, label %for.end28
if.then18: ; preds = %for.cond12.preheader
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31
for.body24: ; preds = %for.cond20.preheader, %for.body24
%j.048 = phi i32 [ %inc27, %for.body24 ], [ 0, %for.cond20.preheader ]
%putchar43 = call i32 @putchar(i32 42)
%inc27 = add nuw nsw i32 %j.048, 1
%6 = load i32, ptr @ice, align 16, !tbaa !5
%cmp23 = icmp slt i32 %inc27, %6
br i1 %cmp23, label %for.body24, label %for.end28, !llvm.loop !11
for.end28: ; preds = %for.body24, %for.cond20.preheader
%putchar = call i32 @putchar(i32 10)
br label %for.inc31
for.inc31: ; preds = %if.then18, %for.end28
%7 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 1), align 4, !tbaa !5
%cmp17.1 = icmp eq i32 %7, 0
br i1 %cmp17.1, label %if.then18.1, label %for.cond20.preheader.1
for.cond20.preheader.1: ; preds = %for.inc31
%cmp2347.1 = icmp sgt i32 %7, 0
br i1 %cmp2347.1, label %for.body24.1, label %for.end28.1
for.body24.1: ; preds = %for.cond20.preheader.1, %for.body24.1
%j.048.1 = phi i32 [ %inc27.1, %for.body24.1 ], [ 0, %for.cond20.preheader.1 ]
%putchar43.1 = call i32 @putchar(i32 42)
%inc27.1 = add nuw nsw i32 %j.048.1, 1
%8 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 1), align 4, !tbaa !5
%cmp23.1 = icmp slt i32 %inc27.1, %8
br i1 %cmp23.1, label %for.body24.1, label %for.end28.1, !llvm.loop !11
for.end28.1: ; preds = %for.body24.1, %for.cond20.preheader.1
%putchar.1 = call i32 @putchar(i32 10)
br label %for.inc31.1
if.then18.1: ; preds = %for.inc31
%puts.1 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.1
for.inc31.1: ; preds = %if.then18.1, %for.end28.1
%9 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 2), align 8, !tbaa !5
%cmp17.2 = icmp eq i32 %9, 0
br i1 %cmp17.2, label %if.then18.2, label %for.cond20.preheader.2
for.cond20.preheader.2: ; preds = %for.inc31.1
%cmp2347.2 = icmp sgt i32 %9, 0
br i1 %cmp2347.2, label %for.body24.2, label %for.end28.2
for.body24.2: ; preds = %for.cond20.preheader.2, %for.body24.2
%j.048.2 = phi i32 [ %inc27.2, %for.body24.2 ], [ 0, %for.cond20.preheader.2 ]
%putchar43.2 = call i32 @putchar(i32 42)
%inc27.2 = add nuw nsw i32 %j.048.2, 1
%10 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 2), align 8, !tbaa !5
%cmp23.2 = icmp slt i32 %inc27.2, %10
br i1 %cmp23.2, label %for.body24.2, label %for.end28.2, !llvm.loop !11
for.end28.2: ; preds = %for.body24.2, %for.cond20.preheader.2
%putchar.2 = call i32 @putchar(i32 10)
br label %for.inc31.2
if.then18.2: ; preds = %for.inc31.1
%puts.2 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.2
for.inc31.2: ; preds = %if.then18.2, %for.end28.2
%11 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 3), align 4, !tbaa !5
%cmp17.3 = icmp eq i32 %11, 0
br i1 %cmp17.3, label %if.then18.3, label %for.cond20.preheader.3
for.cond20.preheader.3: ; preds = %for.inc31.2
%cmp2347.3 = icmp sgt i32 %11, 0
br i1 %cmp2347.3, label %for.body24.3, label %for.end28.3
for.body24.3: ; preds = %for.cond20.preheader.3, %for.body24.3
%j.048.3 = phi i32 [ %inc27.3, %for.body24.3 ], [ 0, %for.cond20.preheader.3 ]
%putchar43.3 = call i32 @putchar(i32 42)
%inc27.3 = add nuw nsw i32 %j.048.3, 1
%12 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 3), align 4, !tbaa !5
%cmp23.3 = icmp slt i32 %inc27.3, %12
br i1 %cmp23.3, label %for.body24.3, label %for.end28.3, !llvm.loop !11
for.end28.3: ; preds = %for.body24.3, %for.cond20.preheader.3
%putchar.3 = call i32 @putchar(i32 10)
br label %for.inc31.3
if.then18.3: ; preds = %for.inc31.2
%puts.3 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.3
for.inc31.3: ; preds = %if.then18.3, %for.end28.3
%13 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 4), align 16, !tbaa !5
%cmp17.4 = icmp eq i32 %13, 0
br i1 %cmp17.4, label %if.then18.4, label %for.cond20.preheader.4
for.cond20.preheader.4: ; preds = %for.inc31.3
%cmp2347.4 = icmp sgt i32 %13, 0
br i1 %cmp2347.4, label %for.body24.4, label %for.end28.4
for.body24.4: ; preds = %for.cond20.preheader.4, %for.body24.4
%j.048.4 = phi i32 [ %inc27.4, %for.body24.4 ], [ 0, %for.cond20.preheader.4 ]
%putchar43.4 = call i32 @putchar(i32 42)
%inc27.4 = add nuw nsw i32 %j.048.4, 1
%14 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 4), align 16, !tbaa !5
%cmp23.4 = icmp slt i32 %inc27.4, %14
br i1 %cmp23.4, label %for.body24.4, label %for.end28.4, !llvm.loop !11
for.end28.4: ; preds = %for.body24.4, %for.cond20.preheader.4
%putchar.4 = call i32 @putchar(i32 10)
br label %for.inc31.4
if.then18.4: ; preds = %for.inc31.3
%puts.4 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.4
for.inc31.4: ; preds = %if.then18.4, %for.end28.4
%15 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 5), align 4, !tbaa !5
%cmp17.5 = icmp eq i32 %15, 0
br i1 %cmp17.5, label %if.then18.5, label %for.cond20.preheader.5
for.cond20.preheader.5: ; preds = %for.inc31.4
%cmp2347.5 = icmp sgt i32 %15, 0
br i1 %cmp2347.5, label %for.body24.5, label %for.end28.5
for.body24.5: ; preds = %for.cond20.preheader.5, %for.body24.5
%j.048.5 = phi i32 [ %inc27.5, %for.body24.5 ], [ 0, %for.cond20.preheader.5 ]
%putchar43.5 = call i32 @putchar(i32 42)
%inc27.5 = add nuw nsw i32 %j.048.5, 1
%16 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 5), align 4, !tbaa !5
%cmp23.5 = icmp slt i32 %inc27.5, %16
br i1 %cmp23.5, label %for.body24.5, label %for.end28.5, !llvm.loop !11
for.end28.5: ; preds = %for.body24.5, %for.cond20.preheader.5
%putchar.5 = call i32 @putchar(i32 10)
br label %for.inc31.5
if.then18.5: ; preds = %for.inc31.4
%puts.5 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.5
for.inc31.5: ; preds = %if.then18.5, %for.end28.5
%17 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 6), align 8, !tbaa !5
%cmp17.6 = icmp eq i32 %17, 0
br i1 %cmp17.6, label %if.then18.6, label %for.cond20.preheader.6
for.cond20.preheader.6: ; preds = %for.inc31.5
%cmp2347.6 = icmp sgt i32 %17, 0
br i1 %cmp2347.6, label %for.body24.6, label %for.end28.6
for.body24.6: ; preds = %for.cond20.preheader.6, %for.body24.6
%j.048.6 = phi i32 [ %inc27.6, %for.body24.6 ], [ 0, %for.cond20.preheader.6 ]
%putchar43.6 = call i32 @putchar(i32 42)
%inc27.6 = add nuw nsw i32 %j.048.6, 1
%18 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 6), align 8, !tbaa !5
%cmp23.6 = icmp slt i32 %inc27.6, %18
br i1 %cmp23.6, label %for.body24.6, label %for.end28.6, !llvm.loop !11
for.end28.6: ; preds = %for.body24.6, %for.cond20.preheader.6
%putchar.6 = call i32 @putchar(i32 10)
br label %for.inc31.6
if.then18.6: ; preds = %for.inc31.5
%puts.6 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.6
for.inc31.6: ; preds = %if.then18.6, %for.end28.6
%19 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 7), align 4, !tbaa !5
%cmp17.7 = icmp eq i32 %19, 0
br i1 %cmp17.7, label %if.then18.7, label %for.cond20.preheader.7
for.cond20.preheader.7: ; preds = %for.inc31.6
%cmp2347.7 = icmp sgt i32 %19, 0
br i1 %cmp2347.7, label %for.body24.7, label %for.end28.7
for.body24.7: ; preds = %for.cond20.preheader.7, %for.body24.7
%j.048.7 = phi i32 [ %inc27.7, %for.body24.7 ], [ 0, %for.cond20.preheader.7 ]
%putchar43.7 = call i32 @putchar(i32 42)
%inc27.7 = add nuw nsw i32 %j.048.7, 1
%20 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 7), align 4, !tbaa !5
%cmp23.7 = icmp slt i32 %inc27.7, %20
br i1 %cmp23.7, label %for.body24.7, label %for.end28.7, !llvm.loop !11
for.end28.7: ; preds = %for.body24.7, %for.cond20.preheader.7
%putchar.7 = call i32 @putchar(i32 10)
br label %for.inc31.7
if.then18.7: ; preds = %for.inc31.6
%puts.7 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.7
for.inc31.7: ; preds = %if.then18.7, %for.end28.7
%21 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 8), align 16, !tbaa !5
%cmp17.8 = icmp eq i32 %21, 0
br i1 %cmp17.8, label %if.then18.8, label %for.cond20.preheader.8
for.cond20.preheader.8: ; preds = %for.inc31.7
%cmp2347.8 = icmp sgt i32 %21, 0
br i1 %cmp2347.8, label %for.body24.8, label %for.end28.8
for.body24.8: ; preds = %for.cond20.preheader.8, %for.body24.8
%j.048.8 = phi i32 [ %inc27.8, %for.body24.8 ], [ 0, %for.cond20.preheader.8 ]
%putchar43.8 = call i32 @putchar(i32 42)
%inc27.8 = add nuw nsw i32 %j.048.8, 1
%22 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 8), align 16, !tbaa !5
%cmp23.8 = icmp slt i32 %inc27.8, %22
br i1 %cmp23.8, label %for.body24.8, label %for.end28.8, !llvm.loop !11
for.end28.8: ; preds = %for.body24.8, %for.cond20.preheader.8
%putchar.8 = call i32 @putchar(i32 10)
br label %for.inc31.8
if.then18.8: ; preds = %for.inc31.7
%puts.8 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.8
for.inc31.8: ; preds = %if.then18.8, %for.end28.8
%23 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 9), align 4, !tbaa !5
%cmp17.9 = icmp eq i32 %23, 0
br i1 %cmp17.9, label %if.then18.9, label %for.cond20.preheader.9
for.cond20.preheader.9: ; preds = %for.inc31.8
%cmp2347.9 = icmp sgt i32 %23, 0
br i1 %cmp2347.9, label %for.body24.9, label %for.end28.9
for.body24.9: ; preds = %for.cond20.preheader.9, %for.body24.9
%j.048.9 = phi i32 [ %inc27.9, %for.body24.9 ], [ 0, %for.cond20.preheader.9 ]
%putchar43.9 = call i32 @putchar(i32 42)
%inc27.9 = add nuw nsw i32 %j.048.9, 1
%24 = load i32, ptr getelementptr inbounds ([11 x i32], ptr @ice, i64 0, i64 9), align 4, !tbaa !5
%cmp23.9 = icmp slt i32 %inc27.9, %24
br i1 %cmp23.9, label %for.body24.9, label %for.end28.9, !llvm.loop !11
for.end28.9: ; preds = %for.body24.9, %for.cond20.preheader.9
%putchar.9 = call i32 @putchar(i32 10)
br label %for.inc31.9
if.then18.9: ; preds = %for.inc31.8
%puts.9 = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc31.9
for.inc31.9: ; preds = %if.then18.9, %for.end28.9
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) @ice, i8 0, i64 40, i1 false), !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%25 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp eq i32 %25, 0
br i1 %cmp1, label %if.then, label %for.cond2.preheader, !llvm.loop !12
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include <stdio.h>
int main(void) {
int i,n,input,t;
while(scanf("%d",&n)!=0){
if(n==0)break;
int data[10]={0};
for(i=0;i<n;i++){
scanf("%d",&input);
data[input]++;
}
for(i=0;i<10;i++){
if(data[i]==0){
puts("-");
}else{
for(t=0;t<data[i];t++){
printf("*");
}
puts("");
}
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128668/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128668/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [2 x i8] c"-\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%input = alloca i32, align 4
%data = alloca [10 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %input) #5
%call39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp40 = icmp eq i32 %call39, 0
%0 = load i32, ptr %n, align 4
%cmp141 = icmp eq i32 %0, 0
%or.cond42 = select i1 %cmp40, i1 true, i1 %cmp141
br i1 %or.cond42, label %while.end, label %if.end.preheader
if.end.preheader: ; preds = %entry
%arrayidx9.1 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 1
%arrayidx9.2 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 2
%arrayidx9.3 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 3
%arrayidx9.4 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 4
%arrayidx9.5 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 5
%arrayidx9.6 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 6
%arrayidx9.7 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 7
%arrayidx9.8 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 8
%arrayidx9.9 = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 9
br label %if.end
if.end: ; preds = %if.end.preheader, %for.inc24.9
%1 = phi i32 [ %0, %if.end.preheader ], [ %14, %for.inc24.9 ]
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %data) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %data, i8 0, i64 40, i1 false)
%cmp234 = icmp sgt i32 %1, 0
br i1 %cmp234, label %for.body, label %if.then11
for.cond5.preheader: ; preds = %for.body
%.pre = load i32, ptr %data, align 16, !tbaa !5
%cmp10 = icmp eq i32 %.pre, 0
br i1 %cmp10, label %if.then11, label %for.cond13.preheader
for.body: ; preds = %if.end, %for.body
%i.035 = phi i32 [ %inc4, %for.body ], [ 0, %if.end ]
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%2 = load i32, ptr %input, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [10 x i32], ptr %data, i64 0, i64 %idxprom
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%inc4 = add nuw nsw i32 %i.035, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%cmp2 = icmp slt i32 %inc4, %4
br i1 %cmp2, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond13.preheader: ; preds = %for.cond5.preheader
%cmp1636 = icmp sgt i32 %.pre, 0
br i1 %cmp1636, label %for.body17, label %for.end21
if.then11: ; preds = %if.end, %for.cond5.preheader
%call12 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24
for.body17: ; preds = %for.cond13.preheader, %for.body17
%t.037 = phi i32 [ %inc20, %for.body17 ], [ 0, %for.cond13.preheader ]
%putchar33 = call i32 @putchar(i32 42)
%inc20 = add nuw nsw i32 %t.037, 1
%exitcond.not = icmp eq i32 %inc20, %.pre
br i1 %exitcond.not, label %for.end21, label %for.body17, !llvm.loop !11
for.end21: ; preds = %for.body17, %for.cond13.preheader
%putchar = call i32 @putchar(i32 10)
br label %for.inc24
for.inc24: ; preds = %if.then11, %for.end21
%5 = load i32, ptr %arrayidx9.1, align 4, !tbaa !5
%cmp10.1 = icmp eq i32 %5, 0
br i1 %cmp10.1, label %if.then11.1, label %for.cond13.preheader.1
for.cond13.preheader.1: ; preds = %for.inc24
%cmp1636.1 = icmp sgt i32 %5, 0
br i1 %cmp1636.1, label %for.body17.1, label %for.end21.1
for.body17.1: ; preds = %for.cond13.preheader.1, %for.body17.1
%t.037.1 = phi i32 [ %inc20.1, %for.body17.1 ], [ 0, %for.cond13.preheader.1 ]
%putchar33.1 = call i32 @putchar(i32 42)
%inc20.1 = add nuw nsw i32 %t.037.1, 1
%exitcond.1.not = icmp eq i32 %inc20.1, %5
br i1 %exitcond.1.not, label %for.end21.1, label %for.body17.1, !llvm.loop !11
for.end21.1: ; preds = %for.body17.1, %for.cond13.preheader.1
%putchar.1 = call i32 @putchar(i32 10)
br label %for.inc24.1
if.then11.1: ; preds = %for.inc24
%call12.1 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.1
for.inc24.1: ; preds = %if.then11.1, %for.end21.1
%6 = load i32, ptr %arrayidx9.2, align 8, !tbaa !5
%cmp10.2 = icmp eq i32 %6, 0
br i1 %cmp10.2, label %if.then11.2, label %for.cond13.preheader.2
for.cond13.preheader.2: ; preds = %for.inc24.1
%cmp1636.2 = icmp sgt i32 %6, 0
br i1 %cmp1636.2, label %for.body17.2, label %for.end21.2
for.body17.2: ; preds = %for.cond13.preheader.2, %for.body17.2
%t.037.2 = phi i32 [ %inc20.2, %for.body17.2 ], [ 0, %for.cond13.preheader.2 ]
%putchar33.2 = call i32 @putchar(i32 42)
%inc20.2 = add nuw nsw i32 %t.037.2, 1
%exitcond.2.not = icmp eq i32 %inc20.2, %6
br i1 %exitcond.2.not, label %for.end21.2, label %for.body17.2, !llvm.loop !11
for.end21.2: ; preds = %for.body17.2, %for.cond13.preheader.2
%putchar.2 = call i32 @putchar(i32 10)
br label %for.inc24.2
if.then11.2: ; preds = %for.inc24.1
%call12.2 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.2
for.inc24.2: ; preds = %if.then11.2, %for.end21.2
%7 = load i32, ptr %arrayidx9.3, align 4, !tbaa !5
%cmp10.3 = icmp eq i32 %7, 0
br i1 %cmp10.3, label %if.then11.3, label %for.cond13.preheader.3
for.cond13.preheader.3: ; preds = %for.inc24.2
%cmp1636.3 = icmp sgt i32 %7, 0
br i1 %cmp1636.3, label %for.body17.3, label %for.end21.3
for.body17.3: ; preds = %for.cond13.preheader.3, %for.body17.3
%t.037.3 = phi i32 [ %inc20.3, %for.body17.3 ], [ 0, %for.cond13.preheader.3 ]
%putchar33.3 = call i32 @putchar(i32 42)
%inc20.3 = add nuw nsw i32 %t.037.3, 1
%exitcond.3.not = icmp eq i32 %inc20.3, %7
br i1 %exitcond.3.not, label %for.end21.3, label %for.body17.3, !llvm.loop !11
for.end21.3: ; preds = %for.body17.3, %for.cond13.preheader.3
%putchar.3 = call i32 @putchar(i32 10)
br label %for.inc24.3
if.then11.3: ; preds = %for.inc24.2
%call12.3 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.3
for.inc24.3: ; preds = %if.then11.3, %for.end21.3
%8 = load i32, ptr %arrayidx9.4, align 16, !tbaa !5
%cmp10.4 = icmp eq i32 %8, 0
br i1 %cmp10.4, label %if.then11.4, label %for.cond13.preheader.4
for.cond13.preheader.4: ; preds = %for.inc24.3
%cmp1636.4 = icmp sgt i32 %8, 0
br i1 %cmp1636.4, label %for.body17.4, label %for.end21.4
for.body17.4: ; preds = %for.cond13.preheader.4, %for.body17.4
%t.037.4 = phi i32 [ %inc20.4, %for.body17.4 ], [ 0, %for.cond13.preheader.4 ]
%putchar33.4 = call i32 @putchar(i32 42)
%inc20.4 = add nuw nsw i32 %t.037.4, 1
%exitcond.4.not = icmp eq i32 %inc20.4, %8
br i1 %exitcond.4.not, label %for.end21.4, label %for.body17.4, !llvm.loop !11
for.end21.4: ; preds = %for.body17.4, %for.cond13.preheader.4
%putchar.4 = call i32 @putchar(i32 10)
br label %for.inc24.4
if.then11.4: ; preds = %for.inc24.3
%call12.4 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.4
for.inc24.4: ; preds = %if.then11.4, %for.end21.4
%9 = load i32, ptr %arrayidx9.5, align 4, !tbaa !5
%cmp10.5 = icmp eq i32 %9, 0
br i1 %cmp10.5, label %if.then11.5, label %for.cond13.preheader.5
for.cond13.preheader.5: ; preds = %for.inc24.4
%cmp1636.5 = icmp sgt i32 %9, 0
br i1 %cmp1636.5, label %for.body17.5, label %for.end21.5
for.body17.5: ; preds = %for.cond13.preheader.5, %for.body17.5
%t.037.5 = phi i32 [ %inc20.5, %for.body17.5 ], [ 0, %for.cond13.preheader.5 ]
%putchar33.5 = call i32 @putchar(i32 42)
%inc20.5 = add nuw nsw i32 %t.037.5, 1
%exitcond.5.not = icmp eq i32 %inc20.5, %9
br i1 %exitcond.5.not, label %for.end21.5, label %for.body17.5, !llvm.loop !11
for.end21.5: ; preds = %for.body17.5, %for.cond13.preheader.5
%putchar.5 = call i32 @putchar(i32 10)
br label %for.inc24.5
if.then11.5: ; preds = %for.inc24.4
%call12.5 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.5
for.inc24.5: ; preds = %if.then11.5, %for.end21.5
%10 = load i32, ptr %arrayidx9.6, align 8, !tbaa !5
%cmp10.6 = icmp eq i32 %10, 0
br i1 %cmp10.6, label %if.then11.6, label %for.cond13.preheader.6
for.cond13.preheader.6: ; preds = %for.inc24.5
%cmp1636.6 = icmp sgt i32 %10, 0
br i1 %cmp1636.6, label %for.body17.6, label %for.end21.6
for.body17.6: ; preds = %for.cond13.preheader.6, %for.body17.6
%t.037.6 = phi i32 [ %inc20.6, %for.body17.6 ], [ 0, %for.cond13.preheader.6 ]
%putchar33.6 = call i32 @putchar(i32 42)
%inc20.6 = add nuw nsw i32 %t.037.6, 1
%exitcond.6.not = icmp eq i32 %inc20.6, %10
br i1 %exitcond.6.not, label %for.end21.6, label %for.body17.6, !llvm.loop !11
for.end21.6: ; preds = %for.body17.6, %for.cond13.preheader.6
%putchar.6 = call i32 @putchar(i32 10)
br label %for.inc24.6
if.then11.6: ; preds = %for.inc24.5
%call12.6 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.6
for.inc24.6: ; preds = %if.then11.6, %for.end21.6
%11 = load i32, ptr %arrayidx9.7, align 4, !tbaa !5
%cmp10.7 = icmp eq i32 %11, 0
br i1 %cmp10.7, label %if.then11.7, label %for.cond13.preheader.7
for.cond13.preheader.7: ; preds = %for.inc24.6
%cmp1636.7 = icmp sgt i32 %11, 0
br i1 %cmp1636.7, label %for.body17.7, label %for.end21.7
for.body17.7: ; preds = %for.cond13.preheader.7, %for.body17.7
%t.037.7 = phi i32 [ %inc20.7, %for.body17.7 ], [ 0, %for.cond13.preheader.7 ]
%putchar33.7 = call i32 @putchar(i32 42)
%inc20.7 = add nuw nsw i32 %t.037.7, 1
%exitcond.7.not = icmp eq i32 %inc20.7, %11
br i1 %exitcond.7.not, label %for.end21.7, label %for.body17.7, !llvm.loop !11
for.end21.7: ; preds = %for.body17.7, %for.cond13.preheader.7
%putchar.7 = call i32 @putchar(i32 10)
br label %for.inc24.7
if.then11.7: ; preds = %for.inc24.6
%call12.7 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.7
for.inc24.7: ; preds = %if.then11.7, %for.end21.7
%12 = load i32, ptr %arrayidx9.8, align 16, !tbaa !5
%cmp10.8 = icmp eq i32 %12, 0
br i1 %cmp10.8, label %if.then11.8, label %for.cond13.preheader.8
for.cond13.preheader.8: ; preds = %for.inc24.7
%cmp1636.8 = icmp sgt i32 %12, 0
br i1 %cmp1636.8, label %for.body17.8, label %for.end21.8
for.body17.8: ; preds = %for.cond13.preheader.8, %for.body17.8
%t.037.8 = phi i32 [ %inc20.8, %for.body17.8 ], [ 0, %for.cond13.preheader.8 ]
%putchar33.8 = call i32 @putchar(i32 42)
%inc20.8 = add nuw nsw i32 %t.037.8, 1
%exitcond.8.not = icmp eq i32 %inc20.8, %12
br i1 %exitcond.8.not, label %for.end21.8, label %for.body17.8, !llvm.loop !11
for.end21.8: ; preds = %for.body17.8, %for.cond13.preheader.8
%putchar.8 = call i32 @putchar(i32 10)
br label %for.inc24.8
if.then11.8: ; preds = %for.inc24.7
%call12.8 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.8
for.inc24.8: ; preds = %if.then11.8, %for.end21.8
%13 = load i32, ptr %arrayidx9.9, align 4, !tbaa !5
%cmp10.9 = icmp eq i32 %13, 0
br i1 %cmp10.9, label %if.then11.9, label %for.cond13.preheader.9
for.cond13.preheader.9: ; preds = %for.inc24.8
%cmp1636.9 = icmp sgt i32 %13, 0
br i1 %cmp1636.9, label %for.body17.9, label %for.end21.9
for.body17.9: ; preds = %for.cond13.preheader.9, %for.body17.9
%t.037.9 = phi i32 [ %inc20.9, %for.body17.9 ], [ 0, %for.cond13.preheader.9 ]
%putchar33.9 = call i32 @putchar(i32 42)
%inc20.9 = add nuw nsw i32 %t.037.9, 1
%exitcond.9.not = icmp eq i32 %inc20.9, %13
br i1 %exitcond.9.not, label %for.end21.9, label %for.body17.9, !llvm.loop !11
for.end21.9: ; preds = %for.body17.9, %for.cond13.preheader.9
%putchar.9 = call i32 @putchar(i32 10)
br label %for.inc24.9
if.then11.9: ; preds = %for.inc24.8
%call12.9 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
br label %for.inc24.9
for.inc24.9: ; preds = %if.then11.9, %for.end21.9
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %data) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%cmp = icmp eq i32 %call, 0
%14 = load i32, ptr %n, align 4
%cmp1 = icmp eq i32 %14, 0
%or.cond = select i1 %cmp, i1 true, i1 %cmp1
br i1 %or.cond, label %while.end, label %if.end, !llvm.loop !12
while.end: ; preds = %for.inc24.9, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %input) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: 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: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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}
|
#include <stdio.h>
#include <string.h>
int main(void)
{
int n;
int s;
int i, j;
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d", &s);
printf("Case %d:\n", i + 1);
for (j = 0; j < 10; j++){
s = s * s / 100 % 10000;
printf("%d\n", s);
}
}
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128710/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128710/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"Case %d:\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%s = 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 %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp14 = icmp sgt i32 %0, 0
br i1 %cmp14, label %for.body, label %for.end9
for.body: ; preds = %entry, %for.body
%i.015 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %s)
%add = add nuw nsw i32 %i.015, 1
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
%1 = load i32, ptr %s, align 4, !tbaa !5
%mul = mul nsw i32 %1, %1
%div = udiv i32 %mul, 100
%rem = urem i32 %div, 10000
store i32 %rem, ptr %s, align 4, !tbaa !5
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem)
%2 = load i32, ptr %s, align 4, !tbaa !5
%mul.1 = mul nsw i32 %2, %2
%div.1 = udiv i32 %mul.1, 100
%rem.1 = urem i32 %div.1, 10000
store i32 %rem.1, ptr %s, align 4, !tbaa !5
%call6.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.1)
%3 = load i32, ptr %s, align 4, !tbaa !5
%mul.2 = mul nsw i32 %3, %3
%div.2 = udiv i32 %mul.2, 100
%rem.2 = urem i32 %div.2, 10000
store i32 %rem.2, ptr %s, align 4, !tbaa !5
%call6.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.2)
%4 = load i32, ptr %s, align 4, !tbaa !5
%mul.3 = mul nsw i32 %4, %4
%div.3 = udiv i32 %mul.3, 100
%rem.3 = urem i32 %div.3, 10000
store i32 %rem.3, ptr %s, align 4, !tbaa !5
%call6.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.3)
%5 = load i32, ptr %s, align 4, !tbaa !5
%mul.4 = mul nsw i32 %5, %5
%div.4 = udiv i32 %mul.4, 100
%rem.4 = urem i32 %div.4, 10000
store i32 %rem.4, ptr %s, align 4, !tbaa !5
%call6.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.4)
%6 = load i32, ptr %s, align 4, !tbaa !5
%mul.5 = mul nsw i32 %6, %6
%div.5 = udiv i32 %mul.5, 100
%rem.5 = urem i32 %div.5, 10000
store i32 %rem.5, ptr %s, align 4, !tbaa !5
%call6.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.5)
%7 = load i32, ptr %s, align 4, !tbaa !5
%mul.6 = mul nsw i32 %7, %7
%div.6 = udiv i32 %mul.6, 100
%rem.6 = urem i32 %div.6, 10000
store i32 %rem.6, ptr %s, align 4, !tbaa !5
%call6.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.6)
%8 = load i32, ptr %s, align 4, !tbaa !5
%mul.7 = mul nsw i32 %8, %8
%div.7 = udiv i32 %mul.7, 100
%rem.7 = urem i32 %div.7, 10000
store i32 %rem.7, ptr %s, align 4, !tbaa !5
%call6.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.7)
%9 = load i32, ptr %s, align 4, !tbaa !5
%mul.8 = mul nsw i32 %9, %9
%div.8 = udiv i32 %mul.8, 100
%rem.8 = urem i32 %div.8, 10000
store i32 %rem.8, ptr %s, align 4, !tbaa !5
%call6.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.8)
%10 = load i32, ptr %s, align 4, !tbaa !5
%mul.9 = mul nsw i32 %10, %10
%div.9 = udiv i32 %mul.9, 100
%rem.9 = urem i32 %div.9, 10000
store i32 %rem.9, ptr %s, align 4, !tbaa !5
%call6.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %rem.9)
%11 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %add, %11
br i1 %cmp, label %for.body, label %for.end9, !llvm.loop !9
for.end9: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])
{
long long input;
long long num;
int i, j;
scanf("%lld",&input);
for (i = 0; i < input; i++) {
scanf("%08lld",&num);
printf("Case %d:\n",i + 1);
for (j = 0; j < 10; j++) {
num = pow(num, 2);
num %= 1000000;
num /= 100;
printf("%lld\n",num);
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128761/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128761/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%08lld\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"Case %d:\0A\00", align 1
@.str.3 = private unnamed_addr constant [6 x i8] c"%lld\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:
%input = alloca i64, align 8
%num = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %input) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %num) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %input)
%0 = load i64, ptr %input, align 8, !tbaa !5
%cmp20 = icmp sgt i64 %0, 0
br i1 %cmp20, label %for.body, label %for.end14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %num)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%1 = trunc i64 %indvars.iv.next to i32
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %1)
%2 = load i64, ptr %num, align 8, !tbaa !5
%conv8 = sitofp i64 %2 to double
%square = fmul double %conv8, %conv8
%conv10 = fptosi double %square to i64
%rem = srem i64 %conv10, 1000000
%div.lhs.trunc = trunc i64 %rem to i32
%div18 = sdiv i32 %div.lhs.trunc, 100
%div.sext = sext i32 %div18 to i64
store i64 %div.sext, ptr %num, align 8, !tbaa !5
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext)
%3 = load i64, ptr %num, align 8, !tbaa !5
%conv8.1 = sitofp i64 %3 to double
%square.1 = fmul double %conv8.1, %conv8.1
%conv10.1 = fptosi double %square.1 to i64
%rem.1 = srem i64 %conv10.1, 1000000
%div.lhs.trunc.1 = trunc i64 %rem.1 to i32
%div18.1 = sdiv i32 %div.lhs.trunc.1, 100
%div.sext.1 = sext i32 %div18.1 to i64
store i64 %div.sext.1, ptr %num, align 8, !tbaa !5
%call11.1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.1)
%4 = load i64, ptr %num, align 8, !tbaa !5
%conv8.2 = sitofp i64 %4 to double
%square.2 = fmul double %conv8.2, %conv8.2
%conv10.2 = fptosi double %square.2 to i64
%rem.2 = srem i64 %conv10.2, 1000000
%div.lhs.trunc.2 = trunc i64 %rem.2 to i32
%div18.2 = sdiv i32 %div.lhs.trunc.2, 100
%div.sext.2 = sext i32 %div18.2 to i64
store i64 %div.sext.2, ptr %num, align 8, !tbaa !5
%call11.2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.2)
%5 = load i64, ptr %num, align 8, !tbaa !5
%conv8.3 = sitofp i64 %5 to double
%square.3 = fmul double %conv8.3, %conv8.3
%conv10.3 = fptosi double %square.3 to i64
%rem.3 = srem i64 %conv10.3, 1000000
%div.lhs.trunc.3 = trunc i64 %rem.3 to i32
%div18.3 = sdiv i32 %div.lhs.trunc.3, 100
%div.sext.3 = sext i32 %div18.3 to i64
store i64 %div.sext.3, ptr %num, align 8, !tbaa !5
%call11.3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.3)
%6 = load i64, ptr %num, align 8, !tbaa !5
%conv8.4 = sitofp i64 %6 to double
%square.4 = fmul double %conv8.4, %conv8.4
%conv10.4 = fptosi double %square.4 to i64
%rem.4 = srem i64 %conv10.4, 1000000
%div.lhs.trunc.4 = trunc i64 %rem.4 to i32
%div18.4 = sdiv i32 %div.lhs.trunc.4, 100
%div.sext.4 = sext i32 %div18.4 to i64
store i64 %div.sext.4, ptr %num, align 8, !tbaa !5
%call11.4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.4)
%7 = load i64, ptr %num, align 8, !tbaa !5
%conv8.5 = sitofp i64 %7 to double
%square.5 = fmul double %conv8.5, %conv8.5
%conv10.5 = fptosi double %square.5 to i64
%rem.5 = srem i64 %conv10.5, 1000000
%div.lhs.trunc.5 = trunc i64 %rem.5 to i32
%div18.5 = sdiv i32 %div.lhs.trunc.5, 100
%div.sext.5 = sext i32 %div18.5 to i64
store i64 %div.sext.5, ptr %num, align 8, !tbaa !5
%call11.5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.5)
%8 = load i64, ptr %num, align 8, !tbaa !5
%conv8.6 = sitofp i64 %8 to double
%square.6 = fmul double %conv8.6, %conv8.6
%conv10.6 = fptosi double %square.6 to i64
%rem.6 = srem i64 %conv10.6, 1000000
%div.lhs.trunc.6 = trunc i64 %rem.6 to i32
%div18.6 = sdiv i32 %div.lhs.trunc.6, 100
%div.sext.6 = sext i32 %div18.6 to i64
store i64 %div.sext.6, ptr %num, align 8, !tbaa !5
%call11.6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.6)
%9 = load i64, ptr %num, align 8, !tbaa !5
%conv8.7 = sitofp i64 %9 to double
%square.7 = fmul double %conv8.7, %conv8.7
%conv10.7 = fptosi double %square.7 to i64
%rem.7 = srem i64 %conv10.7, 1000000
%div.lhs.trunc.7 = trunc i64 %rem.7 to i32
%div18.7 = sdiv i32 %div.lhs.trunc.7, 100
%div.sext.7 = sext i32 %div18.7 to i64
store i64 %div.sext.7, ptr %num, align 8, !tbaa !5
%call11.7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.7)
%10 = load i64, ptr %num, align 8, !tbaa !5
%conv8.8 = sitofp i64 %10 to double
%square.8 = fmul double %conv8.8, %conv8.8
%conv10.8 = fptosi double %square.8 to i64
%rem.8 = srem i64 %conv10.8, 1000000
%div.lhs.trunc.8 = trunc i64 %rem.8 to i32
%div18.8 = sdiv i32 %div.lhs.trunc.8, 100
%div.sext.8 = sext i32 %div18.8 to i64
store i64 %div.sext.8, ptr %num, align 8, !tbaa !5
%call11.8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.8)
%11 = load i64, ptr %num, align 8, !tbaa !5
%conv8.9 = sitofp i64 %11 to double
%square.9 = fmul double %conv8.9, %conv8.9
%conv10.9 = fptosi double %square.9 to i64
%rem.9 = srem i64 %conv10.9, 1000000
%div.lhs.trunc.9 = trunc i64 %rem.9 to i32
%div18.9 = sdiv i32 %div.lhs.trunc.9, 100
%div.sext.9 = sext i32 %div18.9 to i64
store i64 %div.sext.9, ptr %num, align 8, !tbaa !5
%call11.9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %div.sext.9)
%12 = load i64, ptr %input, align 8, !tbaa !5
%cmp = icmp sgt i64 %12, %indvars.iv.next
br i1 %cmp, label %for.body, label %for.end14, !llvm.loop !9
for.end14: ; preds = %for.body, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %num) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %input) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main() {
int A,B;
scanf("%d %d ",&A, &B);
if(A+B<10)
printf("%d",A+B);
else
printf("error");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128804/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128804/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 \00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp slt i32 %add, 10
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int x,y;
scanf("%d %d",&x,&y);
if(x + y < 10) printf("%d",(x + y));
else printf("error");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128848/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128848/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [6 x i8] c"error\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
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %x, align 4, !tbaa !5
%1 = load i32, ptr %y, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp slt i32 %add, 10
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #3
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 a,b;
scanf("%d%d",&a,&b);
if(a+b<10)printf("%d",a+b);
else printf("error");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128891/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128891/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp slt i32 %add, 10
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,b;
scanf("%d%d",&a,&b);
printf(a+b>=10?"error\n":"%d\n",a+b);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128934/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128934/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [7 x i8] c"error\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp sgt i32 %add, 9
%cond = select i1 %cmp, ptr @.str.1, ptr @.str.2
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %cond, i32 noundef %add)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void) {
int a,b;
scanf("%d %d",&a,&b);
if(a+b>=10){
printf("error\n");
}else{
printf("%d\n",a+b);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_128978/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_128978/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp sgt i32 %add, 9
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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 n,i,c_x,c_y,c_z,flag1,flag2,pos;
scanf("%d",&n);
int a[n],x[n],y[n],z[n];
pos = 0;
for (i = 0; i < n; i++) {
scanf("%d",&a[i]);
if (a[i] > 0) {
pos = 1;
}
}
c_x = c_y = c_z = 0;
flag1 = 0;
flag2 = 0;
if (pos == 1) {
for (i = 0; i < n; i++) {
if (a[i] < 0 && flag1 == 0) {
x[c_x] = a[i];
c_x++;
flag1 = 1;
} else if (a[i] > 0 && flag2 == 0) {
y[c_y] = a[i];
c_y++;
flag2 = 1;
} else {
z[c_z] = a[i];
c_z++;
}
}
} else {
for (i = 0; i < n; i++) {
if (a[i] < 0 && flag1 == 0) {
x[c_x] = a[i];
c_x++;
flag1 = 1;
} else if (a[i] < 0 && flag2 < 2) {
y[c_y] = a[i];
c_y++;
flag2++;
} else {
z[c_z] = a[i];
c_z++;
}
}
}
printf("%d ",c_x);
for (i = 0; i < c_x; i++) {
printf("%d ",x[i]);
}
printf("\n");
printf("%d ",c_y);
for (i = 0; i < c_y; i++) {
printf("%d ",y[i]);
}
printf("\n");
printf("%d ",c_z);
for (i = 0; i < c_z; i++) {
printf("%d ",z[i]);
}
printf("\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12902/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12902/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = zext i32 %3 to i64
%vla1 = alloca i32, i64 %4, align 16
%vla2 = alloca i32, i64 %4, align 16
%vla3 = alloca i32, i64 %4, align 16
%cmp170 = icmp sgt i32 %3, 0
br i1 %cmp170, label %for.body, label %if.end84.thread
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%pos.0171 = phi i32 [ %spec.select, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp7.inv = icmp slt i32 %5, 1
%spec.select = select i1 %cmp7.inv, i32 %pos.0171, i32 1
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%8 = icmp eq i32 %spec.select, 1
%cmp11184 = icmp sgt i32 %6, 0
br i1 %8, label %for.cond10.preheader, label %for.cond46.preheader
for.cond46.preheader: ; preds = %for.end
br i1 %cmp11184, label %for.body48.preheader, label %if.end84.thread
for.body48.preheader: ; preds = %for.cond46.preheader
%wide.trip.count = zext i32 %6 to i64
br label %for.body48
for.cond10.preheader: ; preds = %for.end
br i1 %cmp11184, label %for.body12.preheader, label %if.end84.thread
for.body12.preheader: ; preds = %for.cond10.preheader
%wide.trip.count209 = zext i32 %6 to i64
br label %for.body12
for.body12: ; preds = %for.body12.preheader, %for.inc42
%indvars.iv206 = phi i64 [ 0, %for.body12.preheader ], [ %indvars.iv.next207, %for.inc42 ]
%c_x.0189 = phi i32 [ 0, %for.body12.preheader ], [ %c_x.1, %for.inc42 ]
%c_y.0188 = phi i32 [ 0, %for.body12.preheader ], [ %c_y.1, %for.inc42 ]
%c_z.0187 = phi i32 [ 0, %for.body12.preheader ], [ %c_z.1, %for.inc42 ]
%flag2.0186 = phi i32 [ 0, %for.body12.preheader ], [ %flag2.1, %for.inc42 ]
%flag1.0185 = phi i32 [ 0, %for.body12.preheader ], [ %flag1.1, %for.inc42 ]
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv206
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%cmp15 = icmp slt i32 %9, 0
%cmp16 = icmp eq i32 %flag1.0185, 0
%or.cond = select i1 %cmp15, i1 %cmp16, i1 false
br i1 %or.cond, label %if.then17, label %if.else
if.then17: ; preds = %for.body12
%idxprom20 = sext i32 %c_x.0189 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom20
store i32 %9, ptr %arrayidx21, align 4, !tbaa !5
%inc22 = add nsw i32 %c_x.0189, 1
br label %for.inc42
if.else: ; preds = %for.body12
%cmp25 = icmp sgt i32 %9, 0
%cmp27 = icmp eq i32 %flag2.0186, 0
%or.cond118 = select i1 %cmp25, i1 %cmp27, i1 false
br i1 %or.cond118, label %if.then28, label %if.else34
if.then28: ; preds = %if.else
%idxprom31 = sext i32 %c_y.0188 to i64
%arrayidx32 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom31
store i32 %9, ptr %arrayidx32, align 4, !tbaa !5
%inc33 = add nsw i32 %c_y.0188, 1
br label %for.inc42
if.else34: ; preds = %if.else
%idxprom37 = sext i32 %c_z.0187 to i64
%arrayidx38 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom37
store i32 %9, ptr %arrayidx38, align 4, !tbaa !5
%inc39 = add nsw i32 %c_z.0187, 1
br label %for.inc42
for.inc42: ; preds = %if.then17, %if.else34, %if.then28
%flag1.1 = phi i32 [ 1, %if.then17 ], [ %flag1.0185, %if.then28 ], [ %flag1.0185, %if.else34 ]
%flag2.1 = phi i32 [ %flag2.0186, %if.then17 ], [ 1, %if.then28 ], [ %flag2.0186, %if.else34 ]
%c_z.1 = phi i32 [ %c_z.0187, %if.then17 ], [ %c_z.0187, %if.then28 ], [ %inc39, %if.else34 ]
%c_y.1 = phi i32 [ %c_y.0188, %if.then17 ], [ %inc33, %if.then28 ], [ %c_y.0188, %if.else34 ]
%c_x.1 = phi i32 [ %inc22, %if.then17 ], [ %c_x.0189, %if.then28 ], [ %c_x.0189, %if.else34 ]
%indvars.iv.next207 = add nuw nsw i64 %indvars.iv206, 1
%exitcond210.not = icmp eq i64 %indvars.iv.next207, %wide.trip.count209
br i1 %exitcond210.not, label %if.end84, label %for.body12, !llvm.loop !11
for.body48: ; preds = %for.body48.preheader, %for.inc81
%indvars.iv203 = phi i64 [ 0, %for.body48.preheader ], [ %indvars.iv.next204, %for.inc81 ]
%c_x.2179 = phi i32 [ 0, %for.body48.preheader ], [ %c_x.3, %for.inc81 ]
%c_y.2178 = phi i32 [ 0, %for.body48.preheader ], [ %c_y.3, %for.inc81 ]
%c_z.2177 = phi i32 [ 0, %for.body48.preheader ], [ %c_z.3, %for.inc81 ]
%flag2.2176 = phi i32 [ 0, %for.body48.preheader ], [ %flag2.3, %for.inc81 ]
%flag1.2175 = phi i32 [ 0, %for.body48.preheader ], [ %flag1.3, %for.inc81 ]
%arrayidx50 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv203
%10 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%cmp51 = icmp slt i32 %10, 0
%cmp53 = icmp eq i32 %flag1.2175, 0
%or.cond119 = select i1 %cmp51, i1 %cmp53, i1 false
br i1 %or.cond119, label %if.then54, label %if.else60
if.then54: ; preds = %for.body48
%idxprom57 = sext i32 %c_x.2179 to i64
%arrayidx58 = getelementptr inbounds i32, ptr %vla1, i64 %idxprom57
store i32 %10, ptr %arrayidx58, align 4, !tbaa !5
%inc59 = add nsw i32 %c_x.2179, 1
br label %for.inc81
if.else60: ; preds = %for.body48
%cmp65 = icmp slt i32 %flag2.2176, 2
%or.cond120 = select i1 %cmp51, i1 %cmp65, i1 false
br i1 %or.cond120, label %if.then66, label %if.else73
if.then66: ; preds = %if.else60
%idxprom69 = sext i32 %c_y.2178 to i64
%arrayidx70 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom69
store i32 %10, ptr %arrayidx70, align 4, !tbaa !5
%inc71 = add nsw i32 %c_y.2178, 1
%inc72 = add nsw i32 %flag2.2176, 1
br label %for.inc81
if.else73: ; preds = %if.else60
%idxprom76 = sext i32 %c_z.2177 to i64
%arrayidx77 = getelementptr inbounds i32, ptr %vla3, i64 %idxprom76
store i32 %10, ptr %arrayidx77, align 4, !tbaa !5
%inc78 = add nsw i32 %c_z.2177, 1
br label %for.inc81
for.inc81: ; preds = %if.then54, %if.else73, %if.then66
%flag1.3 = phi i32 [ 1, %if.then54 ], [ %flag1.2175, %if.then66 ], [ %flag1.2175, %if.else73 ]
%flag2.3 = phi i32 [ %flag2.2176, %if.then54 ], [ %inc72, %if.then66 ], [ %flag2.2176, %if.else73 ]
%c_z.3 = phi i32 [ %c_z.2177, %if.then54 ], [ %c_z.2177, %if.then66 ], [ %inc78, %if.else73 ]
%c_y.3 = phi i32 [ %c_y.2178, %if.then54 ], [ %inc71, %if.then66 ], [ %c_y.2178, %if.else73 ]
%c_x.3 = phi i32 [ %inc59, %if.then54 ], [ %c_x.2179, %if.then66 ], [ %c_x.2179, %if.else73 ]
%indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
%exitcond.not = icmp eq i64 %indvars.iv.next204, %wide.trip.count
br i1 %exitcond.not, label %if.end84, label %for.body48, !llvm.loop !12
if.end84.thread: ; preds = %for.cond10.preheader, %for.cond46.preheader, %entry
%call85234 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef 0)
br label %for.end94
if.end84: ; preds = %for.inc81, %for.inc42
%c_z.4 = phi i32 [ %c_z.1, %for.inc42 ], [ %c_z.3, %for.inc81 ]
%c_y.4 = phi i32 [ %c_y.1, %for.inc42 ], [ %c_y.3, %for.inc81 ]
%c_x.4 = phi i32 [ %c_x.1, %for.inc42 ], [ %c_x.3, %for.inc81 ]
%call85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c_x.4)
%cmp87194 = icmp sgt i32 %c_x.4, 0
br i1 %cmp87194, label %for.body88.preheader, label %for.end94
for.body88.preheader: ; preds = %if.end84
%wide.trip.count214 = zext i32 %c_x.4 to i64
br label %for.body88
for.body88: ; preds = %for.body88.preheader, %for.body88
%indvars.iv211 = phi i64 [ 0, %for.body88.preheader ], [ %indvars.iv.next212, %for.body88 ]
%arrayidx90 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv211
%11 = load i32, ptr %arrayidx90, align 4, !tbaa !5
%call91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %11)
%indvars.iv.next212 = add nuw nsw i64 %indvars.iv211, 1
%exitcond215.not = icmp eq i64 %indvars.iv.next212, %wide.trip.count214
br i1 %exitcond215.not, label %for.end94, label %for.body88, !llvm.loop !13
for.end94: ; preds = %for.body88, %if.end84.thread, %if.end84
%c_y.4237 = phi i32 [ 0, %if.end84.thread ], [ %c_y.4, %if.end84 ], [ %c_y.4, %for.body88 ]
%c_z.4236 = phi i32 [ 0, %if.end84.thread ], [ %c_z.4, %if.end84 ], [ %c_z.4, %for.body88 ]
%putchar = call i32 @putchar(i32 10)
%call96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c_y.4237)
%cmp98196 = icmp sgt i32 %c_y.4237, 0
br i1 %cmp98196, label %for.body99.preheader, label %for.end105
for.body99.preheader: ; preds = %for.end94
%wide.trip.count219 = zext i32 %c_y.4237 to i64
br label %for.body99
for.body99: ; preds = %for.body99.preheader, %for.body99
%indvars.iv216 = phi i64 [ 0, %for.body99.preheader ], [ %indvars.iv.next217, %for.body99 ]
%arrayidx101 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv216
%12 = load i32, ptr %arrayidx101, align 4, !tbaa !5
%call102 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12)
%indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
%exitcond220.not = icmp eq i64 %indvars.iv.next217, %wide.trip.count219
br i1 %exitcond220.not, label %for.end105, label %for.body99, !llvm.loop !14
for.end105: ; preds = %for.body99, %for.end94
%putchar167 = call i32 @putchar(i32 10)
%call107 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c_z.4236)
%cmp109198 = icmp sgt i32 %c_z.4236, 0
br i1 %cmp109198, label %for.body110.preheader, label %for.end116
for.body110.preheader: ; preds = %for.end105
%wide.trip.count224 = zext i32 %c_z.4236 to i64
br label %for.body110
for.body110: ; preds = %for.body110.preheader, %for.body110
%indvars.iv221 = phi i64 [ 0, %for.body110.preheader ], [ %indvars.iv.next222, %for.body110 ]
%arrayidx112 = getelementptr inbounds i32, ptr %vla3, i64 %indvars.iv221
%13 = load i32, ptr %arrayidx112, align 4, !tbaa !5
%call113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
%indvars.iv.next222 = add nuw nsw i64 %indvars.iv221, 1
%exitcond225.not = icmp eq i64 %indvars.iv.next222, %wide.trip.count224
br i1 %exitcond225.not, label %for.end116, label %for.body110, !llvm.loop !15
for.end116: ; preds = %for.body110, %for.end105
%putchar168 = call i32 @putchar(i32 10)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(){
int A,B,n;
scanf("%d %d",&A,&B);
n=A+B;
if(n<10){
printf("%d\n",n);
}
else{
printf("error\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129063/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129063/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp slt i32 %add, 10
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add)
br label %if.end
if.else: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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,B;
scanf("%d%d",&A,&B);
if(A+B >= 10)
printf("error\n");
else
printf("%d\n",A+B);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129106/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129106/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [6 x i8] c"error\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%A = alloca i32, align 4
%B = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A, ptr noundef nonnull %B)
%0 = load i32, ptr %A, align 4, !tbaa !5
%1 = load i32, ptr %B, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%cmp = icmp sgt i32 %add, 9
br i1 %cmp, label %if.then, label %if.else
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %if.end
if.else: ; preds = %entry
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add)
br label %if.end
if.end: ; preds = %if.else, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @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>
#include<stdlib.h>
int main(){
int n, m, a, i, j, now=0, ans=0;
int s[100000];
scanf("%d %d", &n, &m);
s[0] = 0;
for(i=1;i<=n-1;i++)
{
scanf("%d", &s[i]);
s[i] += s[i-1];
/*
printf("%d ", s[i]);
*/
}
for(j=0;j<m;j++)
{
scanf("%d", &a);
if(a>0) ans += (s[now+a] - s[now]) % 100000;
else ans += (s[now] - s[now+a]) % 100000;
if(ans>100000) ans = ans % 100000;
/*
printf("%d ", s[now+a] - s[now]);
*/
now += a;
}
printf("%d\n", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129157/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129157/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%m = alloca i32, align 4
%a = alloca i32, align 4
%s = alloca [100000 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 %m) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 400000, ptr nonnull %s) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %m)
store i32 0, ptr %s, align 16, !tbaa !5
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not.not50 = icmp sgt i32 %0, 1
br i1 %cmp.not.not50, label %for.body, label %for.cond8.preheader
for.cond8.preheader: ; preds = %for.body, %entry
%1 = load i32, ptr %m, align 4, !tbaa !5
%cmp952 = icmp sgt i32 %1, 0
br i1 %cmp952, label %for.body10, label %for.end35
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 1, %entry ]
%arrayidx1 = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx1)
%2 = add nsw i64 %indvars.iv, -1
%arrayidx5 = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %2
%3 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%add = add nsw i32 %4, %3
store i32 %add, ptr %arrayidx1, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp.not.not = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp.not.not, label %for.body, label %for.cond8.preheader, !llvm.loop !9
for.body10: ; preds = %for.cond8.preheader, %for.body10
%ans.055 = phi i32 [ %ans.2, %for.body10 ], [ 0, %for.cond8.preheader ]
%now.054 = phi i32 [ %add13, %for.body10 ], [ 0, %for.cond8.preheader ]
%j.053 = phi i32 [ %inc34, %for.body10 ], [ 0, %for.cond8.preheader ]
%call11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a)
%7 = load i32, ptr %a, align 4, !tbaa !5
%cmp12 = icmp sgt i32 %7, 0
%add13 = add nsw i32 %7, %now.054
%now.054.add13 = select i1 %cmp12, i32 %now.054, i32 %add13
%add13.now.054 = select i1 %cmp12, i32 %add13, i32 %now.054
%idxprom20.pn = sext i32 %add13.now.054 to i64
%.sink.in = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %idxprom20.pn
%.sink = load i32, ptr %.sink.in, align 4, !tbaa !5
%idxprom23 = sext i32 %now.054.add13 to i64
%arrayidx24 = getelementptr inbounds [100000 x i32], ptr %s, i64 0, i64 %idxprom23
%8 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%sub25 = sub nsw i32 %.sink, %8
%rem.pn = srem i32 %sub25, 100000
%ans.1 = add nsw i32 %rem.pn, %ans.055
%cmp28 = icmp sgt i32 %ans.1, 100000
%rem30 = urem i32 %ans.1, 100000
%ans.2 = select i1 %cmp28, i32 %rem30, i32 %ans.1
%inc34 = add nuw nsw i32 %j.053, 1
%9 = load i32, ptr %m, align 4, !tbaa !5
%cmp9 = icmp slt i32 %inc34, %9
br i1 %cmp9, label %for.body10, label %for.end35, !llvm.loop !11
for.end35: ; preds = %for.body10, %for.cond8.preheader
%ans.0.lcssa = phi i32 [ 0, %for.cond8.preheader ], [ %ans.2, %for.body10 ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
unsigned long n,i,j,k,num,x;
char c[102];
char fast_char_var;
#define fast_unsigned_dtype unsigned long
fast_unsigned_dtype fast_unsigned_var;
void fast_unsigned()
{
fast_char_var=getchar();
while(fast_char_var<48||fast_char_var>57)
fast_char_var=getchar();
fast_unsigned_var=0;
while(fast_char_var>47&&fast_char_var<58)
{
//fast_unsigned_var=(fast_unsigned_var<<1)+(fast_unsigned_var<<3)+fast_char_var-48;
c[fast_unsigned_var++]=fast_char_var;
fast_char_var=getchar();
}
n=fast_unsigned_var;
//return fast_unsigned_var;
}
int main()
{
fast_unsigned();
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
for(k=j+1;k<n;k++)
{
num=c[i]-'0';
num=(num<<1)+(num<<3)+c[j]-'0';
num=(num<<1)+(num<<3)+c[k]-'0';
//printf("%lu\n",num );
if(!(num%8))
{
printf("YES\n%lu\n",num);
return 0;
}
}
}
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
num=c[i]-'0';
num=(num<<1)+(num<<3)+c[j]-'0';
if(!(num%8))
{
printf("YES\n%lu\n",num);
return 0;
}
}
}
for(i=0;i<n;i++)
{
num=c[i]-'0';
if(!(num%8))
{
printf("YES\n%lu\n",num);
return 0;
}
}
printf("NO\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12920/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12920/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@fast_char_var = dso_local local_unnamed_addr global i8 0, align 1
@fast_unsigned_var = dso_local local_unnamed_addr global i64 0, align 8
@c = dso_local local_unnamed_addr global [102 x i8] zeroinitializer, align 16
@n = dso_local local_unnamed_addr global i64 0, align 8
@i = dso_local local_unnamed_addr global i64 0, align 8
@j = dso_local local_unnamed_addr global i64 0, align 8
@k = dso_local local_unnamed_addr global i64 0, align 8
@num = dso_local local_unnamed_addr global i64 0, align 8
@.str = private unnamed_addr constant [9 x i8] c"YES\0A%lu\0A\00", align 1
@x = dso_local local_unnamed_addr global i64 0, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [3 x i8] c"NO\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local void @fast_unsigned() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %0)
%storemerge21 = trunc i32 %call.i to i8
store i8 %storemerge21, ptr @fast_char_var, align 1, !tbaa !9
%sext22 = shl i32 %call.i, 24
%1 = add i32 %sext22, -956301313
%2 = icmp ult i32 %1, -150994945
br i1 %2, label %while.body, label %while.end
while.body: ; preds = %entry, %while.body
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i19 = tail call i32 @getc(ptr noundef %3)
%storemerge = trunc i32 %call.i19 to i8
store i8 %storemerge, ptr @fast_char_var, align 1, !tbaa !9
%sext = shl i32 %call.i19, 24
%4 = add i32 %sext, -956301313
%5 = icmp ult i32 %4, -150994945
br i1 %5, label %while.body, label %while.end, !llvm.loop !10
while.end: ; preds = %while.body, %entry
%6 = phi i8 [ %storemerge21, %entry ], [ %storemerge, %while.body ]
store i64 0, ptr @fast_unsigned_var, align 8, !tbaa !12
%7 = add i8 %6, -48
%8 = icmp ult i8 %7, 10
br i1 %8, label %while.body15, label %while.end18
while.body15: ; preds = %while.end, %while.body15
%9 = phi i8 [ %conv17, %while.body15 ], [ %6, %while.end ]
%10 = load i64, ptr @fast_unsigned_var, align 8, !tbaa !12
%inc = add i64 %10, 1
store i64 %inc, ptr @fast_unsigned_var, align 8, !tbaa !12
%arrayidx = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %10
store i8 %9, ptr %arrayidx, align 1, !tbaa !9
%11 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i20 = tail call i32 @getc(ptr noundef %11)
%conv17 = trunc i32 %call.i20 to i8
store i8 %conv17, ptr @fast_char_var, align 1, !tbaa !9
%12 = add i8 %conv17, -48
%13 = icmp ult i8 %12, 10
br i1 %13, label %while.body15, label %while.end18.loopexit, !llvm.loop !14
while.end18.loopexit: ; preds = %while.body15
%.pre = load i64, ptr @fast_unsigned_var, align 8, !tbaa !12
br label %while.end18
while.end18: ; preds = %while.end18.loopexit, %while.end
%14 = phi i64 [ %.pre, %while.end18.loopexit ], [ 0, %while.end ]
store i64 %14, ptr @n, align 8, !tbaa !12
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i.i = tail call i32 @getc(ptr noundef %0)
%storemerge21.i = trunc i32 %call.i.i to i8
store i8 %storemerge21.i, ptr @fast_char_var, align 1, !tbaa !9
%sext22.i = shl i32 %call.i.i, 24
%1 = add i32 %sext22.i, -956301313
%2 = icmp ult i32 %1, -150994945
br i1 %2, label %while.body.i, label %while.end.i
while.body.i: ; preds = %entry, %while.body.i
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i19.i = tail call i32 @getc(ptr noundef %3)
%storemerge.i = trunc i32 %call.i19.i to i8
store i8 %storemerge.i, ptr @fast_char_var, align 1, !tbaa !9
%sext.i = shl i32 %call.i19.i, 24
%4 = add i32 %sext.i, -956301313
%5 = icmp ult i32 %4, -150994945
br i1 %5, label %while.body.i, label %while.end.i, !llvm.loop !10
while.end.i: ; preds = %while.body.i, %entry
%6 = phi i8 [ %storemerge21.i, %entry ], [ %storemerge.i, %while.body.i ]
store i64 0, ptr @fast_unsigned_var, align 8, !tbaa !12
%7 = add i8 %6, -48
%8 = icmp ult i8 %7, 10
br i1 %8, label %while.body15.i, label %fast_unsigned.exit.thread
fast_unsigned.exit.thread: ; preds = %while.end.i
store i64 0, ptr @n, align 8, !tbaa !12
br label %for.end74
while.body15.i: ; preds = %while.end.i, %while.body15.i
%9 = phi i8 [ %conv17.i, %while.body15.i ], [ %6, %while.end.i ]
%10 = load i64, ptr @fast_unsigned_var, align 8, !tbaa !12
%inc.i = add i64 %10, 1
store i64 %inc.i, ptr @fast_unsigned_var, align 8, !tbaa !12
%arrayidx.i = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %10
store i8 %9, ptr %arrayidx.i, align 1, !tbaa !9
%11 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i20.i = tail call i32 @getc(ptr noundef %11)
%conv17.i = trunc i32 %call.i20.i to i8
store i8 %conv17.i, ptr @fast_char_var, align 1, !tbaa !9
%12 = add i8 %conv17.i, -48
%13 = icmp ult i8 %12, 10
br i1 %13, label %while.body15.i, label %fast_unsigned.exit, !llvm.loop !14
fast_unsigned.exit: ; preds = %while.body15.i
%.pre.i = load i64, ptr @fast_unsigned_var, align 8, !tbaa !12
store i64 %.pre.i, ptr @n, align 8, !tbaa !12
%cmp96.not = icmp eq i64 %.pre.i, 0
br i1 %cmp96.not, label %for.end74, label %for.cond1.preheader
for.cond1.preheader: ; preds = %fast_unsigned.exit, %for.inc25
%storemerge97 = phi i64 [ %storemerge8290, %for.inc25 ], [ 0, %fast_unsigned.exit ]
%storemerge8290 = add nuw i64 %storemerge97, 1
%cmp291 = icmp ult i64 %storemerge8290, %.pre.i
br i1 %cmp291, label %for.body3.lr.ph, label %for.inc25
for.body3.lr.ph: ; preds = %for.cond1.preheader
%arrayidx = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %storemerge97
br label %for.body3
for.cond28.preheader: ; preds = %for.inc25
br i1 %cmp96.not, label %for.end74, label %for.cond33.preheader
for.cond5.for.cond1.loopexit_crit_edge: ; preds = %for.inc
%sub21.le = add nsw i64 %add20, -48
store i64 %sub21.le, ptr @num, align 8, !tbaa !12
br label %for.cond1.loopexit
for.cond1.loopexit: ; preds = %for.cond5.for.cond1.loopexit_crit_edge, %for.body3
%storemerge83.lcssa = phi i64 [ %.pre.i, %for.cond5.for.cond1.loopexit_crit_edge ], [ %add4, %for.body3 ]
store i64 %storemerge83.lcssa, ptr @k, align 8, !tbaa !12
%storemerge82 = add nuw i64 %storemerge8293, 1
%cmp2 = icmp ult i64 %storemerge82, %.pre.i
br i1 %cmp2, label %for.body3, label %for.inc25, !llvm.loop !15
for.body3: ; preds = %for.body3.lr.ph, %for.cond1.loopexit
%storemerge8293 = phi i64 [ %storemerge8290, %for.body3.lr.ph ], [ %storemerge82, %for.cond1.loopexit ]
%storemerge82.in92 = phi i64 [ %storemerge97, %for.body3.lr.ph ], [ %storemerge8293, %for.cond1.loopexit ]
%add4 = add i64 %storemerge82.in92, 2
%cmp685 = icmp ult i64 %add4, %.pre.i
br i1 %cmp685, label %for.body7.lr.ph, label %for.cond1.loopexit
for.body7.lr.ph: ; preds = %for.body3
%14 = load i8, ptr %arrayidx, align 1, !tbaa !9
%conv = sext i8 %14 to i64
%15 = mul nsw i64 %conv, 10
%arrayidx11 = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %storemerge8293
%16 = load i8, ptr %arrayidx11, align 1, !tbaa !9
%conv12 = sext i8 %16 to i64
%add10 = add nsw i64 %15, %conv12
%17 = mul nsw i64 %add10, 10
%add17 = add nsw i64 %17, -5280
br label %for.body7
for.body7: ; preds = %for.body7.lr.ph, %for.inc
%storemerge8386 = phi i64 [ %add4, %for.body7.lr.ph ], [ %inc, %for.inc ]
%arrayidx18 = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %storemerge8386
%18 = load i8, ptr %arrayidx18, align 1, !tbaa !9
%conv19 = sext i8 %18 to i64
%add20 = add nsw i64 %add17, %conv19
%rem = and i64 %add20, 7
%tobool.not = icmp eq i64 %rem, 0
br i1 %tobool.not, label %if.then, label %for.inc
if.then: ; preds = %for.body7
%sub21.le137 = add nsw i64 %add20, -48
store i64 %storemerge97, ptr @i, align 8, !tbaa !12
store i64 %storemerge8293, ptr @j, align 8, !tbaa !12
store i64 %sub21.le137, ptr @num, align 8, !tbaa !12
store i64 %storemerge8386, ptr @k, align 8, !tbaa !12
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub21.le137)
br label %return
for.inc: ; preds = %for.body7
%inc = add nuw i64 %storemerge8386, 1
%cmp6 = icmp ult i64 %inc, %.pre.i
br i1 %cmp6, label %for.body7, label %for.cond5.for.cond1.loopexit_crit_edge, !llvm.loop !16
for.inc25: ; preds = %for.cond1.loopexit, %for.cond1.preheader
%storemerge82.lcssa = phi i64 [ %storemerge8290, %for.cond1.preheader ], [ %.pre.i, %for.cond1.loopexit ]
store i64 %storemerge82.lcssa, ptr @j, align 8, !tbaa !12
%exitcond.not = icmp eq i64 %storemerge8290, %.pre.i
br i1 %exitcond.not, label %for.cond28.preheader, label %for.cond1.preheader, !llvm.loop !17
for.cond33.preheader: ; preds = %for.cond28.preheader, %for.inc56
%storemerge79102 = phi i64 [ %inc57, %for.inc56 ], [ 0, %for.cond28.preheader ]
%arrayidx37 = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %storemerge79102
br label %for.cond33
for.cond59.preheader: ; preds = %for.inc56
br i1 %cmp96.not, label %for.end74, label %for.body62
for.cond33: ; preds = %for.cond33.preheader, %for.body36
%storemerge81.in = phi i64 [ %storemerge81, %for.body36 ], [ %storemerge79102, %for.cond33.preheader ]
%storemerge81 = add nuw i64 %storemerge81.in, 1
%cmp34 = icmp ult i64 %storemerge81, %.pre.i
br i1 %cmp34, label %for.body36, label %for.inc56
for.body36: ; preds = %for.cond33
%19 = load i8, ptr %arrayidx37, align 1, !tbaa !9
%conv38 = sext i8 %19 to i64
%20 = mul nsw i64 %conv38, 10
%add43 = add nsw i64 %20, -480
%arrayidx44 = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %storemerge81
%21 = load i8, ptr %arrayidx44, align 1, !tbaa !9
%conv45 = sext i8 %21 to i64
%add46 = add nsw i64 %add43, %conv45
%sub47 = add nsw i64 %add46, -48
store i64 %sub47, ptr @num, align 8, !tbaa !12
%rem48 = and i64 %add46, 7
%tobool49.not = icmp eq i64 %rem48, 0
br i1 %tobool49.not, label %if.then50, label %for.cond33, !llvm.loop !18
if.then50: ; preds = %for.body36
store i64 %storemerge79102, ptr @i, align 8, !tbaa !12
store i64 %storemerge81, ptr @j, align 8, !tbaa !12
%call51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub47)
br label %return
for.inc56: ; preds = %for.cond33
store i64 %storemerge81, ptr @j, align 8, !tbaa !12
%inc57 = add nuw i64 %storemerge79102, 1
%exitcond119.not = icmp eq i64 %inc57, %.pre.i
br i1 %exitcond119.not, label %for.cond59.preheader, label %for.cond33.preheader, !llvm.loop !19
for.body62: ; preds = %for.cond59.preheader, %for.inc72
%storemerge80106 = phi i64 [ %inc73, %for.inc72 ], [ 0, %for.cond59.preheader ]
%arrayidx63 = getelementptr inbounds [102 x i8], ptr @c, i64 0, i64 %storemerge80106
%22 = load i8, ptr %arrayidx63, align 1, !tbaa !9
%conv64 = sext i8 %22 to i64
%rem67 = and i64 %conv64, 7
%tobool68.not = icmp eq i64 %rem67, 0
br i1 %tobool68.not, label %if.then69, label %for.inc72
if.then69: ; preds = %for.body62
%sub65.le139 = add nsw i64 %conv64, -48
store i64 %sub65.le139, ptr @num, align 8, !tbaa !12
store i64 %storemerge80106, ptr @i, align 8, !tbaa !12
%call70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub65.le139)
br label %return
for.inc72: ; preds = %for.body62
%inc73 = add nuw i64 %storemerge80106, 1
%exitcond120.not = icmp eq i64 %inc73, %.pre.i
br i1 %exitcond120.not, label %for.cond59.for.end74_crit_edge, label %for.body62, !llvm.loop !20
for.cond59.for.end74_crit_edge: ; preds = %for.inc72
%sub65.le = add nsw i64 %conv64, -48
store i64 %sub65.le, ptr @num, align 8, !tbaa !12
br label %for.end74
for.end74: ; preds = %for.cond28.preheader, %fast_unsigned.exit, %fast_unsigned.exit.thread, %for.cond59.for.end74_crit_edge, %for.cond59.preheader
%storemerge80.lcssa = phi i64 [ %.pre.i, %for.cond59.for.end74_crit_edge ], [ 0, %for.cond59.preheader ], [ 0, %fast_unsigned.exit.thread ], [ 0, %fast_unsigned.exit ], [ 0, %for.cond28.preheader ]
store i64 %storemerge80.lcssa, ptr @i, align 8, !tbaa !12
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %return
return: ; preds = %for.end74, %if.then69, %if.then50, %if.then
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
|
#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
printf("%d\n",a + a * a + a * a * a);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129243/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129243/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%add = add nsw i32 %mul, %0
%mul2 = mul nsw i32 %mul, %0
%add3 = add nsw i32 %add, %mul2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a;
scanf("%d", &a);
printf("%d",a+a*a+a*a*a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129287/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129287/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%add = add nsw i32 %mul, %0
%mul2 = mul nsw i32 %mul, %0
%add3 = add nsw i32 %add, %mul2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n;
char buf[30];
//標準入力から1行bufに格納
fgets(buf, sizeof(buf), stdin);
n = atoi(buf);
//標準出力に書き出す
if (1<=n && n<=10)
printf("%d\n", n+n*n+n*n*n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129373/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129373/source.c"
target datalayout = "e-m:e-p270: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 [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%buf = alloca [30 x i8], align 16
call void @llvm.lifetime.start.p0(i64 30, ptr nonnull %buf) #4
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call = call ptr @fgets(ptr noundef nonnull %buf, i32 noundef 30, ptr noundef %0)
%call.i = call i64 @strtol(ptr nocapture noundef nonnull %buf, ptr noundef null, i32 noundef 10) #4
%conv.i = trunc i64 %call.i to i32
%1 = add i32 %conv.i, -1
%or.cond = icmp ult i32 %1, 10
br i1 %or.cond, label %if.then, label %if.end
if.then: ; preds = %entry
%mul = mul nuw nsw i32 %conv.i, %conv.i
%add = add nuw nsw i32 %mul, %conv.i
%mul5 = mul nuw nsw i32 %mul, %conv.i
%add6 = add nuw nsw i32 %add, %mul5
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add6)
br label %if.end
if.end: ; preds = %if.then, %entry
call void @llvm.lifetime.end.p0(i64 30, ptr nonnull %buf) #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 ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a;
int b;
int result;
scanf("%d",&a);
if(a <= 10 && a>=1){
result = a + a*a + a*a*a;
printf("%d", result);
return 0;
}
return 1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129416/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129416/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 10
br i1 %or.cond, label %if.then, label %cleanup
if.then: ; preds = %entry
%mul = mul nuw nsw i32 %0, %0
%add = add nuw nsw i32 %mul, %0
%mul3 = mul nuw nsw i32 %mul, %0
%add4 = add nuw nsw i32 %add, %mul3
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add4)
br label %cleanup
cleanup: ; preds = %entry, %if.then
%retval.0 = phi i32 [ 0, %if.then ], [ 1, %entry ]
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #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)"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int num(char *str,int index)
{
int a = (int)(str[index]-'0');
return a;
}
int main()
{
char *str;
str = (char *)malloc(1000);
scanf("%s",str);
int i,j,k;
int n = strlen(str);
for(i=0;i<n;i++)
{
if(num(str,i)==0 || num(str,i)==8)
{
printf("YES\n");
printf("%d",num(str,i));
return 0;
}
}
for(i=0;i<n;i++)
{
if(num(str,i)!=0)
{
for(j=i+1;j<n;j++)
{
int a = num(str,i)*10 + num(str,j);
if(a%8==0)
{
printf("YES\n");
printf("%d",a);
return 0;
}
}
}
}
for(i=0;i<n;i++)
{
if(num(str,i)!=0)
{
for(j=i+1;j<n;j++)
{
for(k=j+1;k<n;k++)
{
int a = num(str,i)*100 + num(str,j)*10 + num(str,k);
if(a%8==0)
{
printf("YES\n");
printf("%d",a);
return 0;
}
}
}
}
}
printf("NO");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12946/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12946/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"NO\00", align 1
@str.5 = private unnamed_addr constant [4 x i8] c"YES\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @num(ptr nocapture noundef readonly %str, i32 noundef %index) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %index to i64
%arrayidx = getelementptr inbounds i8, ptr %str, i64 %idxprom
%0 = load i8, ptr %arrayidx, align 1, !tbaa !5
%conv = sext i8 %0 to i32
%sub = add nsw i32 %conv, -48
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call noalias dereferenceable_or_null(1000) ptr @malloc(i64 noundef 1000) #6
%call1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %call)
%call2 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %call) #7
%conv = trunc i64 %call2 to i32
%cmp173 = icmp sgt i32 %conv, 0
br i1 %cmp173, label %for.body.preheader, label %for.end86
for.body.preheader: ; preds = %entry
%wide.trip.count = and i64 %call2, 4294967295
br label %for.body
for.cond13.preheader: ; preds = %for.inc
br i1 %cmp173, label %for.body16.preheader, label %for.end86
for.body16.preheader: ; preds = %for.cond13.preheader
%sext = shl i64 %call2, 32
%0 = ashr exact i64 %sext, 32
%wide.trip.count192 = and i64 %call2, 4294967295
br label %for.body16
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%arrayidx.i = getelementptr inbounds i8, ptr %call, i64 %indvars.iv
%1 = load i8, ptr %arrayidx.i, align 1, !tbaa !5
%conv.i = sext i8 %1 to i32
switch i32 %conv.i, label %for.inc [
i32 48, label %if.then
i32 56, label %if.then
]
if.then: ; preds = %for.body, %for.body
%arrayidx.i.le = getelementptr inbounds i8, ptr %call, i64 %indvars.iv
%puts136 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%2 = load i8, ptr %arrayidx.i.le, align 1, !tbaa !5
%conv.i143 = sext i8 %2 to i32
%sub.i144 = add nsw i32 %conv.i143, -48
%call12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %sub.i144)
br label %cleanup88
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 %for.cond13.preheader, label %for.body, !llvm.loop !8
for.cond41.preheader: ; preds = %for.inc38
br i1 %cmp173, label %for.body44.preheader, label %for.end86
for.body44.preheader: ; preds = %for.cond41.preheader
%sext214 = shl i64 %call2, 32
%3 = ashr exact i64 %sext214, 32
%wide.trip.count212 = and i64 %call2, 4294967295
br label %for.body44
for.body16: ; preds = %for.body16.preheader, %for.inc38
%indvars.iv186 = phi i64 [ 0, %for.body16.preheader ], [ %indvars.iv.next187, %for.inc38 ]
%arrayidx.i146 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv186
%4 = load i8, ptr %arrayidx.i146, align 1, !tbaa !5
%conv.i147 = sext i8 %4 to i32
%sub.i148 = add nsw i32 %conv.i147, -48
%cmp18.not = icmp eq i32 %sub.i148, 0
br i1 %cmp18.not, label %for.inc38, label %for.cond21.preheader
for.cond21.preheader: ; preds = %for.body16
%mul = mul nsw i32 %sub.i148, 10
%sub.i156 = add nsw i32 %mul, -48
br label %for.cond21
for.cond21: ; preds = %for.cond21.preheader, %for.body24
%indvars.iv188 = phi i64 [ %indvars.iv186, %for.cond21.preheader ], [ %indvars.iv.next189, %for.body24 ]
%indvars.iv.next189 = add nuw nsw i64 %indvars.iv188, 1
%cmp22 = icmp slt i64 %indvars.iv.next189, %0
br i1 %cmp22, label %for.body24, label %for.inc38
for.body24: ; preds = %for.cond21
%arrayidx.i154 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv.next189
%5 = load i8, ptr %arrayidx.i154, align 1, !tbaa !5
%conv.i155 = sext i8 %5 to i32
%add27 = add nsw i32 %sub.i156, %conv.i155
%6 = and i32 %add27, 7
%cmp28.not = icmp eq i32 %6, 0
br i1 %cmp28.not, label %if.then30, label %for.cond21, !llvm.loop !10
if.then30: ; preds = %for.body24
%puts135 = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%call32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add27)
br label %cleanup88
for.inc38: ; preds = %for.cond21, %for.body16
%indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 1
%exitcond193.not = icmp eq i64 %indvars.iv.next187, %wide.trip.count192
br i1 %exitcond193.not, label %for.cond41.preheader, label %for.body16, !llvm.loop !11
for.body44: ; preds = %for.body44.preheader, %for.inc84
%indvars.iv208 = phi i64 [ 0, %for.body44.preheader ], [ %.pre, %for.inc84 ]
%indvars.iv201 = phi i64 [ 1, %for.body44.preheader ], [ %indvars.iv.next202, %for.inc84 ]
%indvars.iv194 = phi i64 [ 2, %for.body44.preheader ], [ %indvars.iv.next195, %for.inc84 ]
%arrayidx.i158 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv208
%7 = load i8, ptr %arrayidx.i158, align 1, !tbaa !5
%conv.i159 = sext i8 %7 to i32
%sub.i160 = add nsw i32 %conv.i159, -48
%cmp46.not = icmp ne i32 %sub.i160, 0
%.pre = add nuw nsw i64 %indvars.iv208, 1
%cmp51179 = icmp slt i64 %.pre, %3
%or.cond = select i1 %cmp46.not, i1 %cmp51179, i1 false
br i1 %or.cond, label %for.body53.lr.ph, label %for.inc84
for.body53.lr.ph: ; preds = %for.body44
%mul61 = mul nsw i32 %sub.i160, 100
%add64 = add nsw i32 %mul61, -528
br label %for.body53
for.cond50.loopexit: ; preds = %for.cond55, %for.body53
%indvars.iv.next197 = add nuw nsw i64 %indvars.iv196, 1
%exitcond207.not = icmp eq i64 %indvars.iv.next204, %wide.trip.count212
br i1 %exitcond207.not, label %for.inc84, label %for.body53, !llvm.loop !12
for.body53: ; preds = %for.body53.lr.ph, %for.cond50.loopexit
%indvars.iv203 = phi i64 [ %indvars.iv201, %for.body53.lr.ph ], [ %indvars.iv.next204, %for.cond50.loopexit ]
%indvars.iv196 = phi i64 [ %indvars.iv194, %for.body53.lr.ph ], [ %indvars.iv.next197, %for.cond50.loopexit ]
%indvars.iv.next204 = add nuw nsw i64 %indvars.iv203, 1
%8 = trunc i64 %indvars.iv.next204 to i32
%cmp56177 = icmp slt i32 %8, %conv
br i1 %cmp56177, label %for.body58.lr.ph, label %for.cond50.loopexit
for.body58.lr.ph: ; preds = %for.body53
%arrayidx.i166 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv203
%9 = load i8, ptr %arrayidx.i166, align 1, !tbaa !5
%conv.i167 = sext i8 %9 to i32
%10 = mul nsw i32 %conv.i167, 10
br label %for.body58
for.cond55: ; preds = %for.body58
%indvars.iv.next199 = add nuw nsw i64 %indvars.iv198, 1
%11 = trunc i64 %indvars.iv.next199 to i32
%cmp56 = icmp slt i32 %11, %conv
br i1 %cmp56, label %for.body58, label %for.cond50.loopexit, !llvm.loop !13
for.body58: ; preds = %for.body58.lr.ph, %for.cond55
%indvars.iv198 = phi i64 [ %indvars.iv196, %for.body58.lr.ph ], [ %indvars.iv.next199, %for.cond55 ]
%arrayidx.i170 = getelementptr inbounds i8, ptr %call, i64 %indvars.iv198
%12 = load i8, ptr %arrayidx.i170, align 1, !tbaa !5
%conv.i171 = sext i8 %12 to i32
%sub.i172 = add nsw i32 %add64, %conv.i171
%add66 = add nsw i32 %sub.i172, %10
%13 = and i32 %add66, 7
%cmp68.not = icmp eq i32 %13, 0
br i1 %cmp68.not, label %if.then70, label %for.cond55
if.then70: ; preds = %for.body58
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str.5)
%call72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add66)
br label %cleanup88
for.inc84: ; preds = %for.cond50.loopexit, %for.body44
%indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
%indvars.iv.next202 = add nuw nsw i64 %indvars.iv201, 1
%exitcond213.not = icmp eq i64 %.pre, %wide.trip.count212
br i1 %exitcond213.not, label %for.end86, label %for.body44, !llvm.loop !14
for.end86: ; preds = %for.inc84, %entry, %for.cond13.preheader, %for.cond41.preheader
%call87 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
br label %cleanup88
cleanup88: ; preds = %if.then70, %if.then30, %for.end86, %if.then
ret i32 0
}
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}
|
#include <stdio.h>
int main () {
int a, ans = 0;
scanf("%d", &a);
ans = a + a * a + a * a * a;
printf("%d", ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129502/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129502/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%add = add nsw i32 %mul, %0
%mul2 = mul nsw i32 %mul, %0
%add3 = add nsw i32 %add, %mul2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#pragma GCC optimize("Ofast")
#include<stdio.h>
int main(void)
{
switch(getchar_unlocked())
{
case '2': puts("14"); return 0;
case '3': puts("39"); return 0;
case '4': puts("84"); return 0;
case '5': puts("155"); return 0;
case '6': puts("258"); return 0;
case '7': puts("399"); return 0;
case '8': puts("584"); return 0;
case '9': puts("819"); return 0;
default: switch(getchar_unlocked())
{
case '0': puts("1110"); return 0;
default: puts("3");
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129546/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129546/source.c"
target datalayout = "e-m:e-p270: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._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] }
@.str = private unnamed_addr constant [3 x i8] c"14\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"39\00", align 1
@.str.2 = private unnamed_addr constant [3 x i8] c"84\00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"155\00", align 1
@.str.4 = private unnamed_addr constant [4 x i8] c"258\00", align 1
@.str.5 = private unnamed_addr constant [4 x i8] c"399\00", align 1
@.str.6 = private unnamed_addr constant [4 x i8] c"584\00", align 1
@.str.7 = private unnamed_addr constant [4 x i8] c"819\00", align 1
@.str.8 = private unnamed_addr constant [5 x i8] c"1110\00", align 1
@.str.9 = private unnamed_addr constant [2 x i8] c"3\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@reltable.main = private unnamed_addr constant [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @.str to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.1 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.2 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.3 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.4 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.5 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.6 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @.str.7 to i64), i64 ptrtoint (ptr @reltable.main to i64)) to i32)], align 4
; Function Attrs: nounwind uwtable
define dso_local i32 @main() 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) #4
br label %getchar_unlocked.exit
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 %getchar_unlocked.exit
getchar_unlocked.exit: ; preds = %cond.true.i, %cond.false.i
%cond.i = phi i32 [ %call.i, %cond.true.i ], [ %conv3.i, %cond.false.i ]
%switch.tableidx = add i32 %cond.i, -50
%4 = icmp ult i32 %switch.tableidx, 8
br i1 %4, label %switch.lookup, label %sw.default
sw.default: ; preds = %getchar_unlocked.exit
%5 = load ptr, ptr @stdin, align 8, !tbaa !5
%_IO_read_ptr.i22 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 1
%6 = load ptr, ptr %_IO_read_ptr.i22, align 8, !tbaa !9
%_IO_read_end.i23 = getelementptr inbounds %struct._IO_FILE, ptr %5, i64 0, i32 2
%7 = load ptr, ptr %_IO_read_end.i23, align 8, !tbaa !14
%cmp.not.i24 = icmp ult ptr %6, %7
br i1 %cmp.not.i24, label %cond.false.i28, label %cond.true.i25, !prof !15
cond.true.i25: ; preds = %sw.default
%call.i26 = tail call i32 @__uflow(ptr noundef nonnull %5) #4
br label %getchar_unlocked.exit31
cond.false.i28: ; preds = %sw.default
%incdec.ptr.i29 = getelementptr inbounds i8, ptr %6, i64 1
store ptr %incdec.ptr.i29, ptr %_IO_read_ptr.i22, align 8, !tbaa !9
%8 = load i8, ptr %6, align 1, !tbaa !16
%conv3.i30 = zext i8 %8 to i32
br label %getchar_unlocked.exit31
getchar_unlocked.exit31: ; preds = %cond.true.i25, %cond.false.i28
%cond.i27 = phi i32 [ %call.i26, %cond.true.i25 ], [ %conv3.i30, %cond.false.i28 ]
%cond = icmp eq i32 %cond.i27, 48
%.str.8..str.9 = select i1 %cond, ptr @.str.8, ptr @.str.9
br label %return
switch.lookup: ; preds = %getchar_unlocked.exit
%9 = sext i32 %switch.tableidx to i64
%reltable.shift = shl i64 %9, 2
%reltable.intrinsic = call ptr @llvm.load.relative.i64(ptr @reltable.main, i64 %reltable.shift)
br label %return
return: ; preds = %switch.lookup, %getchar_unlocked.exit31
%.str.9.sink = phi ptr [ %.str.8..str.9, %getchar_unlocked.exit31 ], [ %reltable.intrinsic, %switch.lookup ]
%call20 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.9.sink)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1
declare i32 @__uflow(ptr noundef) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
declare ptr @llvm.load.relative.i64(ptr, i64) #3
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 = { nofree nounwind "no-trapping-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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!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}
|
#include<stdio.h>
#include<math.h>
int main()
{
int n;
long l,r,x,pows,counter,max,min,ans,i,s,ct,j;
long arr[20];
scanf("%d %ld %ld %ld",&n,&l,&r,&x);
for(i=0; i<n; i++)
{
scanf("%ld",&arr[i]);
}
pows=pow(2,n);
ans=0;
for(counter = 0; counter < pows; counter++)
{
s=0; ct=0; min=1000000001; max=-1;
for(j = 0; j < n; j++)
{
if(counter & (1<<j))
{
if(arr[j]>max)
max=arr[j];
if(arr[j]<min)
min=arr[j];
ct++;
s=s+arr[j];
}
}
if(ct>1)
{
if(s>=l && s<=r)
{
if((max-min)>=x)
{
ans++;
}
}
}
}
printf("%ld",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12964/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12964/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"%d %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:
%n = alloca i32, align 4
%l = alloca i64, align 8
%r = alloca i64, align 8
%x = alloca i64, align 8
%arr = alloca [20 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %r) #5
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %arr) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %l, ptr noundef nonnull %r, ptr noundef nonnull %x)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%i.074 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i64], ptr %arr, i64 0, i64 %i.074
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%inc = add nuw nsw i64 %i.074, 1
%1 = load i32, ptr %n, align 4, !tbaa !5
%conv = sext i32 %1 to i64
%cmp = icmp slt i64 %inc, %conv
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body, %entry
%.lcssa = phi i32 [ %0, %entry ], [ %1, %for.body ]
%ldexp = call double @ldexp(double 1.000000e+00, i32 %.lcssa) #5
%conv5 = fptosi double %ldexp to i64
%cmp785 = icmp sgt i64 %conv5, 0
br i1 %cmp785, label %for.cond10.preheader.lr.ph, label %for.end50
for.cond10.preheader.lr.ph: ; preds = %for.end
%2 = load i32, ptr %n, align 4, !tbaa !5
%conv11 = sext i32 %2 to i64
%cmp1275 = icmp sgt i32 %2, 0
%3 = load i64, ptr %l, align 8
%4 = load i64, ptr %r, align 8
%5 = load i64, ptr %x, align 8
br i1 %cmp1275, label %for.cond10.preheader.us, label %for.end50
for.cond10.preheader.us: ; preds = %for.cond10.preheader.lr.ph, %for.cond10.for.end32_crit_edge.us
%ans.087.us = phi i64 [ %ans.1.us, %for.cond10.for.end32_crit_edge.us ], [ 0, %for.cond10.preheader.lr.ph ]
%counter.086.us = phi i64 [ %inc49.us, %for.cond10.for.end32_crit_edge.us ], [ 0, %for.cond10.preheader.lr.ph ]
br label %for.body14.us
for.body14.us: ; preds = %for.cond10.preheader.us, %for.inc30.us
%j.080.us = phi i64 [ 0, %for.cond10.preheader.us ], [ %inc31.us, %for.inc30.us ]
%ct.079.us = phi i64 [ 0, %for.cond10.preheader.us ], [ %ct.1.us, %for.inc30.us ]
%s.078.us = phi i64 [ 0, %for.cond10.preheader.us ], [ %s.1.us, %for.inc30.us ]
%min.077.us = phi i64 [ 1000000001, %for.cond10.preheader.us ], [ %min.2.us, %for.inc30.us ]
%max.076.us = phi i64 [ -1, %for.cond10.preheader.us ], [ %max.2.us, %for.inc30.us ]
%sh_prom.us = trunc i64 %j.080.us to i32
%shl.us = shl nuw i32 1, %sh_prom.us
%conv15.us = sext i32 %shl.us to i64
%and.us = and i64 %counter.086.us, %conv15.us
%tobool.not.us = icmp eq i64 %and.us, 0
br i1 %tobool.not.us, label %for.inc30.us, label %if.then.us
if.then.us: ; preds = %for.body14.us
%arrayidx16.us = getelementptr inbounds [20 x i64], ptr %arr, i64 0, i64 %j.080.us
%6 = load i64, ptr %arrayidx16.us, align 8, !tbaa !11
%spec.select.us = call i64 @llvm.smax.i64(i64 %6, i64 %max.076.us)
%min.1.us = call i64 @llvm.smin.i64(i64 %6, i64 %min.077.us)
%inc27.us = add nsw i64 %ct.079.us, 1
%add.us = add nsw i64 %6, %s.078.us
br label %for.inc30.us
for.inc30.us: ; preds = %if.then.us, %for.body14.us
%max.2.us = phi i64 [ %spec.select.us, %if.then.us ], [ %max.076.us, %for.body14.us ]
%min.2.us = phi i64 [ %min.1.us, %if.then.us ], [ %min.077.us, %for.body14.us ]
%s.1.us = phi i64 [ %add.us, %if.then.us ], [ %s.078.us, %for.body14.us ]
%ct.1.us = phi i64 [ %inc27.us, %if.then.us ], [ %ct.079.us, %for.body14.us ]
%inc31.us = add nuw nsw i64 %j.080.us, 1
%exitcond.not = icmp eq i64 %inc31.us, %conv11
br i1 %exitcond.not, label %for.cond10.for.end32_crit_edge.us, label %for.body14.us, !llvm.loop !13
for.cond10.for.end32_crit_edge.us: ; preds = %for.inc30.us
%cmp33.us = icmp sgt i64 %ct.1.us, 1
%cmp36.not.us = icmp sge i64 %s.1.us, %3
%or.cond.us.not = select i1 %cmp33.us, i1 %cmp36.not.us, i1 false
%cmp38.not.us = icmp sle i64 %s.1.us, %4
%or.cond70.us = select i1 %or.cond.us.not, i1 %cmp38.not.us, i1 false
%sub.us = sub nsw i64 %max.2.us, %min.2.us
%cmp41.not.us = icmp sge i64 %sub.us, %5
%narrow = select i1 %or.cond70.us, i1 %cmp41.not.us, i1 false
%spec.select71.us = zext i1 %narrow to i64
%ans.1.us = add nuw nsw i64 %ans.087.us, %spec.select71.us
%inc49.us = add nuw nsw i64 %counter.086.us, 1
%exitcond91.not = icmp eq i64 %inc49.us, %conv5
br i1 %exitcond91.not, label %for.end50, label %for.cond10.preheader.us, !llvm.loop !14
for.end50: ; preds = %for.cond10.for.end32_crit_edge.us, %for.cond10.preheader.lr.ph, %for.end
%ans.0.lcssa = phi i64 [ 0, %for.end ], [ 0, %for.cond10.preheader.lr.ph ], [ %ans.1.us, %for.cond10.for.end32_crit_edge.us ]
%call51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %arr) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %r) #5
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int main ()
{
int a;
scanf ("%d",&a);
printf ("%d\n",(a+(a*a)+(a*a*a)));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129683/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129683/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%add = add nsw i32 %mul, %0
%mul2 = mul nsw i32 %mul, %0
%add3 = add nsw i32 %add, %mul2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a;
scanf("%d",&a);
printf("%d",a+a*a+a*a*a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129726/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129726/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%add = add nsw i32 %mul, %0
%mul2 = mul nsw i32 %mul, %0
%add3 = add nsw i32 %add, %mul2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int n,l,r,x,a[20],ans=0,state=0;
void func(int k,int d,int e,int h,int t)
{
if(k==n)
{
if(h-e>=x && d>=l && d<=r && t>1)
{
ans++;
// printf("%d %d %d %d\n",t,d,e,h);
}
return;
}
if(state==0)
{
state=1;
func(k+1,d+a[k],a[k],a[k],t+1);
state=0;
func(k+1,d,e,h,t);
}
else
{
if(a[k]<e)
{
func(k+1,d+a[k],a[k],h,t+1);
func(k+1,d,e,h,t);
}
else if(a[k]>h)
{
func(k+1,d+a[k],e,a[k],t+1);
func(k+1,d,e,h,t);
}
else
{
func(k+1,d+a[k],e,h,t+1);
func(k+1,d,e,h,t);
}
}
return;
}
int main()
{
int i;
scanf("%d %d %d %d",&n,&l,&r,&x);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
func(0,0,0,0,0);
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12977/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12977/source.c"
target datalayout = "e-m:e-p270: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 i32 0, align 4
@state = dso_local local_unnamed_addr global i32 0, align 4
@n = dso_local global i32 0, align 4
@x = dso_local global i32 0, align 4
@l = dso_local global i32 0, align 4
@r = dso_local global i32 0, align 4
@a = dso_local global [20 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [12 x i8] c"%d %d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @func(i32 noundef %k, i32 noundef %d, i32 noundef %e, i32 noundef %h, i32 noundef %t) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp103 = icmp eq i32 %0, %k
br i1 %cmp103, label %if.then, label %if.end8.lr.ph
if.end8.lr.ph: ; preds = %entry
%add48 = add nsw i32 %t, 1
br label %if.end8
if.then: ; preds = %tailrecurse.backedge, %entry
%sub = sub nsw i32 %h, %e
%1 = load i32, ptr @x, align 4, !tbaa !5
%cmp1.not = icmp slt i32 %sub, %1
%2 = load i32, ptr @l, align 4
%cmp2.not = icmp sgt i32 %2, %d
%or.cond102 = select i1 %cmp1.not, i1 true, i1 %cmp2.not
br i1 %or.cond102, label %return, label %land.lhs.true3
land.lhs.true3: ; preds = %if.then
%3 = load i32, ptr @r, align 4, !tbaa !5
%cmp4 = icmp sge i32 %3, %d
%cmp6 = icmp sgt i32 %t, 1
%or.cond = and i1 %cmp6, %cmp4
br i1 %or.cond, label %if.then7, label %return
if.then7: ; preds = %land.lhs.true3
%4 = load i32, ptr @ans, align 4, !tbaa !5
%inc = add nsw i32 %4, 1
store i32 %inc, ptr @ans, align 4, !tbaa !5
br label %return
if.end8: ; preds = %if.end8.lr.ph, %tailrecurse.backedge
%k.tr104 = phi i32 [ %k, %if.end8.lr.ph ], [ %k.tr.be, %tailrecurse.backedge ]
%5 = load i32, ptr @state, align 4, !tbaa !5
%cmp9 = icmp eq i32 %5, 0
br i1 %cmp9, label %if.then10, label %if.else
if.then10: ; preds = %if.end8
store i32 1, ptr @state, align 4, !tbaa !5
%add = add nsw i32 %k.tr104, 1
%idxprom = sext i32 %k.tr104 to i64
%arrayidx = getelementptr inbounds [20 x i32], ptr @a, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add11 = add nsw i32 %6, %d
tail call void @func(i32 noundef %add, i32 noundef %add11, i32 noundef %6, i32 noundef %6, i32 noundef %add48)
store i32 0, ptr @state, align 4, !tbaa !5
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.then10, %if.then21, %if.then34, %if.else43
%k.tr.be = phi i32 [ %add, %if.then10 ], [ %add22, %if.then21 ], [ %add35, %if.then34 ], [ %add35, %if.else43 ]
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp eq i32 %7, %k.tr.be
br i1 %cmp, label %if.then, label %if.end8
if.else: ; preds = %if.end8
%idxprom18 = sext i32 %k.tr104 to i64
%arrayidx19 = getelementptr inbounds [20 x i32], ptr @a, i64 0, i64 %idxprom18
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%cmp20 = icmp slt i32 %8, %e
br i1 %cmp20, label %if.then21, label %if.else30
if.then21: ; preds = %if.else
%add22 = add nsw i32 %k.tr104, 1
%add25 = add nsw i32 %8, %d
tail call void @func(i32 noundef %add22, i32 noundef %add25, i32 noundef %8, i32 noundef %h, i32 noundef %add48)
br label %tailrecurse.backedge
if.else30: ; preds = %if.else
%cmp33 = icmp sgt i32 %8, %h
%add35 = add nsw i32 %k.tr104, 1
%add38 = add nsw i32 %8, %d
br i1 %cmp33, label %if.then34, label %if.else43
if.then34: ; preds = %if.else30
tail call void @func(i32 noundef %add35, i32 noundef %add38, i32 noundef %e, i32 noundef %8, i32 noundef %add48)
br label %tailrecurse.backedge
if.else43: ; preds = %if.else30
tail call void @func(i32 noundef %add35, i32 noundef %add38, i32 noundef %e, i32 noundef %h, i32 noundef %add48)
br label %tailrecurse.backedge
return: ; preds = %if.then, %land.lhs.true3, %if.then7
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @l, ptr noundef nonnull @r, ptr noundef nonnull @x)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %for.body, label %for.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [20 x i32], ptr @a, i64 0, i64 %indvars.iv
%call1 = tail 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
tail call void @func(i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0)
%3 = load i32, ptr @ans, align 4, !tbaa !5
%call2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %3)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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"}
|
#include <stdio.h>
int main() {
int a, ans;
scanf("%d", &a);
ans = a + a*a + a*a*a;
printf("%d", ans);
return (0);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129812/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129812/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%mul = mul nsw i32 %0, %0
%add = add nsw i32 %mul, %0
%mul2 = mul nsw i32 %mul, %0
%add3 = add nsw i32 %add, %mul2
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int a,b,i;
scanf("%d",&a);
printf("%d",a*a*a + a*a + a);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129856/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129856/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = add i32 %0, 1
%mul15 = mul i32 %1, %0
%add6 = add i32 %mul15, 1
%add3 = mul i32 %add6, %0
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %add3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int s[20]={0};
long long ans=1;
int so(long long tmp,int a,int f){
// printf("%lld,%d,%d\n",tmp,a,f);
if(tmp<=0)return 0;
if(a==-1){
if(ans<tmp)ans=tmp;
return 1;
}
if(s[a]==-1)so(tmp,a-1,0);
if(f==1)so(tmp*9,a-1,1);
if(f==0){
so(tmp*(s[a]),a-1,0);
if(s[a]==1&&s[a+1]==-1)so(tmp,a-1,1);
if(s[a]!=0)so(tmp*(s[a]-1),a-1,1);
return 0;
}
}
int main(){
int ny;
scanf("%d",&ny);
int i,k=0,f=0;
for(i=0;i<20;i++)s[i]=-1;
while(ny!=0){
s[k]=ny%10;
ny/=10;
k++;
}
//printf("%d",k);
so(1,k+1,0);
printf("%lld\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1299/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1299/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@s = dso_local local_unnamed_addr global [20 x i32] zeroinitializer, align 16
@ans = dso_local local_unnamed_addr global i64 1, 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"%lld\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @so(i64 noundef %tmp, i32 noundef %a, i32 noundef %f) local_unnamed_addr #0 {
entry:
%cmp74 = icmp slt i64 %tmp, 1
br i1 %cmp74, label %if.end47.thread, label %if.end.preheader
if.end.preheader: ; preds = %entry
%cmp1.peel.not = icmp eq i32 %a, -1
br i1 %cmp1.peel.not, label %if.then2.thread, label %if.end6.peel
if.end6.peel: ; preds = %if.end.preheader
%idxprom.peel = sext i32 %a to i64
%arrayidx.peel = getelementptr inbounds [20 x i32], ptr @s, i64 0, i64 %idxprom.peel
%0 = load i32, ptr %arrayidx.peel, align 4, !tbaa !5
%cmp7.peel = icmp eq i32 %0, -1
br i1 %cmp7.peel, label %if.then8.peel, label %if.end9.peel
if.then8.peel: ; preds = %if.end6.peel
%sub.peel = add nsw i32 %a, -1
%call.peel = tail call i32 @so(i64 noundef %tmp, i32 noundef %sub.peel, i32 noundef 0)
br label %if.end9.peel
if.end9.peel: ; preds = %if.then8.peel, %if.end6.peel
switch i32 %f, label %if.end47.thread [
i32 1, label %if.then11.peel
i32 0, label %if.then16.peel
]
if.then16.peel: ; preds = %if.end9.peel
%1 = load i32, ptr %arrayidx.peel, align 4, !tbaa !5
%conv.peel = sext i32 %1 to i64
%mul19.peel = mul nsw i64 %conv.peel, %tmp
%sub20.peel = add nsw i32 %a, -1
%call21.peel = tail call i32 @so(i64 noundef %mul19.peel, i32 noundef %sub20.peel, i32 noundef 0)
%2 = load i32, ptr %arrayidx.peel, align 4, !tbaa !5
%cmp24.peel = icmp eq i32 %2, 1
br i1 %cmp24.peel, label %land.lhs.true.peel, label %if.end33.peel
land.lhs.true.peel: ; preds = %if.then16.peel
%add.peel = add nuw nsw i32 %a, 1
%idxprom26.peel = sext i32 %add.peel to i64
%arrayidx27.peel = getelementptr inbounds [20 x i32], ptr @s, i64 0, i64 %idxprom26.peel
%3 = load i32, ptr %arrayidx27.peel, align 4, !tbaa !5
%cmp28.peel = icmp eq i32 %3, -1
br i1 %cmp28.peel, label %if.then30.peel, label %if.then38.peel
if.then30.peel: ; preds = %land.lhs.true.peel
%call32.peel = tail call i32 @so(i64 noundef %tmp, i32 noundef %sub20.peel, i32 noundef 1)
%.pr.peel.pre = load i32, ptr %arrayidx.peel, align 4, !tbaa !5
br label %if.end33.peel
if.end33.peel: ; preds = %if.then30.peel, %if.then16.peel
%4 = phi i32 [ %2, %if.then16.peel ], [ %.pr.peel.pre, %if.then30.peel ]
%cmp36.not.peel = icmp eq i32 %4, 0
br i1 %cmp36.not.peel, label %if.end47.thread, label %if.then38.peel
if.then38.peel: ; preds = %land.lhs.true.peel, %if.end33.peel
%5 = phi i32 [ %4, %if.end33.peel ], [ 1, %land.lhs.true.peel ]
%sub41.peel = add nsw i32 %5, -1
%conv42.peel = sext i32 %sub41.peel to i64
%mul43.peel = mul nsw i64 %conv42.peel, %tmp
br label %tailrecurse.backedge.peel
if.then11.peel: ; preds = %if.end9.peel
%mul.peel = mul nsw i64 %tmp, 9
%sub12.peel = add nsw i32 %a, -1
br label %tailrecurse.backedge.peel
tailrecurse.backedge.peel: ; preds = %if.then11.peel, %if.then38.peel
%tmp.tr.be.peel = phi i64 [ %mul.peel, %if.then11.peel ], [ %mul43.peel, %if.then38.peel ]
%a.tr.be.peel = phi i32 [ %sub12.peel, %if.then11.peel ], [ %sub20.peel, %if.then38.peel ]
%cmp.peel = icmp slt i64 %tmp.tr.be.peel, 1
br i1 %cmp.peel, label %if.end47.thread98, label %if.end
if.end: ; preds = %tailrecurse.backedge.peel, %tailrecurse.backedge
%a.tr76 = phi i32 [ %sub12, %tailrecurse.backedge ], [ %a.tr.be.peel, %tailrecurse.backedge.peel ]
%tmp.tr75 = phi i64 [ %mul, %tailrecurse.backedge ], [ %tmp.tr.be.peel, %tailrecurse.backedge.peel ]
%cmp1 = icmp eq i32 %a.tr76, -1
br i1 %cmp1, label %if.then2, label %if.end6
if.then2: ; preds = %if.end
%6 = load i64, ptr @ans, align 8, !tbaa !9
%cmp3 = icmp slt i64 %6, %tmp.tr75
br i1 %cmp3, label %if.then4, label %if.end47
if.then2.thread: ; preds = %if.end.preheader
%7 = load i64, ptr @ans, align 8, !tbaa !9
%cmp3102 = icmp slt i64 %7, %tmp
br i1 %cmp3102, label %if.then4.thread, label %if.end47.thread
if.then4.thread: ; preds = %if.then2.thread
store i64 %tmp, ptr @ans, align 8, !tbaa !9
br label %if.end47.thread
if.then4: ; preds = %if.then2
store i64 %tmp.tr75, ptr @ans, align 8, !tbaa !9
br i1 %cmp1.peel.not, label %if.end47.thread, label %if.end47.thread98
if.end6: ; preds = %if.end
%idxprom = sext i32 %a.tr76 to i64
%arrayidx = getelementptr inbounds [20 x i32], ptr @s, i64 0, i64 %idxprom
%8 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp7 = icmp eq i32 %8, -1
br i1 %cmp7, label %if.then8, label %tailrecurse.backedge
if.then8: ; preds = %if.end6
%sub = add nsw i32 %a.tr76, -1
%call = tail call i32 @so(i64 noundef %tmp.tr75, i32 noundef %sub, i32 noundef 0)
br label %tailrecurse.backedge
tailrecurse.backedge: ; preds = %if.then8, %if.end6
%sub12 = add nsw i32 %a.tr76, -1
%mul = mul nsw i64 %tmp.tr75, 9
%cmp = icmp slt i64 %tmp.tr75, 1
br i1 %cmp, label %if.end47.thread98, label %if.end, !llvm.loop !11
if.end47: ; preds = %if.then2
br i1 %cmp1.peel.not, label %if.end47.thread, label %if.end47.thread98
if.end47.thread98: ; preds = %tailrecurse.backedge, %tailrecurse.backedge.peel, %if.then4, %if.end47
br label %if.end47.thread
if.end47.thread: ; preds = %if.then2.thread, %if.end33.peel, %if.end9.peel, %entry, %if.then4.thread, %if.then4, %if.end47, %if.end47.thread98
%9 = phi i32 [ 0, %if.end47.thread98 ], [ 1, %if.end47 ], [ 1, %if.then4 ], [ 1, %if.then4.thread ], [ 0, %entry ], [ 0, %if.end9.peel ], [ 0, %if.end33.peel ], [ 1, %if.then2.thread ]
ret i32 %9
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%ny = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %ny) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %ny)
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) @s, i8 -1, i64 80, i1 false), !tbaa !5
%.pr = load i32, ptr %ny, align 4, !tbaa !5
%cmp1.not12 = icmp eq i32 %.pr, 0
br i1 %cmp1.not12, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %entry ]
%0 = phi i32 [ %div, %while.body ], [ %.pr, %entry ]
%rem = srem i32 %0, 10
%arrayidx3 = getelementptr inbounds [20 x i32], ptr @s, i64 0, i64 %indvars.iv
store i32 %rem, ptr %arrayidx3, align 4, !tbaa !5
%div = sdiv i32 %0, 10
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%.off = add i32 %0, 9
%cmp1.not = icmp ult i32 %.off, 19
br i1 %cmp1.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !13
while.cond.while.end_crit_edge: ; preds = %while.body
%1 = trunc i64 %indvars.iv to i32
store i32 %div, ptr %ny, align 4, !tbaa !5
%2 = add nuw nsw i32 %1, 2
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%k.0.lcssa = phi i32 [ %2, %while.cond.while.end_crit_edge ], [ 1, %entry ]
%call5 = call i32 @so(i64 noundef 1, i32 noundef %k.0.lcssa, i32 noundef 0)
%3 = load i64, ptr @ans, align 8, !tbaa !9
%call6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %ny) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <stdlib.h>
int main(){
int f,s,fs;
scanf("%d%d%d",&f,&s,&fs);
int max;
int now=0;
if(f<s){
max+=f;
now=1;
}
else{
max+=s;
now=2;
}
if(now==1){
if(f+s<fs)max+=f+s;
else max+=fs;
now=2;
}
else{
if(f+s<fs)max+=f+s;
else max+=fs;
now=1;
}
if(now==1){
if(f<fs+s)max+=f;
else max+=fs+s;
}
else{
if(s<fs+f)max+=s;
else max+=fs+f;
}
printf("%d\n",max);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_12995/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_12995/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%f = alloca i32, align 4
%s = alloca i32, align 4
%fs = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %f) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %fs) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %f, ptr noundef nonnull %s, ptr noundef nonnull %fs)
%call42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef undef)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %fs) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %s) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %f) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
|
#include<stdio.h>
int main(void)
{
int N;
int i;
scanf("%d",&N);
if((N%7)%4==0) { printf("Yes\n"); return 0; }
if((N%4)%7==0) { printf("Yes\n"); return 0; }
for(i=0;i<=14;i++){
if(N-7*i<=0) { printf("No\n"); return 0; }
if((N-7*i)%4==0) { printf("Yes\n"); return 0; }
}
for(i=0;i<=24;i++){
if(N-4*i<=0) { printf("No\n"); return 0; }
if((N-4*i)%7==0) { printf("Yes\n"); return 0; }
}
printf("No\n");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_129993/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_129993/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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.6 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.8 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%rem = srem i32 %0, 7
%1 = and i32 %rem, 3
%cmp = icmp eq i32 %1, 0
br i1 %cmp, label %cleanup, label %if.end
if.end: ; preds = %entry
%2 = and i32 %0, 3
%cmp5 = icmp eq i32 %2, 0
br i1 %cmp5, label %cleanup, label %for.body
for.body: ; preds = %if.end
%3 = add i32 %0, 6
%smin = call i32 @llvm.smin.i32(i32 %0, i32 0)
%4 = sub i32 %3, %smin
%5 = udiv i32 %4, 7
%6 = sub i32 0, %0
%7 = and i32 %6, 3
%.not = icmp ugt i32 %5, %7
%str.5.str.6 = select i1 %.not, ptr @str.8, ptr @str.6
br label %cleanup
cleanup: ; preds = %for.body, %if.end, %entry
%str.5.sink = phi ptr [ @str.8, %entry ], [ @str.8, %if.end ], [ %str.5.str.6, %for.body ]
%puts51 = call i32 @puts(ptr nonnull dereferenceable(1) %str.5.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.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"}
|
#include <stdio.h>
int main(void){
int n, flag = 0;
scanf("%d", &n);
for (int cake = 0; cake < 101; cake++){
for (int donuts = 0; donuts < 101; donuts++){
if (4 * cake + 7 * donuts == n){
flag = 1;
}
}
}
if (flag == 1){
printf("%s\n", "Yes");
}
else {
printf("%s\n", "No");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130034/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130034/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"Yes\00", align 1
@.str.3 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%broadcast.splatinsert25 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat26 = shufflevector <4 x i32> %broadcast.splatinsert25, <4 x i32> poison, <4 x i32> zeroinitializer
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %entry, %for.body4
%cake.023 = phi i32 [ 0, %entry ], [ %inc8, %for.body4 ]
%flag.022 = phi i32 [ 0, %entry ], [ %spec.select, %for.body4 ]
%mul = shl nsw i32 %cake.023, 2
%minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %flag.022, i64 0
%minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %mul, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %for.cond1.preheader
%index = phi i32 [ 0, %for.cond1.preheader ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %for.cond1.preheader ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ %minmax.ident.splat, %for.cond1.preheader ], [ %4, %vector.body ]
%1 = mul nuw nsw <4 x i32> %vec.ind, <i32 7, i32 7, i32 7, i32 7>
%2 = add nuw nsw <4 x i32> %1, %broadcast.splat
%3 = icmp eq <4 x i32> %2, %broadcast.splat26
%4 = select <4 x i1> %3, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%index.next = add nuw i32 %index, 4
%vec.ind.next = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%5 = icmp eq i32 %index.next, 100
br i1 %5, label %for.body4, label %vector.body, !llvm.loop !9
for.cond.cleanup: ; preds = %for.body4
%cmp10 = icmp eq i32 %spec.select, 1
%.str.2..str.3 = select i1 %cmp10, ptr @.str.2, ptr @.str.3
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body4: ; preds = %vector.body
%.splatinsert = insertelement <4 x i32> poison, i32 %flag.022, i64 0
%.splat = shufflevector <4 x i32> %.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
%rdx.select.cmp = icmp ne <4 x i32> %4, %.splat
%6 = bitcast <4 x i1> %rdx.select.cmp to i4
%.not = icmp eq i4 %6, 0
%rdx.select = select i1 %.not, i32 %flag.022, i32 1
%add = add nuw nsw i32 %mul, 700
%cmp6 = icmp eq i32 %add, %0
%spec.select = select i1 %cmp6, i32 1, i32 %rdx.select
%inc8 = add nuw nsw i32 %cake.023, 1
%exitcond24.not = icmp eq i32 %inc8, 101
br i1 %exitcond24.not, label %for.cond.cleanup, label %for.cond1.preheader, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,j,flag=0;
scanf("%d",&n);
for(i=0;4*i<=n;i++)
for(j=0;7*j<=n;j++)
if(4*i+7*j==n)
{
flag=1;break;
}
if(flag)
printf("Yes\n");
else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130078/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130078/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%cmp.not24 = icmp slt i32 %0, 0
br i1 %cmp.not24, label %if.else, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%1 = mul i32 %0, -1227133513
br label %for.cond1.preheader.outer
for.cond1.preheader.outer: ; preds = %for.inc8.thread, %for.cond1.preheader.preheader
%indvars.iv.ph = phi i32 [ %indvars.iv.next33, %for.inc8.thread ], [ %1, %for.cond1.preheader.preheader ]
%2 = phi i1 [ false, %for.inc8.thread ], [ true, %for.cond1.preheader.preheader ]
%i.025.ph = phi i32 [ %inc930, %for.inc8.thread ], [ 0, %for.cond1.preheader.preheader ]
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader.outer, %for.inc8
%indvars.iv = phi i32 [ %indvars.iv.next, %for.inc8 ], [ %indvars.iv.ph, %for.cond1.preheader.outer ]
%i.025 = phi i32 [ %inc9, %for.inc8 ], [ %i.025.ph, %for.cond1.preheader.outer ]
br label %for.body4
for.cond1: ; preds = %for.body4
%inc = add nuw i32 %j.021, 1
%mul2 = mul nsw i32 %inc, 7
%cmp3.not = icmp sgt i32 %mul2, %0
br i1 %cmp3.not, label %for.inc8, label %for.body4, !llvm.loop !9
for.body4: ; preds = %for.cond1.preheader, %for.cond1
%j.021 = phi i32 [ 0, %for.cond1.preheader ], [ %inc, %for.cond1 ]
%exitcond = icmp eq i32 %j.021, %indvars.iv
br i1 %exitcond, label %for.inc8.thread, label %for.cond1
for.inc8: ; preds = %for.cond1
%inc9 = add nuw nsw i32 %i.025, 1
%mul = shl nsw i32 %inc9, 2
%cmp.not = icmp sgt i32 %mul, %0
%indvars.iv.next = add i32 %indvars.iv, 613566756
br i1 %cmp.not, label %for.end10, label %for.cond1.preheader, !llvm.loop !11
for.inc8.thread: ; preds = %for.body4
%inc930 = add nuw nsw i32 %i.025, 1
%mul31 = shl nsw i32 %inc930, 2
%cmp.not32 = icmp sgt i32 %mul31, %0
%indvars.iv.next33 = add i32 %indvars.iv, 613566756
br i1 %cmp.not32, label %if.end14, label %for.cond1.preheader.outer, !llvm.loop !11
for.end10: ; preds = %for.inc8
br i1 %2, label %if.else, label %if.end14
if.else: ; preds = %entry, %for.end10
br label %if.end14
if.end14: ; preds = %for.inc8.thread, %for.end10, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %for.end10 ], [ @str.3, %for.inc8.thread ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int n;
scanf("%d", &n);
int possible = 0;
if(n < 4){
printf("No\n");
}else{
for(int i = 1; ; i++){
if(4 * i > n) break;
if((n - (4 * i)) % 7 == 0){
possible = 1;
printf("Yes\n");
break;
}
}
if(possible == 0){
for(int i = 1; ; i++){
if(7 * i > n) break;
if((n - (7 * i)) % 4 == 0){
possible = 1;
printf("Yes\n");
break;
}
}
}
if(possible == 0) printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
@str.5 = private unnamed_addr constant [3 x i8] c"No\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() 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
%cmp = icmp slt i32 %0, 4
br i1 %cmp, label %if.end33, label %if.end
for.cond: ; preds = %if.end
%inc = add nuw nsw i32 %i.045, 1
%mul = shl nsw i32 %inc, 2
%cmp2 = icmp sgt i32 %mul, %0
br i1 %cmp2, label %for.cond12.preheader, label %if.end
for.cond12.preheader: ; preds = %for.cond
%cmp1447 = icmp slt i32 %0, 7
br i1 %cmp1447, label %if.end33, label %if.end16.preheader
if.end16.preheader: ; preds = %for.cond12.preheader
%1 = trunc i32 %0 to i2
%exitcond = icmp eq i2 %1, -1
br i1 %exitcond, label %if.end33, label %for.cond12
if.end: ; preds = %entry, %for.cond
%mul46 = phi i32 [ %mul, %for.cond ], [ 4, %entry ]
%i.045 = phi i32 [ %inc, %for.cond ], [ 1, %entry ]
%sub = sub nsw i32 %0, %mul46
%rem = srem i32 %sub, 7
%cmp5 = icmp eq i32 %rem, 0
br i1 %cmp5, label %if.end33, label %for.cond
for.cond12: ; preds = %if.end16.preheader
%cmp14 = icmp slt i32 %0, 14
br i1 %cmp14, label %if.end33, label %if.end16.1
if.end16.1: ; preds = %for.cond12
%exitcond.1 = icmp eq i2 %1, -2
br i1 %exitcond.1, label %if.end33, label %for.cond12.1
for.cond12.1: ; preds = %if.end16.1
%cmp14.1 = icmp slt i32 %0, 21
br i1 %cmp14.1, label %if.end33, label %if.end16.2
if.end16.2: ; preds = %for.cond12.1
%exitcond.2 = icmp eq i2 %1, 1
br i1 %exitcond.2, label %if.end33, label %for.cond12.2
for.cond12.2: ; preds = %if.end16.2
%cmp14.2 = icmp slt i32 %0, 28
br i1 %cmp14.2, label %if.end33, label %if.end16.3
if.end16.3: ; preds = %for.cond12.2
%exitcond.3 = icmp eq i2 %1, 0
%spec.select = select i1 %exitcond.3, ptr @str.3, ptr @str.5
br label %if.end33
if.end33: ; preds = %if.end16.3, %if.end, %for.cond12, %if.end16.preheader, %if.end16.1, %for.cond12.1, %if.end16.2, %for.cond12.2, %for.cond12.preheader, %entry
%str.3.sink = phi ptr [ @str.5, %entry ], [ @str.5, %for.cond12.preheader ], [ @str.3, %if.end16.preheader ], [ @str.5, %for.cond12 ], [ @str.3, %if.end16.1 ], [ @str.5, %for.cond12.1 ], [ @str.3, %if.end16.2 ], [ @str.5, %for.cond12.2 ], [ %spec.select, %if.end16.3 ], [ @str.3, %if.end ]
%puts42 = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int N, x;
int a = 0;
scanf("%d", &N);
for (int i = 0; i < 25; i++)
{
for (int j = 0; j < 100; j++) {
x = (4 * i) + (7 * j);
if(N==x)
{
a++;
}
}
}
if (a > 0) {
printf("Yes");
}
else
{
printf("No");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130171/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130171/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body.1, %entry
%index = phi i32 [ 0, %entry ], [ %index.next.1, %vector.body.1 ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %entry ], [ %vec.ind.next.1, %vector.body.1 ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %entry ], [ %10, %vector.body.1 ]
%1 = mul nuw nsw <4 x i32> %vec.ind, <i32 7, i32 7, i32 7, i32 7>
%2 = icmp eq <4 x i32> %broadcast.splat, %1
%3 = zext <4 x i1> %2 to <4 x i32>
%4 = add <4 x i32> %vec.phi, %3
%5 = icmp eq i32 %index, 96
br i1 %5, label %middle.block, label %vector.body.1, !llvm.loop !9
vector.body.1: ; preds = %vector.body
%6 = mul <4 x i32> %vec.ind, <i32 7, i32 7, i32 7, i32 7>
%7 = add <4 x i32> %6, <i32 28, i32 28, i32 28, i32 28>
%8 = icmp eq <4 x i32> %broadcast.splat, %7
%9 = zext <4 x i1> %8 to <4 x i32>
%10 = add <4 x i32> %4, %9
%index.next.1 = add nuw nsw i32 %index, 8
%vec.ind.next.1 = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body
middle.block: ; preds = %vector.body
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %4)
%12 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %11, i64 0
%broadcast.splatinsert35 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat36 = shufflevector <4 x i32> %broadcast.splatinsert35, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body30
vector.body43: ; preds = %vector.body43.1, %middle.block26
%index44 = phi i32 [ 0, %middle.block26 ], [ %index.next50.1, %vector.body43.1 ]
%vec.ind45 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block26 ], [ %vec.ind.next46.1, %vector.body43.1 ]
%vec.phi47 = phi <4 x i32> [ %323, %middle.block26 ], [ %23, %vector.body43.1 ]
%13 = mul nuw nsw <4 x i32> %vec.ind45, <i32 7, i32 7, i32 7, i32 7>
%14 = add nuw nsw <4 x i32> %13, <i32 8, i32 8, i32 8, i32 8>
%15 = icmp eq <4 x i32> %broadcast.splat49, %14
%16 = zext <4 x i1> %15 to <4 x i32>
%17 = add <4 x i32> %vec.phi47, %16
%18 = icmp eq i32 %index44, 96
br i1 %18, label %middle.block39, label %vector.body43.1, !llvm.loop !13
vector.body43.1: ; preds = %vector.body43
%19 = mul <4 x i32> %vec.ind45, <i32 7, i32 7, i32 7, i32 7>
%20 = add <4 x i32> %19, <i32 36, i32 36, i32 36, i32 36>
%21 = icmp eq <4 x i32> %broadcast.splat49, %20
%22 = zext <4 x i1> %21 to <4 x i32>
%23 = add <4 x i32> %17, %22
%index.next50.1 = add nuw nsw i32 %index44, 8
%vec.ind.next46.1 = add <4 x i32> %vec.ind45, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body43
middle.block39: ; preds = %vector.body43
%24 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %17)
%25 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %24, i64 0
%broadcast.splatinsert61 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat62 = shufflevector <4 x i32> %broadcast.splatinsert61, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body56
vector.body56: ; preds = %vector.body56.1, %middle.block39
%index57 = phi i32 [ 0, %middle.block39 ], [ %index.next63.1, %vector.body56.1 ]
%vec.ind58 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block39 ], [ %vec.ind.next59.1, %vector.body56.1 ]
%vec.phi60 = phi <4 x i32> [ %25, %middle.block39 ], [ %36, %vector.body56.1 ]
%26 = mul nuw nsw <4 x i32> %vec.ind58, <i32 7, i32 7, i32 7, i32 7>
%27 = add nuw nsw <4 x i32> %26, <i32 12, i32 12, i32 12, i32 12>
%28 = icmp eq <4 x i32> %broadcast.splat62, %27
%29 = zext <4 x i1> %28 to <4 x i32>
%30 = add <4 x i32> %vec.phi60, %29
%31 = icmp eq i32 %index57, 96
br i1 %31, label %middle.block52, label %vector.body56.1, !llvm.loop !14
vector.body56.1: ; preds = %vector.body56
%32 = mul <4 x i32> %vec.ind58, <i32 7, i32 7, i32 7, i32 7>
%33 = add <4 x i32> %32, <i32 40, i32 40, i32 40, i32 40>
%34 = icmp eq <4 x i32> %broadcast.splat62, %33
%35 = zext <4 x i1> %34 to <4 x i32>
%36 = add <4 x i32> %30, %35
%index.next63.1 = add nuw nsw i32 %index57, 8
%vec.ind.next59.1 = add <4 x i32> %vec.ind58, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body56
middle.block52: ; preds = %vector.body56
%37 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %30)
%38 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %37, i64 0
%broadcast.splatinsert74 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat75 = shufflevector <4 x i32> %broadcast.splatinsert74, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body69
vector.body69: ; preds = %vector.body69.1, %middle.block52
%index70 = phi i32 [ 0, %middle.block52 ], [ %index.next76.1, %vector.body69.1 ]
%vec.ind71 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block52 ], [ %vec.ind.next72.1, %vector.body69.1 ]
%vec.phi73 = phi <4 x i32> [ %38, %middle.block52 ], [ %49, %vector.body69.1 ]
%39 = mul nuw nsw <4 x i32> %vec.ind71, <i32 7, i32 7, i32 7, i32 7>
%40 = add nuw nsw <4 x i32> %39, <i32 16, i32 16, i32 16, i32 16>
%41 = icmp eq <4 x i32> %broadcast.splat75, %40
%42 = zext <4 x i1> %41 to <4 x i32>
%43 = add <4 x i32> %vec.phi73, %42
%44 = icmp eq i32 %index70, 96
br i1 %44, label %middle.block65, label %vector.body69.1, !llvm.loop !15
vector.body69.1: ; preds = %vector.body69
%45 = mul <4 x i32> %vec.ind71, <i32 7, i32 7, i32 7, i32 7>
%46 = add <4 x i32> %45, <i32 44, i32 44, i32 44, i32 44>
%47 = icmp eq <4 x i32> %broadcast.splat75, %46
%48 = zext <4 x i1> %47 to <4 x i32>
%49 = add <4 x i32> %43, %48
%index.next76.1 = add nuw nsw i32 %index70, 8
%vec.ind.next72.1 = add <4 x i32> %vec.ind71, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body69
middle.block65: ; preds = %vector.body69
%50 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %43)
%51 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %50, i64 0
%broadcast.splatinsert87 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat88 = shufflevector <4 x i32> %broadcast.splatinsert87, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body82
vector.body82: ; preds = %vector.body82.1, %middle.block65
%index83 = phi i32 [ 0, %middle.block65 ], [ %index.next89.1, %vector.body82.1 ]
%vec.ind84 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block65 ], [ %vec.ind.next85.1, %vector.body82.1 ]
%vec.phi86 = phi <4 x i32> [ %51, %middle.block65 ], [ %62, %vector.body82.1 ]
%52 = mul nuw nsw <4 x i32> %vec.ind84, <i32 7, i32 7, i32 7, i32 7>
%53 = add nuw nsw <4 x i32> %52, <i32 20, i32 20, i32 20, i32 20>
%54 = icmp eq <4 x i32> %broadcast.splat88, %53
%55 = zext <4 x i1> %54 to <4 x i32>
%56 = add <4 x i32> %vec.phi86, %55
%57 = icmp eq i32 %index83, 96
br i1 %57, label %middle.block78, label %vector.body82.1, !llvm.loop !16
vector.body82.1: ; preds = %vector.body82
%58 = mul <4 x i32> %vec.ind84, <i32 7, i32 7, i32 7, i32 7>
%59 = add <4 x i32> %58, <i32 48, i32 48, i32 48, i32 48>
%60 = icmp eq <4 x i32> %broadcast.splat88, %59
%61 = zext <4 x i1> %60 to <4 x i32>
%62 = add <4 x i32> %56, %61
%index.next89.1 = add nuw nsw i32 %index83, 8
%vec.ind.next85.1 = add <4 x i32> %vec.ind84, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body82
middle.block78: ; preds = %vector.body82
%63 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %56)
%64 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %63, i64 0
%broadcast.splatinsert100 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat101 = shufflevector <4 x i32> %broadcast.splatinsert100, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body95
vector.body95: ; preds = %vector.body95.1, %middle.block78
%index96 = phi i32 [ 0, %middle.block78 ], [ %index.next102.1, %vector.body95.1 ]
%vec.ind97 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block78 ], [ %vec.ind.next98.1, %vector.body95.1 ]
%vec.phi99 = phi <4 x i32> [ %64, %middle.block78 ], [ %75, %vector.body95.1 ]
%65 = mul nuw nsw <4 x i32> %vec.ind97, <i32 7, i32 7, i32 7, i32 7>
%66 = add nuw nsw <4 x i32> %65, <i32 24, i32 24, i32 24, i32 24>
%67 = icmp eq <4 x i32> %broadcast.splat101, %66
%68 = zext <4 x i1> %67 to <4 x i32>
%69 = add <4 x i32> %vec.phi99, %68
%70 = icmp eq i32 %index96, 96
br i1 %70, label %middle.block91, label %vector.body95.1, !llvm.loop !17
vector.body95.1: ; preds = %vector.body95
%71 = mul <4 x i32> %vec.ind97, <i32 7, i32 7, i32 7, i32 7>
%72 = add <4 x i32> %71, <i32 52, i32 52, i32 52, i32 52>
%73 = icmp eq <4 x i32> %broadcast.splat101, %72
%74 = zext <4 x i1> %73 to <4 x i32>
%75 = add <4 x i32> %69, %74
%index.next102.1 = add nuw nsw i32 %index96, 8
%vec.ind.next98.1 = add <4 x i32> %vec.ind97, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body95
middle.block91: ; preds = %vector.body95
%76 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %69)
%77 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %76, i64 0
%broadcast.splatinsert113 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat114 = shufflevector <4 x i32> %broadcast.splatinsert113, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body108
vector.body108: ; preds = %vector.body108.1, %middle.block91
%index109 = phi i32 [ 0, %middle.block91 ], [ %index.next115.1, %vector.body108.1 ]
%vec.ind110 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block91 ], [ %vec.ind.next111.1, %vector.body108.1 ]
%vec.phi112 = phi <4 x i32> [ %77, %middle.block91 ], [ %88, %vector.body108.1 ]
%78 = mul nuw nsw <4 x i32> %vec.ind110, <i32 7, i32 7, i32 7, i32 7>
%79 = add nuw nsw <4 x i32> %78, <i32 28, i32 28, i32 28, i32 28>
%80 = icmp eq <4 x i32> %broadcast.splat114, %79
%81 = zext <4 x i1> %80 to <4 x i32>
%82 = add <4 x i32> %vec.phi112, %81
%83 = icmp eq i32 %index109, 96
br i1 %83, label %middle.block104, label %vector.body108.1, !llvm.loop !18
vector.body108.1: ; preds = %vector.body108
%84 = mul <4 x i32> %vec.ind110, <i32 7, i32 7, i32 7, i32 7>
%85 = add <4 x i32> %84, <i32 56, i32 56, i32 56, i32 56>
%86 = icmp eq <4 x i32> %broadcast.splat114, %85
%87 = zext <4 x i1> %86 to <4 x i32>
%88 = add <4 x i32> %82, %87
%index.next115.1 = add nuw nsw i32 %index109, 8
%vec.ind.next111.1 = add <4 x i32> %vec.ind110, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body108
middle.block104: ; preds = %vector.body108
%89 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %82)
%90 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %89, i64 0
%broadcast.splatinsert126 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat127 = shufflevector <4 x i32> %broadcast.splatinsert126, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body121
vector.body121: ; preds = %vector.body121.1, %middle.block104
%index122 = phi i32 [ 0, %middle.block104 ], [ %index.next128.1, %vector.body121.1 ]
%vec.ind123 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block104 ], [ %vec.ind.next124.1, %vector.body121.1 ]
%vec.phi125 = phi <4 x i32> [ %90, %middle.block104 ], [ %101, %vector.body121.1 ]
%91 = mul nuw nsw <4 x i32> %vec.ind123, <i32 7, i32 7, i32 7, i32 7>
%92 = add nuw nsw <4 x i32> %91, <i32 32, i32 32, i32 32, i32 32>
%93 = icmp eq <4 x i32> %broadcast.splat127, %92
%94 = zext <4 x i1> %93 to <4 x i32>
%95 = add <4 x i32> %vec.phi125, %94
%96 = icmp eq i32 %index122, 96
br i1 %96, label %middle.block117, label %vector.body121.1, !llvm.loop !19
vector.body121.1: ; preds = %vector.body121
%97 = mul <4 x i32> %vec.ind123, <i32 7, i32 7, i32 7, i32 7>
%98 = add <4 x i32> %97, <i32 60, i32 60, i32 60, i32 60>
%99 = icmp eq <4 x i32> %broadcast.splat127, %98
%100 = zext <4 x i1> %99 to <4 x i32>
%101 = add <4 x i32> %95, %100
%index.next128.1 = add nuw nsw i32 %index122, 8
%vec.ind.next124.1 = add <4 x i32> %vec.ind123, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body121
middle.block117: ; preds = %vector.body121
%102 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %95)
%103 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %102, i64 0
%broadcast.splatinsert139 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat140 = shufflevector <4 x i32> %broadcast.splatinsert139, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body134
vector.body134: ; preds = %vector.body134.1, %middle.block117
%index135 = phi i32 [ 0, %middle.block117 ], [ %index.next141.1, %vector.body134.1 ]
%vec.ind136 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block117 ], [ %vec.ind.next137.1, %vector.body134.1 ]
%vec.phi138 = phi <4 x i32> [ %103, %middle.block117 ], [ %114, %vector.body134.1 ]
%104 = mul nuw nsw <4 x i32> %vec.ind136, <i32 7, i32 7, i32 7, i32 7>
%105 = add nuw nsw <4 x i32> %104, <i32 36, i32 36, i32 36, i32 36>
%106 = icmp eq <4 x i32> %broadcast.splat140, %105
%107 = zext <4 x i1> %106 to <4 x i32>
%108 = add <4 x i32> %vec.phi138, %107
%109 = icmp eq i32 %index135, 96
br i1 %109, label %middle.block130, label %vector.body134.1, !llvm.loop !20
vector.body134.1: ; preds = %vector.body134
%110 = mul <4 x i32> %vec.ind136, <i32 7, i32 7, i32 7, i32 7>
%111 = add <4 x i32> %110, <i32 64, i32 64, i32 64, i32 64>
%112 = icmp eq <4 x i32> %broadcast.splat140, %111
%113 = zext <4 x i1> %112 to <4 x i32>
%114 = add <4 x i32> %108, %113
%index.next141.1 = add nuw nsw i32 %index135, 8
%vec.ind.next137.1 = add <4 x i32> %vec.ind136, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body134
middle.block130: ; preds = %vector.body134
%115 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %108)
%116 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %115, i64 0
%broadcast.splatinsert152 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat153 = shufflevector <4 x i32> %broadcast.splatinsert152, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body147
vector.body147: ; preds = %vector.body147.1, %middle.block130
%index148 = phi i32 [ 0, %middle.block130 ], [ %index.next154.1, %vector.body147.1 ]
%vec.ind149 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block130 ], [ %vec.ind.next150.1, %vector.body147.1 ]
%vec.phi151 = phi <4 x i32> [ %116, %middle.block130 ], [ %127, %vector.body147.1 ]
%117 = mul nuw nsw <4 x i32> %vec.ind149, <i32 7, i32 7, i32 7, i32 7>
%118 = add nuw nsw <4 x i32> %117, <i32 40, i32 40, i32 40, i32 40>
%119 = icmp eq <4 x i32> %broadcast.splat153, %118
%120 = zext <4 x i1> %119 to <4 x i32>
%121 = add <4 x i32> %vec.phi151, %120
%122 = icmp eq i32 %index148, 96
br i1 %122, label %middle.block143, label %vector.body147.1, !llvm.loop !21
vector.body147.1: ; preds = %vector.body147
%123 = mul <4 x i32> %vec.ind149, <i32 7, i32 7, i32 7, i32 7>
%124 = add <4 x i32> %123, <i32 68, i32 68, i32 68, i32 68>
%125 = icmp eq <4 x i32> %broadcast.splat153, %124
%126 = zext <4 x i1> %125 to <4 x i32>
%127 = add <4 x i32> %121, %126
%index.next154.1 = add nuw nsw i32 %index148, 8
%vec.ind.next150.1 = add <4 x i32> %vec.ind149, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body147
middle.block143: ; preds = %vector.body147
%128 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %121)
%129 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %128, i64 0
%broadcast.splatinsert165 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat166 = shufflevector <4 x i32> %broadcast.splatinsert165, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body160
vector.body160: ; preds = %vector.body160.1, %middle.block143
%index161 = phi i32 [ 0, %middle.block143 ], [ %index.next167.1, %vector.body160.1 ]
%vec.ind162 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block143 ], [ %vec.ind.next163.1, %vector.body160.1 ]
%vec.phi164 = phi <4 x i32> [ %129, %middle.block143 ], [ %140, %vector.body160.1 ]
%130 = mul nuw nsw <4 x i32> %vec.ind162, <i32 7, i32 7, i32 7, i32 7>
%131 = add nuw nsw <4 x i32> %130, <i32 44, i32 44, i32 44, i32 44>
%132 = icmp eq <4 x i32> %broadcast.splat166, %131
%133 = zext <4 x i1> %132 to <4 x i32>
%134 = add <4 x i32> %vec.phi164, %133
%135 = icmp eq i32 %index161, 96
br i1 %135, label %middle.block156, label %vector.body160.1, !llvm.loop !22
vector.body160.1: ; preds = %vector.body160
%136 = mul <4 x i32> %vec.ind162, <i32 7, i32 7, i32 7, i32 7>
%137 = add <4 x i32> %136, <i32 72, i32 72, i32 72, i32 72>
%138 = icmp eq <4 x i32> %broadcast.splat166, %137
%139 = zext <4 x i1> %138 to <4 x i32>
%140 = add <4 x i32> %134, %139
%index.next167.1 = add nuw nsw i32 %index161, 8
%vec.ind.next163.1 = add <4 x i32> %vec.ind162, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body160
middle.block156: ; preds = %vector.body160
%141 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %134)
%142 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %141, i64 0
%broadcast.splatinsert178 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat179 = shufflevector <4 x i32> %broadcast.splatinsert178, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body173
vector.body173: ; preds = %vector.body173.1, %middle.block156
%index174 = phi i32 [ 0, %middle.block156 ], [ %index.next180.1, %vector.body173.1 ]
%vec.ind175 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block156 ], [ %vec.ind.next176.1, %vector.body173.1 ]
%vec.phi177 = phi <4 x i32> [ %142, %middle.block156 ], [ %153, %vector.body173.1 ]
%143 = mul nuw nsw <4 x i32> %vec.ind175, <i32 7, i32 7, i32 7, i32 7>
%144 = add nuw nsw <4 x i32> %143, <i32 48, i32 48, i32 48, i32 48>
%145 = icmp eq <4 x i32> %broadcast.splat179, %144
%146 = zext <4 x i1> %145 to <4 x i32>
%147 = add <4 x i32> %vec.phi177, %146
%148 = icmp eq i32 %index174, 96
br i1 %148, label %middle.block169, label %vector.body173.1, !llvm.loop !23
vector.body173.1: ; preds = %vector.body173
%149 = mul <4 x i32> %vec.ind175, <i32 7, i32 7, i32 7, i32 7>
%150 = add <4 x i32> %149, <i32 76, i32 76, i32 76, i32 76>
%151 = icmp eq <4 x i32> %broadcast.splat179, %150
%152 = zext <4 x i1> %151 to <4 x i32>
%153 = add <4 x i32> %147, %152
%index.next180.1 = add nuw nsw i32 %index174, 8
%vec.ind.next176.1 = add <4 x i32> %vec.ind175, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body173
middle.block169: ; preds = %vector.body173
%154 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %147)
%155 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %154, i64 0
%broadcast.splatinsert191 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat192 = shufflevector <4 x i32> %broadcast.splatinsert191, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body186
vector.body186: ; preds = %vector.body186.1, %middle.block169
%index187 = phi i32 [ 0, %middle.block169 ], [ %index.next193.1, %vector.body186.1 ]
%vec.ind188 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block169 ], [ %vec.ind.next189.1, %vector.body186.1 ]
%vec.phi190 = phi <4 x i32> [ %155, %middle.block169 ], [ %166, %vector.body186.1 ]
%156 = mul nuw nsw <4 x i32> %vec.ind188, <i32 7, i32 7, i32 7, i32 7>
%157 = add nuw nsw <4 x i32> %156, <i32 52, i32 52, i32 52, i32 52>
%158 = icmp eq <4 x i32> %broadcast.splat192, %157
%159 = zext <4 x i1> %158 to <4 x i32>
%160 = add <4 x i32> %vec.phi190, %159
%161 = icmp eq i32 %index187, 96
br i1 %161, label %middle.block182, label %vector.body186.1, !llvm.loop !24
vector.body186.1: ; preds = %vector.body186
%162 = mul <4 x i32> %vec.ind188, <i32 7, i32 7, i32 7, i32 7>
%163 = add <4 x i32> %162, <i32 80, i32 80, i32 80, i32 80>
%164 = icmp eq <4 x i32> %broadcast.splat192, %163
%165 = zext <4 x i1> %164 to <4 x i32>
%166 = add <4 x i32> %160, %165
%index.next193.1 = add nuw nsw i32 %index187, 8
%vec.ind.next189.1 = add <4 x i32> %vec.ind188, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body186
middle.block182: ; preds = %vector.body186
%167 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %160)
%168 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %167, i64 0
%broadcast.splatinsert204 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat205 = shufflevector <4 x i32> %broadcast.splatinsert204, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body199
vector.body199: ; preds = %vector.body199.1, %middle.block182
%index200 = phi i32 [ 0, %middle.block182 ], [ %index.next206.1, %vector.body199.1 ]
%vec.ind201 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block182 ], [ %vec.ind.next202.1, %vector.body199.1 ]
%vec.phi203 = phi <4 x i32> [ %168, %middle.block182 ], [ %179, %vector.body199.1 ]
%169 = mul nuw nsw <4 x i32> %vec.ind201, <i32 7, i32 7, i32 7, i32 7>
%170 = add nuw nsw <4 x i32> %169, <i32 56, i32 56, i32 56, i32 56>
%171 = icmp eq <4 x i32> %broadcast.splat205, %170
%172 = zext <4 x i1> %171 to <4 x i32>
%173 = add <4 x i32> %vec.phi203, %172
%174 = icmp eq i32 %index200, 96
br i1 %174, label %middle.block195, label %vector.body199.1, !llvm.loop !25
vector.body199.1: ; preds = %vector.body199
%175 = mul <4 x i32> %vec.ind201, <i32 7, i32 7, i32 7, i32 7>
%176 = add <4 x i32> %175, <i32 84, i32 84, i32 84, i32 84>
%177 = icmp eq <4 x i32> %broadcast.splat205, %176
%178 = zext <4 x i1> %177 to <4 x i32>
%179 = add <4 x i32> %173, %178
%index.next206.1 = add nuw nsw i32 %index200, 8
%vec.ind.next202.1 = add <4 x i32> %vec.ind201, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body199
middle.block195: ; preds = %vector.body199
%180 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %173)
%181 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %180, i64 0
%broadcast.splatinsert217 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat218 = shufflevector <4 x i32> %broadcast.splatinsert217, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body212
vector.body212: ; preds = %vector.body212.1, %middle.block195
%index213 = phi i32 [ 0, %middle.block195 ], [ %index.next219.1, %vector.body212.1 ]
%vec.ind214 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block195 ], [ %vec.ind.next215.1, %vector.body212.1 ]
%vec.phi216 = phi <4 x i32> [ %181, %middle.block195 ], [ %192, %vector.body212.1 ]
%182 = mul nuw nsw <4 x i32> %vec.ind214, <i32 7, i32 7, i32 7, i32 7>
%183 = add nuw nsw <4 x i32> %182, <i32 60, i32 60, i32 60, i32 60>
%184 = icmp eq <4 x i32> %broadcast.splat218, %183
%185 = zext <4 x i1> %184 to <4 x i32>
%186 = add <4 x i32> %vec.phi216, %185
%187 = icmp eq i32 %index213, 96
br i1 %187, label %middle.block208, label %vector.body212.1, !llvm.loop !26
vector.body212.1: ; preds = %vector.body212
%188 = mul <4 x i32> %vec.ind214, <i32 7, i32 7, i32 7, i32 7>
%189 = add <4 x i32> %188, <i32 88, i32 88, i32 88, i32 88>
%190 = icmp eq <4 x i32> %broadcast.splat218, %189
%191 = zext <4 x i1> %190 to <4 x i32>
%192 = add <4 x i32> %186, %191
%index.next219.1 = add nuw nsw i32 %index213, 8
%vec.ind.next215.1 = add <4 x i32> %vec.ind214, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body212
middle.block208: ; preds = %vector.body212
%193 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %186)
%194 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %193, i64 0
%broadcast.splatinsert230 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat231 = shufflevector <4 x i32> %broadcast.splatinsert230, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body225
vector.body225: ; preds = %vector.body225.1, %middle.block208
%index226 = phi i32 [ 0, %middle.block208 ], [ %index.next232.1, %vector.body225.1 ]
%vec.ind227 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block208 ], [ %vec.ind.next228.1, %vector.body225.1 ]
%vec.phi229 = phi <4 x i32> [ %194, %middle.block208 ], [ %205, %vector.body225.1 ]
%195 = mul nuw nsw <4 x i32> %vec.ind227, <i32 7, i32 7, i32 7, i32 7>
%196 = add nuw nsw <4 x i32> %195, <i32 64, i32 64, i32 64, i32 64>
%197 = icmp eq <4 x i32> %broadcast.splat231, %196
%198 = zext <4 x i1> %197 to <4 x i32>
%199 = add <4 x i32> %vec.phi229, %198
%200 = icmp eq i32 %index226, 96
br i1 %200, label %middle.block221, label %vector.body225.1, !llvm.loop !27
vector.body225.1: ; preds = %vector.body225
%201 = mul <4 x i32> %vec.ind227, <i32 7, i32 7, i32 7, i32 7>
%202 = add <4 x i32> %201, <i32 92, i32 92, i32 92, i32 92>
%203 = icmp eq <4 x i32> %broadcast.splat231, %202
%204 = zext <4 x i1> %203 to <4 x i32>
%205 = add <4 x i32> %199, %204
%index.next232.1 = add nuw nsw i32 %index226, 8
%vec.ind.next228.1 = add <4 x i32> %vec.ind227, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body225
middle.block221: ; preds = %vector.body225
%206 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %199)
%207 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %206, i64 0
%broadcast.splatinsert243 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat244 = shufflevector <4 x i32> %broadcast.splatinsert243, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body238
vector.body238: ; preds = %vector.body238.1, %middle.block221
%index239 = phi i32 [ 0, %middle.block221 ], [ %index.next245.1, %vector.body238.1 ]
%vec.ind240 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block221 ], [ %vec.ind.next241.1, %vector.body238.1 ]
%vec.phi242 = phi <4 x i32> [ %207, %middle.block221 ], [ %218, %vector.body238.1 ]
%208 = mul nuw nsw <4 x i32> %vec.ind240, <i32 7, i32 7, i32 7, i32 7>
%209 = add nuw nsw <4 x i32> %208, <i32 68, i32 68, i32 68, i32 68>
%210 = icmp eq <4 x i32> %broadcast.splat244, %209
%211 = zext <4 x i1> %210 to <4 x i32>
%212 = add <4 x i32> %vec.phi242, %211
%213 = icmp eq i32 %index239, 96
br i1 %213, label %middle.block234, label %vector.body238.1, !llvm.loop !28
vector.body238.1: ; preds = %vector.body238
%214 = mul <4 x i32> %vec.ind240, <i32 7, i32 7, i32 7, i32 7>
%215 = add <4 x i32> %214, <i32 96, i32 96, i32 96, i32 96>
%216 = icmp eq <4 x i32> %broadcast.splat244, %215
%217 = zext <4 x i1> %216 to <4 x i32>
%218 = add <4 x i32> %212, %217
%index.next245.1 = add nuw nsw i32 %index239, 8
%vec.ind.next241.1 = add <4 x i32> %vec.ind240, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body238
middle.block234: ; preds = %vector.body238
%219 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %212)
%220 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %219, i64 0
%broadcast.splatinsert256 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat257 = shufflevector <4 x i32> %broadcast.splatinsert256, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body251
vector.body251: ; preds = %vector.body251.1, %middle.block234
%index252 = phi i32 [ 0, %middle.block234 ], [ %index.next258.1, %vector.body251.1 ]
%vec.ind253 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block234 ], [ %vec.ind.next254.1, %vector.body251.1 ]
%vec.phi255 = phi <4 x i32> [ %220, %middle.block234 ], [ %231, %vector.body251.1 ]
%221 = mul nuw nsw <4 x i32> %vec.ind253, <i32 7, i32 7, i32 7, i32 7>
%222 = add nuw nsw <4 x i32> %221, <i32 72, i32 72, i32 72, i32 72>
%223 = icmp eq <4 x i32> %broadcast.splat257, %222
%224 = zext <4 x i1> %223 to <4 x i32>
%225 = add <4 x i32> %vec.phi255, %224
%226 = icmp eq i32 %index252, 96
br i1 %226, label %middle.block247, label %vector.body251.1, !llvm.loop !29
vector.body251.1: ; preds = %vector.body251
%227 = mul <4 x i32> %vec.ind253, <i32 7, i32 7, i32 7, i32 7>
%228 = add <4 x i32> %227, <i32 100, i32 100, i32 100, i32 100>
%229 = icmp eq <4 x i32> %broadcast.splat257, %228
%230 = zext <4 x i1> %229 to <4 x i32>
%231 = add <4 x i32> %225, %230
%index.next258.1 = add nuw nsw i32 %index252, 8
%vec.ind.next254.1 = add <4 x i32> %vec.ind253, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body251
middle.block247: ; preds = %vector.body251
%232 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %225)
%233 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %232, i64 0
%broadcast.splatinsert269 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat270 = shufflevector <4 x i32> %broadcast.splatinsert269, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body264
vector.body264: ; preds = %vector.body264.1, %middle.block247
%index265 = phi i32 [ 0, %middle.block247 ], [ %index.next271.1, %vector.body264.1 ]
%vec.ind266 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block247 ], [ %vec.ind.next267.1, %vector.body264.1 ]
%vec.phi268 = phi <4 x i32> [ %233, %middle.block247 ], [ %244, %vector.body264.1 ]
%234 = mul nuw nsw <4 x i32> %vec.ind266, <i32 7, i32 7, i32 7, i32 7>
%235 = add nuw nsw <4 x i32> %234, <i32 76, i32 76, i32 76, i32 76>
%236 = icmp eq <4 x i32> %broadcast.splat270, %235
%237 = zext <4 x i1> %236 to <4 x i32>
%238 = add <4 x i32> %vec.phi268, %237
%239 = icmp eq i32 %index265, 96
br i1 %239, label %middle.block260, label %vector.body264.1, !llvm.loop !30
vector.body264.1: ; preds = %vector.body264
%240 = mul <4 x i32> %vec.ind266, <i32 7, i32 7, i32 7, i32 7>
%241 = add <4 x i32> %240, <i32 104, i32 104, i32 104, i32 104>
%242 = icmp eq <4 x i32> %broadcast.splat270, %241
%243 = zext <4 x i1> %242 to <4 x i32>
%244 = add <4 x i32> %238, %243
%index.next271.1 = add nuw nsw i32 %index265, 8
%vec.ind.next267.1 = add <4 x i32> %vec.ind266, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body264
middle.block260: ; preds = %vector.body264
%245 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %238)
%246 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %245, i64 0
%broadcast.splatinsert282 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat283 = shufflevector <4 x i32> %broadcast.splatinsert282, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body277
vector.body277: ; preds = %vector.body277.1, %middle.block260
%index278 = phi i32 [ 0, %middle.block260 ], [ %index.next284.1, %vector.body277.1 ]
%vec.ind279 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block260 ], [ %vec.ind.next280.1, %vector.body277.1 ]
%vec.phi281 = phi <4 x i32> [ %246, %middle.block260 ], [ %257, %vector.body277.1 ]
%247 = mul nuw nsw <4 x i32> %vec.ind279, <i32 7, i32 7, i32 7, i32 7>
%248 = add nuw nsw <4 x i32> %247, <i32 80, i32 80, i32 80, i32 80>
%249 = icmp eq <4 x i32> %broadcast.splat283, %248
%250 = zext <4 x i1> %249 to <4 x i32>
%251 = add <4 x i32> %vec.phi281, %250
%252 = icmp eq i32 %index278, 96
br i1 %252, label %middle.block273, label %vector.body277.1, !llvm.loop !31
vector.body277.1: ; preds = %vector.body277
%253 = mul <4 x i32> %vec.ind279, <i32 7, i32 7, i32 7, i32 7>
%254 = add <4 x i32> %253, <i32 108, i32 108, i32 108, i32 108>
%255 = icmp eq <4 x i32> %broadcast.splat283, %254
%256 = zext <4 x i1> %255 to <4 x i32>
%257 = add <4 x i32> %251, %256
%index.next284.1 = add nuw nsw i32 %index278, 8
%vec.ind.next280.1 = add <4 x i32> %vec.ind279, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body277
middle.block273: ; preds = %vector.body277
%258 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %251)
%259 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %258, i64 0
%broadcast.splatinsert295 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat296 = shufflevector <4 x i32> %broadcast.splatinsert295, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body290
vector.body290: ; preds = %vector.body290.1, %middle.block273
%index291 = phi i32 [ 0, %middle.block273 ], [ %index.next297.1, %vector.body290.1 ]
%vec.ind292 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block273 ], [ %vec.ind.next293.1, %vector.body290.1 ]
%vec.phi294 = phi <4 x i32> [ %259, %middle.block273 ], [ %270, %vector.body290.1 ]
%260 = mul nuw nsw <4 x i32> %vec.ind292, <i32 7, i32 7, i32 7, i32 7>
%261 = add nuw nsw <4 x i32> %260, <i32 84, i32 84, i32 84, i32 84>
%262 = icmp eq <4 x i32> %broadcast.splat296, %261
%263 = zext <4 x i1> %262 to <4 x i32>
%264 = add <4 x i32> %vec.phi294, %263
%265 = icmp eq i32 %index291, 96
br i1 %265, label %middle.block286, label %vector.body290.1, !llvm.loop !32
vector.body290.1: ; preds = %vector.body290
%266 = mul <4 x i32> %vec.ind292, <i32 7, i32 7, i32 7, i32 7>
%267 = add <4 x i32> %266, <i32 112, i32 112, i32 112, i32 112>
%268 = icmp eq <4 x i32> %broadcast.splat296, %267
%269 = zext <4 x i1> %268 to <4 x i32>
%270 = add <4 x i32> %264, %269
%index.next297.1 = add nuw nsw i32 %index291, 8
%vec.ind.next293.1 = add <4 x i32> %vec.ind292, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body290
middle.block286: ; preds = %vector.body290
%271 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %264)
%272 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %271, i64 0
%broadcast.splatinsert308 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat309 = shufflevector <4 x i32> %broadcast.splatinsert308, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body303
vector.body303: ; preds = %vector.body303.1, %middle.block286
%index304 = phi i32 [ 0, %middle.block286 ], [ %index.next310.1, %vector.body303.1 ]
%vec.ind305 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block286 ], [ %vec.ind.next306.1, %vector.body303.1 ]
%vec.phi307 = phi <4 x i32> [ %272, %middle.block286 ], [ %283, %vector.body303.1 ]
%273 = mul nuw nsw <4 x i32> %vec.ind305, <i32 7, i32 7, i32 7, i32 7>
%274 = add nuw nsw <4 x i32> %273, <i32 88, i32 88, i32 88, i32 88>
%275 = icmp eq <4 x i32> %broadcast.splat309, %274
%276 = zext <4 x i1> %275 to <4 x i32>
%277 = add <4 x i32> %vec.phi307, %276
%278 = icmp eq i32 %index304, 96
br i1 %278, label %middle.block299, label %vector.body303.1, !llvm.loop !33
vector.body303.1: ; preds = %vector.body303
%279 = mul <4 x i32> %vec.ind305, <i32 7, i32 7, i32 7, i32 7>
%280 = add <4 x i32> %279, <i32 116, i32 116, i32 116, i32 116>
%281 = icmp eq <4 x i32> %broadcast.splat309, %280
%282 = zext <4 x i1> %281 to <4 x i32>
%283 = add <4 x i32> %277, %282
%index.next310.1 = add nuw nsw i32 %index304, 8
%vec.ind.next306.1 = add <4 x i32> %vec.ind305, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body303
middle.block299: ; preds = %vector.body303
%284 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %277)
%285 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %284, i64 0
%broadcast.splatinsert321 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat322 = shufflevector <4 x i32> %broadcast.splatinsert321, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body316
vector.body316: ; preds = %vector.body316.1, %middle.block299
%index317 = phi i32 [ 0, %middle.block299 ], [ %index.next323.1, %vector.body316.1 ]
%vec.ind318 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block299 ], [ %vec.ind.next319.1, %vector.body316.1 ]
%vec.phi320 = phi <4 x i32> [ %285, %middle.block299 ], [ %296, %vector.body316.1 ]
%286 = mul nuw nsw <4 x i32> %vec.ind318, <i32 7, i32 7, i32 7, i32 7>
%287 = add nuw nsw <4 x i32> %286, <i32 92, i32 92, i32 92, i32 92>
%288 = icmp eq <4 x i32> %broadcast.splat322, %287
%289 = zext <4 x i1> %288 to <4 x i32>
%290 = add <4 x i32> %vec.phi320, %289
%291 = icmp eq i32 %index317, 96
br i1 %291, label %middle.block312, label %vector.body316.1, !llvm.loop !34
vector.body316.1: ; preds = %vector.body316
%292 = mul <4 x i32> %vec.ind318, <i32 7, i32 7, i32 7, i32 7>
%293 = add <4 x i32> %292, <i32 120, i32 120, i32 120, i32 120>
%294 = icmp eq <4 x i32> %broadcast.splat322, %293
%295 = zext <4 x i1> %294 to <4 x i32>
%296 = add <4 x i32> %290, %295
%index.next323.1 = add nuw nsw i32 %index317, 8
%vec.ind.next319.1 = add <4 x i32> %vec.ind318, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body316
middle.block312: ; preds = %vector.body316
%297 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %290)
%298 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %297, i64 0
%broadcast.splatinsert334 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat335 = shufflevector <4 x i32> %broadcast.splatinsert334, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body329
vector.body329: ; preds = %vector.body329.1, %middle.block312
%index330 = phi i32 [ 0, %middle.block312 ], [ %index.next336.1, %vector.body329.1 ]
%vec.ind331 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block312 ], [ %vec.ind.next332.1, %vector.body329.1 ]
%vec.phi333 = phi <4 x i32> [ %298, %middle.block312 ], [ %309, %vector.body329.1 ]
%299 = mul nuw nsw <4 x i32> %vec.ind331, <i32 7, i32 7, i32 7, i32 7>
%300 = add nuw nsw <4 x i32> %299, <i32 96, i32 96, i32 96, i32 96>
%301 = icmp eq <4 x i32> %broadcast.splat335, %300
%302 = zext <4 x i1> %301 to <4 x i32>
%303 = add <4 x i32> %vec.phi333, %302
%304 = icmp eq i32 %index330, 96
br i1 %304, label %middle.block325, label %vector.body329.1, !llvm.loop !35
vector.body329.1: ; preds = %vector.body329
%305 = mul <4 x i32> %vec.ind331, <i32 7, i32 7, i32 7, i32 7>
%306 = add <4 x i32> %305, <i32 124, i32 124, i32 124, i32 124>
%307 = icmp eq <4 x i32> %broadcast.splat335, %306
%308 = zext <4 x i1> %307 to <4 x i32>
%309 = add <4 x i32> %303, %308
%index.next336.1 = add nuw nsw i32 %index330, 8
%vec.ind.next332.1 = add <4 x i32> %vec.ind331, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body329
middle.block325: ; preds = %vector.body329
%310 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %303)
%cmp11 = icmp sgt i32 %310, 0
%.str.1..str.2 = select i1 %cmp11, ptr @.str.1, ptr @.str.2
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1..str.2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
vector.body30: ; preds = %vector.body30.1, %middle.block
%index31 = phi i32 [ 0, %middle.block ], [ %index.next37.1, %vector.body30.1 ]
%vec.ind32 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %middle.block ], [ %vec.ind.next33.1, %vector.body30.1 ]
%vec.phi34 = phi <4 x i32> [ %12, %middle.block ], [ %321, %vector.body30.1 ]
%311 = mul nuw nsw <4 x i32> %vec.ind32, <i32 7, i32 7, i32 7, i32 7>
%312 = add nuw nsw <4 x i32> %311, <i32 4, i32 4, i32 4, i32 4>
%313 = icmp eq <4 x i32> %broadcast.splat36, %312
%314 = zext <4 x i1> %313 to <4 x i32>
%315 = add <4 x i32> %vec.phi34, %314
%316 = icmp eq i32 %index31, 96
br i1 %316, label %middle.block26, label %vector.body30.1, !llvm.loop !36
vector.body30.1: ; preds = %vector.body30
%317 = mul <4 x i32> %vec.ind32, <i32 7, i32 7, i32 7, i32 7>
%318 = add <4 x i32> %317, <i32 32, i32 32, i32 32, i32 32>
%319 = icmp eq <4 x i32> %broadcast.splat36, %318
%320 = zext <4 x i1> %319 to <4 x i32>
%321 = add <4 x i32> %315, %320
%index.next37.1 = add nuw nsw i32 %index31, 8
%vec.ind.next33.1 = add <4 x i32> %vec.ind32, <i32 8, i32 8, i32 8, i32 8>
br label %vector.body30
middle.block26: ; preds = %vector.body30
%322 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %315)
%323 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %322, i64 0
%broadcast.splatinsert48 = insertelement <4 x i32> poison, i32 %0, i64 0
%broadcast.splat49 = shufflevector <4 x i32> %broadcast.splatinsert48, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body43
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11, !12}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !11, !12}
!19 = distinct !{!19, !10, !11, !12}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !10, !11, !12}
!22 = distinct !{!22, !10, !11, !12}
!23 = distinct !{!23, !10, !11, !12}
!24 = distinct !{!24, !10, !11, !12}
!25 = distinct !{!25, !10, !11, !12}
!26 = distinct !{!26, !10, !11, !12}
!27 = distinct !{!27, !10, !11, !12}
!28 = distinct !{!28, !10, !11, !12}
!29 = distinct !{!29, !10, !11, !12}
!30 = distinct !{!30, !10, !11, !12}
!31 = distinct !{!31, !10, !11, !12}
!32 = distinct !{!32, !10, !11, !12}
!33 = distinct !{!33, !10, !11, !12}
!34 = distinct !{!34, !10, !11, !12}
!35 = distinct !{!35, !10, !11, !12}
!36 = distinct !{!36, !10, !11, !12}
|
#include<stdio.h>
int main(void)
{
int n,a,b;
scanf ("%d",&n);
a=n%4;
b=n%7;
if(n>=18) {printf("Yes");
}else if(a==0) {printf("Yes");
}else if(b==0){ printf("Yes");
}else if(n<11){ printf("No");
}else if (n==13){ printf("No");
}else if(n==17){printf("No");
}else printf("Yes");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130214/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130214/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%rem1 = srem i32 %0, 7
%cmp = icmp sgt i32 %0, 17
%1 = and i32 %0, 3
%cmp3 = icmp eq i32 %1, 0
%or.cond = or i1 %cmp, %cmp3
%cmp7 = icmp eq i32 %rem1, 0
%or.cond29 = or i1 %or.cond, %cmp7
br i1 %or.cond29, label %if.end28, label %if.else10
if.else10: ; preds = %entry
%cmp11 = icmp slt i32 %0, 11
br i1 %cmp11, label %if.end28, label %if.else14
if.else14: ; preds = %if.else10
%2 = add i32 %0, -13
%switch.and = and i32 %2, -5
%switch.selectcmp = icmp eq i32 %switch.and, 0
%3 = select i1 %switch.selectcmp, ptr @.str.2, ptr @.str.1
br label %if.end28
if.end28: ; preds = %if.else14, %if.else10, %entry
%.str.1.sink = phi ptr [ @.str.1, %entry ], [ @.str.2, %if.else10 ], [ %3, %if.else14 ]
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.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;
scanf("%d", &n);
for (i = 0; i <= 25; i ++) {
if (n - (4 * i) >= 0) {
if ((n - (4 * i)) % 7 == 0) {
printf("Yes");
return 0;
}
}
}
printf("No");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130258/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130258/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, -1
%rem = urem i32 %0, 7
%cmp4 = icmp eq i32 %rem, 0
%or.cond = and i1 %cmp1, %cmp4
br i1 %or.cond, label %if.then5, label %for.cond
for.cond: ; preds = %entry
%sub.1 = add nsw i32 %0, -4
%cmp1.1 = icmp sgt i32 %0, 3
%rem.1 = urem i32 %sub.1, 7
%cmp4.1 = icmp eq i32 %rem.1, 0
%or.cond.1 = and i1 %cmp1.1, %cmp4.1
br i1 %or.cond.1, label %if.then5, label %for.cond.1
for.cond.1: ; preds = %for.cond
%sub.2 = add nsw i32 %0, -8
%cmp1.2 = icmp sgt i32 %0, 7
%rem.2 = urem i32 %sub.2, 7
%cmp4.2 = icmp eq i32 %rem.2, 0
%or.cond.2 = and i1 %cmp1.2, %cmp4.2
br i1 %or.cond.2, label %if.then5, label %for.cond.2
for.cond.2: ; preds = %for.cond.1
%sub.3 = add nsw i32 %0, -12
%cmp1.3 = icmp sgt i32 %0, 11
%rem.3 = urem i32 %sub.3, 7
%cmp4.3 = icmp eq i32 %rem.3, 0
%or.cond.3 = and i1 %cmp1.3, %cmp4.3
br i1 %or.cond.3, label %if.then5, label %for.cond.3
for.cond.3: ; preds = %for.cond.2
%sub.4 = add nsw i32 %0, -16
%cmp1.4 = icmp sgt i32 %0, 15
%rem.4 = urem i32 %sub.4, 7
%cmp4.4 = icmp eq i32 %rem.4, 0
%or.cond.4 = and i1 %cmp1.4, %cmp4.4
br i1 %or.cond.4, label %if.then5, label %for.cond.4
for.cond.4: ; preds = %for.cond.3
%sub.5 = add nsw i32 %0, -20
%cmp1.5 = icmp sgt i32 %0, 19
%rem.5 = urem i32 %sub.5, 7
%cmp4.5 = icmp eq i32 %rem.5, 0
%or.cond.5 = and i1 %cmp1.5, %cmp4.5
br i1 %or.cond.5, label %if.then5, label %for.cond.5
for.cond.5: ; preds = %for.cond.4
%sub.6 = add nsw i32 %0, -24
%cmp1.6 = icmp sgt i32 %0, 23
%rem.6 = urem i32 %sub.6, 7
%cmp4.6 = icmp eq i32 %rem.6, 0
%or.cond.6 = and i1 %cmp1.6, %cmp4.6
br i1 %or.cond.6, label %if.then5, label %for.cond.6
for.cond.6: ; preds = %for.cond.5
%sub.7 = add nsw i32 %0, -28
%cmp1.7 = icmp sgt i32 %0, 27
%rem.7 = urem i32 %sub.7, 7
%cmp4.7 = icmp eq i32 %rem.7, 0
%or.cond.7 = and i1 %cmp1.7, %cmp4.7
br i1 %or.cond.7, label %if.then5, label %for.cond.7
for.cond.7: ; preds = %for.cond.6
%sub.8 = add nsw i32 %0, -32
%cmp1.8 = icmp sgt i32 %0, 31
%rem.8 = urem i32 %sub.8, 7
%cmp4.8 = icmp eq i32 %rem.8, 0
%or.cond.8 = and i1 %cmp1.8, %cmp4.8
br i1 %or.cond.8, label %if.then5, label %for.cond.8
for.cond.8: ; preds = %for.cond.7
%sub.9 = add nsw i32 %0, -36
%cmp1.9 = icmp sgt i32 %0, 35
%rem.9 = urem i32 %sub.9, 7
%cmp4.9 = icmp eq i32 %rem.9, 0
%or.cond.9 = and i1 %cmp1.9, %cmp4.9
br i1 %or.cond.9, label %if.then5, label %for.cond.9
for.cond.9: ; preds = %for.cond.8
%sub.10 = add nsw i32 %0, -40
%cmp1.10 = icmp sgt i32 %0, 39
%rem.10 = urem i32 %sub.10, 7
%cmp4.10 = icmp eq i32 %rem.10, 0
%or.cond.10 = and i1 %cmp1.10, %cmp4.10
br i1 %or.cond.10, label %if.then5, label %for.cond.10
for.cond.10: ; preds = %for.cond.9
%sub.11 = add nsw i32 %0, -44
%cmp1.11 = icmp sgt i32 %0, 43
%rem.11 = urem i32 %sub.11, 7
%cmp4.11 = icmp eq i32 %rem.11, 0
%or.cond.11 = and i1 %cmp1.11, %cmp4.11
br i1 %or.cond.11, label %if.then5, label %for.cond.11
for.cond.11: ; preds = %for.cond.10
%sub.12 = add nsw i32 %0, -48
%cmp1.12 = icmp sgt i32 %0, 47
%rem.12 = urem i32 %sub.12, 7
%cmp4.12 = icmp eq i32 %rem.12, 0
%or.cond.12 = and i1 %cmp1.12, %cmp4.12
br i1 %or.cond.12, label %if.then5, label %for.cond.12
for.cond.12: ; preds = %for.cond.11
%sub.13 = add nsw i32 %0, -52
%cmp1.13 = icmp sgt i32 %0, 51
%rem.13 = urem i32 %sub.13, 7
%cmp4.13 = icmp eq i32 %rem.13, 0
%or.cond.13 = and i1 %cmp1.13, %cmp4.13
br i1 %or.cond.13, label %if.then5, label %for.cond.13
for.cond.13: ; preds = %for.cond.12
%sub.14 = add nsw i32 %0, -56
%cmp1.14 = icmp sgt i32 %0, 55
%rem.14 = urem i32 %sub.14, 7
%cmp4.14 = icmp eq i32 %rem.14, 0
%or.cond.14 = and i1 %cmp1.14, %cmp4.14
br i1 %or.cond.14, label %if.then5, label %for.cond.14
for.cond.14: ; preds = %for.cond.13
%sub.15 = add nsw i32 %0, -60
%cmp1.15 = icmp sgt i32 %0, 59
%rem.15 = urem i32 %sub.15, 7
%cmp4.15 = icmp eq i32 %rem.15, 0
%or.cond.15 = and i1 %cmp1.15, %cmp4.15
br i1 %or.cond.15, label %if.then5, label %for.cond.15
for.cond.15: ; preds = %for.cond.14
%sub.16 = add nsw i32 %0, -64
%cmp1.16 = icmp sgt i32 %0, 63
%rem.16 = urem i32 %sub.16, 7
%cmp4.16 = icmp eq i32 %rem.16, 0
%or.cond.16 = and i1 %cmp1.16, %cmp4.16
br i1 %or.cond.16, label %if.then5, label %for.cond.16
for.cond.16: ; preds = %for.cond.15
%sub.17 = add nsw i32 %0, -68
%cmp1.17 = icmp sgt i32 %0, 67
%rem.17 = urem i32 %sub.17, 7
%cmp4.17 = icmp eq i32 %rem.17, 0
%or.cond.17 = and i1 %cmp1.17, %cmp4.17
br i1 %or.cond.17, label %if.then5, label %for.cond.17
for.cond.17: ; preds = %for.cond.16
%sub.18 = add nsw i32 %0, -72
%cmp1.18 = icmp sgt i32 %0, 71
%rem.18 = urem i32 %sub.18, 7
%cmp4.18 = icmp eq i32 %rem.18, 0
%or.cond.18 = and i1 %cmp1.18, %cmp4.18
br i1 %or.cond.18, label %if.then5, label %for.cond.18
for.cond.18: ; preds = %for.cond.17
%sub.19 = add nsw i32 %0, -76
%cmp1.19 = icmp sgt i32 %0, 75
%rem.19 = urem i32 %sub.19, 7
%cmp4.19 = icmp eq i32 %rem.19, 0
%or.cond.19 = and i1 %cmp1.19, %cmp4.19
br i1 %or.cond.19, label %if.then5, label %for.cond.19
for.cond.19: ; preds = %for.cond.18
%sub.20 = add nsw i32 %0, -80
%cmp1.20 = icmp sgt i32 %0, 79
%rem.20 = urem i32 %sub.20, 7
%cmp4.20 = icmp eq i32 %rem.20, 0
%or.cond.20 = and i1 %cmp1.20, %cmp4.20
br i1 %or.cond.20, label %if.then5, label %for.cond.20
for.cond.20: ; preds = %for.cond.19
%sub.21 = add nsw i32 %0, -84
%cmp1.21 = icmp sgt i32 %0, 83
%rem.21 = urem i32 %sub.21, 7
%cmp4.21 = icmp eq i32 %rem.21, 0
%or.cond.21 = and i1 %cmp1.21, %cmp4.21
br i1 %or.cond.21, label %if.then5, label %for.cond.21
for.cond.21: ; preds = %for.cond.20
%sub.22 = add nsw i32 %0, -88
%cmp1.22 = icmp sgt i32 %0, 87
%rem.22 = urem i32 %sub.22, 7
%cmp4.22 = icmp eq i32 %rem.22, 0
%or.cond.22 = and i1 %cmp1.22, %cmp4.22
br i1 %or.cond.22, label %if.then5, label %for.cond.22
for.cond.22: ; preds = %for.cond.21
%sub.23 = add nsw i32 %0, -92
%cmp1.23 = icmp sgt i32 %0, 91
%rem.23 = urem i32 %sub.23, 7
%cmp4.23 = icmp eq i32 %rem.23, 0
%or.cond.23 = and i1 %cmp1.23, %cmp4.23
br i1 %or.cond.23, label %if.then5, label %for.cond.23
for.cond.23: ; preds = %for.cond.22
%sub.24 = add nsw i32 %0, -96
%cmp1.24 = icmp sgt i32 %0, 95
%rem.24 = urem i32 %sub.24, 7
%cmp4.24 = icmp eq i32 %rem.24, 0
%or.cond.24 = and i1 %cmp1.24, %cmp4.24
br i1 %or.cond.24, label %if.then5, label %for.cond.24
for.cond.24: ; preds = %for.cond.23
%sub.25 = add nsw i32 %0, -100
%cmp1.25 = icmp sgt i32 %0, 99
%rem.25 = urem i32 %sub.25, 7
%cmp4.25 = icmp eq i32 %rem.25, 0
%or.cond.25 = and i1 %cmp1.25, %cmp4.25
br i1 %or.cond.25, label %if.then5, label %cleanup
if.then5: ; preds = %for.cond.24, %for.cond.23, %for.cond.22, %for.cond.21, %for.cond.20, %for.cond.19, %for.cond.18, %for.cond.17, %for.cond.16, %for.cond.15, %for.cond.14, %for.cond.13, %for.cond.12, %for.cond.11, %for.cond.10, %for.cond.9, %for.cond.8, %for.cond.7, %for.cond.6, %for.cond.5, %for.cond.4, %for.cond.3, %for.cond.2, %for.cond.1, %for.cond, %entry
br label %cleanup
cleanup: ; preds = %for.cond.24, %if.then5
%.str.2.sink = phi ptr [ @.str.1, %if.then5 ], [ @.str.2, %for.cond.24 ]
%call8 = 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 a,b,c,e,f,g,h;
scanf("%d %d %d",&a,&b,&c);
e=a+b+c;
f=2*(a+b);
g=2*(a+c);
h=2*(b+c);
if (f<=e && f<=g && f<=h){
printf("%d",f);
}
else if (e<=f && e<=g && e<=h){
printf("%d",e);
}
else if(g<=e && g<=f && g<=h){
printf("%d",g);
}
else{
printf("%d",h);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_13033/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_13033/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [9 x i8] c"%d %d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %1, %0
%2 = load i32, ptr %c, align 4, !tbaa !5
%add1 = add nsw i32 %add, %2
%mul = shl nsw i32 %add, 1
%add3 = add nsw i32 %2, %0
%mul4 = shl nsw i32 %add3, 1
%add5 = add nsw i32 %2, %1
%mul6 = shl nsw i32 %add5, 1
%cmp.not = icmp sgt i32 %mul, %add1
%cmp7.not = icmp sgt i32 %mul, %mul4
%or.cond = select i1 %cmp.not, i1 true, i1 %cmp7.not
%cmp9.not = icmp sgt i32 %mul, %mul6
%or.cond48 = select i1 %or.cond, i1 true, i1 %cmp9.not
br i1 %or.cond48, label %if.else, label %if.end29
if.else: ; preds = %entry
%cmp11.not = icmp sgt i32 %add1, %mul
%cmp13.not = icmp sgt i32 %add1, %mul4
%or.cond49 = select i1 %cmp11.not, i1 true, i1 %cmp13.not
%cmp15.not = icmp sgt i32 %add1, %mul6
%or.cond50 = select i1 %or.cond49, i1 true, i1 %cmp15.not
br i1 %or.cond50, label %if.else18, label %if.end29
if.else18: ; preds = %if.else
%cmp19.not = icmp sgt i32 %mul4, %add1
%cmp21.not = icmp sgt i32 %mul4, %mul
%or.cond51 = or i1 %cmp19.not, %cmp21.not
%cmp23.not = icmp sgt i32 %mul4, %mul6
%or.cond52 = select i1 %or.cond51, i1 true, i1 %cmp23.not
%mul6.mul4 = select i1 %or.cond52, i32 %mul6, i32 %mul4
br label %if.end29
if.end29: ; preds = %if.else18, %if.else, %entry
%add1.sink = phi i32 [ %mul, %entry ], [ %add1, %if.else ], [ %mul6.mul4, %if.else18 ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add1.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
int i, j, k, n, result, cnt=0, slash;
char buf[50]={0}, sbuf[50]={0}, word[11]={0}, eot[]="END_OF_TEXT";
scanf("%d", &n);
scanf("%s", &word);
while(1){
scanf("%s", &buf);
if( strcmp(buf, eot) == 0 ){ break; }
for(i=0; i<50; i++){
if(isupper(buf[i])){ buf[i] = tolower(buf[i]); }
if(buf[i] == '-'){
i++;
for(j=i, k=0; j<50; j++, k++){
if( isalpha(buf[j]) ){ sbuf[k] = buf[j]; }
}
break;
}
}
if( strcmp(buf, word) == 0 ){ cnt++; }
}
printf("%d\n", cnt);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130373/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130373/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@__const.main.eot = private unnamed_addr constant [12 x i8] c"END_OF_TEXT\00", align 1
@.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: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%buf = alloca [50 x i8], align 16
%word = alloca [11 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #7
call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %buf) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(50) %buf, i8 0, i64 50, i1 false)
call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %word) #7
call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(11) %word, i8 0, i64 11, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %word)
%call276 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %buf)
%bcmp77 = call i32 @bcmp(ptr noundef nonnull dereferenceable(12) %buf, ptr noundef nonnull dereferenceable(12) @__const.main.eot, i64 12)
%cmp78 = icmp eq i32 %bcmp77, 0
br i1 %cmp78, label %while.end, label %for.cond.preheader.lr.ph
for.cond.preheader.lr.ph: ; preds = %entry
%call6 = tail call ptr @__ctype_b_loc() #8
br label %for.cond.preheader
for.cond.preheader: ; preds = %for.cond.preheader.lr.ph, %for.end51
%cnt.079 = phi i32 [ 0, %for.cond.preheader.lr.ph ], [ %spec.select, %for.end51 ]
br label %for.body
for.body: ; preds = %if.end20, %for.cond.preheader
%indvars.iv = phi i64 [ 0, %for.cond.preheader ], [ %indvars.iv.next, %if.end20 ]
%0 = load ptr, ptr %call6, align 8, !tbaa !5
%arrayidx = getelementptr inbounds [50 x i8], ptr %buf, i64 0, i64 %indvars.iv
%1 = load i8, ptr %arrayidx, align 1, !tbaa !9
%idxprom7 = sext i8 %1 to i64
%arrayidx8 = getelementptr inbounds i16, ptr %0, i64 %idxprom7
%2 = load i16, ptr %arrayidx8, align 2, !tbaa !10
%3 = and i16 %2, 256
%tobool.not = icmp eq i16 %3, 0
br i1 %tobool.not, label %if.end20, label %if.then10
if.then10: ; preds = %for.body
%call11 = tail call ptr @__ctype_tolower_loc() #8
%4 = load ptr, ptr %call11, align 8, !tbaa !5
%arrayidx16 = getelementptr inbounds i32, ptr %4, i64 %idxprom7
%5 = load i32, ptr %arrayidx16, align 4, !tbaa !12
%conv17 = trunc i32 %5 to i8
store i8 %conv17, ptr %arrayidx, align 1, !tbaa !9
br label %if.end20
if.end20: ; preds = %for.body, %if.then10
%6 = phi i8 [ %conv17, %if.then10 ], [ %1, %for.body ]
%cmp24 = icmp eq i8 %6, 45
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 50
%or.cond = select i1 %cmp24, i1 true, i1 %exitcond.not
br i1 %or.cond, label %for.end51, label %for.body, !llvm.loop !14
for.end51: ; preds = %if.end20
%call54 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %buf, ptr noundef nonnull dereferenceable(1) %word) #9
%cmp55 = icmp eq i32 %call54, 0
%inc58 = zext i1 %cmp55 to i32
%spec.select = add nuw nsw i32 %cnt.079, %inc58
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %buf)
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(12) %buf, ptr noundef nonnull dereferenceable(12) @__const.main.eot, i64 12)
%cmp = icmp eq i32 %bcmp, 0
br i1 %cmp, label %while.end, label %for.cond.preheader
while.end: ; preds = %for.end51, %entry
%cnt.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select, %for.end51 ]
%call60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %cnt.0.lcssa)
call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %word) #7
call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %buf) #7
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #5
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_tolower_loc() 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) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #6
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree nounwind willreturn memory(argmem: read) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main()
{
int x, y, flag[13] = {-1, 0, 1, 0, 2, 0, 2, 0, 0, 2, 0, 2, 0};
scanf("%d %d", &x, &y);
if (flag[x] == flag[y]) printf("Yes\n");
else printf("No\n");
fflush(stdout);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_130445/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_130445/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@stdout = external local_unnamed_addr global ptr, align 8
@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:
%x = alloca i32, align 4
%y = alloca i32, align 4
%flag = alloca [13 x i32], align 16
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 52, ptr nonnull %flag) #5
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(52) %flag, i8 0, i64 52, i1 false)
store i32 -1, ptr %flag, align 16
%0 = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 2
store i32 1, ptr %0, align 8
%1 = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 4
store i32 2, ptr %1, align 16
%2 = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 6
store i32 2, ptr %2, align 8
%3 = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 9
store i32 2, ptr %3, align 4
%4 = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 11
store i32 2, ptr %4, align 4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %y)
%5 = load i32, ptr %x, align 4, !tbaa !5
%idxprom = sext i32 %5 to i64
%arrayidx = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 %idxprom
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%7 = load i32, ptr %y, align 4, !tbaa !5
%idxprom1 = sext i32 %7 to i64
%arrayidx2 = getelementptr inbounds [13 x i32], ptr %flag, i64 0, i64 %idxprom1
%8 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp = icmp eq i32 %6, %8
%str.3.str = select i1 %cmp, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
%9 = load ptr, ptr @stdout, align 8, !tbaa !9
%call5 = call i32 @fflush(ptr noundef %9)
call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %flag) #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: 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 @fflush(ptr nocapture noundef) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.