Source_Code stringlengths 69 484k | IR_Original stringlengths 2.05k 17.9M |
|---|---|
#include <stdio.h>
int main ( void )
{
int N;
double a[100];
int i;
double sum = 0;
double ans;
scanf( "%d", &N );
if( N <= 100 )
{
for( i=0; i<N; i++ )
{
scanf( "%lf", &a[i] );
}
}
for( i=0; i<N; i++ )
{
a[i] = 1 / a[i];
sum = sum + a[i];
}
ans = 1 / sum;
printf( "%lf", ans );
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191394/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191394/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%lf\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%a = alloca [100 x double], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 800, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4
%1 = add i32 %0, -1
%or.cond = icmp ult i32 %1, 100
br i1 %or.cond, label %for.body, label %if.end
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x double], ptr %a, i64 0, i64 %indvars.iv
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp1 = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp1, label %for.body, label %if.end, !llvm.loop !9
if.end: ; preds = %for.body, %entry
%4 = phi i32 [ %0, %entry ], [ %2, %for.body ]
%cmp427 = icmp sgt i32 %4, 0
br i1 %cmp427, label %for.body5.preheader, label %for.end14
for.body5.preheader: ; preds = %if.end
%wide.trip.count = zext i32 %4 to i64
%xtraiter = and i64 %wide.trip.count, 3
%5 = icmp ult i32 %4, 4
br i1 %5, label %for.end14.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body5
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%indvars.iv31 = phi i64 [ 0, %for.body5.preheader.new ], [ %indvars.iv.next32.3, %for.body5 ]
%sum.028 = phi double [ 0.000000e+00, %for.body5.preheader.new ], [ %add.3, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.3, %for.body5 ]
%arrayidx7 = getelementptr inbounds [100 x double], ptr %a, i64 0, i64 %indvars.iv31
%6 = load double, ptr %arrayidx7, align 16, !tbaa !11
%div = fdiv double 1.000000e+00, %6
store double %div, ptr %arrayidx7, align 16, !tbaa !11
%add = fadd double %sum.028, %div
%indvars.iv.next32 = or i64 %indvars.iv31, 1
%arrayidx7.1 = getelementptr inbounds [100 x double], ptr %a, i64 0, i64 %indvars.iv.next32
%7 = load double, ptr %arrayidx7.1, align 8, !tbaa !11
%div.1 = fdiv double 1.000000e+00, %7
store double %div.1, ptr %arrayidx7.1, align 8, !tbaa !11
%add.1 = fadd double %add, %div.1
%indvars.iv.next32.1 = or i64 %indvars.iv31, 2
%arrayidx7.2 = getelementptr inbounds [100 x double], ptr %a, i64 0, i64 %indvars.iv.next32.1
%8 = load double, ptr %arrayidx7.2, align 16, !tbaa !11
%div.2 = fdiv double 1.000000e+00, %8
store double %div.2, ptr %arrayidx7.2, align 16, !tbaa !11
%add.2 = fadd double %add.1, %div.2
%indvars.iv.next32.2 = or i64 %indvars.iv31, 3
%arrayidx7.3 = getelementptr inbounds [100 x double], ptr %a, i64 0, i64 %indvars.iv.next32.2
%9 = load double, ptr %arrayidx7.3, align 8, !tbaa !11
%div.3 = fdiv double 1.000000e+00, %9
store double %div.3, ptr %arrayidx7.3, align 8, !tbaa !11
%add.3 = fadd double %add.2, %div.3
%indvars.iv.next32.3 = add nuw nsw i64 %indvars.iv31, 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.end14.loopexit.unr-lcssa, label %for.body5, !llvm.loop !13
for.end14.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%add.lcssa.ph = phi double [ undef, %for.body5.preheader ], [ %add.3, %for.body5 ]
%indvars.iv31.unr = phi i64 [ 0, %for.body5.preheader ], [ %indvars.iv.next32.3, %for.body5 ]
%sum.028.unr = phi double [ 0.000000e+00, %for.body5.preheader ], [ %add.3, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end14, label %for.body5.epil
for.body5.epil: ; preds = %for.end14.loopexit.unr-lcssa, %for.body5.epil
%indvars.iv31.epil = phi i64 [ %indvars.iv.next32.epil, %for.body5.epil ], [ %indvars.iv31.unr, %for.end14.loopexit.unr-lcssa ]
%sum.028.epil = phi double [ %add.epil, %for.body5.epil ], [ %sum.028.unr, %for.end14.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body5.epil ], [ 0, %for.end14.loopexit.unr-lcssa ]
%arrayidx7.epil = getelementptr inbounds [100 x double], ptr %a, i64 0, i64 %indvars.iv31.epil
%10 = load double, ptr %arrayidx7.epil, align 8, !tbaa !11
%div.epil = fdiv double 1.000000e+00, %10
store double %div.epil, ptr %arrayidx7.epil, align 8, !tbaa !11
%add.epil = fadd double %sum.028.epil, %div.epil
%indvars.iv.next32.epil = add nuw nsw i64 %indvars.iv31.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.end14, label %for.body5.epil, !llvm.loop !14
for.end14: ; preds = %for.end14.loopexit.unr-lcssa, %for.body5.epil, %if.end
%sum.0.lcssa = phi double [ 0.000000e+00, %if.end ], [ %add.lcssa.ph, %for.end14.loopexit.unr-lcssa ], [ %add.epil, %for.body5.epil ]
%div15 = fdiv double 1.000000e+00, %sum.0.lcssa
%call16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div15)
call void @llvm.lifetime.end.p0(i64 800, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int n,i,j;
int a[100];
double sum=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",a+i);
}
for(i=0;i<n;i++){
sum+=(double)1/a[i];
}
printf("%f\n",(double)1/sum);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191437/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191437/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%f\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 [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp16 = icmp sgt i32 %0, 0
br i1 %cmp16, label %for.body, label %for.end7
for.cond2.preheader: ; preds = %for.body
%cmp318 = icmp sgt i32 %2, 0
br i1 %cmp318, label %for.body4.preheader, label %for.end7
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.end7.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %add.ptr)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv24 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next25.3, %for.body4 ]
%sum.020 = phi double [ 0.000000e+00, %for.body4.preheader.new ], [ %add.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv24
%4 = load i32, ptr %arrayidx, align 16, !tbaa !5
%conv = sitofp i32 %4 to double
%div = fdiv double 1.000000e+00, %conv
%add = fadd double %sum.020, %div
%indvars.iv.next25 = or i64 %indvars.iv24, 1
%arrayidx.1 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next25
%5 = load i32, ptr %arrayidx.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %5 to double
%div.1 = fdiv double 1.000000e+00, %conv.1
%add.1 = fadd double %add, %div.1
%indvars.iv.next25.1 = or i64 %indvars.iv24, 2
%arrayidx.2 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next25.1
%6 = load i32, ptr %arrayidx.2, align 8, !tbaa !5
%conv.2 = sitofp i32 %6 to double
%div.2 = fdiv double 1.000000e+00, %conv.2
%add.2 = fadd double %add.1, %div.2
%indvars.iv.next25.2 = or i64 %indvars.iv24, 3
%arrayidx.3 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv.next25.2
%7 = load i32, ptr %arrayidx.3, align 4, !tbaa !5
%conv.3 = sitofp i32 %7 to double
%div.3 = fdiv double 1.000000e+00, %conv.3
%add.3 = fadd double %add.2, %div.3
%indvars.iv.next25.3 = add nuw nsw i64 %indvars.iv24, 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.end7.loopexit.unr-lcssa, label %for.body4, !llvm.loop !11
for.end7.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%add.lcssa.ph = phi double [ undef, %for.body4.preheader ], [ %add.3, %for.body4 ]
%indvars.iv24.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next25.3, %for.body4 ]
%sum.020.unr = phi double [ 0.000000e+00, %for.body4.preheader ], [ %add.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end7, label %for.body4.epil
for.body4.epil: ; preds = %for.end7.loopexit.unr-lcssa, %for.body4.epil
%indvars.iv24.epil = phi i64 [ %indvars.iv.next25.epil, %for.body4.epil ], [ %indvars.iv24.unr, %for.end7.loopexit.unr-lcssa ]
%sum.020.epil = phi double [ %add.epil, %for.body4.epil ], [ %sum.020.unr, %for.end7.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.end7.loopexit.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %indvars.iv24.epil
%8 = load i32, ptr %arrayidx.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %8 to double
%div.epil = fdiv double 1.000000e+00, %conv.epil
%add.epil = fadd double %sum.020.epil, %div.epil
%indvars.iv.next25.epil = add nuw nsw i64 %indvars.iv24.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.end7, label %for.body4.epil, !llvm.loop !12
for.end7: ; preds = %for.end7.loopexit.unr-lcssa, %for.body4.epil, %entry, %for.cond2.preheader
%sum.0.lcssa = phi double [ 0.000000e+00, %for.cond2.preheader ], [ 0.000000e+00, %entry ], [ %add.lcssa.ph, %for.end7.loopexit.unr-lcssa ], [ %add.epil, %for.body4.epil ]
%div8 = fdiv double 1.000000e+00, %sum.0.lcssa
%call9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div8)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
|
/*
* main.c
*
* Created on: 2019/07/21
* Author: family
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int A[101] = {0};
int main()
{
int N = 0, i = 0;
double ans = 0.0;
scanf("%d", &N);
for (i = 0; i < N; i++) {
scanf("%d", &A[i]);
}
for (i = 0; i < N; i++) {
ans += 1.0/(double)A[i];
}
printf("%f\n", 1.0/ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191480/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191480/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@A = dso_local global [101 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
store i32 0, ptr %N, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %0, 0
br i1 %cmp18, label %for.body, label %for.end9
for.cond2.preheader: ; preds = %for.body
%cmp320 = icmp sgt i32 %2, 0
br i1 %cmp320, label %for.body4.preheader, label %for.end9
for.body4.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %2 to i64
%xtraiter = and i64 %wide.trip.count, 3
%1 = icmp ult i32 %2, 4
br i1 %1, label %for.end9.loopexit.unr-lcssa, label %for.body4.preheader.new
for.body4.preheader.new: ; preds = %for.body4.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body4
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 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
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.body4: ; preds = %for.body4, %for.body4.preheader.new
%indvars.iv26 = phi i64 [ 0, %for.body4.preheader.new ], [ %indvars.iv.next27.3, %for.body4 ]
%ans.022 = phi double [ 0.000000e+00, %for.body4.preheader.new ], [ %add.3, %for.body4 ]
%niter = phi i64 [ 0, %for.body4.preheader.new ], [ %niter.next.3, %for.body4 ]
%arrayidx6 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv26
%4 = load i32, ptr %arrayidx6, align 16, !tbaa !5
%conv = sitofp i32 %4 to double
%div = fdiv double 1.000000e+00, %conv
%add = fadd double %ans.022, %div
%indvars.iv.next27 = or i64 %indvars.iv26, 1
%arrayidx6.1 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv.next27
%5 = load i32, ptr %arrayidx6.1, align 4, !tbaa !5
%conv.1 = sitofp i32 %5 to double
%div.1 = fdiv double 1.000000e+00, %conv.1
%add.1 = fadd double %add, %div.1
%indvars.iv.next27.1 = or i64 %indvars.iv26, 2
%arrayidx6.2 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv.next27.1
%6 = load i32, ptr %arrayidx6.2, align 8, !tbaa !5
%conv.2 = sitofp i32 %6 to double
%div.2 = fdiv double 1.000000e+00, %conv.2
%add.2 = fadd double %add.1, %div.2
%indvars.iv.next27.2 = or i64 %indvars.iv26, 3
%arrayidx6.3 = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv.next27.2
%7 = load i32, ptr %arrayidx6.3, align 4, !tbaa !5
%conv.3 = sitofp i32 %7 to double
%div.3 = fdiv double 1.000000e+00, %conv.3
%add.3 = fadd double %add.2, %div.3
%indvars.iv.next27.3 = add nuw nsw i64 %indvars.iv26, 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.end9.loopexit.unr-lcssa, label %for.body4, !llvm.loop !11
for.end9.loopexit.unr-lcssa: ; preds = %for.body4, %for.body4.preheader
%add.lcssa.ph = phi double [ undef, %for.body4.preheader ], [ %add.3, %for.body4 ]
%indvars.iv26.unr = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next27.3, %for.body4 ]
%ans.022.unr = phi double [ 0.000000e+00, %for.body4.preheader ], [ %add.3, %for.body4 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end9, label %for.body4.epil
for.body4.epil: ; preds = %for.end9.loopexit.unr-lcssa, %for.body4.epil
%indvars.iv26.epil = phi i64 [ %indvars.iv.next27.epil, %for.body4.epil ], [ %indvars.iv26.unr, %for.end9.loopexit.unr-lcssa ]
%ans.022.epil = phi double [ %add.epil, %for.body4.epil ], [ %ans.022.unr, %for.end9.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body4.epil ], [ 0, %for.end9.loopexit.unr-lcssa ]
%arrayidx6.epil = getelementptr inbounds [101 x i32], ptr @A, i64 0, i64 %indvars.iv26.epil
%8 = load i32, ptr %arrayidx6.epil, align 4, !tbaa !5
%conv.epil = sitofp i32 %8 to double
%div.epil = fdiv double 1.000000e+00, %conv.epil
%add.epil = fadd double %ans.022.epil, %div.epil
%indvars.iv.next27.epil = add nuw nsw i64 %indvars.iv26.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.end9, label %for.body4.epil, !llvm.loop !12
for.end9: ; preds = %for.end9.loopexit.unr-lcssa, %for.body4.epil, %entry, %for.cond2.preheader
%ans.0.lcssa = phi double [ 0.000000e+00, %for.cond2.preheader ], [ 0.000000e+00, %entry ], [ %add.lcssa.ph, %for.end9.loopexit.unr-lcssa ], [ %add.epil, %for.body4.epil ]
%div10 = fdiv double 1.000000e+00, %ans.0.lcssa
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %div10)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
|
#include <stdio.h>
int main(void) {
int N,K;
scanf("%d%d",&N,&K);
int a[100010];
int dp[100010] = {};
for(int i=0;i<N;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<=K;i++){
for(int j=0;j<N;j++){
if(i-a[j]>=0&&dp[i-a[j]]==2){
dp[i] = 1;
break;
}
dp[i] = 2;
}
}
if(dp[K]==1) printf("First");
else printf("Second");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191523/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191523/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"First\00", align 1
@.str.3 = private unnamed_addr constant [7 x i8] c"Second\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
%a = alloca [100010 x i32], align 16
%dp = alloca [100010 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 400040, ptr nonnull %dp) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) %dp, i8 0, i64 400040, i1 false)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp53 = icmp sgt i32 %0, 0
br i1 %cmp53, label %for.body, label %for.cond3.preheader
for.cond3.preheader: ; preds = %for.body, %entry
%.lcssa52 = phi i32 [ %0, %entry ], [ %6, %for.body ]
%1 = load i32, ptr %K, align 4, !tbaa !5
%cmp4.not57 = icmp sgt i32 %1, -1
%cmp855 = icmp sgt i32 %.lcssa52, 0
%or.cond = and i1 %cmp4.not57, %cmp855
br i1 %or.cond, label %for.cond7.preheader.us.preheader, label %for.cond.cleanup5
for.cond7.preheader.us.preheader: ; preds = %for.cond3.preheader
%2 = add nuw i32 %1, 1
%wide.trip.count69 = zext i32 %2 to i64
%wide.trip.count = zext i32 %.lcssa52 to i64
br label %for.cond7.preheader.us
for.cond7.preheader.us: ; preds = %for.cond7.preheader.us.preheader, %cleanup.us
%indvars.iv66 = phi i64 [ 0, %for.cond7.preheader.us.preheader ], [ %indvars.iv.next67, %cleanup.us ]
%arrayidx23.us = getelementptr inbounds [100010 x i32], ptr %dp, i64 0, i64 %indvars.iv66
%3 = trunc i64 %indvars.iv66 to i32
br label %for.body10.us
for.body10.us: ; preds = %for.cond7.preheader.us, %if.end.us
%indvars.iv63 = phi i64 [ 0, %for.cond7.preheader.us ], [ %indvars.iv.next64, %if.end.us ]
%arrayidx12.us = getelementptr inbounds [100010 x i32], ptr %a, i64 0, i64 %indvars.iv63
%4 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%sub.us = sub nsw i32 %3, %4
%cmp13.us = icmp sgt i32 %sub.us, -1
br i1 %cmp13.us, label %land.lhs.true.us, label %if.end.us
land.lhs.true.us: ; preds = %for.body10.us
%idxprom17.us = zext i32 %sub.us to i64
%arrayidx18.us = getelementptr inbounds [100010 x i32], ptr %dp, i64 0, i64 %idxprom17.us
%5 = load i32, ptr %arrayidx18.us, align 4, !tbaa !5
%cmp19.us = icmp eq i32 %5, 2
br i1 %cmp19.us, label %if.then.us, label %if.end.us
if.end.us: ; preds = %land.lhs.true.us, %for.body10.us
store i32 2, ptr %arrayidx23.us, align 4, !tbaa !5
%indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
%exitcond.not = icmp eq i64 %indvars.iv.next64, %wide.trip.count
br i1 %exitcond.not, label %cleanup.us, label %for.body10.us, !llvm.loop !9
if.then.us: ; preds = %land.lhs.true.us
store i32 1, ptr %arrayidx23.us, align 4, !tbaa !5
br label %cleanup.us
cleanup.us: ; preds = %if.end.us, %if.then.us
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
br i1 %exitcond70.not, label %for.cond.cleanup5, label %for.cond7.preheader.us, !llvm.loop !11
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100010 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
%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.cond3.preheader, !llvm.loop !12
for.cond.cleanup5: ; preds = %cleanup.us, %for.cond3.preheader
%idxprom31 = sext i32 %1 to i64
%arrayidx32 = getelementptr inbounds [100010 x i32], ptr %dp, i64 0, i64 %idxprom31
%8 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %8, 1
%.str.2..str.3 = select i1 %cmp33, ptr @.str.2, ptr @.str.3
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %dp) #4
call void @llvm.lifetime.end.p0(i64 400040, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
long sum_A=0,sum_B=0;
int N;
scanf("%d",&N);
int A[N];
for (int i = 0; i < N; i++)
{
scanf("%d",&A[i]);
}
int i=0,j=N-1;
while (i<=j)
{
if (sum_A>=sum_B){
sum_B += A[j--];
}else{
sum_A += A[i++];
}
}
printf("%d",abs(sum_A-sum_B));
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191589/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191589/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %N, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %3, 0
br i1 %cmp23, label %for.body, label %while.end
for.cond.cleanup: ; preds = %for.body
%cmp3.not25 = icmp slt i32 %4, 1
br i1 %cmp3.not25, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %for.cond.cleanup
%sub = add nsw i32 %4, -1
br label %while.body
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %N, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
while.body: ; preds = %while.body.preheader, %if.end
%j.029 = phi i32 [ %j.1, %if.end ], [ %sub, %while.body.preheader ]
%i2.028 = phi i32 [ %i2.1, %if.end ], [ 0, %while.body.preheader ]
%sum_A.027 = phi i64 [ %sum_A.1, %if.end ], [ 0, %while.body.preheader ]
%sum_B.026 = phi i64 [ %sum_B.1, %if.end ], [ 0, %while.body.preheader ]
%cmp4.not = icmp slt i64 %sum_A.027, %sum_B.026
br i1 %cmp4.not, label %if.else, label %if.then
if.then: ; preds = %while.body
%dec = add nsw i32 %j.029, -1
%idxprom5 = sext i32 %j.029 to i64
%arrayidx6 = getelementptr inbounds i32, ptr %vla, i64 %idxprom5
%6 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%conv = sext i32 %6 to i64
%add = add nsw i64 %sum_B.026, %conv
br label %if.end
if.else: ; preds = %while.body
%inc7 = add nsw i32 %i2.028, 1
%idxprom8 = sext i32 %i2.028 to i64
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %idxprom8
%7 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%conv10 = sext i32 %7 to i64
%add11 = add nsw i64 %sum_A.027, %conv10
br label %if.end
if.end: ; preds = %if.else, %if.then
%sum_B.1 = phi i64 [ %add, %if.then ], [ %sum_B.026, %if.else ]
%sum_A.1 = phi i64 [ %sum_A.027, %if.then ], [ %add11, %if.else ]
%i2.1 = phi i32 [ %i2.028, %if.then ], [ %inc7, %if.else ]
%j.1 = phi i32 [ %dec, %if.then ], [ %j.029, %if.else ]
%cmp3.not = icmp sgt i32 %i2.1, %j.1
br i1 %cmp3.not, label %while.end.loopexit, label %while.body, !llvm.loop !11
while.end.loopexit: ; preds = %if.end
%8 = sub nsw i64 %sum_A.1, %sum_B.1
%9 = trunc i64 %8 to i32
br label %while.end
while.end: ; preds = %entry, %while.end.loopexit, %for.cond.cleanup
%sub12 = phi i32 [ 0, %for.cond.cleanup ], [ %9, %while.end.loopexit ], [ 0, %entry ]
%10 = call i32 @llvm.abs.i32(i32 %sub12, i1 true)
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %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: 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 speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; 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 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}
|
//set many funcs template
//Ver.20190820
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}
void llswap(long long *a,long long *b){long long c;c=(*a);(*a)=(*b);(*b)=c;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
void dbswap(double *a,double *b){double c;c=(*a);(*a)=(*b);(*b)=c;}
void chswap(char *a,char *b){char c;c=(*a);(*a)=(*b);(*b)=c;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int strsortfncsj(const void *a,const void *b){return strcmp((char *)a,(char *)b);}
int strsortfnckj(const void *a,const void *b){return strcmp((char *)b,(char *)a);}
int chsortfncsj(const void *a,const void *b){if(*(char *)a>*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
int chsortfnckj(const void *a,const void *b){if(*(char *)a<*(char *)b){return 1;}if(*(char *)a==*(char *)b){return 0;}return -1;}
void shuffledget(int x[],int n){
int i,b[524288],p,c;
for(i=0;i<n;i++){
b[i]=i;
}
for(i=n;i>=1;i--){
p=rand()%i;
c=b[i-1];b[i-1]=b[p];b[p]=c;
}
for(i=0;i<n;i++){
scanf("%d",&x[b[i]]);
}
}
int dx4[4]={1,-1,0,0};
int dy4[4]={0,0,1,-1};
int dx8[8]={-1,-1,-1,0,0,1,1,1};
int dy8[8]={-1,0,1,-1,1,-1,0,1};
int search(int x,int a[],int n){
int st=0,fi=n-1,te;
while(st<=fi){
te=(st+fi)/2;
if(a[te]<x){st=te+1;}else{fi=te-1;}
}
return st;
}
void prarr(int arr[],int n){
int i;
for(i=0;i<n;i++){
if(i){printf(" ");}
printf("%d",arr[i]);
}
printf("\n");
return;
}
void getperm(int a[],int n){
int i,p;
for(i=0;i<n;i++){
a[i]=i;
}
for(i=n-1;i>=1;i--){
p=rand()%(i+1);
swap(&a[p],&a[i]);
}
}
typedef struct{
int val;
int node;
}sd;
int sdsortfnc(const void *a,const void *b){
if(((sd*)a)->val < ((sd*)b)->val){return -1;}
if(((sd*)a)->val > ((sd*)b)->val){return 1;}
return 0;
}
void coordinate_comp(int a[],int n){
int i,c=0;
sd dat[524288];
for(i=0;i<n;i++){
dat[i].val=a[i];
dat[i].node=i;
}
qsort(dat,n,sizeof(dat[0]),sdsortfnc);
a[dat[0].node]=c;
for(i=1;i<n;i++){
if(dat[i-1].val!=dat[i].val){c++;}
a[dat[i].node]=c;
}
}
int main(void){
long long i,j,n,m,k,a[524288],b,c,h,w,r=llinf,l=0,t;
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld",&a[i]);
l+=a[i];
}
b=0;
for(i=0;i<n;i++){
b+=a[i];
c=l-b;
r=llmin(llzt(b,c),r);
}
printf("%lld\n",r);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191631/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191631/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
%struct.sd = type { i32, i32 }
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@dx4 = dso_local local_unnamed_addr global [4 x i32] [i32 1, i32 -1, i32 0, i32 0], align 16
@dy4 = dso_local local_unnamed_addr global [4 x i32] [i32 0, i32 0, i32 1, i32 -1], align 16
@dx8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 -1, i32 -1, i32 0, i32 0, i32 1, i32 1, i32 1], align 16
@dy8 = dso_local local_unnamed_addr global [8 x i32] [i32 -1, i32 0, i32 1, i32 -1, i32 1, i32 -1, i32 0, i32 1], align 16
@.str.3 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
@.str.4 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @max(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smax.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @min(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i32 @llvm.smin.i32(i32 %a, i32 %b)
ret i32 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @zt(i32 noundef %a, i32 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i32 %a, %b
%sub = tail call i32 @llvm.abs.i32(i32 %sub5, i1 true)
ret i32 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @round(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%mul = shl nsw i32 %rem, 1
%cmp.not = icmp sge i32 %mul, %b
%div1 = sdiv i32 %a, %b
%add = zext i1 %cmp.not to i32
%retval.0 = add nsw i32 %div1, %add
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @ceil(i32 noundef %a, i32 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i32 %a, %b
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %a, %b
%add = zext i1 %cmp to i32
%retval.0 = add nsw i32 %div, %add
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @gcd(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i32 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i32 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i32 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i32 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i32 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !5
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i32 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i32 %a.addr.0.lcssa
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @lcm(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i32 %b, 0
br i1 %cmp.not4.i, label %gcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i32 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i32 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i32 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i32 %rem.i, 0
br i1 %cmp.not.i, label %gcd.exit, label %while.body.i, !llvm.loop !5
gcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i32 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i32 %a, %a.addr.0.lcssa.i
%mul = mul nsw i32 %div, %b
ret i32 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nCr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i32 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i32 %a, 1
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i32 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i32 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i32 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i32 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i32 %add, %i.07
%mul = mul nsw i32 %r.08, %sub
%div = sdiv i32 %mul, %i.07
%inc = add nuw i32 %i.07, 1
%sub.1 = sub i32 %add, %inc
%mul.1 = mul nsw i32 %div, %sub.1
%div.1 = sdiv i32 %mul.1, %inc
%inc.1 = add nuw i32 %i.07, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !7
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i32 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i32 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i32 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i32 %add, %i.07.unr
%mul.epil = mul nsw i32 %r.08.unr, %sub.epil
%div.epil = sdiv i32 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @nHr(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i32 %b, %a
%cmp.not6.i = icmp slt i32 %b, 1
br i1 %cmp.not6.i, label %nCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i32 %b, 1
%0 = icmp eq i32 %b, 1
br i1 %0, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i32 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i32 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i32 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i32 %add, %i.07.i
%mul.i = mul nsw i32 %sub.i, %r.08.i
%div.i = sdiv i32 %mul.i, %i.07.i
%inc.i = add nuw i32 %i.07.i, 1
%sub.i.1 = sub i32 %add, %inc.i
%mul.i.1 = mul nsw i32 %sub.i.1, %div.i
%div.i.1 = sdiv i32 %mul.i.1, %inc.i
%inc.i.1 = add nuw i32 %i.07.i, 2
%niter.next.1 = add i32 %niter, 2
%niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %nCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !7
nCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i32 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i32 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %nCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %nCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i32 %add, %i.07.i.unr
%mul.i.epil = mul nsw i32 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i32 %mul.i.epil, %i.07.i.unr
br label %nCr.exit
nCr.exit: ; preds = %for.body.i.epil, %nCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i32 [ 1, %entry ], [ %div.i.lcssa.ph, %nCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i32 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @fact(i32 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i32 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %a, 8
br i1 %min.iters.check, label %for.body.preheader9, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %a, -8
%ind.end = or i32 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi7 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = mul <4 x i32> %vec.phi, %vec.ind
%1 = mul <4 x i32> %vec.phi7, %step.add
%index.next = add nuw i32 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !8
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %a
br i1 %cmp.n, label %for.end, label %for.body.preheader9
for.body.preheader9: ; preds = %for.body.preheader, %middle.block
%r.06.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.05.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader9, %for.body
%r.06 = phi i32 [ %mul, %for.body ], [ %r.06.ph, %for.body.preheader9 ]
%i.05 = phi i32 [ %inc, %for.body ], [ %i.05.ph, %for.body.preheader9 ]
%mul = mul nsw i32 %r.06, %i.05
%inc = add nuw i32 %i.05, 1
%exitcond.not = icmp eq i32 %i.05, %a
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !11
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @pow(i32 noundef %a, i32 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i32 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%min.iters.check = icmp ult i32 %b, 8
br i1 %min.iters.check, label %for.body.preheader7, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i32 %b, -8
%ind.end = or i32 %n.vec, 1
%broadcast.splatinsert = insertelement <4 x i32> poison, i32 %a, i64 0
%broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %0, %vector.body ]
%vec.phi6 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %1, %vector.body ]
%0 = mul <4 x i32> %vec.phi, %broadcast.splat
%1 = mul <4 x i32> %vec.phi6, %broadcast.splat
%index.next = add nuw i32 %index, 8
%2 = icmp eq i32 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !12
middle.block: ; preds = %vector.body
%bin.rdx = mul <4 x i32> %1, %0
%3 = tail call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i32 %n.vec, %b
br i1 %cmp.n, label %for.end, label %for.body.preheader7
for.body.preheader7: ; preds = %for.body.preheader, %middle.block
%r.05.ph = phi i32 [ 1, %for.body.preheader ], [ %3, %middle.block ]
%i.04.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader7, %for.body
%r.05 = phi i32 [ %mul, %for.body ], [ %r.05.ph, %for.body.preheader7 ]
%i.04 = phi i32 [ %inc, %for.body ], [ %i.04.ph, %for.body.preheader7 ]
%mul = mul nsw i32 %r.05, %a
%inc = add nuw i32 %i.04, 1
%exitcond.not = icmp eq i32 %i.04, %b
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !13
for.end: ; preds = %for.body, %middle.block, %entry
%r.0.lcssa = phi i32 [ 1, %entry ], [ %3, %middle.block ], [ %mul, %for.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsum(i32 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i32 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.05, 10
%add = add nsw i32 %r.06, %rem
%div = sdiv i32 %x.addr.05, 10
%x.addr.05.off = add i32 %x.addr.05, 9
%tobool.not = icmp ult i32 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !14
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i32 @dsumb(i32 noundef %x, i32 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i32 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i32 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i32 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i32 %x.addr.06, %b
%add = add nsw i32 %rem, %r.07
%div = sdiv i32 %x.addr.06, %b
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !15
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i32 [ 0, %entry ], [ %add, %while.body ]
ret i32 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @sankaku(i32 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i32 %x, 1
%mul = mul nsw i32 %add, %x
%div = sdiv i32 %mul, 2
ret i32 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
store i32 %1, ptr %a, align 4, !tbaa !16
store i32 %0, ptr %b, align 4, !tbaa !16
ret void
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmax(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smax.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llmin(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%a.b = tail call i64 @llvm.smin.i64(i64 %a, i64 %b)
ret i64 %a.b
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llzt(i64 noundef %a, i64 noundef %b) local_unnamed_addr #0 {
entry:
%sub5 = sub nsw i64 %a, %b
%sub = tail call i64 @llvm.abs.i64(i64 %sub5, i1 true)
ret i64 %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llround(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%mul = shl nsw i64 %rem, 1
%cmp.not = icmp sge i64 %mul, %b
%div1 = sdiv i64 %a, %b
%add = zext i1 %cmp.not to i64
%retval.0 = add nsw i64 %div1, %add
ret i64 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llceil(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%rem = srem i64 %a, %b
%cmp = icmp ne i64 %rem, 0
%div = sdiv i64 %a, %b
%add = zext i1 %cmp to i64
%retval.0 = add nsw i64 %div, %add
ret i64 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llgcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp eq i64 %b, 0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%a.addr.06 = phi i64 [ %b.addr.05, %while.body ], [ %a, %entry ]
%b.addr.05 = phi i64 [ %rem, %while.body ], [ %b, %entry ]
%rem = srem i64 %a.addr.06, %b.addr.05
%cmp.not = icmp eq i64 %rem, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !20
while.end: ; preds = %while.body, %entry
%a.addr.0.lcssa = phi i64 [ %a, %entry ], [ %b.addr.05, %while.body ]
ret i64 %a.addr.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lllcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not4.i = icmp eq i64 %b, 0
br i1 %cmp.not4.i, label %llgcd.exit, label %while.body.i
while.body.i: ; preds = %entry, %while.body.i
%a.addr.06.i = phi i64 [ %b.addr.05.i, %while.body.i ], [ %a, %entry ]
%b.addr.05.i = phi i64 [ %rem.i, %while.body.i ], [ %b, %entry ]
%rem.i = srem i64 %a.addr.06.i, %b.addr.05.i
%cmp.not.i = icmp eq i64 %rem.i, 0
br i1 %cmp.not.i, label %llgcd.exit, label %while.body.i, !llvm.loop !20
llgcd.exit: ; preds = %while.body.i, %entry
%a.addr.0.lcssa.i = phi i64 [ %a, %entry ], [ %b.addr.05.i, %while.body.i ]
%div = sdiv i64 %a, %a.addr.0.lcssa.i
%mul = mul nsw i64 %div, %b
ret i64 %mul
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnCr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not6 = icmp slt i64 %b, 1
br i1 %cmp.not6, label %for.end, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%add = add nsw i64 %a, 1
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.lr.ph.new
for.body.lr.ph.new: ; preds = %for.body.lr.ph
%unroll_iter = and i64 %b, -2
br label %for.body
for.body: ; preds = %for.body, %for.body.lr.ph.new
%r.08 = phi i64 [ 1, %for.body.lr.ph.new ], [ %div.1, %for.body ]
%i.07 = phi i64 [ 1, %for.body.lr.ph.new ], [ %inc.1, %for.body ]
%niter = phi i64 [ 0, %for.body.lr.ph.new ], [ %niter.next.1, %for.body ]
%sub = sub i64 %add, %i.07
%mul = mul nsw i64 %r.08, %sub
%div = sdiv i64 %mul, %i.07
%inc = add nuw i64 %i.07, 1
%sub.1 = sub i64 %add, %inc
%mul.1 = mul nsw i64 %div, %sub.1
%div.1 = sdiv i64 %mul.1, %inc
%inc.1 = add nuw i64 %i.07, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !21
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.lr.ph
%div.lcssa.ph = phi i64 [ undef, %for.body.lr.ph ], [ %div.1, %for.body ]
%r.08.unr = phi i64 [ 1, %for.body.lr.ph ], [ %div.1, %for.body ]
%i.07.unr = phi i64 [ 1, %for.body.lr.ph ], [ %inc.1, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa
%sub.epil = sub i64 %add, %i.07.unr
%mul.epil = mul nsw i64 %r.08.unr, %sub.epil
%div.epil = sdiv i64 %mul.epil, %i.07.unr
br label %for.end
for.end: ; preds = %for.body.epil, %for.end.loopexit.unr-lcssa, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %div.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %div.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llnHr(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%add = add nsw i64 %b, %a
%cmp.not6.i = icmp slt i64 %b, 1
br i1 %cmp.not6.i, label %llnCr.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %entry
%xtraiter = and i64 %b, 1
%0 = icmp eq i64 %b, 1
br i1 %0, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i.preheader.new
for.body.i.preheader.new: ; preds = %for.body.i.preheader
%unroll_iter = and i64 %b, -2
br label %for.body.i
for.body.i: ; preds = %for.body.i, %for.body.i.preheader.new
%r.08.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %div.i.1, %for.body.i ]
%i.07.i = phi i64 [ 1, %for.body.i.preheader.new ], [ %inc.i.1, %for.body.i ]
%niter = phi i64 [ 0, %for.body.i.preheader.new ], [ %niter.next.1, %for.body.i ]
%sub.i = sub i64 %add, %i.07.i
%mul.i = mul nsw i64 %sub.i, %r.08.i
%div.i = sdiv i64 %mul.i, %i.07.i
%inc.i = add nuw i64 %i.07.i, 1
%sub.i.1 = sub i64 %add, %inc.i
%mul.i.1 = mul nsw i64 %sub.i.1, %div.i
%div.i.1 = sdiv i64 %mul.i.1, %inc.i
%inc.i.1 = add nuw i64 %i.07.i, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %llnCr.exit.loopexit.unr-lcssa, label %for.body.i, !llvm.loop !21
llnCr.exit.loopexit.unr-lcssa: ; preds = %for.body.i, %for.body.i.preheader
%div.i.lcssa.ph = phi i64 [ undef, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%r.08.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %div.i.1, %for.body.i ]
%i.07.i.unr = phi i64 [ 1, %for.body.i.preheader ], [ %inc.i.1, %for.body.i ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %llnCr.exit, label %for.body.i.epil
for.body.i.epil: ; preds = %llnCr.exit.loopexit.unr-lcssa
%sub.i.epil = sub i64 %add, %i.07.i.unr
%mul.i.epil = mul nsw i64 %sub.i.epil, %r.08.i.unr
%div.i.epil = sdiv i64 %mul.i.epil, %i.07.i.unr
br label %llnCr.exit
llnCr.exit: ; preds = %for.body.i.epil, %llnCr.exit.loopexit.unr-lcssa, %entry
%r.0.lcssa.i = phi i64 [ 1, %entry ], [ %div.i.lcssa.ph, %llnCr.exit.loopexit.unr-lcssa ], [ %div.i.epil, %for.body.i.epil ]
ret i64 %r.0.lcssa.i
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llfact(i64 noundef %a) local_unnamed_addr #2 {
entry:
%cmp.not4 = icmp slt i64 %a, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %a, 7
%0 = icmp ult i64 %a, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %a, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.06 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%i.05 = phi i64 [ 1, %for.body.preheader.new ], [ %inc.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.06, %i.05
%inc = add nuw nsw i64 %i.05, 1
%mul.1 = mul nsw i64 %mul, %inc
%inc.1 = add nuw nsw i64 %i.05, 2
%mul.2 = mul nsw i64 %mul.1, %inc.1
%inc.2 = add nuw nsw i64 %i.05, 3
%mul.3 = mul nsw i64 %mul.2, %inc.2
%inc.3 = add nuw nsw i64 %i.05, 4
%mul.4 = mul nsw i64 %mul.3, %inc.3
%inc.4 = add nuw nsw i64 %i.05, 5
%mul.5 = mul nsw i64 %mul.4, %inc.4
%inc.5 = add nuw nsw i64 %i.05, 6
%mul.6 = mul nsw i64 %mul.5, %inc.5
%inc.6 = add nuw i64 %i.05, 7
%mul.7 = mul nsw i64 %mul.6, %inc.6
%inc.7 = add nuw i64 %i.05, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !22
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.06.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%i.05.unr = phi i64 [ 1, %for.body.preheader ], [ %inc.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.06.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.06.unr, %for.end.loopexit.unr-lcssa ]
%i.05.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.06.epil, %i.05.epil
%inc.epil = add nuw i64 %i.05.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !23
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @llpow(i64 noundef %a, i64 noundef %b) local_unnamed_addr #2 {
entry:
%cmp.not3 = icmp slt i64 %b, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %b, 7
%0 = icmp ult i64 %b, 8
br i1 %0, label %for.end.loopexit.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %b, -8
br label %for.body
for.body: ; preds = %for.body, %for.body.preheader.new
%r.05 = phi i64 [ 1, %for.body.preheader.new ], [ %mul.7, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.7, %for.body ]
%mul = mul nsw i64 %r.05, %a
%mul.1 = mul nsw i64 %mul, %a
%mul.2 = mul nsw i64 %mul.1, %a
%mul.3 = mul nsw i64 %mul.2, %a
%mul.4 = mul nsw i64 %mul.3, %a
%mul.5 = mul nsw i64 %mul.4, %a
%mul.6 = mul nsw i64 %mul.5, %a
%mul.7 = mul nsw i64 %mul.6, %a
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.end.loopexit.unr-lcssa, label %for.body, !llvm.loop !25
for.end.loopexit.unr-lcssa: ; preds = %for.body, %for.body.preheader
%mul.lcssa.ph = phi i64 [ undef, %for.body.preheader ], [ %mul.7, %for.body ]
%r.05.unr = phi i64 [ 1, %for.body.preheader ], [ %mul.7, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil
%r.05.epil = phi i64 [ %mul.epil, %for.body.epil ], [ %r.05.unr, %for.end.loopexit.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.loopexit.unr-lcssa ]
%mul.epil = mul nsw i64 %r.05.epil, %a
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !26
for.end: ; preds = %for.end.loopexit.unr-lcssa, %for.body.epil, %entry
%r.0.lcssa = phi i64 [ 1, %entry ], [ %mul.lcssa.ph, %for.end.loopexit.unr-lcssa ], [ %mul.epil, %for.body.epil ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsum(i64 noundef %x) local_unnamed_addr #2 {
entry:
%tobool.not4 = icmp eq i64 %x, 0
br i1 %tobool.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.06 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.05 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.05, 10
%add = add nsw i64 %r.06, %rem
%div = sdiv i64 %x.addr.05, 10
%x.addr.05.off = add i64 %x.addr.05, 9
%tobool.not = icmp ult i64 %x.addr.05.off, 19
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !27
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lldsumb(i64 noundef %x, i64 noundef %b) local_unnamed_addr #2 {
entry:
%tobool.not5 = icmp eq i64 %x, 0
br i1 %tobool.not5, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%r.07 = phi i64 [ %add, %while.body ], [ 0, %entry ]
%x.addr.06 = phi i64 [ %div, %while.body ], [ %x, %entry ]
%rem = srem i64 %x.addr.06, %b
%add = add nsw i64 %rem, %r.07
%div = sdiv i64 %x.addr.06, %b
%tobool.not = icmp eq i64 %div, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !28
while.end: ; preds = %while.body, %entry
%r.0.lcssa = phi i64 [ 0, %entry ], [ %add, %while.body ]
ret i64 %r.0.lcssa
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @llsankaku(i64 noundef %x) local_unnamed_addr #1 {
entry:
%add = add nsw i64 %x, 1
%mul = mul nsw i64 %add, %x
%div = sdiv i64 %mul, 2
ret i64 %div
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @llswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
store i64 %1, ptr %a, align 8, !tbaa !29
store i64 %0, ptr %b, align 8, !tbaa !29
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmax(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp ogt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbmin(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp = fcmp olt double %a, %b
%a.b = select i1 %cmp, double %a, double %b
ret double %a.b
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local double @dbzt(double noundef %a, double noundef %b) local_unnamed_addr #1 {
entry:
%cmp.i = fcmp ogt double %a, %b
%a.b.i = select i1 %cmp.i, double %a, double %b
%cmp.i4 = fcmp olt double %a, %b
%a.b.i5 = select i1 %cmp.i4, double %a, double %b
%sub = fsub double %a.b.i, %a.b.i5
ret double %sub
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @dbswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
store double %1, ptr %a, align 8, !tbaa !31
store double %0, ptr %b, align 8, !tbaa !31
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @chswap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #4 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
store i8 %1, ptr %a, align 1, !tbaa !33
store i8 %0, ptr %b, align 1, !tbaa !33
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp sgt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !16
%1 = load i32, ptr %b, align 4, !tbaa !16
%cmp = icmp slt i32 %0, %1
%cmp1 = icmp ne i32 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp sgt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @llsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i64, ptr %a, align 8, !tbaa !29
%1 = load i64, ptr %b, align 8, !tbaa !29
%cmp = icmp slt i64 %0, %1
%cmp1 = icmp ne i64 %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp ogt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @dbsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load double, ptr %a, align 8, !tbaa !31
%1 = load double, ptr %b, align 8, !tbaa !31
%cmp = fcmp olt double %0, %1
%cmp1 = fcmp une double %0, %1
%. = sext i1 %cmp1 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %a, ptr noundef nonnull dereferenceable(1) %b) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @strsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #6 {
entry:
%call = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %b, ptr noundef nonnull dereferenceable(1) %a) #16
ret i32 %call
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfncsj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp sgt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @chsortfnckj(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #5 {
entry:
%0 = load i8, ptr %a, align 1, !tbaa !33
%1 = load i8, ptr %b, align 1, !tbaa !33
%cmp = icmp slt i8 %0, %1
%cmp5 = icmp ne i8 %0, %1
%. = sext i1 %cmp5 to i32
%retval.0 = select i1 %cmp, i32 1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nounwind uwtable
define dso_local void @shuffledget(ptr noundef %x, i32 noundef %n) local_unnamed_addr #8 {
entry:
%b = alloca [524288 x i32], align 16
call void @llvm.lifetime.start.p0(i64 2097152, ptr nonnull %b) #17
%cmp40 = icmp sgt i32 %n, 0
br i1 %cmp40, label %for.body.preheader, label %for.end25
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader57, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 16, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 16, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !34
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader57
for.body.preheader57: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
br i1 %cmp40, label %for.body3.preheader, label %for.end25
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader57, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader57 ]
%arrayidx = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !35
for.cond15.preheader: ; preds = %for.body3
br i1 %cmp40, label %for.body17.preheader, label %for.end25
for.body17.preheader: ; preds = %for.cond15.preheader
%wide.trip.count54 = zext i32 %n to i64
br label %for.body17
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv47 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next48, %for.body3 ]
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv47 to i32
%rem = srem i32 %call, %5
%indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
%idxprom4 = and i64 %indvars.iv.next48, 4294967295
%arrayidx5 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom4
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%idxprom6 = sext i32 %rem to i64
%arrayidx7 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv47, 1
br i1 %cmp2, label %for.body3, label %for.cond15.preheader, !llvm.loop !36
for.body17: ; preds = %for.body17.preheader, %for.body17
%indvars.iv50 = phi i64 [ 0, %for.body17.preheader ], [ %indvars.iv.next51, %for.body17 ]
%arrayidx19 = getelementptr inbounds [524288 x i32], ptr %b, i64 0, i64 %indvars.iv50
%8 = load i32, ptr %arrayidx19, align 4, !tbaa !16
%idxprom20 = sext i32 %8 to i64
%arrayidx21 = getelementptr inbounds i32, ptr %x, i64 %idxprom20
%call22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx21)
%indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
%exitcond55.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count54
br i1 %exitcond55.not, label %for.end25, label %for.body17, !llvm.loop !37
for.end25: ; preds = %for.body17, %entry, %for.cond1.preheader, %for.cond15.preheader
call void @llvm.lifetime.end.p0(i64 2097152, ptr nonnull %b) #17
ret void
}
; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #9
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @search(i32 noundef %x, ptr nocapture noundef readonly %a, i32 noundef %n) local_unnamed_addr #11 {
entry:
%cmp.not9 = icmp slt i32 %n, 1
br i1 %cmp.not9, label %while.end, label %while.body.preheader
while.body.preheader: ; preds = %entry
%sub = add nsw i32 %n, -1
br label %while.body
while.body: ; preds = %while.body.preheader, %while.body
%st.011 = phi i32 [ %st.1, %while.body ], [ 0, %while.body.preheader ]
%fi.010 = phi i32 [ %fi.1, %while.body ], [ %sub, %while.body.preheader ]
%add = add nsw i32 %st.011, %fi.010
%div = sdiv i32 %add, 2
%idxprom = sext i32 %div to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%cmp1 = icmp slt i32 %0, %x
%add2 = add nsw i32 %div, 1
%sub3 = add nsw i32 %div, -1
%fi.1 = select i1 %cmp1, i32 %fi.010, i32 %sub3
%st.1 = select i1 %cmp1, i32 %add2, i32 %st.011
%cmp.not = icmp sgt i32 %st.1, %fi.1
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !38
while.end: ; preds = %while.body, %entry
%st.0.lcssa = phi i32 [ 0, %entry ], [ %st.1, %while.body ]
ret i32 %st.0.lcssa
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @prarr(ptr nocapture noundef readonly %arr, i32 noundef %n) local_unnamed_addr #12 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %if.end.peel, label %for.end
if.end.peel: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%.pre = load i32, ptr %arr, align 4, !tbaa !16
%call1.peel = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.pre)
%exitcond.peel.not = icmp eq i32 %n, 1
br i1 %exitcond.peel.not, label %for.end, label %if.end
if.end: ; preds = %if.end.peel, %if.end
%indvars.iv = phi i64 [ %indvars.iv.next, %if.end ], [ 1, %if.end.peel ]
%putchar6 = tail call i32 @putchar(i32 32)
%arrayidx = getelementptr inbounds i32, ptr %arr, i64 %indvars.iv
%0 = load i32, ptr %arrayidx, align 4, !tbaa !16
%call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %0)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %if.end, !llvm.loop !39
for.end: ; preds = %if.end, %if.end.peel, %entry
%putchar = tail call i32 @putchar(i32 10)
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #10
; Function Attrs: nounwind uwtable
define dso_local void @getperm(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #8 {
entry:
%cmp20 = icmp sgt i32 %n, 0
br i1 %cmp20, label %for.body.preheader, label %for.end9
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader30, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967288
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
%0 = getelementptr inbounds i32, ptr %a, i64 %index
store <4 x i32> %vec.ind, ptr %0, align 4, !tbaa !16
%1 = getelementptr inbounds i32, ptr %0, i64 4
store <4 x i32> %step.add, ptr %1, align 4, !tbaa !16
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
%2 = icmp eq i64 %index.next, %n.vec
br i1 %2, label %middle.block, label %vector.body, !llvm.loop !41
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader30
for.body.preheader30: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
%cmp222 = icmp sgt i32 %n, 1
br i1 %cmp222, label %for.body3.preheader, label %for.end9
for.body3.preheader: ; preds = %for.cond1.preheader
%3 = zext i32 %n to i64
br label %for.body3
for.body: ; preds = %for.body.preheader30, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader30 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%4 = trunc i64 %indvars.iv to i32
store i32 %4, ptr %arrayidx, align 4, !tbaa !16
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !42
for.body3: ; preds = %for.body3.preheader, %for.body3
%indvars.iv25 = phi i64 [ %3, %for.body3.preheader ], [ %indvars.iv.next26, %for.body3 ]
%indvars.iv.next26 = add nsw i64 %indvars.iv25, -1
%call = tail call i32 @rand() #17
%5 = trunc i64 %indvars.iv25 to i32
%rem = srem i32 %call, %5
%idxprom4 = sext i32 %rem to i64
%arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %idxprom4
%idxprom6 = and i64 %indvars.iv.next26, 4294967295
%arrayidx7 = getelementptr inbounds i32, ptr %a, i64 %idxprom6
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !16
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !16
store i32 %7, ptr %arrayidx5, align 4, !tbaa !16
store i32 %6, ptr %arrayidx7, align 4, !tbaa !16
%cmp2 = icmp ugt i64 %indvars.iv25, 2
br i1 %cmp2, label %for.body3, label %for.end9, !llvm.loop !43
for.end9: ; preds = %for.body3, %entry, %for.cond1.preheader
ret void
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @sdsortfnc(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) #5 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !44
%1 = load i32, ptr %b, align 4, !tbaa !44
%cmp = icmp slt i32 %0, %1
%cmp4 = icmp sgt i32 %0, %1
%. = zext i1 %cmp4 to i32
%retval.0 = select i1 %cmp, i32 -1, i32 %.
ret i32 %retval.0
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @coordinate_comp(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr #12 {
entry:
%dat = alloca [524288 x %struct.sd], align 16
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %dat) #17
%cmp46 = icmp sgt i32 %n, 0
br i1 %cmp46, label %for.body.preheader, label %for.end
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %n to i64
%min.iters.check = icmp ult i32 %n, 4
br i1 %min.iters.check, label %for.body.preheader61, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%0 = or i64 %index, 2
%1 = getelementptr inbounds i32, ptr %a, i64 %index
%wide.load = load <2 x i32>, ptr %1, align 4, !tbaa !16
%2 = getelementptr inbounds i32, ptr %1, i64 2
%wide.load59 = load <2 x i32>, ptr %2, align 4, !tbaa !16
%3 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %index
%4 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %0
%interleaved.vec = shufflevector <2 x i32> %wide.load, <2 x i32> %vec.ind, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %3, align 16, !tbaa !16
%interleaved.vec60 = shufflevector <2 x i32> %wide.load59, <2 x i32> %step.add, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec60, ptr %4, align 16, !tbaa !16
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !46
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end, label %for.body.preheader61
for.body.preheader61: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
br label %for.body
for.body: ; preds = %for.body.preheader61, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader61 ]
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !16
%arrayidx2 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv
store i32 %6, ptr %arrayidx2, align 8, !tbaa !44
%node = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv, i32 1
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %node, align 4, !tbaa !47
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !48
for.end: ; preds = %for.body, %middle.block, %entry
%conv = sext i32 %n to i64
call void @qsort(ptr noundef nonnull %dat, i64 noundef %conv, i64 noundef 8, ptr noundef nonnull @sdsortfnc) #17
%node6 = getelementptr inbounds %struct.sd, ptr %dat, i64 0, i32 1
%8 = load i32, ptr %node6, align 4, !tbaa !47
%idxprom7 = sext i32 %8 to i64
%arrayidx8 = getelementptr inbounds i32, ptr %a, i64 %idxprom7
store i32 0, ptr %arrayidx8, align 4, !tbaa !16
%cmp1048 = icmp sgt i32 %n, 1
br i1 %cmp1048, label %for.body12.preheader, label %for.end29
for.body12.preheader: ; preds = %for.end
%wide.trip.count56 = zext i32 %n to i64
%.pre = load i32, ptr %dat, align 16, !tbaa !44
%9 = add nsw i64 %wide.trip.count56, -1
%xtraiter = and i64 %9, 1
%10 = icmp eq i32 %n, 2
br i1 %10, label %for.end29.loopexit.unr-lcssa, label %for.body12.preheader.new
for.body12.preheader.new: ; preds = %for.body12.preheader
%unroll_iter = and i64 %9, -2
br label %for.body12
for.body12: ; preds = %for.body12, %for.body12.preheader.new
%11 = phi i32 [ %.pre, %for.body12.preheader.new ], [ %14, %for.body12 ]
%indvars.iv52 = phi i64 [ 1, %for.body12.preheader.new ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050 = phi i32 [ 0, %for.body12.preheader.new ], [ %spec.select.1, %for.body12 ]
%niter = phi i64 [ 0, %for.body12.preheader.new ], [ %niter.next.1, %for.body12 ]
%arrayidx17 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52
%12 = load i32, ptr %arrayidx17, align 8, !tbaa !44
%cmp19.not = icmp ne i32 %11, %12
%inc21 = zext i1 %cmp19.not to i32
%spec.select = add nuw nsw i32 %c.050, %inc21
%node24 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52, i32 1
%13 = load i32, ptr %node24, align 4, !tbaa !47
%idxprom25 = sext i32 %13 to i64
%arrayidx26 = getelementptr inbounds i32, ptr %a, i64 %idxprom25
store i32 %spec.select, ptr %arrayidx26, align 4, !tbaa !16
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%arrayidx17.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53
%14 = load i32, ptr %arrayidx17.1, align 8, !tbaa !44
%cmp19.not.1 = icmp ne i32 %12, %14
%inc21.1 = zext i1 %cmp19.not.1 to i32
%spec.select.1 = add nuw nsw i32 %spec.select, %inc21.1
%node24.1 = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv.next53, i32 1
%15 = load i32, ptr %node24.1, align 4, !tbaa !47
%idxprom25.1 = sext i32 %15 to i64
%arrayidx26.1 = getelementptr inbounds i32, ptr %a, i64 %idxprom25.1
store i32 %spec.select.1, ptr %arrayidx26.1, align 4, !tbaa !16
%indvars.iv.next53.1 = add nuw nsw i64 %indvars.iv52, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.end29.loopexit.unr-lcssa, label %for.body12, !llvm.loop !49
for.end29.loopexit.unr-lcssa: ; preds = %for.body12, %for.body12.preheader
%.unr = phi i32 [ %.pre, %for.body12.preheader ], [ %14, %for.body12 ]
%indvars.iv52.unr = phi i64 [ 1, %for.body12.preheader ], [ %indvars.iv.next53.1, %for.body12 ]
%c.050.unr = phi i32 [ 0, %for.body12.preheader ], [ %spec.select.1, %for.body12 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end29, label %for.body12.epil
for.body12.epil: ; preds = %for.end29.loopexit.unr-lcssa
%arrayidx17.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr
%16 = load i32, ptr %arrayidx17.epil, align 8, !tbaa !44
%cmp19.not.epil = icmp ne i32 %.unr, %16
%inc21.epil = zext i1 %cmp19.not.epil to i32
%spec.select.epil = add nuw nsw i32 %c.050.unr, %inc21.epil
%node24.epil = getelementptr inbounds [524288 x %struct.sd], ptr %dat, i64 0, i64 %indvars.iv52.unr, i32 1
%17 = load i32, ptr %node24.epil, align 4, !tbaa !47
%idxprom25.epil = sext i32 %17 to i64
%arrayidx26.epil = getelementptr inbounds i32, ptr %a, i64 %idxprom25.epil
store i32 %spec.select.epil, ptr %arrayidx26.epil, align 4, !tbaa !16
br label %for.end29
for.end29: ; preds = %for.body12.epil, %for.end29.loopexit.unr-lcssa, %for.end
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %dat) #17
ret void
}
; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #13
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #12 {
entry:
%n = alloca i64, align 8
%a = alloca [524288 x i64], align 16
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #17
call void @llvm.lifetime.start.p0(i64 4194304, ptr nonnull %a) #17
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %n)
%0 = load i64, ptr %n, align 8, !tbaa !29
%cmp24 = icmp sgt i64 %0, 0
br i1 %cmp24, label %for.body, label %for.end12
for.cond3.preheader: ; preds = %for.body
%cmp428 = icmp sgt i64 %3, 0
br i1 %cmp428, label %for.body5.preheader, label %for.end12
for.body5.preheader: ; preds = %for.cond3.preheader
%xtraiter = and i64 %3, 1
%1 = icmp eq i64 %3, 1
br i1 %1, label %for.end12.loopexit.unr-lcssa, label %for.body5.preheader.new
for.body5.preheader.new: ; preds = %for.body5.preheader
%unroll_iter = and i64 %3, -2
br label %for.body5
for.body: ; preds = %entry, %for.body
%i.026 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%l.025 = phi i64 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.026
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %arrayidx)
%2 = load i64, ptr %arrayidx, align 8, !tbaa !29
%add = add nsw i64 %2, %l.025
%inc = add nuw nsw i64 %i.026, 1
%3 = load i64, ptr %n, align 8, !tbaa !29
%cmp = icmp slt i64 %inc, %3
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !50
for.body5: ; preds = %for.body5, %for.body5.preheader.new
%i.131 = phi i64 [ 0, %for.body5.preheader.new ], [ %inc11.1, %for.body5 ]
%r.030 = phi i64 [ 4154118101919364364, %for.body5.preheader.new ], [ %a.b.i.1, %for.body5 ]
%b.029 = phi i64 [ 0, %for.body5.preheader.new ], [ %add7.1, %for.body5 ]
%niter = phi i64 [ 0, %for.body5.preheader.new ], [ %niter.next.1, %for.body5 ]
%arrayidx6 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.131
%4 = load i64, ptr %arrayidx6, align 16, !tbaa !29
%add7 = add nsw i64 %4, %b.029
%factor = shl i64 %add7, 1
%sub5.i = sub i64 %factor, %add
%sub.i = call i64 @llvm.abs.i64(i64 %sub5.i, i1 true)
%a.b.i = call i64 @llvm.smin.i64(i64 %sub.i, i64 %r.030)
%inc11 = or i64 %i.131, 1
%arrayidx6.1 = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %inc11
%5 = load i64, ptr %arrayidx6.1, align 8, !tbaa !29
%add7.1 = add nsw i64 %5, %add7
%factor.1 = shl i64 %add7.1, 1
%sub5.i.1 = sub i64 %factor.1, %add
%sub.i.1 = call i64 @llvm.abs.i64(i64 %sub5.i.1, i1 true)
%a.b.i.1 = call i64 @llvm.smin.i64(i64 %sub.i.1, i64 %a.b.i)
%inc11.1 = add nuw nsw i64 %i.131, 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.end12.loopexit.unr-lcssa, label %for.body5, !llvm.loop !51
for.end12.loopexit.unr-lcssa: ; preds = %for.body5, %for.body5.preheader
%a.b.i.lcssa.ph = phi i64 [ undef, %for.body5.preheader ], [ %a.b.i.1, %for.body5 ]
%i.131.unr = phi i64 [ 0, %for.body5.preheader ], [ %inc11.1, %for.body5 ]
%r.030.unr = phi i64 [ 4154118101919364364, %for.body5.preheader ], [ %a.b.i.1, %for.body5 ]
%b.029.unr = phi i64 [ 0, %for.body5.preheader ], [ %add7.1, %for.body5 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end12, label %for.body5.epil
for.body5.epil: ; preds = %for.end12.loopexit.unr-lcssa
%arrayidx6.epil = getelementptr inbounds [524288 x i64], ptr %a, i64 0, i64 %i.131.unr
%6 = load i64, ptr %arrayidx6.epil, align 8, !tbaa !29
%add7.epil = add nsw i64 %6, %b.029.unr
%factor.epil = shl i64 %add7.epil, 1
%sub5.i.epil = sub i64 %factor.epil, %add
%sub.i.epil = call i64 @llvm.abs.i64(i64 %sub5.i.epil, i1 true)
%a.b.i.epil = call i64 @llvm.smin.i64(i64 %sub.i.epil, i64 %r.030.unr)
br label %for.end12
for.end12: ; preds = %for.body5.epil, %for.end12.loopexit.unr-lcssa, %entry, %for.cond3.preheader
%r.0.lcssa = phi i64 [ 4154118101919364364, %for.cond3.preheader ], [ 4154118101919364364, %entry ], [ %a.b.i.lcssa.ph, %for.end12.loopexit.unr-lcssa ], [ %a.b.i.epil, %for.body5.epil ]
%call13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %r.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4194304, ptr nonnull %a) #17
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #17
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #14
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #15
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #15
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree norecurse nosync nounwind memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #11 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #12 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #13 = { nofree "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #14 = { nofree nounwind }
attributes #15 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #16 = { nounwind willreturn memory(read) }
attributes #17 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6, !9, !10}
!9 = !{!"llvm.loop.isvectorized", i32 1}
!10 = !{!"llvm.loop.unroll.runtime.disable"}
!11 = distinct !{!11, !6, !10, !9}
!12 = distinct !{!12, !6, !9, !10}
!13 = distinct !{!13, !6, !10, !9}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !18, i64 0}
!18 = !{!"omnipotent char", !19, i64 0}
!19 = !{!"Simple C/C++ TBAA"}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.unroll.disable"}
!25 = distinct !{!25, !6}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !6}
!28 = distinct !{!28, !6}
!29 = !{!30, !30, i64 0}
!30 = !{!"long long", !18, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"double", !18, i64 0}
!33 = !{!18, !18, i64 0}
!34 = distinct !{!34, !6, !9, !10}
!35 = distinct !{!35, !6, !10, !9}
!36 = distinct !{!36, !6}
!37 = distinct !{!37, !6}
!38 = distinct !{!38, !6}
!39 = distinct !{!39, !6, !40}
!40 = !{!"llvm.loop.peeled.count", i32 1}
!41 = distinct !{!41, !6, !9, !10}
!42 = distinct !{!42, !6, !10, !9}
!43 = distinct !{!43, !6}
!44 = !{!45, !17, i64 0}
!45 = !{!"", !17, i64 0, !17, i64 4}
!46 = distinct !{!46, !6, !9, !10}
!47 = !{!45, !17, i64 4}
!48 = distinct !{!48, !6, !10, !9}
!49 = distinct !{!49, !6}
!50 = distinct !{!50, !6}
!51 = distinct !{!51, !6}
|
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#define P 1000000007
int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int main(void){
int a, b, c, x, y;
scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
int ans;
if(c*2>=a+b){
ans = x*a + y*b;
}else{
if(a>c*2) a=c*2;
if(b>c*2) b=c*2;
int z = x>y?y:x;
ans = (x-z)*a + (y-z)*b + z*c*2;
}
printf("%d\n", ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191703/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191703/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @comp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i32, align 4
%y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %y) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x, ptr noundef nonnull %y)
%0 = load i32, ptr %c, align 4, !tbaa !5
%mul = shl i32 %0, 1
%1 = load i32, ptr %a, align 4, !tbaa !5
%2 = load i32, ptr %b, align 4, !tbaa !5
%add = add nsw i32 %2, %1
%cmp.not = icmp slt i32 %mul, %add
br i1 %cmp.not, label %if.else, label %if.then
if.then: ; preds = %entry
%3 = load i32, ptr %x, align 4, !tbaa !5
%mul1 = mul nsw i32 %3, %1
%4 = load i32, ptr %y, align 4, !tbaa !5
%mul2 = mul nsw i32 %4, %2
%add3 = add nsw i32 %mul2, %mul1
br label %if.end21
if.else: ; preds = %entry
%cmp5 = icmp sgt i32 %1, %mul
br i1 %cmp5, label %if.then6, label %if.end
if.then6: ; preds = %if.else
store i32 %mul, ptr %a, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then6, %if.else
%5 = phi i32 [ %mul, %if.then6 ], [ %1, %if.else ]
%cmp9 = icmp sgt i32 %2, %mul
br i1 %cmp9, label %if.then10, label %if.end12
if.then10: ; preds = %if.end
store i32 %mul, ptr %b, align 4, !tbaa !5
br label %if.end12
if.end12: ; preds = %if.then10, %if.end
%6 = phi i32 [ %mul, %if.then10 ], [ %2, %if.end ]
%7 = load i32, ptr %x, align 4
%8 = load i32, ptr %y, align 4
%cond = call i32 @llvm.smin.i32(i32 %7, i32 %8)
%sub = sub nsw i32 %7, %cond
%mul14 = mul nsw i32 %sub, %5
%sub15 = sub nsw i32 %8, %cond
%mul16 = mul nsw i32 %sub15, %6
%mul19 = mul i32 %mul, %cond
%add17 = add i32 %mul16, %mul19
%add20 = add i32 %add17, %mul14
br label %if.end21
if.end21: ; preds = %if.end12, %if.then
%ans.0 = phi i32 [ %add3, %if.then ], [ %add20, %if.end12 ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %y) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %x) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 i32 @llvm.smin.i32(i32, i32) #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#define min(a,b) (a)<=(b)?(a):(b)
int main()
{
int a,b,c,i,j,k;
long x,y,ans;
scanf("%d%d%d%ld%ld",&a,&b,&c,&x,&y);
if(a+b>=2*c){
if(x>=y){
ans=min((2*x*c),(2*y*c+(x-y)*a));
}else{
ans=min((2*y*c),(2*x*c+(y-x)*b));
}
}else {
ans=x*a+y*b;
}
printf("%ld",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191747/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191747/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [13 x i8] c"%d%d%d%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%x = alloca i64, align 8
%y = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %x) #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 %a, ptr noundef nonnull %b, ptr noundef nonnull %c, ptr noundef nonnull %x, ptr noundef nonnull %y)
%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
%mul = shl nsw i32 %2, 1
%cmp.not = icmp slt i32 %add, %mul
%3 = load i64, ptr %x, align 8, !tbaa !9
br i1 %cmp.not, label %if.else49, label %if.then
if.then: ; preds = %entry
%4 = load i64, ptr %y, align 8, !tbaa !9
%cmp1.not = icmp slt i64 %3, %4
%conv24 = sext i32 %2 to i64
%mul23 = shl nsw i64 %conv24, 1
br i1 %cmp1.not, label %if.else, label %if.then2
if.then2: ; preds = %if.then
%mul4 = mul i64 %mul23, %3
%mul7 = mul i64 %mul23, %4
%sub = sub nsw i64 %3, %4
%conv8 = sext i32 %0 to i64
%mul9 = mul nsw i64 %sub, %conv8
%add10 = add nsw i64 %mul7, %mul9
%add10.mul4 = call i64 @llvm.smin.i64(i64 %mul4, i64 %add10)
br label %if.end55
if.else: ; preds = %if.then
%mul25 = mul i64 %mul23, %4
%mul28 = mul i64 %mul23, %3
%sub29 = sub nsw i64 %4, %3
%conv30 = sext i32 %1 to i64
%mul31 = mul nsw i64 %sub29, %conv30
%add32 = add nsw i64 %mul31, %mul28
%add32.mul25 = call i64 @llvm.smin.i64(i64 %mul25, i64 %add32)
br label %if.end55
if.else49: ; preds = %entry
%conv50 = sext i32 %0 to i64
%mul51 = mul nsw i64 %3, %conv50
%5 = load i64, ptr %y, align 8, !tbaa !9
%conv52 = sext i32 %1 to i64
%mul53 = mul nsw i64 %5, %conv52
%add54 = add nsw i64 %mul53, %mul51
br label %if.end55
if.end55: ; preds = %if.then2, %if.else, %if.else49
%ans.0 = phi i64 [ %add10.mul4, %if.then2 ], [ %add32.mul25, %if.else ], [ %add54, %if.else49 ]
%call56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %y) #4
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %x) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
|
#include<stdio.h>
int main(){
int A,B,C,X,Y;//A,B,AB's price, A,B wanted
int PR;//answer
int p,q,r;
int damy;
scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);//read input
if(X > Y){//X<Y for all case
damy = X;
X = Y;
Y = damy;
damy = A;
A = B;
B = damy;
}
p = A * X + B * Y;
q = 2 * C * X + B * (Y - X);
r = 2 * C * Y;
if(p<q) PR = p;
else PR = q;
if(r < PR) PR = r;
printf("%d\n",PR);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191790/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191790/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [11 x i8] c"%d%d%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:
%A = alloca i32, align 4
%B = alloca i32, align 4
%C = alloca i32, align 4
%X = alloca i32, align 4
%Y = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %B) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %C) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %X) #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 %A, ptr noundef nonnull %B, ptr noundef nonnull %C, 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
%cmp = icmp sgt i32 %0, %1
%.pre = load i32, ptr %A, align 4, !tbaa !5
%.pre21 = load i32, ptr %B, align 4, !tbaa !5
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
store i32 %1, ptr %X, align 4, !tbaa !5
store i32 %0, ptr %Y, align 4, !tbaa !5
store i32 %.pre21, ptr %A, align 4, !tbaa !5
store i32 %.pre, ptr %B, align 4, !tbaa !5
br label %if.end
if.end: ; preds = %if.then, %entry
%2 = phi i32 [ %0, %if.then ], [ %1, %entry ]
%3 = phi i32 [ %.pre, %if.then ], [ %.pre21, %entry ]
%4 = phi i32 [ %1, %if.then ], [ %0, %entry ]
%5 = phi i32 [ %.pre21, %if.then ], [ %.pre, %entry ]
%mul = mul nsw i32 %4, %5
%mul1 = mul nsw i32 %2, %3
%add = add nsw i32 %mul1, %mul
%6 = load i32, ptr %C, align 4, !tbaa !5
%mul2 = shl nsw i32 %6, 1
%mul3 = mul nsw i32 %mul2, %4
%sub = sub nsw i32 %2, %4
%mul4 = mul nsw i32 %sub, %3
%add5 = add nsw i32 %mul3, %mul4
%mul7 = mul nsw i32 %mul2, %2
%add.add5 = call i32 @llvm.smin.i32(i32 %add, i32 %add5)
%PR.1 = call i32 @llvm.smin.i32(i32 %mul7, i32 %add.add5)
%call14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %PR.1)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %Y) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %X) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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 nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
//qsort用 降順ソート
int comp(const void *a, const void *b)
{
return *(int*)b - *(int*)a;
}
int main(void)
{
int N;
int i;
int ret = 0;
scanf("%d",&N);
if(N==1){
printf("1\n");
return 0;
}
// N以下の2の累乗を求める
for(i=0;i<8;i++){
if(pow(2,i)<=N){
ret = pow(2,i);
}else{
break;
}
}
printf("%d\n",ret);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191840/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191840/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\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) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %b, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #1 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%cmp = icmp eq i32 %0, 1
br i1 %cmp, label %if.then, label %for.body.preheader
for.body.preheader: ; preds = %entry
%ldexp = call double @ldexp(double 1.000000e+00, i32 0) #6
%1 = load i32, ptr %N, align 4, !tbaa !5
%conv4 = sitofp i32 %1 to double
%cmp5 = fcmp ugt double %ldexp, %conv4
br i1 %cmp5, label %for.end, label %if.then7
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
if.then7: ; preds = %for.body.preheader
%ldexp18 = call double @ldexp(double 1.000000e+00, i32 0) #6
%conv10 = fptosi double %ldexp18 to i32
%ldexp.1 = call double @ldexp(double 1.000000e+00, i32 1) #6
%2 = load i32, ptr %N, align 4, !tbaa !5
%conv4.1 = sitofp i32 %2 to double
%cmp5.1 = fcmp ugt double %ldexp.1, %conv4.1
br i1 %cmp5.1, label %for.end, label %if.then7.1
if.then7.1: ; preds = %if.then7
%ldexp18.1 = call double @ldexp(double 1.000000e+00, i32 1) #6
%conv10.1 = fptosi double %ldexp18.1 to i32
%ldexp.2 = call double @ldexp(double 1.000000e+00, i32 2) #6
%3 = load i32, ptr %N, align 4, !tbaa !5
%conv4.2 = sitofp i32 %3 to double
%cmp5.2 = fcmp ugt double %ldexp.2, %conv4.2
br i1 %cmp5.2, label %for.end, label %if.then7.2
if.then7.2: ; preds = %if.then7.1
%ldexp18.2 = call double @ldexp(double 1.000000e+00, i32 2) #6
%conv10.2 = fptosi double %ldexp18.2 to i32
%ldexp.3 = call double @ldexp(double 1.000000e+00, i32 3) #6
%4 = load i32, ptr %N, align 4, !tbaa !5
%conv4.3 = sitofp i32 %4 to double
%cmp5.3 = fcmp ugt double %ldexp.3, %conv4.3
br i1 %cmp5.3, label %for.end, label %if.then7.3
if.then7.3: ; preds = %if.then7.2
%ldexp18.3 = call double @ldexp(double 1.000000e+00, i32 3) #6
%conv10.3 = fptosi double %ldexp18.3 to i32
%ldexp.4 = call double @ldexp(double 1.000000e+00, i32 4) #6
%5 = load i32, ptr %N, align 4, !tbaa !5
%conv4.4 = sitofp i32 %5 to double
%cmp5.4 = fcmp ugt double %ldexp.4, %conv4.4
br i1 %cmp5.4, label %for.end, label %if.then7.4
if.then7.4: ; preds = %if.then7.3
%ldexp18.4 = call double @ldexp(double 1.000000e+00, i32 4) #6
%conv10.4 = fptosi double %ldexp18.4 to i32
%ldexp.5 = call double @ldexp(double 1.000000e+00, i32 5) #6
%6 = load i32, ptr %N, align 4, !tbaa !5
%conv4.5 = sitofp i32 %6 to double
%cmp5.5 = fcmp ugt double %ldexp.5, %conv4.5
br i1 %cmp5.5, label %for.end, label %if.then7.5
if.then7.5: ; preds = %if.then7.4
%ldexp18.5 = call double @ldexp(double 1.000000e+00, i32 5) #6
%conv10.5 = fptosi double %ldexp18.5 to i32
%ldexp.6 = call double @ldexp(double 1.000000e+00, i32 6) #6
%7 = load i32, ptr %N, align 4, !tbaa !5
%conv4.6 = sitofp i32 %7 to double
%cmp5.6 = fcmp ugt double %ldexp.6, %conv4.6
br i1 %cmp5.6, label %for.end, label %if.then7.6
if.then7.6: ; preds = %if.then7.5
%ldexp18.6 = call double @ldexp(double 1.000000e+00, i32 6) #6
%conv10.6 = fptosi double %ldexp18.6 to i32
%ldexp.7 = call double @ldexp(double 1.000000e+00, i32 7) #6
%8 = load i32, ptr %N, align 4, !tbaa !5
%conv4.7 = sitofp i32 %8 to double
%cmp5.7 = fcmp ugt double %ldexp.7, %conv4.7
br i1 %cmp5.7, label %for.end, label %if.then7.7
if.then7.7: ; preds = %if.then7.6
%ldexp18.7 = call double @ldexp(double 1.000000e+00, i32 7) #6
%conv10.7 = fptosi double %ldexp18.7 to i32
br label %for.end
for.end: ; preds = %if.then7.7, %if.then7.6, %if.then7.5, %if.then7.4, %if.then7.3, %if.then7.2, %if.then7.1, %if.then7, %for.body.preheader
%ret.0.lcssa = phi i32 [ 0, %for.body.preheader ], [ %conv10, %if.then7 ], [ %conv10.1, %if.then7.1 ], [ %conv10.2, %if.then7.2 ], [ %conv10.3, %if.then7.3 ], [ %conv10.4, %if.then7.4 ], [ %conv10.5, %if.then7.5 ], [ %conv10.6, %if.then7.6 ], [ %conv10.7, %if.then7.7 ]
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %ret.0.lcssa)
br label %cleanup
cleanup: ; preds = %for.end, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree willreturn
declare double @ldexp(double, i32) local_unnamed_addr #4
; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree willreturn }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main()
{
int N;
int nb;
scanf("%d\n", &N);
nb = 1;
while ((nb * 2) <= N)
nb *= 2;
printf("%d\n", nb);
return (0);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191884/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191884/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%nb.0 = phi i32 [ 1, %entry ], [ %mul, %while.cond ]
%mul = shl nsw i32 %nb.0, 1
%cmp.not = icmp sgt i32 %mul, %0
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %nb.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main()
{
int n,i=2;
scanf("%d",&n);
while(i<=n){
i=i*2;
}
i=i/2;
printf("%d",i);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191927/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191927/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%i.0 = phi i32 [ 2, %entry ], [ %mul, %while.cond ]
%cmp.not = icmp sgt i32 %i.0, %0
%mul = shl nsw i32 %i.0, 1
br i1 %cmp.not, label %while.end, label %while.cond, !llvm.loop !9
while.end: ; preds = %while.cond
%div = lshr exact i32 %i.0, 1
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %div)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main (){
int n=0;
scanf("%d",&n);
int num=1;
int ans=0;
if(n>=64)ans=64;
else if(n>=32)ans=32;
else if(n>=16)ans=16;
else if(n>=8)ans=8;
else if(n>=4)ans=4;
else if(n>=2)ans=2;
else ans=1;
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_191970/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_191970/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
store i32 0, ptr %n, align 4, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp sgt i32 %0, 63
br i1 %cmp, label %if.end20, label %if.else
if.else: ; preds = %entry
%cmp1 = icmp sgt i32 %0, 31
br i1 %cmp1, label %if.end20, label %if.else3
if.else3: ; preds = %if.else
%cmp4 = icmp sgt i32 %0, 15
br i1 %cmp4, label %if.end20, label %if.else6
if.else6: ; preds = %if.else3
%cmp7 = icmp sgt i32 %0, 7
br i1 %cmp7, label %if.end20, label %if.else9
if.else9: ; preds = %if.else6
%cmp10 = icmp sgt i32 %0, 3
br i1 %cmp10, label %if.end20, label %if.else12
if.else12: ; preds = %if.else9
%cmp13 = icmp sgt i32 %0, 1
%. = select i1 %cmp13, i32 2, i32 1
br label %if.end20
if.end20: ; preds = %if.else12, %if.else9, %if.else6, %if.else3, %if.else, %entry
%ans.0 = phi i32 [ 64, %entry ], [ 32, %if.else ], [ 16, %if.else3 ], [ 8, %if.else6 ], [ 4, %if.else9 ], [ %., %if.else12 ]
%call21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
long long count=2,a[100005],h[100005],left,right,n,i;
scanf("%lld",&n);
for(i=0;i<n;i++)
scanf("%lld%lld",a+i,h+i);
left=a[0];
right=a[2];
for(i=1;i<n-1;i++)
{
if(left<a[i]-h[i])
{
count++;
left=a[i];
right=a[i+2];
}
else if(right>a[i]+h[i])
{
count++;
left=a[i]+h[i];
right=a[i+2];
}
else
{
left=a[i];
right=a[i+2];
}
}
if(n!=1)
printf("%lld",count);
else
printf("1");
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19202/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19202/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [9 x i8] c"%lld%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [100005 x i64], align 16
%h = alloca [100005 x i64], align 16
%n = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 800040, ptr nonnull %h) #4
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
%cmp58 = icmp sgt i64 %0, 0
br i1 %cmp58, label %for.body, label %if.then35
for.body: ; preds = %entry, %for.body
%i.059 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i64, ptr %a, i64 %i.059
%add.ptr2 = getelementptr inbounds i64, ptr %h, i64 %i.059
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr2)
%inc = add nuw nsw i64 %i.059, 1
%1 = load i64, ptr %n, align 8, !tbaa !5
%cmp = icmp slt i64 %inc, %1
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%cmp660 = icmp sgt i64 %1, 2
br i1 %cmp660, label %for.body7.preheader, label %for.end33
for.body7.preheader: ; preds = %for.end
%arrayidx4.phi.trans.insert = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 2
%.pre67 = load i64, ptr %arrayidx4.phi.trans.insert, align 16, !tbaa !5
%.pre = load i64, ptr %a, align 16, !tbaa !5
%2 = add i64 %1, -2
br label %for.body7
for.body7: ; preds = %for.body7.preheader, %for.inc31
%i.164 = phi i64 [ %inc32, %for.inc31 ], [ 1, %for.body7.preheader ]
%right.063 = phi i64 [ %right.1, %for.inc31 ], [ %.pre67, %for.body7.preheader ]
%left.062 = phi i64 [ %left.1, %for.inc31 ], [ %.pre, %for.body7.preheader ]
%count.061 = phi i64 [ %count.1, %for.inc31 ], [ 2, %for.body7.preheader ]
%arrayidx8 = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %i.164
%3 = load i64, ptr %arrayidx8, align 8, !tbaa !5
%arrayidx9 = getelementptr inbounds [100005 x i64], ptr %h, i64 0, i64 %i.164
%4 = load i64, ptr %arrayidx9, align 8, !tbaa !5
%sub10 = sub nsw i64 %3, %4
%cmp11 = icmp slt i64 %left.062, %sub10
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %for.body7
%inc12 = add nsw i64 %count.061, 1
br label %for.inc31
if.else: ; preds = %for.body7
%add17 = add nsw i64 %4, %3
%cmp18 = icmp sgt i64 %right.063, %add17
%inc20 = zext i1 %cmp18 to i64
%spec.select = add nsw i64 %count.061, %inc20
%spec.select75 = select i1 %cmp18, i64 %add17, i64 %3
br label %for.inc31
for.inc31: ; preds = %if.else, %if.then
%count.1 = phi i64 [ %inc12, %if.then ], [ %spec.select, %if.else ]
%left.1 = phi i64 [ %3, %if.then ], [ %spec.select75, %if.else ]
%add = add nuw nsw i64 %i.164, 2
%arrayidx14 = getelementptr inbounds [100005 x i64], ptr %a, i64 0, i64 %add
%right.1 = load i64, ptr %arrayidx14, align 8, !tbaa !5
%inc32 = add nuw nsw i64 %i.164, 1
%exitcond.not = icmp eq i64 %i.164, %2
br i1 %exitcond.not, label %for.end33, label %for.body7, !llvm.loop !11
for.end33: ; preds = %for.inc31, %for.end
%count.0.lcssa = phi i64 [ 2, %for.end ], [ %count.1, %for.inc31 ]
%cmp34.not = icmp eq i64 %1, 1
br i1 %cmp34.not, label %if.else37, label %if.then35
if.then35: ; preds = %entry, %for.end33
%count.0.lcssa74 = phi i64 [ %count.0.lcssa, %for.end33 ], [ 2, %entry ]
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %count.0.lcssa74)
br label %if.end39
if.else37: ; preds = %for.end33
%putchar = call i32 @putchar(i32 49)
br label %if.end39
if.end39: ; preds = %if.else37, %if.then35
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 800040, ptr nonnull %h) #4
call void @llvm.lifetime.end.p0(i64 800040, 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 @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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
int main()
{
int n;
scanf("%d", &n);
int i, count, tmp;
int count_max = -1;
int ans = 0;
for (i=1; i<=n; i++)
{
tmp = i;
count = 0;
while(tmp % 2 == 0)
{
tmp /= 2;
count ++;
}
if (count > count_max) {
count_max = count;
ans = i;
}
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192070/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192070/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not15 = icmp slt i32 %0, 1
br i1 %cmp.not15, label %for.end, label %while.cond.preheader
while.cond.preheader: ; preds = %entry, %while.end
%ans.018 = phi i32 [ %spec.select11, %while.end ], [ 0, %entry ]
%count_max.017 = phi i32 [ %spec.select, %while.end ], [ -1, %entry ]
%i.016 = phi i32 [ %inc3, %while.end ], [ 1, %entry ]
%1 = and i32 %i.016, 1
%cmp112 = icmp eq i32 %1, 0
br i1 %cmp112, label %while.body, label %while.end
while.body: ; preds = %while.cond.preheader, %while.body
%tmp.014 = phi i32 [ %div, %while.body ], [ %i.016, %while.cond.preheader ]
%count.013 = phi i32 [ %inc, %while.body ], [ 0, %while.cond.preheader ]
%div = sdiv i32 %tmp.014, 2
%inc = add nuw nsw i32 %count.013, 1
%2 = and i32 %div, 1
%cmp1 = icmp eq i32 %2, 0
br i1 %cmp1, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%count.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %inc, %while.body ]
%cmp2 = icmp sgt i32 %count.0.lcssa, %count_max.017
%spec.select = call i32 @llvm.smax.i32(i32 %count.0.lcssa, i32 %count_max.017)
%spec.select11 = select i1 %cmp2, i32 %i.016, i32 %ans.018
%inc3 = add nuw i32 %i.016, 1
%exitcond.not = icmp eq i32 %i.016, %0
br i1 %exitcond.not, label %for.end, label %while.cond.preheader, !llvm.loop !11
for.end: ; preds = %while.end, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %spec.select11, %while.end ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#include<math.h>
int main()
{
int a;
int i,j[101];
j[0]=1;
while (scanf("%d",&a)!=EOF)
{
int b=0;
for (i=1;i<=a;i++)
{
j[i]=pow(2,i);
if (j[i]>a)
{
b=j[i-1];
break;
}
}
printf("%d\n",b);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192120/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192120/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
%j = alloca [101 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 404, ptr nonnull %j) #4
store i32 1, ptr %j, align 16, !tbaa !5
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not21 = icmp eq i32 %call20, -1
br i1 %cmp.not21, label %while.end, label %for.cond.preheader
for.cond.preheader: ; preds = %entry, %for.end
%0 = load i32, ptr %a, align 4, !tbaa !5
%cmp1.not18 = icmp slt i32 %0, 1
br i1 %cmp1.not18, label %for.end, label %for.body
for.body: ; preds = %for.cond.preheader, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %for.cond.preheader ]
%1 = trunc i64 %indvars.iv to i32
%ldexp = call double @ldexp(double 1.000000e+00, i32 %1) #4
%conv3 = fptosi double %ldexp to i32
%arrayidx4 = getelementptr inbounds [101 x i32], ptr %j, i64 0, i64 %indvars.iv
store i32 %conv3, ptr %arrayidx4, align 4, !tbaa !5
%2 = load i32, ptr %a, align 4, !tbaa !5
%cmp7 = icmp slt i32 %2, %conv3
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %for.body
%sub = shl i64 %indvars.iv, 32
%sext = add i64 %sub, -4294967296
%idxprom9 = ashr exact i64 %sext, 32
%arrayidx10 = getelementptr inbounds [101 x i32], ptr %j, i64 0, i64 %idxprom9
%3 = load i32, ptr %arrayidx10, align 4, !tbaa !5
br label %for.end
for.inc: ; preds = %for.body
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = sext i32 %2 to i64
%cmp1.not.not = icmp slt i64 %indvars.iv, %4
br i1 %cmp1.not.not, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.inc, %for.cond.preheader, %if.then
%b.0 = phi i32 [ %3, %if.then ], [ 0, %for.cond.preheader ], [ 0, %for.inc ]
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %b.0)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%cmp.not = icmp eq i32 %call, -1
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !11
while.end: ; preds = %for.end, %entry
call void @llvm.lifetime.end.p0(i64 404, ptr nonnull %j) #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 willreturn
declare double @ldexp(double, i32) 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 willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
int main(void){
int n;
scanf("%d", &n);
if(n >= 64){
printf("64\n");
}else if(n >= 32){
printf("32\n");
}else if(n >= 16){
printf("16\n");
}else if(n >= 8){
printf("8\n");
}else if(n >= 4){
printf("4\n");
}else if(n >= 2){
printf("2\n");
}else{
printf("1\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192164/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192164/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
@str.8 = private unnamed_addr constant [2 x i8] c"2\00", align 1
@str.9 = private unnamed_addr constant [2 x i8] c"4\00", align 1
@str.10 = private unnamed_addr constant [2 x i8] c"8\00", align 1
@str.11 = private unnamed_addr constant [3 x i8] c"16\00", align 1
@str.12 = private unnamed_addr constant [3 x i8] c"32\00", align 1
@str.13 = private unnamed_addr constant [3 x i8] c"64\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 sgt i32 %0, 63
br i1 %cmp, label %if.end27, label %if.else
if.else: ; preds = %entry
%cmp2 = icmp sgt i32 %0, 31
br i1 %cmp2, label %if.end27, label %if.else5
if.else5: ; preds = %if.else
%cmp6 = icmp sgt i32 %0, 15
br i1 %cmp6, label %if.end27, label %if.else9
if.else9: ; preds = %if.else5
%cmp10 = icmp sgt i32 %0, 7
br i1 %cmp10, label %if.end27, label %if.else13
if.else13: ; preds = %if.else9
%cmp14 = icmp sgt i32 %0, 3
br i1 %cmp14, label %if.end27, label %if.else17
if.else17: ; preds = %if.else13
%cmp18 = icmp sgt i32 %0, 1
%str.8.str = select i1 %cmp18, ptr @str.8, ptr @str
br label %if.end27
if.end27: ; preds = %if.else17, %if.else13, %if.else9, %if.else5, %if.else, %entry
%str.12.sink = phi ptr [ @str.13, %entry ], [ @str.12, %if.else ], [ @str.11, %if.else5 ], [ @str.10, %if.else9 ], [ @str.9, %if.else13 ], [ %str.8.str, %if.else17 ]
%puts32 = call i32 @puts(ptr nonnull dereferenceable(1) %str.12.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() {
int n, i, ret=1, max=0;
scanf("%d", &n);
for (i=1; i<=n; i++) {
int tmp = i;
int cnt = 0;;
while (tmp % 2 == 0) {
cnt++;
tmp = tmp / 2;
}
if (cnt > max) {
ret = i;
max = cnt;
}
}
printf("%d\n", ret);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192207/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192207/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not15 = icmp slt i32 %0, 1
br i1 %cmp.not15, label %for.end, label %while.cond.preheader
while.cond.preheader: ; preds = %entry, %while.end
%max.018 = phi i32 [ %spec.select11, %while.end ], [ 0, %entry ]
%ret.017 = phi i32 [ %spec.select, %while.end ], [ 1, %entry ]
%i.016 = phi i32 [ %inc3, %while.end ], [ 1, %entry ]
%1 = and i32 %i.016, 1
%cmp112 = icmp eq i32 %1, 0
br i1 %cmp112, label %while.body, label %while.end
while.body: ; preds = %while.cond.preheader, %while.body
%cnt.014 = phi i32 [ %inc, %while.body ], [ 0, %while.cond.preheader ]
%tmp.013 = phi i32 [ %div, %while.body ], [ %i.016, %while.cond.preheader ]
%inc = add nuw nsw i32 %cnt.014, 1
%div = sdiv i32 %tmp.013, 2
%2 = and i32 %div, 1
%cmp1 = icmp eq i32 %2, 0
br i1 %cmp1, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %while.cond.preheader
%cnt.0.lcssa = phi i32 [ 0, %while.cond.preheader ], [ %inc, %while.body ]
%cmp2 = icmp sgt i32 %cnt.0.lcssa, %max.018
%spec.select = select i1 %cmp2, i32 %i.016, i32 %ret.017
%spec.select11 = call i32 @llvm.smax.i32(i32 %cnt.0.lcssa, i32 %max.018)
%inc3 = add nuw i32 %i.016, 1
%exitcond.not = icmp eq i32 %i.016, %0
br i1 %exitcond.not, label %for.end, label %while.cond.preheader, !llvm.loop !11
for.end: ; preds = %while.end, %entry
%ret.0.lcssa = phi i32 [ 1, %entry ], [ %spec.select, %while.end ]
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ret.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
return *(long int*)b - *(long int*)a; // 大きい順
}
// 公約数
long int gcd(long int a, long int b){
if(b == 0){
return a;
}else{
return gcd(b, a % b);
}
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long int lcm(long int a, long int b){
return a * b / gcd(a, b);
}
// min
int main(void){
int n;
long int t[101];
long int ans = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%ld", &t[i]);
}
// 大きい順に並び替える
qsort(t, n, sizeof(long int), compare_int);
ans = t[0];
for(int i = 1; i < n; i++){
if(ans > t[i]){
ans = ans / gcd(ans, t[i]) * t[i];
}else{
ans = t[i] / gcd(t[i], ans) * ans;
}
}
printf("%ld\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192250/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192250/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 @compare_int(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 norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @gcd(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%cmp4 = icmp eq i64 %b, 0
br i1 %cmp4, label %return, label %if.else
if.else: ; preds = %entry, %if.else
%b.tr6 = phi i64 [ %rem, %if.else ], [ %b, %entry ]
%a.tr5 = phi i64 [ %b.tr6, %if.else ], [ %a, %entry ]
%rem = srem i64 %a.tr5, %b.tr6
%cmp = icmp eq i64 %rem, 0
br i1 %cmp, label %return, label %if.else
return: ; preds = %if.else, %entry
%a.tr.lcssa = phi i64 [ %a, %entry ], [ %b.tr6, %if.else ]
ret i64 %a.tr.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(none) uwtable
define dso_local i64 @lcm(i64 noundef %a, i64 noundef %b) local_unnamed_addr #1 {
entry:
%cmp4.i = icmp eq i64 %b, 0
br i1 %cmp4.i, label %gcd.exit, label %if.else.i
if.else.i: ; preds = %entry, %if.else.i
%b.tr6.i = phi i64 [ %rem.i, %if.else.i ], [ %b, %entry ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.else.i ], [ %a, %entry ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.else.i
gcd.exit: ; preds = %if.else.i, %entry
%a.tr.lcssa.i = phi i64 [ %a, %entry ], [ %b.tr6.i, %if.else.i ]
%mul = mul nsw i64 %b, %a
%div = sdiv i64 %mul, %a.tr.lcssa.i
ret i64 %div
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%t = alloca [101 x i64], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 808, ptr nonnull %t) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !9
%cmp51 = icmp sgt i32 %0, 0
br i1 %cmp51, label %for.body, label %entry.for.cond.cleanup_crit_edge
entry.for.cond.cleanup_crit_edge: ; preds = %entry
%.pre = sext i32 %0 to i64
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry.for.cond.cleanup_crit_edge
%conv.pre-phi = phi i64 [ %.pre, %entry.for.cond.cleanup_crit_edge ], [ %4, %for.body ]
call void @qsort(ptr noundef nonnull %t, i64 noundef %conv.pre-phi, i64 noundef 8, ptr noundef nonnull @compare_int) #6
%1 = load i64, ptr %t, align 16, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !9
%cmp553 = icmp sgt i32 %2, 1
br i1 %cmp553, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond.cleanup
%wide.trip.count = zext i32 %2 to i64
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [101 x i64], ptr %t, 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 !9
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond.cleanup7: ; preds = %for.inc25, %for.cond.cleanup
%ans.0.lcssa = phi i64 [ %1, %for.cond.cleanup ], [ %ans.1, %for.inc25 ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 808, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body8: ; preds = %for.body8.preheader, %for.inc25
%indvars.iv59 = phi i64 [ 1, %for.body8.preheader ], [ %indvars.iv.next60, %for.inc25 ]
%ans.054 = phi i64 [ %1, %for.body8.preheader ], [ %ans.1, %for.inc25 ]
%arrayidx10 = getelementptr inbounds [101 x i64], ptr %t, i64 0, i64 %indvars.iv59
%5 = load i64, ptr %arrayidx10, align 8, !tbaa !5
%cmp11 = icmp sgt i64 %ans.054, %5
br i1 %cmp11, label %if.then, label %if.else
if.then: ; preds = %for.body8
%cmp4.i = icmp eq i64 %5, 0
br i1 %cmp4.i, label %gcd.exit, label %if.else.i
if.else.i: ; preds = %if.then, %if.else.i
%b.tr6.i = phi i64 [ %rem.i, %if.else.i ], [ %5, %if.then ]
%a.tr5.i = phi i64 [ %b.tr6.i, %if.else.i ], [ %ans.054, %if.then ]
%rem.i = srem i64 %a.tr5.i, %b.tr6.i
%cmp.i = icmp eq i64 %rem.i, 0
br i1 %cmp.i, label %gcd.exit, label %if.else.i
gcd.exit: ; preds = %if.else.i, %if.then
%a.tr.lcssa.i = phi i64 [ %ans.054, %if.then ], [ %b.tr6.i, %if.else.i ]
%div = sdiv i64 %ans.054, %a.tr.lcssa.i
%mul = mul nsw i64 %div, %5
br label %for.inc25
if.else: ; preds = %for.body8
%cmp4.i43 = icmp eq i64 %ans.054, 0
br i1 %cmp4.i43, label %gcd.exit50, label %if.else.i44
if.else.i44: ; preds = %if.else, %if.else.i44
%b.tr6.i45 = phi i64 [ %rem.i47, %if.else.i44 ], [ %ans.054, %if.else ]
%a.tr5.i46 = phi i64 [ %b.tr6.i45, %if.else.i44 ], [ %5, %if.else ]
%rem.i47 = srem i64 %a.tr5.i46, %b.tr6.i45
%cmp.i48 = icmp eq i64 %rem.i47, 0
br i1 %cmp.i48, label %gcd.exit50, label %if.else.i44
gcd.exit50: ; preds = %if.else.i44, %if.else
%a.tr.lcssa.i49 = phi i64 [ %5, %if.else ], [ %b.tr6.i45, %if.else.i44 ]
%div23 = sdiv i64 %5, %a.tr.lcssa.i49
%mul24 = mul nsw i64 %div23, %ans.054
br label %for.inc25
for.inc25: ; preds = %gcd.exit, %gcd.exit50
%ans.1 = phi i64 [ %mul, %gcd.exit ], [ %mul24, %gcd.exit50 ]
%indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
%exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup7, 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) #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
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 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 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree "no-trapping-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", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
|
#include<stdio.h>
int main()
{
int n,i,t;
long long max=1,m,k;
scanf("%d",&n);
long long s[n];
for(i=0;i<n;i++)
{
t=2;
m=max;
scanf("%lld",&s[i]);
if(m>=s[i])
{
while(max%s[i]!=0)max=m*t++;
}
else
{
max=s[i];
while(max%m!=0)max=s[i]*t++;
}
}
printf("%lld",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192300/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192300/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i64, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp43 = icmp sgt i32 %3, 0
br i1 %cmp43, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%indvars.iv52 = phi i64 [ %indvars.iv.next53, %for.inc ], [ 0, %entry ]
%max.044 = phi i64 [ %max.3, %for.inc ], [ 1, %entry ]
%arrayidx = getelementptr inbounds i64, ptr %vla, i64 %indvars.iv52
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx)
%4 = load i64, ptr %arrayidx, align 8, !tbaa !9
%cmp4.not = icmp slt i64 %max.044, %4
br i1 %cmp4.not, label %while.cond10.preheader, label %while.cond.preheader
while.cond.preheader: ; preds = %for.body
%rem36 = srem i64 %max.044, %4
%cmp7.not37 = icmp eq i64 %rem36, 0
br i1 %cmp7.not37, label %for.inc, label %while.body
while.cond10.preheader: ; preds = %for.body
%rem1139 = srem i64 %4, %max.044
%cmp12.not40 = icmp eq i64 %rem1139, 0
br i1 %cmp12.not40, label %for.inc, label %while.body14
while.body: ; preds = %while.cond.preheader, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 2, %while.cond.preheader ]
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%mul = mul nsw i64 %max.044, %indvars.iv
%rem = srem i64 %mul, %4
%cmp7.not = icmp eq i64 %rem, 0
br i1 %cmp7.not, label %for.inc, label %while.body, !llvm.loop !11
while.body14: ; preds = %while.cond10.preheader, %while.body14
%indvars.iv49 = phi i64 [ %indvars.iv.next50, %while.body14 ], [ 2, %while.cond10.preheader ]
%indvars.iv.next50 = add nuw i64 %indvars.iv49, 1
%mul19 = mul nsw i64 %4, %indvars.iv49
%rem11 = srem i64 %mul19, %max.044
%cmp12.not = icmp eq i64 %rem11, 0
br i1 %cmp12.not, label %for.inc, label %while.body14, !llvm.loop !13
for.inc: ; preds = %while.body, %while.body14, %while.cond.preheader, %while.cond10.preheader
%max.3 = phi i64 [ %4, %while.cond10.preheader ], [ %max.044, %while.cond.preheader ], [ %mul19, %while.body14 ], [ %mul, %while.body ]
%indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next53, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %for.inc, %entry
%max.0.lcssa = phi i64 [ 1, %entry ], [ %max.3, %for.inc ]
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %max.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!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>
long long aaa(long long, long long);
long long t[100] = {};
int main()
{
int n;
long long ans;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%lld", &t[i]);
}
ans = t[0];
for (int i = 0; i < n - 1; i++)
{
ans = aaa(ans, t[i + 1]);
}
printf("%lld", ans);
return 0;
}
long long aaa(long long x, long long y)
{
long long r, r1, x1, y1;
if (x < y)
{
x1 = y;
y1 = x;
}
else
{
x1 = x;
y1 = y;
}
r = x1 % y1;
while (r != 0)
{
x1 = y1;
y1 = r;
r = x1 % y1;
}
r1 = x * (y / y1);
return r1;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192344/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192344/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@t = dso_local global [100 x i64] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%lld\00", align 1
; Function Attrs: 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
%cmp19 = icmp sgt i32 %0, 0
br i1 %cmp19, label %for.body, label %for.cond.cleanup.thread
for.cond.cleanup.thread: ; preds = %entry
%1 = load i64, ptr @t, align 16, !tbaa !9
br label %for.cond.cleanup5
for.cond.cleanup: ; preds = %for.body
%2 = load i64, ptr @t, align 16, !tbaa !9
%cmp421 = icmp sgt i32 %3, 1
br i1 %cmp421, label %for.body6.preheader, label %for.cond.cleanup5
for.body6.preheader: ; preds = %for.cond.cleanup
%sub = add nsw i32 %3, -1
%wide.trip.count = zext i32 %sub to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i64], ptr @t, 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 = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.cond.cleanup5: ; preds = %aaa.exit, %for.cond.cleanup.thread, %for.cond.cleanup
%ans.0.lcssa = phi i64 [ %2, %for.cond.cleanup ], [ %1, %for.cond.cleanup.thread ], [ %mul.i, %aaa.exit ]
%call13 = 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 %n) #5
ret i32 0
for.body6: ; preds = %for.body6.preheader, %aaa.exit
%indvars.iv27 = phi i64 [ 0, %for.body6.preheader ], [ %indvars.iv.next28, %aaa.exit ]
%ans.022 = phi i64 [ %2, %for.body6.preheader ], [ %mul.i, %aaa.exit ]
%indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
%arrayidx8 = getelementptr inbounds [100 x i64], ptr @t, i64 0, i64 %indvars.iv.next28
%5 = load i64, ptr %arrayidx8, align 8, !tbaa !9
%y.x.i = call i64 @llvm.smax.i64(i64 %ans.022, i64 %5)
%x.y.i = call i64 @llvm.smin.i64(i64 %ans.022, i64 %5)
%rem.i = srem i64 %y.x.i, %x.y.i
%cmp1.not14.i = icmp eq i64 %rem.i, 0
br i1 %cmp1.not14.i, label %aaa.exit, label %while.body.i
while.body.i: ; preds = %for.body6, %while.body.i
%y1.116.i = phi i64 [ %r.015.i, %while.body.i ], [ %x.y.i, %for.body6 ]
%r.015.i = phi i64 [ %rem2.i, %while.body.i ], [ %rem.i, %for.body6 ]
%rem2.i = srem i64 %y1.116.i, %r.015.i
%cmp1.not.i = icmp eq i64 %rem2.i, 0
br i1 %cmp1.not.i, label %aaa.exit, label %while.body.i, !llvm.loop !13
aaa.exit: ; preds = %while.body.i, %for.body6
%y1.1.lcssa.i = phi i64 [ %x.y.i, %for.body6 ], [ %r.015.i, %while.body.i ]
%div.i = sdiv i64 %5, %y1.1.lcssa.i
%mul.i = mul nsw i64 %div.i, %ans.022
%exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !14
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(none) uwtable
define dso_local i64 @aaa(i64 noundef %x, i64 noundef %y) local_unnamed_addr #3 {
entry:
%y.x = tail call i64 @llvm.smax.i64(i64 %x, i64 %y)
%x.y = tail call i64 @llvm.smin.i64(i64 %x, i64 %y)
%rem = srem i64 %y.x, %x.y
%cmp1.not14 = icmp eq i64 %rem, 0
br i1 %cmp1.not14, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%y1.116 = phi i64 [ %r.015, %while.body ], [ %x.y, %entry ]
%r.015 = phi i64 [ %rem2, %while.body ], [ %rem, %entry ]
%rem2 = srem i64 %y1.116, %r.015
%cmp1.not = icmp eq i64 %rem2, 0
br i1 %cmp1.not, label %while.end, label %while.body, !llvm.loop !13
while.end: ; preds = %while.body, %entry
%y1.1.lcssa = phi i64 [ %x.y, %entry ], [ %r.015, %while.body ]
%div = sdiv i64 %y, %y1.1.lcssa
%mul = mul nsw i64 %div, %x
ret i64 %mul
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.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 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 = !{!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 <math.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))
double dp[1010][1010];
//dp[i][j]=現在地がiで最後に飛ばしたのがjで確定した距離
int x[1010],y[1010];
int main(){
int n;
scanf("%d",&n);
rep(i,0,n)scanf("%d%d",x+i,y+i);
dp[1][0]=hypot(x[1]-x[0],y[1]-y[0]);
rep(i,2,n+1){
rep(j,0,i-1)dp[i][j]=dp[i-1][j]+hypot(x[i]-x[i-1],y[i]-y[i-1]);
dp[i][i-1]=1e10;
rep(j,0,i-1)dp[i][i-1]=min(dp[i][i-1],dp[i-1][j]+hypot(x[i]-x[j],y[i]-y[j]));
}
double ans=1e10;
rep(j,0,n-1)ans=min(ans,dp[n-1][j]+hypot(x[n-1]-x[j],y[n-1]-y[j]));
printf("%.9f\n",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192388/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192388/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@x = dso_local global [1010 x i32] zeroinitializer, align 16
@y = dso_local global [1010 x i32] zeroinitializer, align 16
@dp = dso_local local_unnamed_addr global [1010 x [1010 x double]] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [6 x i8] c"%.9f\0A\00", align 1
; Function Attrs: 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
%cmp222 = icmp sgt i32 %0, 0
br i1 %cmp222, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body, %entry
%1 = load i32, ptr getelementptr inbounds ([1010 x i32], ptr @x, i64 0, i64 1), align 4, !tbaa !5
%2 = load i32, ptr @x, align 16, !tbaa !5
%sub = sub nsw i32 %1, %2
%conv = sitofp i32 %sub to double
%3 = load i32, ptr getelementptr inbounds ([1010 x i32], ptr @y, i64 0, i64 1), align 4, !tbaa !5
%4 = load i32, ptr @y, align 16, !tbaa !5
%sub4 = sub nsw i32 %3, %4
%conv5 = sitofp i32 %sub4 to double
%call6 = call double @hypot(double noundef %conv, double noundef %conv5) #4
store double %call6, ptr getelementptr inbounds ([1010 x [1010 x double]], ptr @dp, i64 0, i64 1), align 16, !tbaa !9
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp9.not228 = icmp slt i32 %5, 2
br i1 %cmp9.not228, label %for.cond.cleanup123, label %for.body18.lr.ph
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%add.ptr = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
%add.ptr2 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %add.ptr, ptr noundef nonnull %add.ptr2)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = load i32, ptr %n, align 4, !tbaa !5
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !11
for.body18.lr.ph: ; preds = %for.cond.cleanup, %for.cond.cleanup55
%indvars.iv248 = phi i64 [ %indvars.iv.next249, %for.cond.cleanup55 ], [ 2, %for.cond.cleanup ]
%indvars.iv246 = phi i64 [ %indvars.iv.next247, %for.cond.cleanup55 ], [ 1, %for.cond.cleanup ]
%8 = add nsw i64 %indvars.iv248, -1
%arrayidx23 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %indvars.iv248
%arrayidx26 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %8
%arrayidx30 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %indvars.iv248
%arrayidx33 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %8
br label %for.body18
for.cond119.preheader: ; preds = %for.cond.cleanup55
%cmp121231 = icmp sgt i32 %14, 1
br i1 %cmp121231, label %for.body124.preheader, label %for.cond.cleanup123
for.body124.preheader: ; preds = %for.cond119.preheader
%sub120230 = add nsw i32 %14, -1
br label %for.body124
for.body56.lr.ph: ; preds = %for.body18
%arrayidx49 = getelementptr inbounds [1010 x [1010 x double]], ptr @dp, i64 0, i64 %indvars.iv248, i64 %8
store double 1.000000e+10, ptr %arrayidx49, align 8, !tbaa !9
%arrayidx68 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %indvars.iv248
%arrayidx74 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %indvars.iv248
br label %for.body56
for.body18: ; preds = %for.body18.lr.ph, %for.body18
%indvars.iv236 = phi i64 [ 0, %for.body18.lr.ph ], [ %indvars.iv.next237, %for.body18 ]
%arrayidx21 = getelementptr inbounds [1010 x [1010 x double]], ptr @dp, i64 0, i64 %8, i64 %indvars.iv236
%9 = load double, ptr %arrayidx21, align 8, !tbaa !9
%10 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%11 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%sub27 = sub nsw i32 %10, %11
%conv28 = sitofp i32 %sub27 to double
%12 = load i32, ptr %arrayidx30, align 4, !tbaa !5
%13 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%sub34 = sub nsw i32 %12, %13
%conv35 = sitofp i32 %sub34 to double
%call36 = call double @hypot(double noundef %conv28, double noundef %conv35) #4
%add37 = fadd double %9, %call36
%arrayidx41 = getelementptr inbounds [1010 x [1010 x double]], ptr @dp, i64 0, i64 %indvars.iv248, i64 %indvars.iv236
store double %add37, ptr %arrayidx41, align 8, !tbaa !9
%indvars.iv.next237 = add nuw nsw i64 %indvars.iv236, 1
%exitcond.not = icmp eq i64 %indvars.iv.next237, %indvars.iv246
br i1 %exitcond.not, label %for.body56.lr.ph, label %for.body18, !llvm.loop !13
for.cond.cleanup55: ; preds = %cond.end
%indvars.iv.next249 = add nuw nsw i64 %indvars.iv248, 1
%14 = load i32, ptr %n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp9.not.not = icmp slt i64 %indvars.iv248, %15
%indvars.iv.next247 = add nuw nsw i64 %indvars.iv246, 1
br i1 %cmp9.not.not, label %for.body18.lr.ph, label %for.cond119.preheader, !llvm.loop !14
for.body56: ; preds = %for.body56.lr.ph, %cond.end
%16 = phi double [ 1.000000e+10, %for.body56.lr.ph ], [ %cond, %cond.end ]
%indvars.iv241 = phi i64 [ 0, %for.body56.lr.ph ], [ %indvars.iv.next242, %cond.end ]
%arrayidx66 = getelementptr inbounds [1010 x [1010 x double]], ptr @dp, i64 0, i64 %8, i64 %indvars.iv241
%17 = load double, ptr %arrayidx66, align 8, !tbaa !9
%18 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%arrayidx70 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %indvars.iv241
%19 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%sub71 = sub nsw i32 %18, %19
%conv72 = sitofp i32 %sub71 to double
%20 = load i32, ptr %arrayidx74, align 4, !tbaa !5
%arrayidx76 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %indvars.iv241
%21 = load i32, ptr %arrayidx76, align 4, !tbaa !5
%sub77 = sub nsw i32 %20, %21
%conv78 = sitofp i32 %sub77 to double
%call79 = call double @hypot(double noundef %conv72, double noundef %conv78) #4
%add80 = fadd double %17, %call79
%cmp81 = fcmp olt double %16, %add80
br i1 %cmp81, label %cond.true, label %cond.false
cond.true: ; preds = %for.body56
%22 = load double, ptr %arrayidx49, align 8, !tbaa !9
br label %cond.end
cond.false: ; preds = %for.body56
%23 = load double, ptr %arrayidx66, align 8, !tbaa !9
%24 = load i32, ptr %arrayidx68, align 4, !tbaa !5
%25 = load i32, ptr %arrayidx70, align 4, !tbaa !5
%sub97 = sub nsw i32 %24, %25
%conv98 = sitofp i32 %sub97 to double
%26 = load i32, ptr %arrayidx74, align 4, !tbaa !5
%27 = load i32, ptr %arrayidx76, align 4, !tbaa !5
%sub103 = sub nsw i32 %26, %27
%conv104 = sitofp i32 %sub103 to double
%call105 = call double @hypot(double noundef %conv98, double noundef %conv104) #4
%add106 = fadd double %23, %call105
br label %cond.end
cond.end: ; preds = %cond.false, %cond.true
%cond = phi double [ %22, %cond.true ], [ %add106, %cond.false ]
store double %cond, ptr %arrayidx49, align 8, !tbaa !9
%indvars.iv.next242 = add nuw nsw i64 %indvars.iv241, 1
%exitcond245.not = icmp eq i64 %indvars.iv.next242, %indvars.iv246
br i1 %exitcond245.not, label %for.cond.cleanup55, label %for.body56, !llvm.loop !15
for.cond.cleanup123: ; preds = %cond.end171, %for.cond.cleanup, %for.cond119.preheader
%ans.0.lcssa = phi double [ 1.000000e+10, %for.cond119.preheader ], [ 1.000000e+10, %for.cond.cleanup ], [ %cond172, %cond.end171 ]
%call176 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
for.body124: ; preds = %for.body124.preheader, %cond.end171
%indvars.iv254 = phi i64 [ 0, %for.body124.preheader ], [ %indvars.iv.next255, %cond.end171 ]
%sub120234 = phi i32 [ %sub120230, %for.body124.preheader ], [ %sub120, %cond.end171 ]
%ans.0232 = phi double [ 1.000000e+10, %for.body124.preheader ], [ %cond172, %cond.end171 ]
%idxprom126 = sext i32 %sub120234 to i64
%arrayidx129 = getelementptr inbounds [1010 x [1010 x double]], ptr @dp, i64 0, i64 %idxprom126, i64 %indvars.iv254
%28 = load double, ptr %arrayidx129, align 8, !tbaa !9
%arrayidx132 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %idxprom126
%29 = load i32, ptr %arrayidx132, align 4, !tbaa !5
%arrayidx134 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %indvars.iv254
%30 = load i32, ptr %arrayidx134, align 4, !tbaa !5
%sub135 = sub nsw i32 %29, %30
%conv136 = sitofp i32 %sub135 to double
%arrayidx139 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %idxprom126
%31 = load i32, ptr %arrayidx139, align 4, !tbaa !5
%arrayidx141 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %indvars.iv254
%32 = load i32, ptr %arrayidx141, align 4, !tbaa !5
%sub142 = sub nsw i32 %31, %32
%conv143 = sitofp i32 %sub142 to double
%call144 = call double @hypot(double noundef %conv136, double noundef %conv143) #4
%add145 = fadd double %28, %call144
%cmp146 = fcmp olt double %ans.0232, %add145
br i1 %cmp146, label %cond.end171, label %cond.false149
cond.false149: ; preds = %for.body124
%33 = load i32, ptr %n, align 4, !tbaa !5
%sub150 = add nsw i32 %33, -1
%idxprom151 = sext i32 %sub150 to i64
%arrayidx154 = getelementptr inbounds [1010 x [1010 x double]], ptr @dp, i64 0, i64 %idxprom151, i64 %indvars.iv254
%34 = load double, ptr %arrayidx154, align 8, !tbaa !9
%arrayidx157 = getelementptr inbounds [1010 x i32], ptr @x, i64 0, i64 %idxprom151
%35 = load i32, ptr %arrayidx157, align 4, !tbaa !5
%36 = load i32, ptr %arrayidx134, align 4, !tbaa !5
%sub160 = sub nsw i32 %35, %36
%conv161 = sitofp i32 %sub160 to double
%arrayidx164 = getelementptr inbounds [1010 x i32], ptr @y, i64 0, i64 %idxprom151
%37 = load i32, ptr %arrayidx164, align 4, !tbaa !5
%38 = load i32, ptr %arrayidx141, align 4, !tbaa !5
%sub167 = sub nsw i32 %37, %38
%conv168 = sitofp i32 %sub167 to double
%call169 = call double @hypot(double noundef %conv161, double noundef %conv168) #4
%add170 = fadd double %34, %call169
br label %cond.end171
cond.end171: ; preds = %for.body124, %cond.false149
%cond172 = phi double [ %add170, %cond.false149 ], [ %ans.0232, %for.body124 ]
%indvars.iv.next255 = add nuw nsw i64 %indvars.iv254, 1
%39 = load i32, ptr %n, align 4, !tbaa !5
%sub120 = add nsw i32 %39, -1
%40 = sext i32 %sub120 to i64
%cmp121 = icmp slt i64 %indvars.iv.next255, %40
br i1 %cmp121, label %for.body124, label %for.cond.cleanup123, !llvm.loop !16
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: 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: nounwind
declare double @hypot(double noundef, double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
|
#include<stdio.h>
#include<string.h>
int main() {
char s[51];
scanf("%s", s);
s[strlen(s) - 8] = '\0';
printf("%s\n", s);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192430/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192430/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 [51 x i8], align 16
call void @llvm.lifetime.start.p0(i64 51, 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
%sub = add i64 %call2, -8
%arrayidx = getelementptr inbounds [51 x i8], ptr %s, i64 0, i64 %sub
store i8 0, ptr %arrayidx, align 1, !tbaa !5
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %s)
call void @llvm.lifetime.end.p0(i64 51, 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 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
#include<string.h>
int main(void) {
int n, x, y, c;
scanf("%d", &n);
c = n / 15;
x = n * 800;
y = c * 200;
printf("%d", x - y);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192474/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192474/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %0, 15
%mul = mul nsw i32 %0, 800
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int N,x,y,b,ans;
scanf("%d",&N);
b=N/15;
ans=800*N-b*200;
printf("%d",ans);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192524/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192524/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%div = sdiv i32 %0, 15
%mul = mul nsw i32 %0, 800
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
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, gasto, saldo;
scanf("%d", &n);
gasto = n*800;
if (n < 15)
printf("%d\n", gasto);
else{
saldo = (n / 15) * 200;
printf("%d\n", gasto - saldo);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192568/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192568/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%cmp = icmp slt i32 %0, 15
br i1 %cmp, label %if.end, label %if.else
if.else: ; preds = %entry
%div = udiv i32 %0, 15
%mul2.neg = mul i32 %div, -200
%sub = add i32 %mul2.neg, %mul
br label %if.end
if.end: ; preds = %entry, %if.else
%sub.sink = phi i32 [ %sub, %if.else ], [ %mul, %entry ]
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub.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(void)
{
int n;
scanf("%d", &n);
printf("%d", 800*n-(n-n%15)/15*200);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192610/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192610/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub2 = add i32 %mul1.neg, %mul
%call3 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include<math.h>
int main()
{
long long int a=0,b=0,w=0,flag,i,str1=0,str2=0;
scanf("%lld",&w);
printf("%lld",(800*w)-((w/15)*200));
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192654/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192654/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%w = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %w) #3
store i64 0, ptr %w, align 8, !tbaa !5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %w)
%0 = load i64, ptr %w, align 8, !tbaa !5
%mul = mul nsw i64 %0, 800
%div = sdiv i64 %0, 15
%mul1.neg = mul i64 %div, -200
%sub = add i64 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %sub)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %w) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int N;
int x, y;
scanf("%d", &N);
x = N * 800;
y = N / 15 * 200;
printf("%d\n", x-y);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192698/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192698/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %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(void)
{
int amo,x,y;
scanf("%d", &amo);
x = 800 * amo;
y = 200 * (amo / 15);
printf("%d", x - y);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192740/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192740/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%amo = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %amo) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %amo)
%0 = load i32, ptr %amo, align 4, !tbaa !5
%mul = mul nsw i32 %0, 800
%div = sdiv i32 %0, 15
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %amo) #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>
#define A 800
int main(){
int n;
scanf("%d",&n);
int a = n/15;
n = (n*A)-(a*200);
printf("%d",n);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192784/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192784/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%div = sdiv i32 %0, 15
%mul = mul nsw i32 %0, 800
%mul1.neg = mul i32 %div, -200
%sub = add i32 %mul1.neg, %mul
store i32 %sub, ptr %n, align 4, !tbaa !5
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %sub)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
#include <string.h>
#define MAX 1001
int main(void) {
int n,i,j,k,pt,tp;
char c,charA[MAX],t[8];
scanf("%d\n",&n);
for (i=0;i<n;i++) {
pt = 0;
while ((c = fgetc(stdin))!='\n') {
charA[pt++] = c;
}
charA[pt] = '\0';
for (j=0;j<pt;j++) {
if (charA[j]=='H') {
for (k=j;k<=j+6;k++) {
t[k-j] = charA[k];
}
t[7] = '\0';
if (!strcmp(t,"Hoshino")) {
charA[j+6] = 'a';
j += 5;
}
}
}
printf("%s\n",charA);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192827/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192827/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@.str.1 = private unnamed_addr constant [8 x i8] c"Hoshino\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%charA = alloca [1001 x i8], align 16
%t = alloca [8 x i8], align 1
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 1001, ptr nonnull %charA) #6
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %t) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp62 = icmp sgt i32 %0, 0
br i1 %cmp62, label %while.cond.preheader.lr.ph, label %for.end40
while.cond.preheader.lr.ph: ; preds = %entry
%arrayidx25 = getelementptr inbounds [8 x i8], ptr %t, i64 0, i64 7
br label %while.cond.preheader
while.cond.preheader: ; preds = %while.cond.preheader.lr.ph, %for.end35
%i.063 = phi i32 [ 0, %while.cond.preheader.lr.ph ], [ %inc39, %for.end35 ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call154 = call i32 @fgetc(ptr noundef %1)
%sext.mask55 = and i32 %call154, 255
%cmp3.not56 = icmp eq i32 %sext.mask55, 10
br i1 %cmp3.not56, label %while.end.thread, label %while.body
while.end.thread: ; preds = %while.cond.preheader
store i8 0, ptr %charA, align 16, !tbaa !11
br label %for.end35
while.body: ; preds = %while.cond.preheader, %while.body
%indvars.iv = phi i64 [ %indvars.iv.next, %while.body ], [ 0, %while.cond.preheader ]
%call158 = phi i32 [ %call1, %while.body ], [ %call154, %while.cond.preheader ]
%conv = trunc i32 %call158 to i8
%indvars.iv.next = add nuw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [1001 x i8], ptr %charA, i64 0, i64 %indvars.iv
store i8 %conv, ptr %arrayidx, align 1, !tbaa !11
%2 = load ptr, ptr @stdin, align 8, !tbaa !9
%call1 = call i32 @fgetc(ptr noundef %2)
%sext.mask = and i32 %call1, 255
%cmp3.not = icmp eq i32 %sext.mask, 10
br i1 %cmp3.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body
%3 = trunc i64 %indvars.iv.next to i32
%idxprom5 = and i64 %indvars.iv.next, 4294967295
%arrayidx6 = getelementptr inbounds [1001 x i8], ptr %charA, i64 0, i64 %idxprom5
store i8 0, ptr %arrayidx6, align 1, !tbaa !11
%cmp860 = icmp sgt i32 %3, 0
br i1 %cmp860, label %for.body10, label %for.end35
for.body10: ; preds = %while.end, %for.inc33
%j.061 = phi i32 [ %inc34, %for.inc33 ], [ 0, %while.end ]
%idxprom11 = sext i32 %j.061 to i64
%arrayidx12 = getelementptr [1001 x i8], ptr %charA, i64 0, i64 %idxprom11
%4 = load i8, ptr %arrayidx12, align 1, !tbaa !11
%cmp14 = icmp eq i8 %4, 72
br i1 %cmp14, label %for.cond16.preheader, label %for.inc33
for.cond16.preheader: ; preds = %for.body10
call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(7) %t, ptr noundef nonnull align 1 dereferenceable(7) %arrayidx12, i64 7, i1 false), !tbaa !11
store i8 0, ptr %arrayidx25, align 1, !tbaa !11
%bcmp = call i32 @bcmp(ptr noundef nonnull dereferenceable(8) %t, ptr noundef nonnull dereferenceable(8) @.str.1, i64 8)
%tobool.not = icmp eq i32 %bcmp, 0
br i1 %tobool.not, label %if.then27, label %for.inc33
if.then27: ; preds = %for.cond16.preheader
%add = add nsw i32 %j.061, 6
%idxprom29 = sext i32 %add to i64
%arrayidx30 = getelementptr inbounds [1001 x i8], ptr %charA, i64 0, i64 %idxprom29
store i8 97, ptr %arrayidx30, align 1, !tbaa !11
%add31 = add nsw i32 %j.061, 5
br label %for.inc33
for.inc33: ; preds = %for.body10, %if.then27, %for.cond16.preheader
%j.1 = phi i32 [ %j.061, %for.cond16.preheader ], [ %add31, %if.then27 ], [ %j.061, %for.body10 ]
%inc34 = add nsw i32 %j.1, 1
%cmp8 = icmp slt i32 %inc34, %3
br i1 %cmp8, label %for.body10, label %for.end35, !llvm.loop !14
for.end35: ; preds = %for.inc33, %while.end.thread, %while.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %charA)
%inc39 = add nuw nsw i32 %i.063, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc39, %5
br i1 %cmp, label %while.cond.preheader, label %for.end40, !llvm.loop !15
for.end40: ; preds = %for.end35, %entry
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %t) #6
call void @llvm.lifetime.end.p0(i64 1001, ptr nonnull %charA) #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: nofree nounwind
declare noundef i32 @fgetc(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nofree nounwind willreturn memory(argmem: read) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
|
#include<stdio.h>
#include<string.h>
int main(){
char str[1002],ho[]="Hoshino";
int n,i;
char *a;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
fgets(str,sizeof(str),stdin);
while((a=strstr(str,ho)) != NULL)
{
a[6] = 'a';
}
printf("%s",str);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_192885/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_192885/source.c"
target datalayout = "e-m:e-p270: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.ho = private unnamed_addr constant [8 x i8] c"Hoshino\00", align 1
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%str = alloca [1002 x i8], align 16
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 1002, ptr nonnull %str) #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
%cmp12 = icmp sgt i32 %0, 0
br i1 %cmp12, label %for.body, label %for.end
for.body: ; preds = %entry, %while.end
%i.013 = phi i32 [ %inc, %while.end ], [ 0, %entry ]
%1 = load ptr, ptr @stdin, align 8, !tbaa !9
%call1 = call ptr @fgets(ptr noundef nonnull %str, i32 noundef 1002, ptr noundef %1)
%call49 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @__const.main.ho) #5
%cmp5.not10 = icmp eq ptr %call49, null
br i1 %cmp5.not10, label %while.end, label %while.body
while.body: ; preds = %for.body, %while.body
%call411 = phi ptr [ %call4, %while.body ], [ %call49, %for.body ]
%arrayidx = getelementptr inbounds i8, ptr %call411, i64 6
store i8 97, ptr %arrayidx, align 1, !tbaa !11
%call4 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %str, ptr noundef nonnull dereferenceable(1) @__const.main.ho) #5
%cmp5.not = icmp eq ptr %call4, null
br i1 %cmp5.not, label %while.end, label %while.body, !llvm.loop !12
while.end: ; preds = %while.body, %for.body
%call7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %str)
%inc = add nuw nsw i32 %i.013, 1
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc, %2
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !14
for.end: ; preds = %while.end, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 1002, ptr nonnull %str) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 ptr @strstr(ptr noundef, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
|
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define gc getchar
#define pc putchar
#define MOD 1000000007
typedef long long ll;
ll scan()
{
ll n = 0;
ll ch = gc();
ll sign = 1;
while(ch < '0' || ch > '9')
{
if(ch == '-')
sign = -1;
ch = gc();
}
while(ch >= '0' && ch <= '9')
n = (n << 3) + (n << 1) + ch - '0', ch = gc();
n = n * sign;
return n;
}
void writeInt (ll n)
{
ll N = n, rev, count = 0;
rev = N;
if(N < 0)
{
N = -N;
pc('-');
}
if (N == 0) { pc('0'); pc('\n'); return ;}
while ((rev % 10) == 0) { count++; rev /= 10;}
rev = 0;
while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
while (rev != 0) { pc(rev % 10 + '0'); rev /= 10;}
while (count--) pc('0');
}
ll ar1[100001], ar2[100001], dff[100001], ans[100001];
char ar[100001];
int main()
{
ll n, i, cnt = 0;
scanf("%s", ar);
n = strlen(ar);
for(i = 0; i < n; i++)
ar1[i] = ar[i] - 48;
scanf("%s", ar);
for(i = 0; i < n; i++)
ar2[i] = ar[i] - 48;
//writeInt(ar1[0]);
//writeInt(ar1[1]);
for(i = 0; i < n; i++)
if(ar1[i] != ar2[i])
dff[i] = 1;
for(i = 0; i < n; i++)
if(dff[i] == 1)
cnt += 1;
if(cnt % 2 == 1)
{
printf("impossible\n");
return 0;
}/*
if(cnt == 0 && n%2 == 1)
{
printf("impossible\n");
return 0;
}*/
for(i = 0; i < n; i++)
{
if(dff[i] == 0)
ans[i] = ar1[i];
else
{
if(cnt%2 == 0)
{
ans[i] = ar1[i];
cnt -= 1;
}
else
{
ans[i] = ar2[i];
cnt -= 1;
}
}
}
for(i = 0; i < n; i++)
printf("%i", ans[i]);
pc('\n');
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19295/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19295/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@ar = dso_local global [100001 x i8] zeroinitializer, align 16
@ar1 = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@ar2 = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@dff = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@ans = dso_local local_unnamed_addr global [100001 x i64] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [3 x i8] c"%i\00", align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@str = private unnamed_addr constant [11 x i8] c"impossible\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i64 @scan() local_unnamed_addr #0 {
entry:
%0 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i = tail call i32 @getc(ptr noundef %0)
%1 = add i32 %call.i, -58
%2 = icmp ult i32 %1, -10
br i1 %2, label %while.body, label %while.cond8.preheader
while.cond8.preheader: ; preds = %while.body, %entry
%ch.0.in.lcssa = phi i32 [ %call.i, %entry ], [ %call.i27, %while.body ]
%sign.0.lcssa = phi i64 [ 1, %entry ], [ %spec.select, %while.body ]
%ch.132 = zext i32 %ch.0.in.lcssa to i64
br label %while.body13
while.body: ; preds = %entry, %while.body
%sign.030 = phi i64 [ %spec.select, %while.body ], [ 1, %entry ]
%ch.0.in29 = phi i32 [ %call.i27, %while.body ], [ %call.i, %entry ]
%cmp4 = icmp eq i32 %ch.0.in29, 45
%spec.select = select i1 %cmp4, i64 -1, i64 %sign.030
%3 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i27 = tail call i32 @getc(ptr noundef %3)
%4 = add i32 %call.i27, -58
%5 = icmp ult i32 %4, -10
br i1 %5, label %while.body, label %while.cond8.preheader, !llvm.loop !9
while.body13: ; preds = %while.cond8.preheader, %while.body13
%ch.134 = phi i64 [ %ch.1, %while.body13 ], [ %ch.132, %while.cond8.preheader ]
%n.033 = phi i64 [ %sub, %while.body13 ], [ 0, %while.cond8.preheader ]
%add = mul i64 %n.033, 10
%add15 = add i64 %add, -48
%sub = add i64 %add15, %ch.134
%6 = load ptr, ptr @stdin, align 8, !tbaa !5
%call.i28 = tail call i32 @getc(ptr noundef %6)
%ch.1 = sext i32 %call.i28 to i64
%7 = add nsw i64 %ch.1, -48
%8 = icmp ult i64 %7, 10
br i1 %8, label %while.body13, label %while.end18, !llvm.loop !11
while.end18: ; preds = %while.body13
%mul = mul nsw i64 %sub, %sign.0.lcssa
ret i64 %mul
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @writeInt(i64 noundef %n) local_unnamed_addr #0 {
entry:
%cmp = icmp slt i64 %n, 0
br i1 %cmp, label %if.end.thread, label %if.end
if.end.thread: ; preds = %entry
%sub = sub nsw i64 0, %n
%0 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = tail call i32 @putc(i32 noundef 45, ptr noundef %0)
br label %while.cond.preheader
if.end: ; preds = %entry
%cmp1 = icmp eq i64 %n, 0
br i1 %cmp1, label %if.then2, label %while.cond.preheader
while.cond.preheader: ; preds = %if.end.thread, %if.end
%N.058 = phi i64 [ %sub, %if.end.thread ], [ %n, %if.end ]
%rem46 = srem i64 %n, 10
%cmp647 = icmp eq i64 %rem46, 0
br i1 %cmp647, label %while.body, label %while.cond7.preheader
if.then2: ; preds = %if.end
%1 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i42 = tail call i32 @putc(i32 noundef 48, ptr noundef %1)
%2 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i43 = tail call i32 @putc(i32 noundef 10, ptr noundef %2)
br label %cleanup
while.cond7.preheader: ; preds = %while.body, %while.cond.preheader
%count.0.lcssa = phi i64 [ 0, %while.cond.preheader ], [ %inc, %while.body ]
br label %while.body9
while.body: ; preds = %while.cond.preheader, %while.body
%count.049 = phi i64 [ %inc, %while.body ], [ 0, %while.cond.preheader ]
%rev.048 = phi i64 [ %div, %while.body ], [ %n, %while.cond.preheader ]
%inc = add nuw nsw i64 %count.049, 1
%div = sdiv i64 %rev.048, 10
%rem = srem i64 %div, 10
%cmp6 = icmp eq i64 %rem, 0
br i1 %cmp6, label %while.body, label %while.cond7.preheader, !llvm.loop !12
while.cond15.preheader: ; preds = %while.body9
%cmp16.not52 = icmp eq i64 %add12, 0
br i1 %cmp16.not52, label %while.cond23.preheader, label %while.body17
while.body9: ; preds = %while.cond7.preheader, %while.body9
%rev.151 = phi i64 [ 0, %while.cond7.preheader ], [ %add12, %while.body9 ]
%N.150 = phi i64 [ %N.058, %while.cond7.preheader ], [ %div13, %while.body9 ]
%add = mul i64 %rev.151, 10
%rem11 = srem i64 %N.150, 10
%add12 = add nsw i64 %add, %rem11
%div13 = sdiv i64 %N.150, 10
%N.150.off = add i64 %N.150, 9
%cmp8.not = icmp ult i64 %N.150.off, 19
br i1 %cmp8.not, label %while.cond15.preheader, label %while.body9, !llvm.loop !13
while.cond23.preheader: ; preds = %while.body17, %while.cond15.preheader
%tobool.not54 = icmp eq i64 %count.0.lcssa, 0
br i1 %tobool.not54, label %cleanup, label %while.body24
while.body17: ; preds = %while.cond15.preheader, %while.body17
%rev.253 = phi i64 [ %div21, %while.body17 ], [ %add12, %while.cond15.preheader ]
%rem18 = srem i64 %rev.253, 10
%3 = trunc i64 %rem18 to i32
%conv = add nsw i32 %3, 48
%4 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i44 = tail call i32 @putc(i32 noundef %conv, ptr noundef %4)
%div21 = sdiv i64 %rev.253, 10
%rev.253.off = add i64 %rev.253, 9
%cmp16.not = icmp ult i64 %rev.253.off, 19
br i1 %cmp16.not, label %while.cond23.preheader, label %while.body17, !llvm.loop !14
while.body24: ; preds = %while.cond23.preheader, %while.body24
%count.155 = phi i64 [ %dec, %while.body24 ], [ %count.0.lcssa, %while.cond23.preheader ]
%dec = add nsw i64 %count.155, -1
%5 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i45 = tail call i32 @putc(i32 noundef 48, ptr noundef %5)
%tobool.not = icmp eq i64 %dec, 0
br i1 %tobool.not, label %cleanup, label %while.body24, !llvm.loop !15
cleanup: ; preds = %while.body24, %while.cond23.preheader, %if.then2
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @ar)
%call1 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @ar) #5
%cmp120 = icmp sgt i64 %call1, 0
br i1 %cmp120, label %for.body.preheader, label %for.end.thread
for.body.preheader: ; preds = %entry
%xtraiter = and i64 %call1, 3
%0 = icmp ult i64 %call1, 4
br i1 %0, label %for.end.unr-lcssa, label %for.body.preheader.new
for.body.preheader.new: ; preds = %for.body.preheader
%unroll_iter = and i64 %call1, -4
br label %for.body
for.end.thread: ; preds = %entry
%call4139 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @ar)
br label %for.end80
for.body: ; preds = %for.body, %for.body.preheader.new
%i.0121 = phi i64 [ 0, %for.body.preheader.new ], [ %inc.3, %for.body ]
%niter = phi i64 [ 0, %for.body.preheader.new ], [ %niter.next.3, %for.body ]
%arrayidx = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %i.0121
%1 = load i8, ptr %arrayidx, align 4, !tbaa !16
%conv = sext i8 %1 to i64
%sub = add nsw i64 %conv, -48
%arrayidx3 = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %i.0121
store i64 %sub, ptr %arrayidx3, align 16, !tbaa !17
%inc = or i64 %i.0121, 1
%arrayidx.1 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %inc
%2 = load i8, ptr %arrayidx.1, align 1, !tbaa !16
%conv.1 = sext i8 %2 to i64
%sub.1 = add nsw i64 %conv.1, -48
%arrayidx3.1 = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %inc
store i64 %sub.1, ptr %arrayidx3.1, align 8, !tbaa !17
%inc.1 = or i64 %i.0121, 2
%arrayidx.2 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %inc.1
%3 = load i8, ptr %arrayidx.2, align 2, !tbaa !16
%conv.2 = sext i8 %3 to i64
%sub.2 = add nsw i64 %conv.2, -48
%arrayidx3.2 = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %inc.1
store i64 %sub.2, ptr %arrayidx3.2, align 16, !tbaa !17
%inc.2 = or i64 %i.0121, 3
%arrayidx.3 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %inc.2
%4 = load i8, ptr %arrayidx.3, align 1, !tbaa !16
%conv.3 = sext i8 %4 to i64
%sub.3 = add nsw i64 %conv.3, -48
%arrayidx3.3 = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %inc.2
store i64 %sub.3, ptr %arrayidx3.3, align 8, !tbaa !17
%inc.3 = add nuw nsw i64 %i.0121, 4
%niter.next.3 = add i64 %niter, 4
%niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
br i1 %niter.ncmp.3, label %for.end.unr-lcssa, label %for.body, !llvm.loop !19
for.end.unr-lcssa: ; preds = %for.body, %for.body.preheader
%i.0121.unr = phi i64 [ 0, %for.body.preheader ], [ %inc.3, %for.body ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.end, label %for.body.epil
for.body.epil: ; preds = %for.end.unr-lcssa, %for.body.epil
%i.0121.epil = phi i64 [ %inc.epil, %for.body.epil ], [ %i.0121.unr, %for.end.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.epil ], [ 0, %for.end.unr-lcssa ]
%arrayidx.epil = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %i.0121.epil
%5 = load i8, ptr %arrayidx.epil, align 1, !tbaa !16
%conv.epil = sext i8 %5 to i64
%sub.epil = add nsw i64 %conv.epil, -48
%arrayidx3.epil = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %i.0121.epil
store i64 %sub.epil, ptr %arrayidx3.epil, align 8, !tbaa !17
%inc.epil = add nuw nsw i64 %i.0121.epil, 1
%epil.iter.next = add i64 %epil.iter, 1
%epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
br i1 %epil.iter.cmp.not, label %for.end, label %for.body.epil, !llvm.loop !20
for.end: ; preds = %for.body.epil, %for.end.unr-lcssa
%call4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @ar)
br i1 %cmp120, label %for.body8.preheader, label %for.end80
for.body8.preheader: ; preds = %for.end
%xtraiter149 = and i64 %call1, 3
%6 = icmp ult i64 %call1, 4
br i1 %6, label %for.cond17.preheader.unr-lcssa, label %for.body8.preheader.new
for.body8.preheader.new: ; preds = %for.body8.preheader
%unroll_iter152 = and i64 %call1, -4
br label %for.body8
for.cond17.preheader.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%i.1123.unr = phi i64 [ 0, %for.body8.preheader ], [ %inc15.3, %for.body8 ]
%lcmp.mod151.not = icmp eq i64 %xtraiter149, 0
br i1 %lcmp.mod151.not, label %for.cond17.preheader, label %for.body8.epil
for.body8.epil: ; preds = %for.cond17.preheader.unr-lcssa, %for.body8.epil
%i.1123.epil = phi i64 [ %inc15.epil, %for.body8.epil ], [ %i.1123.unr, %for.cond17.preheader.unr-lcssa ]
%epil.iter150 = phi i64 [ %epil.iter150.next, %for.body8.epil ], [ 0, %for.cond17.preheader.unr-lcssa ]
%arrayidx9.epil = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %i.1123.epil
%7 = load i8, ptr %arrayidx9.epil, align 1, !tbaa !16
%conv10.epil = sext i8 %7 to i64
%sub11.epil = add nsw i64 %conv10.epil, -48
%arrayidx13.epil = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %i.1123.epil
store i64 %sub11.epil, ptr %arrayidx13.epil, align 8, !tbaa !17
%inc15.epil = add nuw nsw i64 %i.1123.epil, 1
%epil.iter150.next = add i64 %epil.iter150, 1
%epil.iter150.cmp.not = icmp eq i64 %epil.iter150.next, %xtraiter149
br i1 %epil.iter150.cmp.not, label %for.cond17.preheader, label %for.body8.epil, !llvm.loop !22
for.cond17.preheader: ; preds = %for.body8.epil, %for.cond17.preheader.unr-lcssa
br i1 %cmp120, label %for.body20.preheader, label %for.end80
for.body20.preheader: ; preds = %for.cond17.preheader
%xtraiter154 = and i64 %call1, 1
%8 = icmp eq i64 %call1, 1
br i1 %8, label %for.cond29.preheader.unr-lcssa, label %for.body20.preheader.new
for.body20.preheader.new: ; preds = %for.body20.preheader
%unroll_iter157 = and i64 %call1, -2
br label %for.body20
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%i.1123 = phi i64 [ 0, %for.body8.preheader.new ], [ %inc15.3, %for.body8 ]
%niter153 = phi i64 [ 0, %for.body8.preheader.new ], [ %niter153.next.3, %for.body8 ]
%arrayidx9 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %i.1123
%9 = load i8, ptr %arrayidx9, align 4, !tbaa !16
%conv10 = sext i8 %9 to i64
%sub11 = add nsw i64 %conv10, -48
%arrayidx13 = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %i.1123
store i64 %sub11, ptr %arrayidx13, align 16, !tbaa !17
%inc15 = or i64 %i.1123, 1
%arrayidx9.1 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %inc15
%10 = load i8, ptr %arrayidx9.1, align 1, !tbaa !16
%conv10.1 = sext i8 %10 to i64
%sub11.1 = add nsw i64 %conv10.1, -48
%arrayidx13.1 = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %inc15
store i64 %sub11.1, ptr %arrayidx13.1, align 8, !tbaa !17
%inc15.1 = or i64 %i.1123, 2
%arrayidx9.2 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %inc15.1
%11 = load i8, ptr %arrayidx9.2, align 2, !tbaa !16
%conv10.2 = sext i8 %11 to i64
%sub11.2 = add nsw i64 %conv10.2, -48
%arrayidx13.2 = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %inc15.1
store i64 %sub11.2, ptr %arrayidx13.2, align 16, !tbaa !17
%inc15.2 = or i64 %i.1123, 3
%arrayidx9.3 = getelementptr inbounds [100001 x i8], ptr @ar, i64 0, i64 %inc15.2
%12 = load i8, ptr %arrayidx9.3, align 1, !tbaa !16
%conv10.3 = sext i8 %12 to i64
%sub11.3 = add nsw i64 %conv10.3, -48
%arrayidx13.3 = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %inc15.2
store i64 %sub11.3, ptr %arrayidx13.3, align 8, !tbaa !17
%inc15.3 = add nuw nsw i64 %i.1123, 4
%niter153.next.3 = add i64 %niter153, 4
%niter153.ncmp.3 = icmp eq i64 %niter153.next.3, %unroll_iter152
br i1 %niter153.ncmp.3, label %for.cond17.preheader.unr-lcssa, label %for.body8, !llvm.loop !23
for.cond29.preheader.unr-lcssa: ; preds = %for.inc26.1, %for.body20.preheader
%i.2125.unr = phi i64 [ 0, %for.body20.preheader ], [ %inc27.1, %for.inc26.1 ]
%lcmp.mod156.not = icmp eq i64 %xtraiter154, 0
br i1 %lcmp.mod156.not, label %for.cond29.preheader, label %for.body20.epil
for.body20.epil: ; preds = %for.cond29.preheader.unr-lcssa
%arrayidx21.epil = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %i.2125.unr
%13 = load i64, ptr %arrayidx21.epil, align 8, !tbaa !17
%arrayidx22.epil = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %i.2125.unr
%14 = load i64, ptr %arrayidx22.epil, align 8, !tbaa !17
%cmp23.not.epil = icmp eq i64 %13, %14
br i1 %cmp23.not.epil, label %for.cond29.preheader, label %if.then.epil
if.then.epil: ; preds = %for.body20.epil
%arrayidx25.epil = getelementptr inbounds [100001 x i64], ptr @dff, i64 0, i64 %i.2125.unr
store i64 1, ptr %arrayidx25.epil, align 8, !tbaa !17
br label %for.cond29.preheader
for.cond29.preheader: ; preds = %for.body20.epil, %if.then.epil, %for.cond29.preheader.unr-lcssa
br i1 %cmp120, label %for.body32.preheader, label %for.end80
for.body32.preheader: ; preds = %for.cond29.preheader
%min.iters.check = icmp ult i64 %call1, 4
br i1 %min.iters.check, label %for.body32.preheader146, label %vector.ph
vector.ph: ; preds = %for.body32.preheader
%n.vec = and i64 %call1, -4
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %21, %vector.body ]
%vec.phi144 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %22, %vector.body ]
%15 = getelementptr inbounds [100001 x i64], ptr @dff, i64 0, i64 %index
%wide.load = load <2 x i64>, ptr %15, align 16, !tbaa !17
%16 = getelementptr inbounds i64, ptr %15, i64 2
%wide.load145 = load <2 x i64>, ptr %16, align 16, !tbaa !17
%17 = icmp eq <2 x i64> %wide.load, <i64 1, i64 1>
%18 = icmp eq <2 x i64> %wide.load145, <i64 1, i64 1>
%19 = zext <2 x i1> %17 to <2 x i64>
%20 = zext <2 x i1> %18 to <2 x i64>
%21 = add <2 x i64> %vec.phi, %19
%22 = add <2 x i64> %vec.phi144, %20
%index.next = add nuw i64 %index, 4
%23 = icmp eq i64 %index.next, %n.vec
br i1 %23, label %middle.block, label %vector.body, !llvm.loop !24
middle.block: ; preds = %vector.body
%bin.rdx = add <2 x i64> %22, %21
%24 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
%cmp.n = icmp eq i64 %call1, %n.vec
br i1 %cmp.n, label %for.end40, label %for.body32.preheader146
for.body32.preheader146: ; preds = %for.body32.preheader, %middle.block
%cnt.0128.ph = phi i64 [ 0, %for.body32.preheader ], [ %24, %middle.block ]
%i.3127.ph = phi i64 [ 0, %for.body32.preheader ], [ %n.vec, %middle.block ]
br label %for.body32
for.body20: ; preds = %for.inc26.1, %for.body20.preheader.new
%i.2125 = phi i64 [ 0, %for.body20.preheader.new ], [ %inc27.1, %for.inc26.1 ]
%niter158 = phi i64 [ 0, %for.body20.preheader.new ], [ %niter158.next.1, %for.inc26.1 ]
%arrayidx21 = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %i.2125
%25 = load i64, ptr %arrayidx21, align 16, !tbaa !17
%arrayidx22 = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %i.2125
%26 = load i64, ptr %arrayidx22, align 16, !tbaa !17
%cmp23.not = icmp eq i64 %25, %26
br i1 %cmp23.not, label %for.inc26, label %if.then
if.then: ; preds = %for.body20
%arrayidx25 = getelementptr inbounds [100001 x i64], ptr @dff, i64 0, i64 %i.2125
store i64 1, ptr %arrayidx25, align 16, !tbaa !17
br label %for.inc26
for.inc26: ; preds = %for.body20, %if.then
%inc27 = or i64 %i.2125, 1
%arrayidx21.1 = getelementptr inbounds [100001 x i64], ptr @ar1, i64 0, i64 %inc27
%27 = load i64, ptr %arrayidx21.1, align 8, !tbaa !17
%arrayidx22.1 = getelementptr inbounds [100001 x i64], ptr @ar2, i64 0, i64 %inc27
%28 = load i64, ptr %arrayidx22.1, align 8, !tbaa !17
%cmp23.not.1 = icmp eq i64 %27, %28
br i1 %cmp23.not.1, label %for.inc26.1, label %if.then.1
if.then.1: ; preds = %for.inc26
%arrayidx25.1 = getelementptr inbounds [100001 x i64], ptr @dff, i64 0, i64 %inc27
store i64 1, ptr %arrayidx25.1, align 8, !tbaa !17
br label %for.inc26.1
for.inc26.1: ; preds = %if.then.1, %for.inc26
%inc27.1 = add nuw nsw i64 %i.2125, 2
%niter158.next.1 = add i64 %niter158, 2
%niter158.ncmp.1 = icmp eq i64 %niter158.next.1, %unroll_iter157
br i1 %niter158.ncmp.1, label %for.cond29.preheader.unr-lcssa, label %for.body20, !llvm.loop !27
for.body32: ; preds = %for.body32.preheader146, %for.body32
%cnt.0128 = phi i64 [ %spec.select, %for.body32 ], [ %cnt.0128.ph, %for.body32.preheader146 ]
%i.3127 = phi i64 [ %inc39, %for.body32 ], [ %i.3127.ph, %for.body32.preheader146 ]
%arrayidx33 = getelementptr inbounds [100001 x i64], ptr @dff, i64 0, i64 %i.3127
%29 = load i64, ptr %arrayidx33, align 8, !tbaa !17
%cmp34 = icmp eq i64 %29, 1
%add = zext i1 %cmp34 to i64
%spec.select = add nuw nsw i64 %cnt.0128, %add
%inc39 = add nuw nsw i64 %i.3127, 1
%exitcond136.not = icmp eq i64 %inc39, %call1
br i1 %exitcond136.not, label %for.end40, label %for.body32, !llvm.loop !28
for.end40: ; preds = %for.body32, %middle.block
%spec.select.lcssa = phi i64 [ %24, %middle.block ], [ %spec.select, %for.body32 ]
%30 = and i64 %spec.select.lcssa, 1
%cmp41.not = icmp eq i64 %30, 0
br i1 %cmp41.not, label %for.cond46.preheader, label %if.then43
for.cond46.preheader: ; preds = %for.end40
br i1 %cmp120, label %for.body49, label %for.end80
if.then43: ; preds = %for.end40
%puts = tail call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %cleanup
for.cond72.preheader: ; preds = %for.body49
br i1 %cmp120, label %for.body75, label %for.end80
for.body49: ; preds = %for.cond46.preheader, %for.body49
%cnt.2131 = phi i64 [ %cnt.3, %for.body49 ], [ %spec.select.lcssa, %for.cond46.preheader ]
%i.4130 = phi i64 [ %inc70, %for.body49 ], [ 0, %for.cond46.preheader ]
%arrayidx50 = getelementptr inbounds [100001 x i64], ptr @dff, i64 0, i64 %i.4130
%31 = load i64, ptr %arrayidx50, align 8, !tbaa !17
%cmp51 = icmp eq i64 %31, 0
%arrayidx55 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %i.4130
%32 = and i64 %cnt.2131, 1
%cmp57 = icmp eq i64 %32, 0
%33 = select i1 %cmp51, i1 true, i1 %cmp57
%ar1.sink = select i1 %33, ptr @ar1, ptr @ar2
%not.cmp51 = xor i1 %cmp51, true
%sub62 = sext i1 %not.cmp51 to i64
%cnt.3 = add nsw i64 %cnt.2131, %sub62
%arrayidx54 = getelementptr inbounds [100001 x i64], ptr %ar1.sink, i64 0, i64 %i.4130
%34 = load i64, ptr %arrayidx54, align 8, !tbaa !17
store i64 %34, ptr %arrayidx55, align 8, !tbaa !17
%inc70 = add nuw nsw i64 %i.4130, 1
%exitcond137.not = icmp eq i64 %inc70, %call1
br i1 %exitcond137.not, label %for.cond72.preheader, label %for.body49, !llvm.loop !29
for.body75: ; preds = %for.cond72.preheader, %for.body75
%i.5133 = phi i64 [ %inc79, %for.body75 ], [ 0, %for.cond72.preheader ]
%arrayidx76 = getelementptr inbounds [100001 x i64], ptr @ans, i64 0, i64 %i.5133
%35 = load i64, ptr %arrayidx76, align 8, !tbaa !17
%call77 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %35)
%inc79 = add nuw nsw i64 %i.5133, 1
%exitcond138.not = icmp eq i64 %inc79, %call1
br i1 %exitcond138.not, label %for.end80, label %for.body75, !llvm.loop !30
for.end80: ; preds = %for.body75, %for.cond29.preheader, %for.cond17.preheader, %for.end.thread, %for.end, %for.cond46.preheader, %for.cond72.preheader
%36 = load ptr, ptr @stdout, align 8, !tbaa !5
%call.i = tail call i32 @putc(i32 noundef 10, ptr noundef %36)
br label %cleanup
cleanup: ; preds = %for.end80, %if.then43
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #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 i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind willreturn memory(read) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10, !25, !26}
!25 = !{!"llvm.loop.isvectorized", i32 1}
!26 = !{!"llvm.loop.unroll.runtime.disable"}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10, !26, !25}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}
|
#include<stdio.h>
#include<string.h>
int main()
{
int n,max=0,z,i,j,k;
scanf("%d",&n);
char a[n][1001],b,c;
for(i=0;i<n;i++)
{
scanf("%s",a[i]);
}
for(b='a';b<='z';b++)
{
for(c=b;c<='z';c++)
{
z=0;
for(i=0;i<n;i++)
{
k=0;
for(j=0;j<strlen(a[i]);j++)
{
if(a[i][j]!=b && a[i][j]!=c)
{
k=1;
break;
}
}
if(k==0)
{
z=z+strlen(a[i]);
}
}
if(z>max)
{
max=z;
}
}
}
printf("%d\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_1930/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_1930/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca [1001 x i8], i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp87 = icmp sgt i32 %3, 0
br i1 %cmp87, label %for.body, label %for.end65
for.cond2.preheader: ; preds = %for.body
%cmp1293 = icmp sgt i32 %6, 0
br i1 %cmp1293, label %for.cond6.preheader.us.preheader, label %for.end65
for.cond6.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count = zext i32 %6 to i64
br label %for.cond6.preheader.us
for.cond6.preheader.us: ; preds = %for.cond6.preheader.us.preheader, %for.inc63.split.us.us
%b.0100.us = phi i8 [ %inc64.us, %for.inc63.split.us.us ], [ 97, %for.cond6.preheader.us.preheader ]
%max.099.us = phi i32 [ %spec.select.us.us, %for.inc63.split.us.us ], [ 0, %for.cond6.preheader.us.preheader ]
br label %for.cond11.preheader.us.us
for.cond11.preheader.us.us: ; preds = %for.cond11.for.end55_crit_edge.us.us, %for.cond6.preheader.us
%c.098.us.us = phi i8 [ %b.0100.us, %for.cond6.preheader.us ], [ %inc61.us.us, %for.cond11.for.end55_crit_edge.us.us ]
%max.197.us.us = phi i32 [ %max.099.us, %for.cond6.preheader.us ], [ %spec.select.us.us, %for.cond11.for.end55_crit_edge.us.us ]
br label %for.cond15.preheader.us.us
for.cond15.us.us: ; preds = %for.body23.us.us
%indvars.iv.next106 = add nuw i64 %indvars.iv105, 1
%exitcond.not = icmp eq i64 %indvars.iv.next106, %call20.us.us
br i1 %exitcond.not, label %if.then45.us.us, label %for.body23.us.us, !llvm.loop !9
if.then45.us.us: ; preds = %for.cond15.us.us, %for.cond15.preheader.us.us
%4 = trunc i64 %call20.us.us to i32
%conv51.us.us = add i32 %z.094.us.us, %4
br label %for.inc53.us.us
for.body23.us.us: ; preds = %for.cond15.preheader.us.us, %for.cond15.us.us
%indvars.iv105 = phi i64 [ %indvars.iv.next106, %for.cond15.us.us ], [ 0, %for.cond15.preheader.us.us ]
%arrayidx27.us.us = getelementptr inbounds [1001 x i8], ptr %vla, i64 %indvars.iv108, i64 %indvars.iv105
%5 = load i8, ptr %arrayidx27.us.us, align 1, !tbaa !11
%cmp30.not.us.us = icmp eq i8 %5, %b.0100.us
%cmp38.not.us.us = icmp eq i8 %5, %c.098.us.us
%or.cond.us.us = or i1 %cmp30.not.us.us, %cmp38.not.us.us
br i1 %or.cond.us.us, label %for.cond15.us.us, label %for.inc53.us.us
for.inc53.us.us: ; preds = %for.body23.us.us, %if.then45.us.us
%z.1.us.us = phi i32 [ %conv51.us.us, %if.then45.us.us ], [ %z.094.us.us, %for.body23.us.us ]
%indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
%exitcond111.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count
br i1 %exitcond111.not, label %for.cond11.for.end55_crit_edge.us.us, label %for.cond15.preheader.us.us, !llvm.loop !12
for.cond15.preheader.us.us: ; preds = %for.inc53.us.us, %for.cond11.preheader.us.us
%indvars.iv108 = phi i64 [ %indvars.iv.next109, %for.inc53.us.us ], [ 0, %for.cond11.preheader.us.us ]
%z.094.us.us = phi i32 [ %z.1.us.us, %for.inc53.us.us ], [ 0, %for.cond11.preheader.us.us ]
%arrayidx18.us.us = getelementptr inbounds [1001 x i8], ptr %vla, i64 %indvars.iv108
%call20.us.us = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %arrayidx18.us.us) #7
%cmp21.not89.us.us.not = icmp eq i64 %call20.us.us, 0
br i1 %cmp21.not89.us.us.not, label %if.then45.us.us, label %for.body23.us.us
for.cond11.for.end55_crit_edge.us.us: ; preds = %for.inc53.us.us
%spec.select.us.us = call i32 @llvm.smax.i32(i32 %z.1.us.us, i32 %max.197.us.us)
%inc61.us.us = add nuw nsw i8 %c.098.us.us, 1
%cmp8.us.us = icmp ult i8 %c.098.us.us, 122
br i1 %cmp8.us.us, label %for.cond11.preheader.us.us, label %for.inc63.split.us.us, !llvm.loop !13
for.inc63.split.us.us: ; preds = %for.cond11.for.end55_crit_edge.us.us
%inc64.us = add nuw nsw i8 %b.0100.us, 1
%exitcond112.not = icmp eq i8 %inc64.us, 123
br i1 %exitcond112.not, label %for.end65, label %for.cond6.preheader.us, !llvm.loop !14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [1001 x i8], 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
%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.cond2.preheader, !llvm.loop !15
for.end65: ; preds = %for.inc63.split.us.us, %entry, %for.cond2.preheader
%.us-phi101 = phi i32 [ 0, %for.cond2.preheader ], [ 0, %entry ], [ %spec.select.us.us, %for.inc63.split.us.us ]
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.us-phi101)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nofree 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 #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.smax.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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
/* ex3_3
masaaki52 */
#include <stdio.h>
int main(void){
int number,kisuu,ruijou,keta;
scanf("%d %d",&number,&kisuu);
ruijou = kisuu;
keta = 1;
while(number >= ruijou){
ruijou = ruijou * kisuu;
keta += 1;
}
printf("%d\n",keta);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193042/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193042/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%number = alloca i32, align 4
%kisuu = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %kisuu) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number, ptr noundef nonnull %kisuu)
%0 = load i32, ptr %kisuu, align 4, !tbaa !5
%1 = load i32, ptr %number, align 4, !tbaa !5
%cmp.not4 = icmp slt i32 %1, %0
br i1 %cmp.not4, label %while.end, label %while.body
while.body: ; preds = %entry, %while.body
%keta.06 = phi i32 [ %add, %while.body ], [ 1, %entry ]
%ruijou.05 = phi i32 [ %mul, %while.body ], [ %0, %entry ]
%mul = mul nsw i32 %ruijou.05, %0
%add = add nuw nsw i32 %keta.06, 1
%cmp.not = icmp slt i32 %1, %mul
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%keta.0.lcssa = phi i32 [ 1, %entry ], [ %add, %while.body ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %keta.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %kisuu) #3
call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
/* ex3_3
Acro */
#include <stdio.h>
#include <math.h>
int main(void){
int num,base,ans;
scanf("%d %d",&num,&base);
/* 底の変換公式 */
ans = log(num)/log(base) + 1;
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193086/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193086/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%base = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %base) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %base)
%0 = load i32, ptr %num, align 4, !tbaa !5
%conv = sitofp i32 %0 to double
%call1 = call double @log(double noundef %conv) #4
%1 = load i32, ptr %base, align 4, !tbaa !5
%conv2 = sitofp i32 %1 to double
%call3 = call double @log(double noundef %conv2) #4
%div = fdiv double %call1, %call3
%add = fadd double %div, 1.000000e+00
%conv4 = fptosi double %add to i32
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv4)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %base) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %num) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int number, notation, digit; // number(整数), notation(表記法), digit(桁数)をint型の変数として宣言
scanf("%d %d", &number, ¬ation); // number, notationを入力
digit = 0; // 桁数を初めは0としておく
// 整数numberをnotation進数で表すと何桁になるかをnumberが何回notationで割れるかで計算する
while (number > 0){
number = number / notation;
digit++; // numberをnotationで1回割ったら桁数digitを1増やす
}
printf("%d", digit); // 桁数digitを出力
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193143/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193143/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%number = alloca i32, align 4
%notation = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %number) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %notation) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %number, ptr noundef nonnull %notation)
%.pr = load i32, ptr %number, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %notation, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%digit.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %div, %while.body ]
%div = sdiv i32 %1, %0
%inc = add nuw nsw i32 %digit.04, 1
%cmp = icmp sgt i32 %div, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %div, ptr %number, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%digit.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %digit.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %notation) #3
call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int n,k;
scanf("%d %d",&n,&k);
int ans=0;
while(n>0){
n/=k;
ans++;
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193187/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193187/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %k, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%ans.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %div, %while.body ]
%div = sdiv i32 %1, %0
%inc = add nuw nsw i32 %ans.04, 1
%cmp = icmp sgt i32 %div, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %div, ptr %n, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%ans.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int i, j, n, ar[101][101], s, ans[102], a;
int main(){
scanf("%d", &n);
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
scanf("%d", &ar[i][j]);
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
if(i==j)continue;
else{
if(ar[i][j]==1||ar[i][j]==3)s++;
}
}
if(s>0){
ans[i]=1;
a++;
}
s=0;
}
printf("%d\n", n-a);
for(i=1;i<=n;i++){
if(ans[i]==0)printf("%d ", i);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19323/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19323/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@i = dso_local local_unnamed_addr global i32 0, align 4
@j = dso_local local_unnamed_addr global i32 0, align 4
@ar = dso_local global [101 x [101 x i32]] zeroinitializer, align 16
@s = dso_local local_unnamed_addr global i32 0, align 4
@ans = dso_local local_unnamed_addr global [102 x i32] zeroinitializer, align 16
@a = dso_local local_unnamed_addr global i32 0, align 4
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 1, ptr @i, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not66 = icmp slt i32 %0, 1
br i1 %cmp.not66, label %for.cond10.preheader.thread, label %for.cond1.preheader
for.cond10.preheader.thread: ; preds = %entry
%a.promoted98 = load i32, ptr @a, align 4, !tbaa !5
br label %for.end41
for.cond1.preheader: ; preds = %entry, %for.inc7
%1 = phi i32 [ %9, %for.inc7 ], [ %0, %entry ]
%2 = phi i32 [ %inc8, %for.inc7 ], [ 1, %entry ]
store i32 1, ptr @j, align 4, !tbaa !5
%cmp2.not64 = icmp slt i32 %1, 1
br i1 %cmp2.not64, label %for.inc7, label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%a.promoted = load i32, ptr @a, align 4, !tbaa !5
%cmp11.not79 = icmp slt i32 %9, 1
br i1 %cmp11.not79, label %for.end41, label %for.cond13.preheader.preheader
for.cond13.preheader.preheader: ; preds = %for.cond10.preheader
%s.promoted74 = load i32, ptr @s, align 4, !tbaa !5
%3 = add i32 %9, 1
%wide.trip.count93 = zext i32 %3 to i64
%4 = add nsw i64 %wide.trip.count93, -1
%xtraiter = and i64 %4, 1
%5 = icmp eq i32 %3, 2
%unroll_iter = and i64 %4, -2
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br label %for.cond13.preheader
for.body3: ; preds = %for.cond1.preheader, %for.body3
%storemerge6365 = phi i32 [ %inc, %for.body3 ], [ 1, %for.cond1.preheader ]
%6 = load i32, ptr @i, align 4, !tbaa !5
%idxprom = sext i32 %6 to i64
%idxprom4 = sext i32 %storemerge6365 to i64
%arrayidx5 = getelementptr inbounds [101 x [101 x i32]], ptr @ar, i64 0, i64 %idxprom, i64 %idxprom4
%call6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%7 = load i32, ptr @j, align 4, !tbaa !5
%inc = add nsw i32 %7, 1
store i32 %inc, ptr @j, align 4, !tbaa !5
%8 = load i32, ptr @n, align 4, !tbaa !5
%cmp2.not.not = icmp slt i32 %7, %8
br i1 %cmp2.not.not, label %for.body3, label %for.inc7.loopexit, !llvm.loop !9
for.inc7.loopexit: ; preds = %for.body3
%.pre = load i32, ptr @i, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.inc7.loopexit, %for.cond1.preheader
%9 = phi i32 [ %8, %for.inc7.loopexit ], [ %1, %for.cond1.preheader ]
%10 = phi i32 [ %.pre, %for.inc7.loopexit ], [ %2, %for.cond1.preheader ]
%inc8 = add nsw i32 %10, 1
store i32 %inc8, ptr @i, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %10, %9
br i1 %cmp.not.not, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !11
for.cond13.preheader: ; preds = %for.cond13.preheader.preheader, %if.end38
%indvars.iv90 = phi i64 [ 1, %for.cond13.preheader.preheader ], [ %indvars.iv.next91, %if.end38 ]
%s.promoted7581 = phi i32 [ %s.promoted74, %for.cond13.preheader.preheader ], [ 0, %if.end38 ]
%inc377880 = phi i32 [ %a.promoted, %for.cond13.preheader.preheader ], [ %inc3777, %if.end38 ]
br i1 %5, label %for.cond13.for.end32_crit_edge.unr-lcssa, label %for.body15
for.body15: ; preds = %for.cond13.preheader, %for.inc30.1
%indvars.iv = phi i64 [ %indvars.iv.next.1, %for.inc30.1 ], [ 1, %for.cond13.preheader ]
%inc286971 = phi i32 [ %inc2868.1, %for.inc30.1 ], [ %s.promoted7581, %for.cond13.preheader ]
%niter = phi i64 [ %niter.next.1, %for.inc30.1 ], [ 0, %for.cond13.preheader ]
%cmp16 = icmp eq i64 %indvars.iv90, %indvars.iv
br i1 %cmp16, label %for.inc30, label %if.else
if.else: ; preds = %for.body15
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr @ar, i64 0, i64 %indvars.iv90, i64 %indvars.iv
%11 = load i32, ptr %arrayidx20, align 4, !tbaa !5
switch i32 %11, label %for.inc30 [
i32 1, label %if.then27
i32 3, label %if.then27
]
if.then27: ; preds = %if.else, %if.else
%inc28 = add nsw i32 %inc286971, 1
br label %for.inc30
for.inc30: ; preds = %if.else, %if.then27, %for.body15
%inc2868 = phi i32 [ %inc286971, %if.else ], [ %inc28, %if.then27 ], [ %inc286971, %for.body15 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%cmp16.1 = icmp eq i64 %indvars.iv90, %indvars.iv.next
br i1 %cmp16.1, label %for.inc30.1, label %if.else.1
if.else.1: ; preds = %for.inc30
%arrayidx20.1 = getelementptr inbounds [101 x [101 x i32]], ptr @ar, i64 0, i64 %indvars.iv90, i64 %indvars.iv.next
%12 = load i32, ptr %arrayidx20.1, align 4, !tbaa !5
switch i32 %12, label %for.inc30.1 [
i32 1, label %if.then27.1
i32 3, label %if.then27.1
]
if.then27.1: ; preds = %if.else.1, %if.else.1
%inc28.1 = add nsw i32 %inc2868, 1
br label %for.inc30.1
for.inc30.1: ; preds = %if.then27.1, %if.else.1, %for.inc30
%inc2868.1 = phi i32 [ %inc2868, %if.else.1 ], [ %inc28.1, %if.then27.1 ], [ %inc2868, %for.inc30 ]
%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.cond13.for.end32_crit_edge.unr-lcssa, label %for.body15, !llvm.loop !13
for.cond13.for.end32_crit_edge.unr-lcssa: ; preds = %for.inc30.1, %for.cond13.preheader
%inc2868.lcssa.ph = phi i32 [ undef, %for.cond13.preheader ], [ %inc2868.1, %for.inc30.1 ]
%indvars.iv.unr = phi i64 [ 1, %for.cond13.preheader ], [ %indvars.iv.next.1, %for.inc30.1 ]
%inc286971.unr = phi i32 [ %s.promoted7581, %for.cond13.preheader ], [ %inc2868.1, %for.inc30.1 ]
br i1 %lcmp.mod.not, label %for.cond13.for.end32_crit_edge, label %for.body15.epil
for.body15.epil: ; preds = %for.cond13.for.end32_crit_edge.unr-lcssa
%cmp16.epil = icmp eq i64 %indvars.iv90, %indvars.iv.unr
br i1 %cmp16.epil, label %for.cond13.for.end32_crit_edge, label %if.else.epil
if.else.epil: ; preds = %for.body15.epil
%arrayidx20.epil = getelementptr inbounds [101 x [101 x i32]], ptr @ar, i64 0, i64 %indvars.iv90, i64 %indvars.iv.unr
%13 = load i32, ptr %arrayidx20.epil, align 4, !tbaa !5
switch i32 %13, label %for.cond13.for.end32_crit_edge [
i32 1, label %if.then27.epil
i32 3, label %if.then27.epil
]
if.then27.epil: ; preds = %if.else.epil, %if.else.epil
%inc28.epil = add nsw i32 %inc286971.unr, 1
br label %for.cond13.for.end32_crit_edge
for.cond13.for.end32_crit_edge: ; preds = %for.body15.epil, %if.else.epil, %if.then27.epil, %for.cond13.for.end32_crit_edge.unr-lcssa
%inc2868.lcssa = phi i32 [ %inc2868.lcssa.ph, %for.cond13.for.end32_crit_edge.unr-lcssa ], [ %inc286971.unr, %if.else.epil ], [ %inc28.epil, %if.then27.epil ], [ %inc286971.unr, %for.body15.epil ]
%cmp33 = icmp sgt i32 %inc2868.lcssa, 0
br i1 %cmp33, label %if.then34, label %if.end38
if.then34: ; preds = %for.cond13.for.end32_crit_edge
%arrayidx36 = getelementptr inbounds [102 x i32], ptr @ans, i64 0, i64 %indvars.iv90
store i32 1, ptr %arrayidx36, align 4, !tbaa !5
%inc37 = add nsw i32 %inc377880, 1
store i32 %inc37, ptr @a, align 4, !tbaa !5
br label %if.end38
if.end38: ; preds = %if.then34, %for.cond13.for.end32_crit_edge
%inc3777 = phi i32 [ %inc37, %if.then34 ], [ %inc377880, %for.cond13.for.end32_crit_edge ]
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%exitcond94.not = icmp eq i64 %indvars.iv.next91, %wide.trip.count93
br i1 %exitcond94.not, label %for.cond10.for.end41_crit_edge, label %for.cond13.preheader, !llvm.loop !14
for.cond10.for.end41_crit_edge: ; preds = %if.end38
store i32 0, ptr @s, align 4, !tbaa !5
store i32 %3, ptr @j, align 4, !tbaa !5
br label %for.end41
for.end41: ; preds = %for.cond10.preheader.thread, %for.cond10.for.end41_crit_edge, %for.cond10.preheader
%.lcssa100 = phi i32 [ %9, %for.cond10.for.end41_crit_edge ], [ %9, %for.cond10.preheader ], [ %0, %for.cond10.preheader.thread ]
%14 = phi i32 [ %inc3777, %for.cond10.for.end41_crit_edge ], [ %a.promoted, %for.cond10.preheader ], [ %a.promoted98, %for.cond10.preheader.thread ]
%storemerge60.lcssa = phi i32 [ %3, %for.cond10.for.end41_crit_edge ], [ 1, %for.cond10.preheader ], [ 1, %for.cond10.preheader.thread ]
store i32 %storemerge60.lcssa, ptr @i, align 4, !tbaa !5
%sub = sub nsw i32 %.lcssa100, %14
%call42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %sub)
store i32 1, ptr @i, align 4, !tbaa !5
%15 = load i32, ptr @n, align 4, !tbaa !5
%cmp44.not86 = icmp slt i32 %15, 1
br i1 %cmp44.not86, label %for.end54, label %for.body45
for.body45: ; preds = %for.end41, %for.inc52
%16 = phi i32 [ %18, %for.inc52 ], [ %15, %for.end41 ]
%storemerge6187 = phi i32 [ %inc53, %for.inc52 ], [ 1, %for.end41 ]
%idxprom46 = sext i32 %storemerge6187 to i64
%arrayidx47 = getelementptr inbounds [102 x i32], ptr @ans, i64 0, i64 %idxprom46
%17 = load i32, ptr %arrayidx47, align 4, !tbaa !5
%cmp48 = icmp eq i32 %17, 0
br i1 %cmp48, label %if.then49, label %for.inc52
if.then49: ; preds = %for.body45
%call50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %storemerge6187)
%.pre95 = load i32, ptr @i, align 4, !tbaa !5
%.pre96 = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc52
for.inc52: ; preds = %for.body45, %if.then49
%18 = phi i32 [ %16, %for.body45 ], [ %.pre96, %if.then49 ]
%19 = phi i32 [ %storemerge6187, %for.body45 ], [ %.pre95, %if.then49 ]
%inc53 = add nsw i32 %19, 1
store i32 %inc53, ptr @i, align 4, !tbaa !5
%cmp44.not.not = icmp slt i32 %19, %18
br i1 %cmp44.not.not, label %for.body45, label %for.end54, !llvm.loop !15
for.end54: ; preds = %for.inc52, %for.end41
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
int main()
{
long long int n;
int k,c=0,a;
scanf("%lld %d",&n,&k);
do
{
a=n/k;
n=a;
c++;
}
while(a!=0);
printf("%d\n",c);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193273/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193273/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%lld %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 i64, align 8
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%0 = load i32, ptr %k, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%n.promoted = load i64, ptr %n, align 8, !tbaa !9
br label %do.body
do.body: ; preds = %do.body, %entry
%conv27 = phi i64 [ %n.promoted, %entry ], [ %conv2, %do.body ]
%c.0 = phi i32 [ 0, %entry ], [ %inc, %do.body ]
%div = sdiv i64 %conv27, %conv
%sext = shl i64 %div, 32
%conv2 = ashr exact i64 %sext, 32
%inc = add nuw nsw i32 %c.0, 1
%1 = and i64 %div, 4294967295
%cmp.not = icmp eq i64 %1, 0
br i1 %cmp.not, label %do.end, label %do.body, !llvm.loop !11
do.end: ; preds = %do.body
store i64 %conv2, ptr %n, align 8, !tbaa !9
%call4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %inc)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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"}
|
#include <stdio.h>
int main() {
int x,m,j=0;
scanf("%d %d",&x,&m);
while(x) {
x/=m;
j++;
}
printf("%d\n",j);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193316/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193316/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%x = alloca i32, align 4
%m = 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 %m) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %x, ptr noundef nonnull %m)
%.pr = load i32, ptr %x, align 4, !tbaa !5
%tobool.not3 = icmp eq i32 %.pr, 0
br i1 %tobool.not3, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %m, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%j.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %div, %while.body ]
%div = sdiv i32 %1, %0
%inc = add nuw nsw i32 %j.04, 1
%tobool.not = icmp eq i32 %div, 0
br i1 %tobool.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 0, ptr %x, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%j.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %j.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %m) #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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int n,k;
int count = 0;
scanf("%d %d",&n,&k);
while(n != 0){
n = n / k;
count++;
}
printf("%d\n",count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193402/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193402/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n, ptr noundef nonnull %k)
%.pr = load i32, ptr %n, align 4, !tbaa !5
%cmp.not3 = icmp eq i32 %.pr, 0
br i1 %cmp.not3, label %while.end, label %while.body.lr.ph
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %k, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%count.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %div, %while.body ]
%div = sdiv i32 %1, %0
%inc = add nuw nsw i32 %count.04, 1
%cmp.not = icmp eq i32 %div, 0
br i1 %cmp.not, label %while.cond.while.end_crit_edge, label %while.body, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 0, ptr %n, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%count.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(void){
int N,K;
scanf("%d %d",&N,&K);
int c=0;
while(N>=1){
N/=K;
c++;
}
printf("%d",c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193446/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193446/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
%K = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %K) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N, ptr noundef nonnull %K)
%.pr = load i32, ptr %N, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %K, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%c.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %div, %while.body ]
%div = sdiv i32 %1, %0
%inc = add nuw nsw i32 %c.04, 1
%cmp = icmp sgt i32 %div, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %div, ptr %N, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%c.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %K) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main() {
int n,i,j,b[100]={0},c;
scanf("%d",&n);
int a[100][100];
c=n;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
scanf("%d", &a[i][j]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if((a[i][j]==1)||(a[i][j]==3))
{
if(b[i]==0)
{
b[i]=-1;
c--;
}
break;
}
}
}
printf("%d \n",c);
for(i=0;i<n;i++)
if(b[i]==0)
printf("%d ",i+1);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19349/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19349/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d \0A\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%b = alloca [100 x i32], align 16
%a = alloca [100 x [100 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %b) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %b, i8 0, i64 400, i1 false)
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.start.p0(i64 40000, ptr nonnull %a) #4
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.cond1.preheader, label %for.end38
for.cond1.preheader: ; preds = %entry, %for.inc7
%1 = phi i32 [ %6, %for.inc7 ], [ %0, %entry ]
%indvars.iv88 = phi i64 [ %indvars.iv.next89, %for.inc7 ], [ 0, %entry ]
%cmp271 = icmp sgt i32 %1, 0
br i1 %cmp271, label %for.body3, label %for.cond1.preheader.for.inc7_crit_edge
for.cond1.preheader.for.inc7_crit_edge: ; preds = %for.cond1.preheader
%.pre103 = sext i32 %1 to i64
br label %for.inc7
for.cond10.preheader: ; preds = %for.inc7
%cmp1177 = icmp sgt i32 %6, 0
br i1 %cmp1177, label %for.cond13.preheader.us.preheader, label %for.end38
for.cond13.preheader.us.preheader: ; preds = %for.cond10.preheader
%wide.trip.count97 = zext i32 %6 to i64
br label %for.cond13.preheader.us
for.cond13.preheader.us: ; preds = %for.cond13.preheader.us.preheader, %for.inc36.us
%indvars.iv94 = phi i64 [ 0, %for.cond13.preheader.us.preheader ], [ %indvars.iv.next95, %for.inc36.us ]
%c.080.us = phi i32 [ %0, %for.cond13.preheader.us.preheader ], [ %c.1.us, %for.inc36.us ]
br label %for.body15.us
for.body15.us: ; preds = %for.cond13.preheader.us, %for.inc33.us
%indvars.iv91 = phi i64 [ 0, %for.cond13.preheader.us ], [ %indvars.iv.next92, %for.inc33.us ]
%arrayidx19.us = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv94, i64 %indvars.iv91
%2 = load i32, ptr %arrayidx19.us, align 4, !tbaa !5
switch i32 %2, label %for.inc33.us [
i32 1, label %if.then.us
i32 3, label %if.then.us
]
if.then.us: ; preds = %for.body15.us, %for.body15.us
%arrayidx27.us = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv94
%3 = load i32, ptr %arrayidx27.us, align 4, !tbaa !5
%cmp28.us = icmp eq i32 %3, 0
br i1 %cmp28.us, label %if.then29.us, label %for.inc36.us
if.then29.us: ; preds = %if.then.us
store i32 -1, ptr %arrayidx27.us, align 4, !tbaa !5
%dec.us = add nsw i32 %c.080.us, -1
br label %for.inc36.us
for.inc36.us: ; preds = %for.inc33.us, %if.then29.us, %if.then.us
%c.1.us = phi i32 [ %dec.us, %if.then29.us ], [ %c.080.us, %if.then.us ], [ %c.080.us, %for.inc33.us ]
%indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
%exitcond98.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count97
br i1 %exitcond98.not, label %for.end38, label %for.cond13.preheader.us, !llvm.loop !9
for.inc33.us: ; preds = %for.body15.us
%indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
%exitcond.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count97
br i1 %exitcond.not, label %for.inc36.us, label %for.body15.us, !llvm.loop !11
for.body3: ; preds = %for.cond1.preheader, %for.body3
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body3 ], [ 0, %for.cond1.preheader ]
%arrayidx5 = getelementptr inbounds [100 x [100 x i32]], ptr %a, i64 0, i64 %indvars.iv88, i64 %indvars.iv
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp2, label %for.body3, label %for.inc7, !llvm.loop !12
for.inc7: ; preds = %for.body3, %for.cond1.preheader.for.inc7_crit_edge
%.pre-phi = phi i64 [ %.pre103, %for.cond1.preheader.for.inc7_crit_edge ], [ %5, %for.body3 ]
%6 = phi i32 [ %1, %for.cond1.preheader.for.inc7_crit_edge ], [ %4, %for.body3 ]
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%cmp = icmp slt i64 %indvars.iv.next89, %.pre-phi
br i1 %cmp, label %for.cond1.preheader, label %for.cond10.preheader, !llvm.loop !13
for.end38: ; preds = %for.inc36.us, %entry, %for.cond10.preheader
%c.0.lcssa = phi i32 [ %0, %for.cond10.preheader ], [ %0, %entry ], [ %c.1.us, %for.inc36.us ]
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp4183 = icmp sgt i32 %7, 0
br i1 %cmp4183, label %for.body42, label %for.end51
for.body42: ; preds = %for.end38, %for.inc49
%8 = phi i32 [ %12, %for.inc49 ], [ %7, %for.end38 ]
%indvars.iv99 = phi i64 [ %10, %for.inc49 ], [ 0, %for.end38 ]
%arrayidx44 = getelementptr inbounds [100 x i32], ptr %b, i64 0, i64 %indvars.iv99
%9 = load i32, ptr %arrayidx44, align 4, !tbaa !5
%cmp45 = icmp eq i32 %9, 0
%10 = add nuw nsw i64 %indvars.iv99, 1
br i1 %cmp45, label %if.then46, label %for.inc49
if.then46: ; preds = %for.body42
%11 = trunc i64 %10 to i32
%call47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc49
for.inc49: ; preds = %for.body42, %if.then46
%12 = phi i32 [ %.pre, %if.then46 ], [ %8, %for.body42 ]
%13 = sext i32 %12 to i64
%cmp41 = icmp slt i64 %10, %13
br i1 %cmp41, label %for.body42, label %for.end51, !llvm.loop !15
for.end51: ; preds = %for.inc49, %for.end38
call void @llvm.lifetime.end.p0(i64 40000, ptr nonnull %a) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
int main(){
int H, A, c = 0;
scanf("%d %d", &H, &A);
while (H > 0) {
H -= A;
c++;
}
printf("%d\n", c);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193547/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193547/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%A = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %A)
%.pr = load i32, ptr %H, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %A, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%c.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%sub = sub nsw i32 %1, %0
%inc = add nuw nsw i32 %c.04, 1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %sub, ptr %H, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%c.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %c.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main(){
int a,b;
int count;
scanf("%d %d",&a,&b);
count=a/b;
if(a%b!=0){
count+=1;
}
printf("%d",count);
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193590/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193590/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%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
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%cmp.not = icmp ne i32 %rem, 0
%add = zext i1 %cmp.not to i32
%spec.select = add nsw i32 %div, %add
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
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 h, a, x=0;
scanf("%d%d",&h,&a);
while(h>0){
h=h-a;
x++;
}
printf("%d\n",x);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193633/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193633/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %a)
%.pr = load i32, ptr %h, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %a, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%x.04 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%sub = sub nsw i32 %1, %0
%inc = add nuw nsw i32 %x.04, 1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %sub, ptr %h, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%x.0.lcssa = phi i32 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %x.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int h, a, n;
scanf("%d %d",&h, &a);
if(h%a==0){
n=(h-h%a)/a;
}
else{
n=(h-h%a)/a+1;
}
printf("%d\n", n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193677/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193677/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %a)
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%rem = srem i32 %0, %1
%cmp = icmp ne i32 %rem, 0
%div = sdiv i32 %0, %1
%add = zext i1 %cmp to i32
%n.0 = add nsw i32 %div, %add
%call5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %n.0)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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()
{
unsigned short H, A, out;
scanf("%hu %hu", &H, &A);
if (H%A ==0)
{
out = H/A;
}
else
{
out = H/A +1;
}
printf("%hu", out);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193727/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193727/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%hu %hu\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%hu\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i16, align 2
%A = alloca i16, align 2
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %A)
%0 = load i16, ptr %H, align 2, !tbaa !5
%1 = load i16, ptr %A, align 2, !tbaa !5
%2 = urem i16 %0, %1
%cmp = icmp ne i16 %2, 0
%div = udiv i16 %0, %1
%add = zext i1 %cmp to i16
%out.0 = add i16 %div, %add
%conv10 = zext i16 %out.0 to i32
%call11 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %conv10)
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main()
{
int H,A,n;
scanf("%d %d",&H,&A);
n=H/A;
if(H%A!=0)
n++;
printf("%d",n);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193770/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193770/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%H = alloca i32, align 4
%A = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %A)
%0 = load i32, ptr %H, align 4, !tbaa !5
%1 = load i32, ptr %A, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%cmp.not = icmp ne i32 %rem, 0
%inc = zext i1 %cmp.not to i32
%spec.select = add nsw i32 %div, %inc
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 H,A,k;
k = 0;
scanf("%d %d", &H,&A);
while(H>0){
H = H - A;
k += 1;
}
printf("%d", k);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193820/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193820/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%H = alloca i32, align 4
%A = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H, ptr noundef nonnull %A)
%.pr = load i32, ptr %H, align 4, !tbaa !5
%cmp3 = icmp sgt i32 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i32, ptr %A, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%k.04 = phi i32 [ 0, %while.body.lr.ph ], [ %add, %while.body ]
%1 = phi i32 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%sub = sub nsw i32 %1, %0
%add = add nuw nsw i32 %k.04, 1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i32 %sub, ptr %H, align 4, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%k.0.lcssa = phi i32 [ %add, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %k.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
int main (){
int h,a;
scanf("%d%d", &h,&a);
for(int i=1; i<=h; i++){
if(a*i>=h){
printf("%d\n", i);
break;
}
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193864/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193864/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %a)
%0 = load i32, ptr %h, align 4, !tbaa !5
%cmp.not9 = icmp slt i32 %0, 1
br i1 %cmp.not9, label %cleanup, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %a, align 4, !tbaa !5
br label %for.body
for.body: ; preds = %for.body.lr.ph, %for.inc
%i.010 = phi i32 [ 1, %for.body.lr.ph ], [ %inc, %for.inc ]
%mul = mul nsw i32 %1, %i.010
%cmp1.not = icmp slt i32 %mul, %0
br i1 %cmp1.not, label %for.inc, label %if.then
if.then: ; preds = %for.body
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %i.010)
br label %cleanup
for.inc: ; preds = %for.body
%inc = add nuw i32 %i.010, 1
%exitcond.not = icmp eq i32 %i.010, %0
br i1 %exitcond.not, label %cleanup, label %for.body, !llvm.loop !9
cleanup: ; preds = %for.inc, %entry, %if.then
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
long int i, j;
long int h, a;
long int count = 0;
scanf("%ld%ld", &h, &a);
while(h > 0) {
count++;
h -= a;
}
printf("%ld\n", count);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193914/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193914/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [7 x i8] c"%ld%ld\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%h = alloca i64, align 8
%a = alloca i64, align 8
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %a)
%.pr = load i64, ptr %h, align 8, !tbaa !5
%cmp3 = icmp sgt i64 %.pr, 0
br i1 %cmp3, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%0 = load i64, ptr %a, align 8, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%count.04 = phi i64 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%1 = phi i64 [ %.pr, %while.body.lr.ph ], [ %sub, %while.body ]
%inc = add nuw nsw i64 %count.04, 1
%sub = sub nsw i64 %1, %0
%cmp = icmp sgt i64 %sub, 0
br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge, !llvm.loop !9
while.cond.while.end_crit_edge: ; preds = %while.body
store i64 %sub, ptr %h, align 8, !tbaa !5
br label %while.end
while.end: ; preds = %while.cond.while.end_crit_edge, %entry
%count.0.lcssa = phi i64 [ %inc, %while.cond.while.end_crit_edge ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %count.0.lcssa)
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
#include<math.h>
int main()
{
int h,a;
scanf("%d%d",&h,&a);
int ans;
ans=h/a;
int yu;
yu=h%a;
if (yu!=0) ++ans;
printf("%d",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_193958/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_193958/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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:
%h = alloca i32, align 4
%a = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %h, ptr noundef nonnull %a)
%0 = load i32, ptr %h, align 4, !tbaa !5
%1 = load i32, ptr %a, align 4, !tbaa !5
%div = sdiv i32 %0, %1
%rem = srem i32 %0, %1
%cmp.not = icmp ne i32 %rem, 0
%inc = zext i1 %cmp.not to i32
%spec.select = add nsw i32 %div, %inc
%call1 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 i,n,j,k;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
a[i]=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{scanf("%d",&k);
if(k==1)
a[i]=1;
if(k==2)
a[j]=1;
if(k==3)
{
a[i]=1;
a[j]=1;
}
}
}
int count=0;
for(i=0;i<n;i++)
{
if(a[i]==0)
count++;
}
printf("%d\n",count);
for(i=0;i<n;i++)
{
if(a[i]==0)
printf("%d ",i+1);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19400/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19400/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@.str.2 = private unnamed_addr constant [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
%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)
%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
%cmp73 = icmp sgt i32 %3, 0
br i1 %cmp73, label %for.cond4.preheader.preheader, label %for.end40
for.cond4.preheader.preheader: ; preds = %entry
%4 = zext i32 %3 to i64
%5 = shl nuw nsw i64 %4, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 %vla, i8 0, i64 %5, i1 false), !tbaa !5
br label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.cond4.preheader.preheader, %for.inc26
%6 = phi i32 [ %3, %for.cond4.preheader.preheader ], [ %20, %for.inc26 ]
%indvars.iv89 = phi i64 [ 0, %for.cond4.preheader.preheader ], [ %indvars.iv.next90, %for.inc26 ]
%cmp575 = icmp sgt i32 %6, 0
br i1 %cmp575, label %for.body6.lr.ph, label %for.cond4.preheader.for.inc26_crit_edge
for.cond4.preheader.for.inc26_crit_edge: ; preds = %for.cond4.preheader
%.pre99 = sext i32 %6 to i64
br label %for.inc26
for.body6.lr.ph: ; preds = %for.cond4.preheader
%arrayidx19 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv89
br label %for.body6
for.cond29.preheader: ; preds = %for.inc26
%cmp3079 = icmp sgt i32 %20, 0
br i1 %cmp3079, label %for.body31.preheader, label %for.end40
for.body31.preheader: ; preds = %for.cond29.preheader
%wide.trip.count = zext i32 %20 to i64
%min.iters.check = icmp ult i32 %20, 8
br i1 %min.iters.check, label %for.body31.preheader109, label %vector.ph
vector.ph: ; preds = %for.body31.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 ], [ %13, %vector.body ]
%vec.phi107 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%7 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load108 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = icmp eq <4 x i32> %wide.load, zeroinitializer
%10 = icmp eq <4 x i32> %wide.load108, zeroinitializer
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %vec.phi, %11
%14 = add <4 x i32> %vec.phi107, %12
%index.next = add nuw i64 %index, 8
%15 = icmp eq i64 %index.next, %n.vec
br i1 %15, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %14, %13
%16 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end40, label %for.body31.preheader109
for.body31.preheader109: ; preds = %for.body31.preheader, %middle.block
%indvars.iv92.ph = phi i64 [ 0, %for.body31.preheader ], [ %n.vec, %middle.block ]
%count.081.ph = phi i32 [ 0, %for.body31.preheader ], [ %16, %middle.block ]
br label %for.body31
for.body6: ; preds = %for.body6.lr.ph, %for.inc23
%indvars.iv = phi i64 [ 0, %for.body6.lr.ph ], [ %indvars.iv.next, %for.inc23 ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%17 = load i32, ptr %k, align 4, !tbaa !5
switch i32 %17, label %for.inc23 [
i32 1, label %for.inc23.sink.split
i32 2, label %if.then12
i32 3, label %if.then17
]
if.then12: ; preds = %for.body6
%arrayidx14 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
br label %for.inc23.sink.split
if.then17: ; preds = %for.body6
store i32 1, ptr %arrayidx19, align 4, !tbaa !5
%arrayidx21 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
br label %for.inc23.sink.split
for.inc23.sink.split: ; preds = %for.body6, %if.then17, %if.then12
%arrayidx14.sink = phi ptr [ %arrayidx14, %if.then12 ], [ %arrayidx21, %if.then17 ], [ %arrayidx19, %for.body6 ]
store i32 1, ptr %arrayidx14.sink, align 4, !tbaa !5
br label %for.inc23
for.inc23: ; preds = %for.inc23.sink.split, %for.body6
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%18 = load i32, ptr %n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %19
br i1 %cmp5, label %for.body6, label %for.inc26, !llvm.loop !13
for.inc26: ; preds = %for.inc23, %for.cond4.preheader.for.inc26_crit_edge
%.pre-phi = phi i64 [ %.pre99, %for.cond4.preheader.for.inc26_crit_edge ], [ %19, %for.inc23 ]
%20 = phi i32 [ %6, %for.cond4.preheader.for.inc26_crit_edge ], [ %18, %for.inc23 ]
%indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
%cmp2 = icmp slt i64 %indvars.iv.next90, %.pre-phi
br i1 %cmp2, label %for.cond4.preheader, label %for.cond29.preheader, !llvm.loop !14
for.body31: ; preds = %for.body31.preheader109, %for.body31
%indvars.iv92 = phi i64 [ %indvars.iv.next93, %for.body31 ], [ %indvars.iv92.ph, %for.body31.preheader109 ]
%count.081 = phi i32 [ %spec.select, %for.body31 ], [ %count.081.ph, %for.body31.preheader109 ]
%arrayidx33 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv92
%21 = load i32, ptr %arrayidx33, align 4, !tbaa !5
%cmp34 = icmp eq i32 %21, 0
%inc36 = zext i1 %cmp34 to i32
%spec.select = add nuw nsw i32 %count.081, %inc36
%indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
%exitcond.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
br i1 %exitcond.not, label %for.end40, label %for.body31, !llvm.loop !16
for.end40: ; preds = %for.body31, %middle.block, %entry, %for.cond29.preheader
%count.0.lcssa = phi i32 [ 0, %for.cond29.preheader ], [ 0, %entry ], [ %16, %middle.block ], [ %spec.select, %for.body31 ]
%call41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %count.0.lcssa)
%22 = load i32, ptr %n, align 4, !tbaa !5
%cmp4383 = icmp sgt i32 %22, 0
br i1 %cmp4383, label %for.body44, label %for.end53
for.body44: ; preds = %for.end40, %for.inc51
%23 = phi i32 [ %27, %for.inc51 ], [ %22, %for.end40 ]
%indvars.iv95 = phi i64 [ %25, %for.inc51 ], [ 0, %for.end40 ]
%arrayidx46 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv95
%24 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%cmp47 = icmp eq i32 %24, 0
%25 = add nuw nsw i64 %indvars.iv95, 1
br i1 %cmp47, label %if.then48, label %for.inc51
if.then48: ; preds = %for.body44
%26 = trunc i64 %25 to i32
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%.pre = load i32, ptr %n, align 4, !tbaa !5
br label %for.inc51
for.inc51: ; preds = %for.body44, %if.then48
%27 = phi i32 [ %.pre, %if.then48 ], [ %23, %for.body44 ]
%28 = sext i32 %27 to i64
%cmp43 = icmp slt i64 %25, %28
br i1 %cmp43, label %for.body44, label %for.end53, !llvm.loop !17
for.end53: ; preds = %for.inc51, %for.end40
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
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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
; 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 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, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
int main(void){
int H,A;
scanf("%d", &H);
scanf("%d", &A);
int i=0;
int num = H;
while(num > 0){
i++;
num = num -A;
}
printf("%d",i);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194043/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194043/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%H = alloca i32, align 4
%A = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %H) #3
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %A) #3
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %H)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %A)
%0 = load i32, ptr %H, align 4, !tbaa !5
%cmp5 = icmp sgt i32 %0, 0
br i1 %cmp5, label %while.body.lr.ph, label %while.end
while.body.lr.ph: ; preds = %entry
%1 = load i32, ptr %A, align 4, !tbaa !5
br label %while.body
while.body: ; preds = %while.body.lr.ph, %while.body
%num.07 = phi i32 [ %0, %while.body.lr.ph ], [ %sub, %while.body ]
%i.06 = phi i32 [ 0, %while.body.lr.ph ], [ %inc, %while.body ]
%inc = add nuw nsw i32 %i.06, 1
%sub = sub nsw i32 %num.07, %1
%cmp = icmp sgt i32 %sub, 0
br i1 %cmp, label %while.body, label %while.end, !llvm.loop !9
while.end: ; preds = %while.body, %entry
%i.0.lcssa = phi i32 [ 0, %entry ], [ %inc, %while.body ]
%call2 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %i.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %A) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %H) #3
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // int64_t
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))
int get_int2(int *a1, int *a2) {
scanf("%d %d", a1, a2);
return 0;
}
struct pair {
int v1;
int v2;
};
#define EDGE_MAX 10000
int main(void) {
int num, k;
get_int2(&num, &k);
struct pair ps[EDGE_MAX];
int pidx = 0;
int mmax = (num-1)*(num-2)/2;
if(k > mmax) {
printf("-1\n");
goto finish;
}
int i, j;
int cnt = mmax;
for(i = 1; i <= num-1; i++) {
ps[pidx++] = (struct pair){i, num};
}
for(i = 1; i <= num-1; i++) {
for(j = i+1; j <= num-1; j++) {
if(cnt == k) goto exist;
ps[pidx++] = (struct pair){i, j};
cnt--;
}
}
exist:
printf("%d\n", pidx);
for(i = 0; i < pidx; i++) {
printf("%d %d\n", ps[i].v1, ps[i].v2);
}
finish:
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194087/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194087/source.c"
target datalayout = "e-m:e-p270: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.pair = type { i32, i32 }
@.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.3 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
@str = private unnamed_addr constant [3 x i8] c"-1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @get_int2(ptr noundef %a1, ptr noundef %a2) local_unnamed_addr #0 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %a1, ptr noundef %a2)
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%num = alloca i32, align 4
%k = alloca i32, align 4
%ps = alloca [10000 x %struct.pair], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %num) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call.i = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %num, ptr noundef nonnull %k)
call void @llvm.lifetime.start.p0(i64 80000, ptr nonnull %ps) #5
%0 = load i32, ptr %num, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%sub1 = add nsw i32 %0, -2
%mul = mul nsw i32 %sub, %sub1
%div = sdiv i32 %mul, 2
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp = icmp sgt i32 %1, %div
br i1 %cmp, label %if.then, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%cmp4.not.not64 = icmp sgt i32 %0, 1
br i1 %cmp4.not.not64, label %for.body.preheader, label %exist.thread
exist.thread: ; preds = %for.cond.preheader
%call2995 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0)
br label %finish
for.body.preheader: ; preds = %for.cond.preheader
%wide.trip.count = zext i32 %sub to i64
%min.iters.check = icmp ult i32 %0, 5
br i1 %min.iters.check, label %for.body.preheader132, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %wide.trip.count, 4294967292
%.cast = trunc i64 %n.vec to i32
%ind.end = or i32 %.cast, 1
%broadcast.splatinsert = insertelement <2 x i32> poison, i32 %0, i64 0
%broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> 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 i32> [ <i32 1, i32 2>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
%2 = or i64 %index, 2
%3 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %index
%4 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %2
%interleaved.vec = shufflevector <2 x i32> %vec.ind, <2 x i32> %broadcast.splat, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec, ptr %3, align 16
%interleaved.vec103 = shufflevector <2 x i32> %step.add, <2 x i32> %broadcast.splat, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec103, ptr %4, align 16
%index.next = add nuw i64 %index, 4
%vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond6.preheader, label %for.body.preheader132
for.body.preheader132: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%i.065.ph = phi i32 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
br label %for.body
if.then: ; preds = %entry
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %finish
for.cond6.preheader: ; preds = %for.body, %middle.block
br i1 %cmp4.not.not64, label %for.body9.preheader, label %exist
for.body9.preheader: ; preds = %for.cond6.preheader
%6 = add i32 %0, -3
br label %for.body9
for.body: ; preds = %for.body.preheader132, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader132 ]
%i.065 = phi i32 [ %inc5, %for.body ], [ %i.065.ph, %for.body.preheader132 ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %indvars.iv
store i32 %i.065, ptr %arrayidx, align 8, !tbaa.struct !13
%.compoundliteral.sroa.2.0.arrayidx.sroa_idx = getelementptr inbounds i8, ptr %arrayidx, i64 4
store i32 %0, ptr %.compoundliteral.sroa.2.0.arrayidx.sroa_idx, align 4, !tbaa.struct !14
%inc5 = add nuw nsw i32 %i.065, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond6.preheader, label %for.body, !llvm.loop !15
for.cond6.loopexit.loopexit: ; preds = %if.end16
%7 = trunc i64 %indvars.iv.next84 to i32
br label %for.cond6.loopexit
for.cond6.loopexit: ; preds = %for.cond6.loopexit.loopexit, %for.body9
%cnt.1.lcssa = phi i32 [ %cnt.074, %for.body9 ], [ %dec, %for.cond6.loopexit.loopexit ]
%pidx.2.lcssa = phi i32 [ %pidx.176, %for.body9 ], [ %7, %for.cond6.loopexit.loopexit ]
%exitcond87.not = icmp eq i32 %add, %0
%indvar.next = add i32 %indvar, 1
br i1 %exitcond87.not, label %exist, label %for.body9, !llvm.loop !16
for.body9: ; preds = %for.body9.preheader, %for.cond6.loopexit
%indvar = phi i32 [ 0, %for.body9.preheader ], [ %indvar.next, %for.cond6.loopexit ]
%pidx.176 = phi i32 [ %sub, %for.body9.preheader ], [ %pidx.2.lcssa, %for.cond6.loopexit ]
%i.175 = phi i32 [ 1, %for.body9.preheader ], [ %add, %for.cond6.loopexit ]
%cnt.074 = phi i32 [ %div, %for.body9.preheader ], [ %cnt.1.lcssa, %for.cond6.loopexit ]
%add = add nuw nsw i32 %i.175, 1
%cmp12.not.not67 = icmp slt i32 %add, %0
br i1 %cmp12.not.not67, label %for.body13.preheader, label %for.cond6.loopexit
for.body13.preheader: ; preds = %for.body9
%8 = sub i32 %6, %indvar
%9 = sext i32 %pidx.176 to i64
%10 = sub i32 %cnt.074, %1
%11 = call i32 @llvm.umin.i32(i32 %8, i32 %10)
%min.iters.check106 = icmp ult i32 %11, 4
br i1 %min.iters.check106, label %for.body13.preheader129, label %vector.ph107
vector.ph107: ; preds = %for.body13.preheader
%umin = zext i32 %11 to i64
%12 = add nuw nsw i64 %umin, 1
%n.mod.vf108 = and i64 %12, 3
%13 = icmp eq i64 %n.mod.vf108, 0
%14 = select i1 %13, i64 4, i64 %n.mod.vf108
%n.vec109 = sub nsw i64 %12, %14
%ind.end110 = add nsw i64 %n.vec109, %9
%.cast112 = trunc i64 %n.vec109 to i32
%ind.end113 = add i32 %add, %.cast112
%.cast115 = trunc i64 %n.vec109 to i32
%ind.end116 = sub i32 %cnt.074, %.cast115
%.splatinsert = insertelement <2 x i32> poison, i32 %add, i64 0
%.splat = shufflevector <2 x i32> %.splatinsert, <2 x i32> poison, <2 x i32> zeroinitializer
%induction = add nuw <2 x i32> %.splat, <i32 0, i32 1>
%broadcast.splatinsert124 = insertelement <2 x i32> poison, i32 %i.175, i64 0
%broadcast.splat125 = shufflevector <2 x i32> %broadcast.splatinsert124, <2 x i32> poison, <2 x i32> zeroinitializer
br label %vector.body118
vector.body118: ; preds = %vector.body118, %vector.ph107
%index119 = phi i64 [ 0, %vector.ph107 ], [ %index.next128, %vector.body118 ]
%vec.ind120 = phi <2 x i32> [ %induction, %vector.ph107 ], [ %vec.ind.next123, %vector.body118 ]
%step.add121 = add <2 x i32> %vec.ind120, <i32 2, i32 2>
%offset.idx = add i64 %index119, %9
%15 = add i64 %offset.idx, 2
%16 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %offset.idx
%17 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %15
%interleaved.vec126 = shufflevector <2 x i32> %broadcast.splat125, <2 x i32> %vec.ind120, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec126, ptr %16, align 8
%interleaved.vec127 = shufflevector <2 x i32> %broadcast.splat125, <2 x i32> %step.add121, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x i32> %interleaved.vec127, ptr %17, align 8
%index.next128 = add nuw i64 %index119, 4
%vec.ind.next123 = add <2 x i32> %vec.ind120, <i32 4, i32 4>
%18 = icmp eq i64 %index.next128, %n.vec109
br i1 %18, label %for.body13.preheader129, label %vector.body118, !llvm.loop !17
for.body13.preheader129: ; preds = %vector.body118, %for.body13.preheader
%indvars.iv83.ph = phi i64 [ %9, %for.body13.preheader ], [ %ind.end110, %vector.body118 ]
%j.069.ph = phi i32 [ %add, %for.body13.preheader ], [ %ind.end113, %vector.body118 ]
%cnt.168.ph = phi i32 [ %cnt.074, %for.body13.preheader ], [ %ind.end116, %vector.body118 ]
br label %for.body13
for.body13: ; preds = %for.body13.preheader129, %if.end16
%indvars.iv83 = phi i64 [ %indvars.iv.next84, %if.end16 ], [ %indvars.iv83.ph, %for.body13.preheader129 ]
%j.069 = phi i32 [ %inc24, %if.end16 ], [ %j.069.ph, %for.body13.preheader129 ]
%cnt.168 = phi i32 [ %dec, %if.end16 ], [ %cnt.168.ph, %for.body13.preheader129 ]
%cmp14 = icmp eq i32 %cnt.168, %1
br i1 %cmp14, label %exist.loopexit, label %if.end16
if.end16: ; preds = %for.body13
%indvars.iv.next84 = add nsw i64 %indvars.iv83, 1
%arrayidx19 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %indvars.iv83
store i32 %i.175, ptr %arrayidx19, align 8, !tbaa.struct !13
%.compoundliteral20.sroa.2.0.arrayidx19.sroa_idx = getelementptr inbounds i8, ptr %arrayidx19, i64 4
store i32 %j.069, ptr %.compoundliteral20.sroa.2.0.arrayidx19.sroa_idx, align 4, !tbaa.struct !14
%dec = add nsw i32 %cnt.168, -1
%inc24 = add nuw i32 %j.069, 1
%exitcond86.not = icmp eq i32 %inc24, %0
br i1 %exitcond86.not, label %for.cond6.loopexit.loopexit, label %for.body13, !llvm.loop !18
exist.loopexit: ; preds = %for.body13
%19 = trunc i64 %indvars.iv83 to i32
br label %exist
exist: ; preds = %for.cond6.loopexit, %exist.loopexit, %for.cond6.preheader
%pidx.3 = phi i32 [ %sub, %for.cond6.preheader ], [ %19, %exist.loopexit ], [ %pidx.2.lcssa, %for.cond6.loopexit ]
%call29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %pidx.3)
%cmp3178 = icmp sgt i32 %pidx.3, 0
br i1 %cmp3178, label %for.body32.preheader, label %finish
for.body32.preheader: ; preds = %exist
%wide.trip.count91 = zext i32 %pidx.3 to i64
br label %for.body32
for.body32: ; preds = %for.body32.preheader, %for.body32
%indvars.iv88 = phi i64 [ 0, %for.body32.preheader ], [ %indvars.iv.next89, %for.body32 ]
%arrayidx34 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %indvars.iv88
%20 = load i32, ptr %arrayidx34, align 8, !tbaa !19
%v238 = getelementptr inbounds [10000 x %struct.pair], ptr %ps, i64 0, i64 %indvars.iv88, i32 1
%21 = load i32, ptr %v238, align 4, !tbaa !21
%call39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %20, i32 noundef %21)
%indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
%exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91
br i1 %exitcond92.not, label %finish, label %for.body32, !llvm.loop !22
finish: ; preds = %for.body32, %exist.thread, %exist, %if.then
call void @llvm.lifetime.end.p0(i64 80000, ptr nonnull %ps) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, 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) #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!14 = !{i64 0, i64 4, !5}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !12, !11}
!19 = !{!20, !6, i64 0}
!20 = !{!"pair", !6, i64 0, !6, i64 4}
!21 = !{!20, !6, i64 4}
!22 = distinct !{!22, !10}
|
#include<stdio.h>
int main(void)
{
//nを入力
int n;
scanf("%d",&n);
//wを入力
int i,w[n];
for(i=0;i<n;i++)
scanf("%d",&w[i]);
int t,s1,s2,sub,ans=100;
for(t=0;t<n;t++){
//s1,s2を初期化
s1 = 0; s2 = 0;
for(i=0;i<n;i++){
//番号がt以下ならs1に加算
if(t>=i)
s1 += w[i];
else
s2 += w[i];
}
//差の絶対値をsubとする
sub = s1-s2;
if(sub<0)
sub = -sub;
//ansを更新
if(sub<ans)
ans = sub;
}
printf("%d\n",ans);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194137/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194137/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp44 = icmp sgt i32 %3, 0
br i1 %cmp44, label %for.body, label %for.end27
for.cond2.preheader: ; preds = %for.body
%cmp352 = icmp sgt i32 %20, 0
br i1 %cmp352, label %for.cond5.preheader.us.preheader, label %for.end27
for.cond5.preheader.us.preheader: ; preds = %for.cond2.preheader
%wide.trip.count64 = zext i32 %20 to i64
%min.iters.check = icmp ult i32 %20, 8
%n.vec = and i64 %wide.trip.count64, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count64
br label %for.cond5.preheader.us
for.cond5.preheader.us: ; preds = %for.cond5.preheader.us.preheader, %for.cond5.for.end16_crit_edge.us
%indvars.iv61 = phi i64 [ 0, %for.cond5.preheader.us.preheader ], [ %indvars.iv.next62, %for.cond5.for.end16_crit_edge.us ]
%ans.054.us = phi i32 [ 100, %for.cond5.preheader.us.preheader ], [ %ans.1.us, %for.cond5.for.end16_crit_edge.us ]
br i1 %min.iters.check, label %for.body7.us.preheader, label %vector.ph
vector.ph: ; preds = %for.cond5.preheader.us
%broadcast.splatinsert = insertelement <4 x i64> poison, i64 %indvars.iv61, i64 0
%broadcast.splat = shufflevector <4 x i64> %broadcast.splatinsert, <4 x i64> poison, <4 x i32> zeroinitializer
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.ind = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %14, %vector.body ]
%vec.phi69 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %15, %vector.body ]
%vec.phi70 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
%vec.phi71 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %11, %vector.body ]
%step.add = add <4 x i64> %vec.ind, <i64 4, i64 4, i64 4, i64 4>
%4 = icmp ult <4 x i64> %broadcast.splat, %vec.ind
%5 = icmp ult <4 x i64> %broadcast.splat, %step.add
%6 = getelementptr inbounds i32, ptr %vla, i64 %index
%wide.load = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load72 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = select <4 x i1> %4, <4 x i32> zeroinitializer, <4 x i32> %wide.load
%9 = select <4 x i1> %5, <4 x i32> zeroinitializer, <4 x i32> %wide.load72
%10 = add <4 x i32> %vec.phi70, %8
%11 = add <4 x i32> %vec.phi71, %9
%12 = select <4 x i1> %4, <4 x i32> %wide.load, <4 x i32> zeroinitializer
%13 = select <4 x i1> %5, <4 x i32> %wide.load72, <4 x i32> zeroinitializer
%14 = add <4 x i32> %vec.phi, %12
%15 = add <4 x i32> %vec.phi69, %13
%index.next = add nuw i64 %index, 8
%vec.ind.next = add <4 x i64> %vec.ind, <i64 8, i64 8, i64 8, i64 8>
%16 = icmp eq i64 %index.next, %n.vec
br i1 %16, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx73 = add <4 x i32> %11, %10
%17 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx73)
%bin.rdx = add <4 x i32> %15, %14
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
br i1 %cmp.n, label %for.cond5.for.end16_crit_edge.us, label %for.body7.us.preheader
for.body7.us.preheader: ; preds = %for.cond5.preheader.us, %middle.block
%indvars.iv58.ph = phi i64 [ 0, %for.cond5.preheader.us ], [ %n.vec, %middle.block ]
%s2.049.us.ph = phi i32 [ 0, %for.cond5.preheader.us ], [ %18, %middle.block ]
%s1.048.us.ph = phi i32 [ 0, %for.cond5.preheader.us ], [ %17, %middle.block ]
br label %for.body7.us
for.body7.us: ; preds = %for.body7.us.preheader, %for.body7.us
%indvars.iv58 = phi i64 [ %indvars.iv.next59, %for.body7.us ], [ %indvars.iv58.ph, %for.body7.us.preheader ]
%s2.049.us = phi i32 [ %s2.1.us, %for.body7.us ], [ %s2.049.us.ph, %for.body7.us.preheader ]
%s1.048.us = phi i32 [ %s1.1.us, %for.body7.us ], [ %s1.048.us.ph, %for.body7.us.preheader ]
%cmp8.not.us = icmp ult i64 %indvars.iv61, %indvars.iv58
%arrayidx12.us = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv58
%19 = load i32, ptr %arrayidx12.us, align 4, !tbaa !5
%add.us = select i1 %cmp8.not.us, i32 0, i32 %19
%s1.1.us = add nsw i32 %s1.048.us, %add.us
%add13.us = select i1 %cmp8.not.us, i32 %19, i32 0
%s2.1.us = add nsw i32 %s2.049.us, %add13.us
%indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
%exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count64
br i1 %exitcond.not, label %for.cond5.for.end16_crit_edge.us, label %for.body7.us, !llvm.loop !13
for.cond5.for.end16_crit_edge.us: ; preds = %for.body7.us, %middle.block
%s1.1.us.lcssa = phi i32 [ %17, %middle.block ], [ %s1.1.us, %for.body7.us ]
%s2.1.us.lcssa = phi i32 [ %18, %middle.block ], [ %s2.1.us, %for.body7.us ]
%sub17.us = sub nsw i32 %s1.1.us.lcssa, %s2.1.us.lcssa
%spec.select.us = call i32 @llvm.abs.i32(i32 %sub17.us, i1 true)
%ans.1.us = call i32 @llvm.smin.i32(i32 %spec.select.us, i32 %ans.054.us)
%indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
%exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count64
br i1 %exitcond65.not, label %for.end27, label %for.cond5.preheader.us, !llvm.loop !14
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%20 = load i32, ptr %n, align 4, !tbaa !5
%21 = sext i32 %20 to i64
%cmp = icmp slt i64 %indvars.iv.next, %21
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !15
for.end27: ; preds = %for.cond5.for.end16_crit_edge.us, %entry, %for.cond2.preheader
%ans.0.lcssa = phi i32 [ 100, %for.cond2.preheader ], [ 100, %entry ], [ %ans.1.us, %for.cond5.for.end16_crit_edge.us ]
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(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
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main(void){
int n;
scanf("%d",&n);
int i,j,t;
int s1=0,s2=0;
int w[n];
int min=1000000;
int tmp;
for(i=0;i<n;i++){
scanf("%d",&w[i]);
}
for(i=0;i<n;i++){
s1=0;
s2=0;
for(j=0;j<i;j++){
s1=s1+w[j];
}
for(j=i;j<n;j++){
s2=s2+w[j];
}
if(s2>s1)
tmp=s2-s1;
else
tmp=s1-s2;
if(tmp<min)
min=tmp;
}
printf("%d",min);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194188/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194188/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp50 = icmp sgt i32 %3, 0
br i1 %cmp50, label %for.body, label %for.end29
for.cond2.preheader: ; preds = %for.body
%cmp360 = icmp sgt i32 %4, 0
br i1 %cmp360, label %for.cond5.preheader.preheader, label %for.end29
for.cond5.preheader.preheader: ; preds = %for.cond2.preheader
%wide.trip.count77 = zext i32 %4 to i64
br label %for.cond5.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.cond2.preheader, !llvm.loop !9
for.cond5.preheader: ; preds = %for.cond5.preheader.preheader, %for.end21
%indvars.iv69 = phi i64 [ 0, %for.cond5.preheader.preheader ], [ %indvars.iv.next70, %for.end21 ]
%min.062 = phi i32 [ 1000000, %for.cond5.preheader.preheader ], [ %min.1, %for.end21 ]
%6 = sub nsw i64 %wide.trip.count77, %indvars.iv69
%cmp652.not = icmp eq i64 %indvars.iv69, 0
br i1 %cmp652.not, label %for.body15.preheader, label %for.body7.preheader
for.body7.preheader: ; preds = %for.cond5.preheader
%min.iters.check85 = icmp ult i64 %indvars.iv69, 8
br i1 %min.iters.check85, label %for.body7.preheader101, label %vector.ph86
vector.ph86: ; preds = %for.body7.preheader
%n.vec88 = and i64 %indvars.iv69, 9223372036854775800
br label %vector.body91
vector.body91: ; preds = %vector.body91, %vector.ph86
%index92 = phi i64 [ 0, %vector.ph86 ], [ %index.next97, %vector.body91 ]
%vec.phi93 = phi <4 x i32> [ zeroinitializer, %vector.ph86 ], [ %9, %vector.body91 ]
%vec.phi94 = phi <4 x i32> [ zeroinitializer, %vector.ph86 ], [ %10, %vector.body91 ]
%7 = getelementptr inbounds i32, ptr %vla, i64 %index92
%wide.load95 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load96 = load <4 x i32>, ptr %8, align 16, !tbaa !5
%9 = add <4 x i32> %wide.load95, %vec.phi93
%10 = add <4 x i32> %wide.load96, %vec.phi94
%index.next97 = add nuw i64 %index92, 8
%11 = icmp eq i64 %index.next97, %n.vec88
br i1 %11, label %middle.block83, label %vector.body91, !llvm.loop !11
middle.block83: ; preds = %vector.body91
%bin.rdx98 = add <4 x i32> %10, %9
%12 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx98)
%cmp.n90 = icmp eq i64 %indvars.iv69, %n.vec88
br i1 %cmp.n90, label %for.body15.preheader, label %for.body7.preheader101
for.body7.preheader101: ; preds = %for.body7.preheader, %middle.block83
%indvars.iv66.ph = phi i64 [ 0, %for.body7.preheader ], [ %n.vec88, %middle.block83 ]
%s1.054.ph = phi i32 [ 0, %for.body7.preheader ], [ %12, %middle.block83 ]
br label %for.body7
for.body15.preheader: ; preds = %for.body7, %middle.block83, %for.cond5.preheader
%s1.0.lcssa = phi i32 [ 0, %for.cond5.preheader ], [ %12, %middle.block83 ], [ %add, %for.body7 ]
%min.iters.check = icmp ult i64 %6, 8
br i1 %min.iters.check, label %for.body15.preheader100, label %vector.ph
vector.ph: ; preds = %for.body15.preheader
%n.vec = and i64 %6, -8
%ind.end = add i64 %indvars.iv69, %n.vec
%13 = getelementptr i32, ptr %vla, i64 %indvars.iv69
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 ], [ %16, %vector.body ]
%vec.phi81 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%14 = getelementptr i32, ptr %13, i64 %index
%wide.load = load <4 x i32>, ptr %14, align 4, !tbaa !5
%15 = getelementptr inbounds i32, ptr %14, i64 4
%wide.load82 = load <4 x i32>, ptr %15, align 4, !tbaa !5
%16 = add <4 x i32> %wide.load, %vec.phi
%17 = add <4 x i32> %wide.load82, %vec.phi81
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %6, %n.vec
br i1 %cmp.n, label %for.end21, label %for.body15.preheader100
for.body15.preheader100: ; preds = %for.body15.preheader, %middle.block
%indvars.iv71.ph = phi i64 [ %indvars.iv69, %for.body15.preheader ], [ %ind.end, %middle.block ]
%s2.058.ph = phi i32 [ 0, %for.body15.preheader ], [ %19, %middle.block ]
br label %for.body15
for.body7: ; preds = %for.body7.preheader101, %for.body7
%indvars.iv66 = phi i64 [ %indvars.iv.next67, %for.body7 ], [ %indvars.iv66.ph, %for.body7.preheader101 ]
%s1.054 = phi i32 [ %add, %for.body7 ], [ %s1.054.ph, %for.body7.preheader101 ]
%arrayidx9 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv66
%20 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%add = add nsw i32 %20, %s1.054
%indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
%exitcond.not = icmp eq i64 %indvars.iv.next67, %indvars.iv69
br i1 %exitcond.not, label %for.body15.preheader, label %for.body7, !llvm.loop !15
for.body15: ; preds = %for.body15.preheader100, %for.body15
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body15 ], [ %indvars.iv71.ph, %for.body15.preheader100 ]
%s2.058 = phi i32 [ %add18, %for.body15 ], [ %s2.058.ph, %for.body15.preheader100 ]
%arrayidx17 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv71
%21 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%add18 = add nsw i32 %21, %s2.058
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count77
br i1 %exitcond75.not, label %for.end21, label %for.body15, !llvm.loop !16
for.end21: ; preds = %for.body15, %middle.block
%add18.lcssa = phi i32 [ %19, %middle.block ], [ %add18, %for.body15 ]
%sub = sub nsw i32 %add18.lcssa, %s1.0.lcssa
%tmp.0 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
%min.1 = call i32 @llvm.smin.i32(i32 %tmp.0, i32 %min.062)
%indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
%exitcond78.not = icmp eq i64 %indvars.iv.next70, %wide.trip.count77
br i1 %exitcond78.not, label %for.end29, label %for.cond5.preheader, !llvm.loop !17
for.end29: ; preds = %for.end21, %entry, %for.cond2.preheader
%min.0.lcssa = phi i32 [ 1000000, %for.cond2.preheader ], [ 1000000, %entry ], [ %min.1, %for.end21 ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %min.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn 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.abs.i32(i32, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10, !13, !12}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int w[n];
for(int i=0;i<n;i++){
scanf("%d",&w[i]);
}
int r_sum,l_sum;
int min=1000000;
int dif;
for(int i=0;i<n-1;i++){
r_sum=0;
l_sum=0;
for(int j=0;j<=i;j++){
r_sum+=w[j];
}
for(int k=i+1;k<n;k++){
l_sum+=w[k];
}
dif=l_sum-r_sum;
if(dif<0){
dif=dif*(-1);
}
if(dif<min){
min=dif;
}
}
printf("%d\n",min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194238/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194238/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp51 = icmp sgt i32 %3, 0
br i1 %cmp51, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp459 = icmp sgt i32 %5, 1
br i1 %cmp459, label %for.cond7.preheader.preheader, label %for.cond.cleanup5
for.cond7.preheader.preheader: ; preds = %for.cond3.preheader
%wide.trip.count75 = zext i32 %5 to i64
%4 = add i32 %5, -2
br label %for.cond7.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond3.preheader, !llvm.loop !9
for.cond7.preheader: ; preds = %for.cond7.preheader.preheader, %for.cond.cleanup19
%indvar = phi i64 [ 0, %for.cond7.preheader.preheader ], [ %indvar.next, %for.cond.cleanup19 ]
%indvars.iv70 = phi i64 [ 1, %for.cond7.preheader.preheader ], [ %indvars.iv.next71, %for.cond.cleanup19 ]
%i2.061 = phi i32 [ 0, %for.cond7.preheader.preheader ], [ %add16, %for.cond.cleanup19 ]
%min.060 = phi i32 [ 1000000, %for.cond7.preheader.preheader ], [ %min.1, %for.cond.cleanup19 ]
%7 = xor i64 %indvar, -1
%8 = add i64 %7, %wide.trip.count75
%min.iters.check85 = icmp ult i64 %indvars.iv70, 8
br i1 %min.iters.check85, label %for.body10.preheader, label %vector.ph86
vector.ph86: ; preds = %for.cond7.preheader
%n.vec88 = and i64 %indvars.iv70, 9223372036854775800
br label %vector.body91
vector.body91: ; preds = %vector.body91, %vector.ph86
%index92 = phi i64 [ 0, %vector.ph86 ], [ %index.next97, %vector.body91 ]
%vec.phi93 = phi <4 x i32> [ zeroinitializer, %vector.ph86 ], [ %11, %vector.body91 ]
%vec.phi94 = phi <4 x i32> [ zeroinitializer, %vector.ph86 ], [ %12, %vector.body91 ]
%9 = getelementptr inbounds i32, ptr %vla, i64 %index92
%wide.load95 = load <4 x i32>, ptr %9, align 16, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load96 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = add <4 x i32> %wide.load95, %vec.phi93
%12 = add <4 x i32> %wide.load96, %vec.phi94
%index.next97 = add nuw i64 %index92, 8
%13 = icmp eq i64 %index.next97, %n.vec88
br i1 %13, label %middle.block83, label %vector.body91, !llvm.loop !11
middle.block83: ; preds = %vector.body91
%bin.rdx98 = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx98)
%cmp.n90 = icmp eq i64 %indvars.iv70, %n.vec88
br i1 %cmp.n90, label %for.cond.cleanup9, label %for.body10.preheader
for.body10.preheader: ; preds = %for.cond7.preheader, %middle.block83
%indvars.iv65.ph = phi i64 [ 0, %for.cond7.preheader ], [ %n.vec88, %middle.block83 ]
%r_sum.053.ph = phi i32 [ 0, %for.cond7.preheader ], [ %14, %middle.block83 ]
br label %for.body10
for.cond.cleanup5: ; preds = %for.cond.cleanup19, %entry, %for.cond3.preheader
%min.0.lcssa = phi i32 [ 1000000, %for.cond3.preheader ], [ 1000000, %entry ], [ %min.1, %for.cond.cleanup19 ]
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
for.cond.cleanup9: ; preds = %for.body10, %middle.block83
%add.lcssa = phi i32 [ %14, %middle.block83 ], [ %add, %for.body10 ]
%add16 = add nuw nsw i32 %i2.061, 1
%cmp1855 = icmp slt i32 %add16, %5
br i1 %cmp1855, label %for.body20.preheader, label %for.cond.cleanup19
for.body20.preheader: ; preds = %for.cond.cleanup9
%min.iters.check = icmp ult i64 %8, 8
br i1 %min.iters.check, label %for.body20.preheader100, label %vector.ph
vector.ph: ; preds = %for.body20.preheader
%n.vec = and i64 %8, -8
%ind.end = add i64 %indvars.iv70, %n.vec
%15 = getelementptr i32, ptr %vla, i64 %indvars.iv70
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.phi81 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%16 = getelementptr i32, ptr %15, i64 %index
%wide.load = load <4 x i32>, ptr %16, align 4, !tbaa !5
%17 = getelementptr inbounds i32, ptr %16, i64 4
%wide.load82 = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = add <4 x i32> %wide.load, %vec.phi
%19 = add <4 x i32> %wide.load82, %vec.phi81
%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 !14
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 %8, %n.vec
br i1 %cmp.n, label %for.cond.cleanup19, label %for.body20.preheader100
for.body20.preheader100: ; preds = %for.body20.preheader, %middle.block
%indvars.iv72.ph = phi i64 [ %indvars.iv70, %for.body20.preheader ], [ %ind.end, %middle.block ]
%l_sum.056.ph = phi i32 [ 0, %for.body20.preheader ], [ %21, %middle.block ]
br label %for.body20
for.body10: ; preds = %for.body10.preheader, %for.body10
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.body10 ], [ %indvars.iv65.ph, %for.body10.preheader ]
%r_sum.053 = phi i32 [ %add, %for.body10 ], [ %r_sum.053.ph, %for.body10.preheader ]
%arrayidx12 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv65
%22 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%add = add nsw i32 %22, %r_sum.053
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%exitcond.not = icmp eq i64 %indvars.iv.next66, %indvars.iv70
br i1 %exitcond.not, label %for.cond.cleanup9, label %for.body10, !llvm.loop !15
for.cond.cleanup19: ; preds = %for.body20, %middle.block, %for.cond.cleanup9
%l_sum.0.lcssa = phi i32 [ 0, %for.cond.cleanup9 ], [ %21, %middle.block ], [ %add23, %for.body20 ]
%sub27 = sub nsw i32 %l_sum.0.lcssa, %add.lcssa
%spec.select = call i32 @llvm.abs.i32(i32 %sub27, i1 true)
%min.1 = call i32 @llvm.smin.i32(i32 %spec.select, i32 %min.060)
%indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
%exitcond78.not = icmp eq i32 %i2.061, %4
%indvar.next = add i64 %indvar, 1
br i1 %exitcond78.not, label %for.cond.cleanup5, label %for.cond7.preheader, !llvm.loop !16
for.body20: ; preds = %for.body20.preheader100, %for.body20
%indvars.iv72 = phi i64 [ %indvars.iv.next73, %for.body20 ], [ %indvars.iv72.ph, %for.body20.preheader100 ]
%l_sum.056 = phi i32 [ %add23, %for.body20 ], [ %l_sum.056.ph, %for.body20.preheader100 ]
%arrayidx22 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv72
%23 = load i32, ptr %arrayidx22, align 4, !tbaa !5
%add23 = add nsw i32 %23, %l_sum.056
%indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
%exitcond76.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count75
br i1 %exitcond76.not, label %for.cond.cleanup19, label %for.body20, !llvm.loop !17
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !13, !12}
|
#include<stdio.h>
#include<stdlib.h>
int max_left(int end, int array[]){
int sum=0;
for(int i=0;i<end;i++){
sum += array[i];
}
return sum;
}
int max_right(int start, int end, int array[])
{
int sum = 0;
for(int i=start;i<end;i++){
sum += array[i];
}
return sum;
}
int main(void){
int n, min;
int w[100];
scanf(" %d",&n);
min = 65536;
for(int i=0;i<n;i++){
scanf(" %d",&w[i]);
}
for(int i=0;i<n-1;i++){
int left = max_left(i+1,w);
int right = max_right(i+1,n,w);
min = min > abs(left-right) ? abs(left-right) : min;
}
printf("%d\n",min);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194281/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194281/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [4 x i8] c" %d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @max_left(i32 noundef %end, ptr nocapture noundef readonly %array) local_unnamed_addr #0 {
entry:
%cmp4 = icmp sgt i32 %end, 0
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %end to i64
%min.iters.check = icmp ult i32 %end, 8
br i1 %min.iters.check, label %for.body.preheader10, 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 ], [ %2, %vector.body ]
%vec.phi8 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%0 = getelementptr inbounds i32, ptr %array, i64 %index
%wide.load = load <4 x i32>, ptr %0, align 4, !tbaa !5
%1 = getelementptr inbounds i32, ptr %0, i64 4
%wide.load9 = load <4 x i32>, ptr %1, align 4, !tbaa !5
%2 = add <4 x i32> %wide.load, %vec.phi
%3 = add <4 x i32> %wide.load9, %vec.phi8
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !9
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %3, %2
%5 = tail 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.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ 0, %for.body.preheader ], [ %n.vec, %middle.block ]
%sum.05.ph = phi i32 [ 0, %for.body.preheader ], [ %5, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %5, %middle.block ], [ %add, %for.body ]
ret i32 %sum.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader10 ]
%sum.05 = phi i32 [ %add, %for.body ], [ %sum.05.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%6 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %6, %sum.05
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body, !llvm.loop !13
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read) uwtable
define dso_local i32 @max_right(i32 noundef %start, i32 noundef %end, ptr nocapture noundef readonly %array) local_unnamed_addr #0 {
entry:
%cmp4 = icmp slt i32 %start, %end
br i1 %cmp4, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%0 = sext i32 %start to i64
%wide.trip.count = sext i32 %end to i64
%1 = sub nsw i64 %wide.trip.count, %0
%min.iters.check = icmp ult i64 %1, 8
br i1 %min.iters.check, label %for.body.preheader10, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = add nsw i64 %n.vec, %0
%invariant.gep = getelementptr i32, ptr %array, 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> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%vec.phi8 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %4, %vector.body ]
%gep = getelementptr i32, ptr %invariant.gep, i64 %index
%wide.load = load <4 x i32>, ptr %gep, align 4, !tbaa !5
%2 = getelementptr inbounds i32, ptr %gep, i64 4
%wide.load9 = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = add <4 x i32> %wide.load, %vec.phi
%4 = add <4 x i32> %wide.load9, %vec.phi8
%index.next = add nuw i64 %index, 8
%5 = icmp eq i64 %index.next, %n.vec
br i1 %5, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %4, %3
%6 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.cond.cleanup, label %for.body.preheader10
for.body.preheader10: ; preds = %for.body.preheader, %middle.block
%indvars.iv.ph = phi i64 [ %0, %for.body.preheader ], [ %ind.end, %middle.block ]
%sum.05.ph = phi i32 [ 0, %for.body.preheader ], [ %6, %middle.block ]
br label %for.body
for.cond.cleanup: ; preds = %for.body, %middle.block, %entry
%sum.0.lcssa = phi i32 [ 0, %entry ], [ %6, %middle.block ], [ %add, %for.body ]
ret i32 %sum.0.lcssa
for.body: ; preds = %for.body.preheader10, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader10 ]
%sum.05 = phi i32 [ %add, %for.body ], [ %sum.05.ph, %for.body.preheader10 ]
%arrayidx = getelementptr inbounds i32, ptr %array, i64 %indvars.iv
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %7, %sum.05
%indvars.iv.next = add 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 @main() local_unnamed_addr #2 {
entry:
%n = alloca i32, align 4
%w = alloca [100 x i32], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #6
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %w) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp35 = icmp sgt i32 %0, 0
br i1 %cmp35, label %for.body, label %for.cond.cleanup5
for.cond3.preheader: ; preds = %for.body
%cmp437 = icmp sgt i32 %1, 1
br i1 %cmp437, label %for.body6.lr.ph, label %for.cond.cleanup5
for.body6.lr.ph: ; preds = %for.cond3.preheader
%sub = add nsw i32 %1, -1
%wide.trip.count.i27 = zext i32 %1 to i64
%wide.trip.count = zext i32 %sub to i64
br label %for.body6
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100 x i32], ptr %w, 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.cond3.preheader, !llvm.loop !16
for.cond.cleanup5: ; preds = %max_right.exit.loopexit, %entry, %for.cond3.preheader
%min.0.lcssa = phi i32 [ 65536, %for.cond3.preheader ], [ 65536, %entry ], [ %.min.0, %max_right.exit.loopexit ]
%call17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %min.0.lcssa)
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %w) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
for.body6: ; preds = %for.body6.lr.ph, %max_right.exit.loopexit
%indvars.iv43 = phi i64 [ 0, %for.body6.lr.ph ], [ %indvars.iv.next44, %max_right.exit.loopexit ]
%min.039 = phi i32 [ 65536, %for.body6.lr.ph ], [ %.min.0, %max_right.exit.loopexit ]
%3 = add nuw i64 %indvars.iv43, 1
%4 = xor i64 %indvars.iv43, -1
%5 = add nsw i64 %4, %wide.trip.count.i27
%indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
%min.iters.check52 = icmp ult i64 %indvars.iv43, 7
br i1 %min.iters.check52, label %for.body.i.preheader, label %vector.ph53
vector.ph53: ; preds = %for.body6
%n.vec55 = and i64 %3, -8
br label %vector.body58
vector.body58: ; preds = %vector.body58, %vector.ph53
%index59 = phi i64 [ 0, %vector.ph53 ], [ %index.next64, %vector.body58 ]
%vec.phi60 = phi <4 x i32> [ zeroinitializer, %vector.ph53 ], [ %8, %vector.body58 ]
%vec.phi61 = phi <4 x i32> [ zeroinitializer, %vector.ph53 ], [ %9, %vector.body58 ]
%6 = getelementptr inbounds i32, ptr %w, i64 %index59
%wide.load62 = load <4 x i32>, ptr %6, align 16, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load63 = load <4 x i32>, ptr %7, align 16, !tbaa !5
%8 = add <4 x i32> %wide.load62, %vec.phi60
%9 = add <4 x i32> %wide.load63, %vec.phi61
%index.next64 = add nuw i64 %index59, 8
%10 = icmp eq i64 %index.next64, %n.vec55
br i1 %10, label %middle.block50, label %vector.body58, !llvm.loop !17
middle.block50: ; preds = %vector.body58
%bin.rdx65 = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx65)
%cmp.n57 = icmp eq i64 %3, %n.vec55
br i1 %cmp.n57, label %max_left.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body6, %middle.block50
%indvars.iv.i.ph = phi i64 [ 0, %for.body6 ], [ %n.vec55, %middle.block50 ]
%sum.05.i.ph = phi i32 [ 0, %for.body6 ], [ %11, %middle.block50 ]
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 ]
%sum.05.i = phi i32 [ %add.i, %for.body.i ], [ %sum.05.i.ph, %for.body.i.preheader ]
%arrayidx.i = getelementptr inbounds i32, ptr %w, i64 %indvars.iv.i
%12 = load i32, ptr %arrayidx.i, align 4, !tbaa !5
%add.i = add nsw i32 %12, %sum.05.i
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.i, %indvars.iv43
br i1 %exitcond.not.i, label %max_left.exit, label %for.body.i, !llvm.loop !18
max_left.exit: ; preds = %for.body.i, %middle.block50
%add.i.lcssa = phi i32 [ %11, %middle.block50 ], [ %add.i, %for.body.i ]
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body.i28.preheader, label %vector.ph
vector.ph: ; preds = %max_left.exit
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv.next44, %n.vec
%13 = getelementptr i32, ptr %w, i64 %indvars.iv.next44
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 ], [ %16, %vector.body ]
%vec.phi48 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %17, %vector.body ]
%14 = getelementptr i32, ptr %13, i64 %index
%wide.load = load <4 x i32>, ptr %14, align 4, !tbaa !5
%15 = getelementptr inbounds i32, ptr %14, i64 4
%wide.load49 = load <4 x i32>, ptr %15, align 4, !tbaa !5
%16 = add <4 x i32> %wide.load, %vec.phi
%17 = add <4 x i32> %wide.load49, %vec.phi48
%index.next = add nuw i64 %index, 8
%18 = icmp eq i64 %index.next, %n.vec
br i1 %18, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %17, %16
%19 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %max_right.exit.loopexit, label %for.body.i28.preheader
for.body.i28.preheader: ; preds = %max_left.exit, %middle.block
%indvars.iv.i29.ph = phi i64 [ %indvars.iv.next44, %max_left.exit ], [ %ind.end, %middle.block ]
%sum.05.i30.ph = phi i32 [ 0, %max_left.exit ], [ %19, %middle.block ]
br label %for.body.i28
for.body.i28: ; preds = %for.body.i28.preheader, %for.body.i28
%indvars.iv.i29 = phi i64 [ %indvars.iv.next.i33, %for.body.i28 ], [ %indvars.iv.i29.ph, %for.body.i28.preheader ]
%sum.05.i30 = phi i32 [ %add.i32, %for.body.i28 ], [ %sum.05.i30.ph, %for.body.i28.preheader ]
%arrayidx.i31 = getelementptr inbounds i32, ptr %w, i64 %indvars.iv.i29
%20 = load i32, ptr %arrayidx.i31, align 4, !tbaa !5
%add.i32 = add nsw i32 %20, %sum.05.i30
%indvars.iv.next.i33 = add nuw nsw i64 %indvars.iv.i29, 1
%exitcond.not.i34 = icmp eq i64 %indvars.iv.next.i33, %wide.trip.count.i27
br i1 %exitcond.not.i34, label %max_right.exit.loopexit, label %for.body.i28, !llvm.loop !20
max_right.exit.loopexit: ; preds = %for.body.i28, %middle.block
%add.i32.lcssa = phi i32 [ %19, %middle.block ], [ %add.i32, %for.body.i28 ]
%sub11 = sub nsw i32 %add.i.lcssa, %add.i32.lcssa
%21 = call i32 @llvm.abs.i32(i32 %sub11, i1 true)
%.min.0 = call i32 @llvm.smin.i32(i32 %min.039, i32 %21)
%exitcond.not = icmp eq i64 %indvars.iv.next44, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup5, label %for.body6, !llvm.loop !21
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; 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 i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5
attributes #0 = { nofree norecurse nosync nounwind memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11, !12}
!18 = distinct !{!18, !10, !12, !11}
!19 = distinct !{!19, !10, !11, !12}
!20 = distinct !{!20, !10, !12, !11}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int N;
int *array;
int S1, S2, ans=1000;
scanf("%d", &N);
array = malloc(N*sizeof(int));
// scanf("%d", &array[0]);
for(int i=0; i < N; i++) {
scanf("%d", &array[i]);
}
for(int i=0; i < N-1; i++) {
// S1とS2の初期化
S1 = 0;
S2 = 0;
// S1とS2を求める
for(int j=0; j < i+1; j++) {
S1 += array[j];
}
for(int k=i+1; k < N; k++) {
S2 += array[k];
}
// ansの更新
if(ans >= abs(S1-S2)) {
ans = abs(S1-S2);
// printf("%dに更新!S1:%d S2:%d\n", i, S1, S2);
}
}
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194331/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194331/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%conv = sext i32 %0 to i64
%mul = shl nsw i64 %conv, 2
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp57 = icmp sgt i32 %0, 0
br i1 %cmp57, label %for.body, label %for.cond.cleanup8
for.cond5.preheader: ; preds = %for.body
%cmp665 = icmp sgt i32 %2, 1
br i1 %cmp665, label %for.cond10.preheader.preheader, label %for.cond.cleanup8
for.cond10.preheader.preheader: ; preds = %for.cond5.preheader
%wide.trip.count81 = zext i32 %2 to i64
%1 = add i32 %2, -2
br label %for.cond10.preheader
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = load i32, ptr %N, align 4, !tbaa !5
%3 = sext i32 %2 to i64
%cmp = icmp slt i64 %indvars.iv.next, %3
br i1 %cmp, label %for.body, label %for.cond5.preheader, !llvm.loop !9
for.cond10.preheader: ; preds = %for.cond10.preheader.preheader, %for.cond.cleanup25
%indvar = phi i64 [ 0, %for.cond10.preheader.preheader ], [ %indvar.next, %for.cond.cleanup25 ]
%indvars.iv76 = phi i64 [ 1, %for.cond10.preheader.preheader ], [ %indvars.iv.next77, %for.cond.cleanup25 ]
%i4.067 = phi i32 [ 0, %for.cond10.preheader.preheader ], [ %add.le, %for.cond.cleanup25 ]
%ans.066 = phi i32 [ 1000, %for.cond10.preheader.preheader ], [ %spec.select, %for.cond.cleanup25 ]
%4 = xor i64 %indvar, -1
%5 = add i64 %4, %wide.trip.count81
%min.iters.check91 = icmp ult i64 %indvars.iv76, 8
br i1 %min.iters.check91, label %for.body14.preheader, label %vector.ph92
vector.ph92: ; preds = %for.cond10.preheader
%n.vec94 = and i64 %indvars.iv76, 9223372036854775800
br label %vector.body97
vector.body97: ; preds = %vector.body97, %vector.ph92
%index98 = phi i64 [ 0, %vector.ph92 ], [ %index.next103, %vector.body97 ]
%vec.phi99 = phi <4 x i32> [ zeroinitializer, %vector.ph92 ], [ %8, %vector.body97 ]
%vec.phi100 = phi <4 x i32> [ zeroinitializer, %vector.ph92 ], [ %9, %vector.body97 ]
%6 = getelementptr inbounds i32, ptr %call1, i64 %index98
%wide.load101 = load <4 x i32>, ptr %6, align 4, !tbaa !5
%7 = getelementptr inbounds i32, ptr %6, i64 4
%wide.load102 = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = add <4 x i32> %wide.load101, %vec.phi99
%9 = add <4 x i32> %wide.load102, %vec.phi100
%index.next103 = add nuw i64 %index98, 8
%10 = icmp eq i64 %index.next103, %n.vec94
br i1 %10, label %middle.block89, label %vector.body97, !llvm.loop !11
middle.block89: ; preds = %vector.body97
%bin.rdx104 = add <4 x i32> %9, %8
%11 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx104)
%cmp.n96 = icmp eq i64 %indvars.iv76, %n.vec94
br i1 %cmp.n96, label %for.cond22.preheader, label %for.body14.preheader
for.body14.preheader: ; preds = %for.cond10.preheader, %middle.block89
%indvars.iv71.ph = phi i64 [ 0, %for.cond10.preheader ], [ %n.vec94, %middle.block89 ]
%S1.059.ph = phi i32 [ 0, %for.cond10.preheader ], [ %11, %middle.block89 ]
br label %for.body14
for.cond.cleanup8: ; preds = %for.cond.cleanup25, %entry, %for.cond5.preheader
%ans.0.lcssa = phi i32 [ 1000, %for.cond5.preheader ], [ 1000, %entry ], [ %spec.select, %for.cond.cleanup25 ]
%call40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #6
ret i32 0
for.cond22.preheader: ; preds = %for.body14, %middle.block89
%add17.lcssa = phi i32 [ %11, %middle.block89 ], [ %add17, %for.body14 ]
%add.le = add nuw nsw i32 %i4.067, 1
%cmp2361 = icmp slt i32 %add.le, %2
br i1 %cmp2361, label %for.body26.preheader, label %for.cond.cleanup25
for.body26.preheader: ; preds = %for.cond22.preheader
%min.iters.check = icmp ult i64 %5, 8
br i1 %min.iters.check, label %for.body26.preheader106, label %vector.ph
vector.ph: ; preds = %for.body26.preheader
%n.vec = and i64 %5, -8
%ind.end = add i64 %indvars.iv76, %n.vec
%12 = getelementptr i32, ptr %call1, i64 %indvars.iv76
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 ], [ %15, %vector.body ]
%vec.phi87 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %16, %vector.body ]
%13 = getelementptr i32, ptr %12, i64 %index
%wide.load = load <4 x i32>, ptr %13, align 4, !tbaa !5
%14 = getelementptr inbounds i32, ptr %13, i64 4
%wide.load88 = load <4 x i32>, ptr %14, align 4, !tbaa !5
%15 = add <4 x i32> %wide.load, %vec.phi
%16 = add <4 x i32> %wide.load88, %vec.phi87
%index.next = add nuw i64 %index, 8
%17 = icmp eq i64 %index.next, %n.vec
br i1 %17, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %16, %15
%18 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %5, %n.vec
br i1 %cmp.n, label %for.cond.cleanup25, label %for.body26.preheader106
for.body26.preheader106: ; preds = %for.body26.preheader, %middle.block
%indvars.iv78.ph = phi i64 [ %indvars.iv76, %for.body26.preheader ], [ %ind.end, %middle.block ]
%S2.062.ph = phi i32 [ 0, %for.body26.preheader ], [ %18, %middle.block ]
br label %for.body26
for.body14: ; preds = %for.body14.preheader, %for.body14
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body14 ], [ %indvars.iv71.ph, %for.body14.preheader ]
%S1.059 = phi i32 [ %add17, %for.body14 ], [ %S1.059.ph, %for.body14.preheader ]
%arrayidx16 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv71
%19 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%add17 = add nsw i32 %19, %S1.059
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%exitcond.not = icmp eq i64 %indvars.iv.next72, %indvars.iv76
br i1 %exitcond.not, label %for.cond22.preheader, label %for.body14, !llvm.loop !15
for.cond.cleanup25: ; preds = %for.body26, %middle.block, %for.cond22.preheader
%S2.0.lcssa = phi i32 [ 0, %for.cond22.preheader ], [ %18, %middle.block ], [ %add29, %for.body26 ]
%sub33 = sub nsw i32 %add17.lcssa, %S2.0.lcssa
%20 = call i32 @llvm.abs.i32(i32 %sub33, i1 true)
%spec.select = call i32 @llvm.smin.i32(i32 %ans.066, i32 %20)
%indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
%exitcond84.not = icmp eq i32 %i4.067, %1
%indvar.next = add i64 %indvar, 1
br i1 %exitcond84.not, label %for.cond.cleanup8, label %for.cond10.preheader, !llvm.loop !16
for.body26: ; preds = %for.body26.preheader106, %for.body26
%indvars.iv78 = phi i64 [ %indvars.iv.next79, %for.body26 ], [ %indvars.iv78.ph, %for.body26.preheader106 ]
%S2.062 = phi i32 [ %add29, %for.body26 ], [ %S2.062.ph, %for.body26.preheader106 ]
%arrayidx28 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv78
%21 = load i32, ptr %arrayidx28, align 4, !tbaa !5
%add29 = add nsw i32 %21, %S2.062
%indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
%exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count81
br i1 %exitcond82.not, label %for.cond.cleanup25, label %for.body26, !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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: 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 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 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !12, !13}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !13, !12}
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100001
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int main() {
int N,i,ans=INF;
scanf("%d",&N);
int W[N],a[N],b[N];
FOR(i,0,N)scanf("%d",&W[i]);
a[0]=W[0];b[N-1]=W[N-1];
FOR(i,0,N-1)a[i+1]=a[i]+W[i+1];
FOR(i,0,N-1)b[N-i-2]=b[N-i-1]+W[N-i-2];
FOR(i,0,N-1)if(ans>abs(b[i+1]-a[i]))ans=abs(b[i+1]-a[i]);
printf("%d\n",ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194375/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194375/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @swap(ptr nocapture noundef %a, ptr nocapture noundef %b) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
store i32 %1, ptr %a, align 4, !tbaa !5
store i32 %0, ptr %b, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local i32 @cmp(ptr nocapture noundef readonly %a, ptr nocapture noundef readonly %b) local_unnamed_addr #2 {
entry:
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%sub = sub nsw i32 %0, %1
ret i32 %sub
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%N = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %N) #8
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %N)
%0 = load i32, ptr %N, align 4, !tbaa !5
%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
%cmp86 = icmp sgt i32 %3, 0
br i1 %cmp86, label %for.body, label %for.end65
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, ptr noundef nonnull %arrayidx)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr %N, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body
%.pre = load i32, ptr %vla, align 16, !tbaa !5
store i32 %.pre, ptr %vla1, align 16, !tbaa !5
%sub = add nsw i32 %5, -1
%idxprom6 = sext i32 %sub to i64
%arrayidx7 = getelementptr inbounds i32, ptr %vla, i64 %idxprom6
%7 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%arrayidx10 = getelementptr inbounds i32, ptr %vla2, i64 %idxprom6
store i32 %7, ptr %arrayidx10, align 4, !tbaa !5
%cmp1388 = icmp sgt i32 %5, 1
br i1 %cmp1388, label %for.body14.preheader, label %for.end65
for.body14.preheader: ; preds = %for.end
%wide.trip.count = zext i32 %sub to i64
%8 = add nsw i64 %wide.trip.count, -1
%xtraiter = and i64 %wide.trip.count, 3
%9 = icmp ult i64 %8, 3
br i1 %9, label %for.cond26.preheader.unr-lcssa, label %for.body14.preheader.new
for.body14.preheader.new: ; preds = %for.body14.preheader
%unroll_iter = and i64 %wide.trip.count, 4294967292
br label %for.body14
for.cond26.preheader.unr-lcssa: ; preds = %for.body14, %for.body14.preheader
%.unr = phi i32 [ %.pre, %for.body14.preheader ], [ %add19.3, %for.body14 ]
%indvars.iv98.unr = phi i64 [ 0, %for.body14.preheader ], [ %indvars.iv.next99.3, %for.body14 ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond26.preheader, label %for.body14.epil
for.body14.epil: ; preds = %for.cond26.preheader.unr-lcssa, %for.body14.epil
%10 = phi i32 [ %add19.epil, %for.body14.epil ], [ %.unr, %for.cond26.preheader.unr-lcssa ]
%indvars.iv98.epil = phi i64 [ %indvars.iv.next99.epil, %for.body14.epil ], [ %indvars.iv98.unr, %for.cond26.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body14.epil ], [ 0, %for.cond26.preheader.unr-lcssa ]
%indvars.iv.next99.epil = add nuw nsw i64 %indvars.iv98.epil, 1
%arrayidx18.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next99.epil
%11 = load i32, ptr %arrayidx18.epil, align 4, !tbaa !5
%add19.epil = add nsw i32 %11, %10
%arrayidx22.epil = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next99.epil
store i32 %add19.epil, ptr %arrayidx22.epil, align 4, !tbaa !5
%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.cond26.preheader, label %for.body14.epil, !llvm.loop !11
for.cond26.preheader: ; preds = %for.body14.epil, %for.cond26.preheader.unr-lcssa
br i1 %cmp1388, label %for.body29.preheader, label %for.end65
for.body29.preheader: ; preds = %for.cond26.preheader
%12 = zext i32 %5 to i64
%scevgep = getelementptr i8, ptr %vla2, i64 -4
%13 = shl nuw nsw i64 %12, 2
%scevgep134 = getelementptr i8, ptr %scevgep, i64 %13
%load_initial = load i32, ptr %scevgep134, align 4
%xtraiter138 = and i64 %wide.trip.count, 1
%14 = icmp eq i64 %8, 0
br i1 %14, label %for.cond46.preheader.unr-lcssa, label %for.body29.preheader.new
for.body29.preheader.new: ; preds = %for.body29.preheader
%unroll_iter141 = and i64 %wide.trip.count, 4294967294
br label %for.body29
for.body14: ; preds = %for.body14, %for.body14.preheader.new
%15 = phi i32 [ %.pre, %for.body14.preheader.new ], [ %add19.3, %for.body14 ]
%indvars.iv98 = phi i64 [ 0, %for.body14.preheader.new ], [ %indvars.iv.next99.3, %for.body14 ]
%niter = phi i64 [ 0, %for.body14.preheader.new ], [ %niter.next.3, %for.body14 ]
%indvars.iv.next99 = or i64 %indvars.iv98, 1
%arrayidx18 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next99
%16 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%add19 = add nsw i32 %16, %15
%arrayidx22 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next99
store i32 %add19, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next99.1 = or i64 %indvars.iv98, 2
%arrayidx18.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next99.1
%17 = load i32, ptr %arrayidx18.1, align 8, !tbaa !5
%add19.1 = add nsw i32 %17, %add19
%arrayidx22.1 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next99.1
store i32 %add19.1, ptr %arrayidx22.1, align 8, !tbaa !5
%indvars.iv.next99.2 = or i64 %indvars.iv98, 3
%arrayidx18.2 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next99.2
%18 = load i32, ptr %arrayidx18.2, align 4, !tbaa !5
%add19.2 = add nsw i32 %18, %add19.1
%arrayidx22.2 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next99.2
store i32 %add19.2, ptr %arrayidx22.2, align 4, !tbaa !5
%indvars.iv.next99.3 = add nuw nsw i64 %indvars.iv98, 4
%arrayidx18.3 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next99.3
%19 = load i32, ptr %arrayidx18.3, align 16, !tbaa !5
%add19.3 = add nsw i32 %19, %add19.2
%arrayidx22.3 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv.next99.3
store i32 %add19.3, ptr %arrayidx22.3, align 16, !tbaa !5
%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.cond26.preheader.unr-lcssa, label %for.body14, !llvm.loop !13
for.cond46.preheader.unr-lcssa: ; preds = %for.body29, %for.body29.preheader
%store_forwarded.unr = phi i32 [ %load_initial, %for.body29.preheader ], [ %add38.1, %for.body29 ]
%indvars.iv101.unr = phi i64 [ 0, %for.body29.preheader ], [ %indvars.iv.next102.1, %for.body29 ]
%lcmp.mod140.not = icmp eq i64 %xtraiter138, 0
br i1 %lcmp.mod140.not, label %for.cond46.preheader, label %for.body29.epil
for.body29.epil: ; preds = %for.cond46.preheader.unr-lcssa
%20 = sub nsw i64 %12, %indvars.iv101.unr
%21 = add nsw i64 %20, -2
%arrayidx37.epil = getelementptr inbounds i32, ptr %vla, i64 %21
%22 = load i32, ptr %arrayidx37.epil, align 4, !tbaa !5
%add38.epil = add nsw i32 %22, %store_forwarded.unr
%arrayidx42.epil = getelementptr inbounds i32, ptr %vla2, i64 %21
store i32 %add38.epil, ptr %arrayidx42.epil, align 4, !tbaa !5
br label %for.cond46.preheader
for.cond46.preheader: ; preds = %for.cond46.preheader.unr-lcssa, %for.body29.epil
br i1 %cmp1388, label %for.body49.preheader, label %for.end65
for.body49.preheader: ; preds = %for.cond46.preheader
%wide.trip.count112 = zext i32 %sub to i64
%min.iters.check = icmp ult i32 %5, 9
br i1 %min.iters.check, label %for.body49.preheader135, label %vector.ph
vector.ph: ; preds = %for.body49.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> [ <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824>, %vector.ph ], [ %32, %vector.body ]
%vec.phi130 = phi <4 x i32> [ <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824>, %vector.ph ], [ %33, %vector.body ]
%23 = or i64 %index, 1
%24 = getelementptr inbounds i32, ptr %vla2, i64 %23
%wide.load = load <4 x i32>, ptr %24, align 4, !tbaa !5
%25 = getelementptr inbounds i32, ptr %24, i64 4
%wide.load131 = load <4 x i32>, ptr %25, align 4, !tbaa !5
%26 = getelementptr inbounds i32, ptr %vla1, i64 %index
%wide.load132 = load <4 x i32>, ptr %26, align 16, !tbaa !5
%27 = getelementptr inbounds i32, ptr %26, i64 4
%wide.load133 = load <4 x i32>, ptr %27, align 16, !tbaa !5
%28 = sub nsw <4 x i32> %wide.load, %wide.load132
%29 = sub nsw <4 x i32> %wide.load131, %wide.load133
%30 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %28, i1 true)
%31 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> %29, i1 true)
%32 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> %30)
%33 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi130, <4 x i32> %31)
%index.next = add nuw i64 %index, 8
%34 = icmp eq i64 %index.next, %n.vec
br i1 %34, label %middle.block, label %vector.body, !llvm.loop !14
middle.block: ; preds = %vector.body
%rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %32, <4 x i32> %33)
%35 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.end65, label %for.body49.preheader135
for.body49.preheader135: ; preds = %for.body49.preheader, %middle.block
%indvars.iv109.ph = phi i64 [ 0, %for.body49.preheader ], [ %n.vec, %middle.block ]
%ans.093.ph = phi i32 [ 1073741824, %for.body49.preheader ], [ %35, %middle.block ]
br label %for.body49
for.body29: ; preds = %for.body29, %for.body29.preheader.new
%store_forwarded = phi i32 [ %load_initial, %for.body29.preheader.new ], [ %add38.1, %for.body29 ]
%indvars.iv101 = phi i64 [ 0, %for.body29.preheader.new ], [ %indvars.iv.next102.1, %for.body29 ]
%niter142 = phi i64 [ 0, %for.body29.preheader.new ], [ %niter142.next.1, %for.body29 ]
%36 = sub nsw i64 %12, %indvars.iv101
%37 = add nsw i64 %36, -2
%arrayidx37 = getelementptr inbounds i32, ptr %vla, i64 %37
%38 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%add38 = add nsw i32 %38, %store_forwarded
%arrayidx42 = getelementptr inbounds i32, ptr %vla2, i64 %37
store i32 %add38, ptr %arrayidx42, align 4, !tbaa !5
%indvars.iv.next102.neg = xor i64 %indvars.iv101, -1
%39 = add nsw i64 %indvars.iv.next102.neg, %12
%40 = add nsw i64 %39, -2
%arrayidx37.1 = getelementptr inbounds i32, ptr %vla, i64 %40
%41 = load i32, ptr %arrayidx37.1, align 4, !tbaa !5
%add38.1 = add nsw i32 %41, %add38
%arrayidx42.1 = getelementptr inbounds i32, ptr %vla2, i64 %40
store i32 %add38.1, ptr %arrayidx42.1, align 4, !tbaa !5
%indvars.iv.next102.1 = add nuw nsw i64 %indvars.iv101, 2
%niter142.next.1 = add i64 %niter142, 2
%niter142.ncmp.1 = icmp eq i64 %niter142.next.1, %unroll_iter141
br i1 %niter142.ncmp.1, label %for.cond46.preheader.unr-lcssa, label %for.body29, !llvm.loop !17
for.body49: ; preds = %for.body49.preheader135, %for.body49
%indvars.iv109 = phi i64 [ %indvars.iv.next110, %for.body49 ], [ %indvars.iv109.ph, %for.body49.preheader135 ]
%ans.093 = phi i32 [ %spec.select, %for.body49 ], [ %ans.093.ph, %for.body49.preheader135 ]
%indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
%arrayidx52 = getelementptr inbounds i32, ptr %vla2, i64 %indvars.iv.next110
%42 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%arrayidx54 = getelementptr inbounds i32, ptr %vla1, i64 %indvars.iv109
%43 = load i32, ptr %arrayidx54, align 4, !tbaa !5
%sub55 = sub nsw i32 %42, %43
%44 = call i32 @llvm.abs.i32(i32 %sub55, i1 true)
%spec.select = call i32 @llvm.smin.i32(i32 %ans.093, i32 %44)
%exitcond113.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count112
br i1 %exitcond113.not, label %for.end65, label %for.body49, !llvm.loop !18
for.end65: ; preds = %for.body49, %middle.block, %entry, %for.end, %for.cond26.preheader, %for.cond46.preheader
%ans.0.lcssa = phi i32 [ 1073741824, %for.cond46.preheader ], [ 1073741824, %for.cond26.preheader ], [ 1073741824, %for.end ], [ 1073741824, %entry ], [ %35, %middle.block ], [ %spec.select, %for.body49 ]
%call66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %N) #8
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5
; Function Attrs: mustprogress nocallback nofree nosync nounwind 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 #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.abs.v4i32(<4 x i32>, i1 immarg) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #7
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smin.v4i32(<4 x i32>) #7
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 = !{!"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, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !16, !15}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int MIN(int A,int B){
return A<B?A:B;
}
int MAX(int A,int B){
return A>B?A:B;
}
int main(void){
int n,sum=0;
scanf("%d",&n);
int w[n];
for (int i=0; i<n; i++){
scanf("%d",&w[i]);
sum+=w[i];
}
int ans=1e9,sum2=0;
for (int i=0; i<n-1; i++){
sum2+=w[i];
ans=MIN(abs((sum-sum2)-sum2),ans);
}
printf("%d\n",ans);
return 0 ;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194418/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194418/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @MIN(i32 noundef %A, i32 noundef %B) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smin.i32(i32 %A, i32 %B)
ret i32 %cond
}
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @MAX(i32 noundef %A, i32 noundef %B) local_unnamed_addr #0 {
entry:
%cond = tail call i32 @llvm.smax.i32(i32 %A, i32 %B)
ret i32 %cond
}
; 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) #7
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = call ptr @llvm.stacksave.p0()
%vla = alloca i32, i64 %1, align 16
%3 = load i32, ptr %n, align 4, !tbaa !5
%cmp28 = icmp sgt i32 %3, 0
br i1 %cmp28, label %for.body, label %for.cond.cleanup7
for.cond5.preheader: ; preds = %for.body
%cmp632 = icmp sgt i32 %6, 1
br i1 %cmp632, label %for.body8.preheader, label %for.cond.cleanup7
for.body8.preheader: ; preds = %for.cond5.preheader
%sub = add nsw i32 %6, -1
%wide.trip.count = zext i32 %sub to i64
%xtraiter = and i64 %wide.trip.count, 1
%4 = icmp eq i32 %sub, 1
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 i64 %wide.trip.count, 4294967294
br label %for.body8
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%sum.029 = phi i32 [ %add, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%5 = load i32, ptr %arrayidx, align 4, !tbaa !5
%add = add nsw i32 %5, %sum.029
%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.cond5.preheader, !llvm.loop !9
for.cond.cleanup7.loopexit.unr-lcssa: ; preds = %for.body8, %for.body8.preheader
%cond.i.lcssa.ph = phi i32 [ undef, %for.body8.preheader ], [ %cond.i.1, %for.body8 ]
%indvars.iv39.unr = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next40.1, %for.body8 ]
%sum2.034.unr = phi i32 [ 0, %for.body8.preheader ], [ %add11.1, %for.body8 ]
%ans.033.unr = phi i32 [ 1000000000, %for.body8.preheader ], [ %cond.i.1, %for.body8 ]
%lcmp.mod.not = icmp eq i64 %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
%arrayidx10.epil = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39.unr
%8 = load i32, ptr %arrayidx10.epil, align 4, !tbaa !5
%add11.epil = add nsw i32 %8, %sum2.034.unr
%9 = shl i32 %add11.epil, 1
%sub13.epil = sub i32 %add, %9
%10 = call i32 @llvm.abs.i32(i32 %sub13.epil, i1 true)
%cond.i.epil = call i32 @llvm.smin.i32(i32 %10, i32 %ans.033.unr)
br label %for.cond.cleanup7
for.cond.cleanup7: ; preds = %for.body8.epil, %for.cond.cleanup7.loopexit.unr-lcssa, %entry, %for.cond5.preheader
%ans.0.lcssa = phi i32 [ 1000000000, %for.cond5.preheader ], [ 1000000000, %entry ], [ %cond.i.lcssa.ph, %for.cond.cleanup7.loopexit.unr-lcssa ], [ %cond.i.epil, %for.body8.epil ]
%call18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %ans.0.lcssa)
call void @llvm.stackrestore.p0(ptr %2)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #7
ret i32 0
for.body8: ; preds = %for.body8, %for.body8.preheader.new
%indvars.iv39 = phi i64 [ 0, %for.body8.preheader.new ], [ %indvars.iv.next40.1, %for.body8 ]
%sum2.034 = phi i32 [ 0, %for.body8.preheader.new ], [ %add11.1, %for.body8 ]
%ans.033 = phi i32 [ 1000000000, %for.body8.preheader.new ], [ %cond.i.1, %for.body8 ]
%niter = phi i64 [ 0, %for.body8.preheader.new ], [ %niter.next.1, %for.body8 ]
%arrayidx10 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv39
%11 = load i32, ptr %arrayidx10, align 8, !tbaa !5
%add11 = add nsw i32 %11, %sum2.034
%12 = shl i32 %add11, 1
%sub13 = sub i32 %add, %12
%13 = call i32 @llvm.abs.i32(i32 %sub13, i1 true)
%cond.i = call i32 @llvm.smin.i32(i32 %13, i32 %ans.033)
%indvars.iv.next40 = or i64 %indvars.iv39, 1
%arrayidx10.1 = getelementptr inbounds i32, ptr %vla, i64 %indvars.iv.next40
%14 = load i32, ptr %arrayidx10.1, align 4, !tbaa !5
%add11.1 = add nsw i32 %14, %add11
%15 = shl i32 %add11.1, 1
%sub13.1 = sub i32 %add, %15
%16 = call i32 @llvm.abs.i32(i32 %sub13.1, i1 true)
%cond.i.1 = call i32 @llvm.smin.i32(i32 %16, i32 %cond.i)
%indvars.iv.next40.1 = add nuw nsw i64 %indvars.iv39, 2
%niter.next.1 = add i64 %niter, 2
%niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
br i1 %niter.ncmp.1, label %for.cond.cleanup7.loopexit.unr-lcssa, label %for.body8, !llvm.loop !11
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 i32 @llvm.smin.i32(i32, i32) #6
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6
attributes #0 = { mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include <stdio.h>
#include <stdlib.h>
#define tetra(N) N*(N+1)*(N+2)/6
#define isEven(N) N%2==0
#define N_MAX 1000000
int main(int argc, char* argv[]){
int *min=malloc((N_MAX+1)*sizeof(int)), *minOdd=malloc((N_MAX+1)*sizeof(int)), i, n;
/* initialize */
for(i=1; i<=N_MAX; i++) min[i]=-1, minOdd[i]=-1;
/* problem 1 */
for(i=1; tetra(i)<=N_MAX; i++) min[tetra(i)]=1;
for(i=1; i<=N_MAX; i++){
int j, minLocal=N_MAX;
if(min[i]!=-1) continue;
for(j=1; i-tetra(j)>0; j++)
if(min[i-tetra(j)]!=-1 && min[i-tetra(j)]+1<minLocal) minLocal=min[i-tetra(j)]+1;
if(minLocal!=N_MAX) min[i]=minLocal;
}
/* problem 2 */
for(i=1; tetra(i)<=N_MAX; i++){
if(isEven(tetra(i))) continue;
minOdd[tetra(i)]=1;
}
for(i=1; i<=N_MAX; i++){
int j, minLocal=N_MAX;
if(minOdd[i]!=-1) continue;
for(j=1; i-tetra(j)>0; j++){
if(isEven(tetra(j))) continue;
if(minOdd[i-tetra(j)]!=-1 && minOdd[i-tetra(j)]+1<minLocal) minLocal=minOdd[i-tetra(j)]+1;
}
if(minLocal!=N_MAX) minOdd[i]=minLocal;
}
while(scanf("%d",&n), n!=0) printf("%d %d\n",min[n],minOdd[n]);
free(min), free(minOdd);
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194469/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194469/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%call = tail call noalias dereferenceable_or_null(4000004) ptr @malloc(i64 noundef 4000004) #7
%call1 = tail call noalias dereferenceable_or_null(4000004) ptr @malloc(i64 noundef 4000004) #7
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #8
%scevgep = getelementptr i8, ptr %call, i64 4
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(4000000) %scevgep, i8 -1, i64 4000000, i1 false), !tbaa !5
%scevgep289 = getelementptr i8, ptr %call1, i64 4
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(4000000) %scevgep289, i8 -1, i64 4000000, i1 false), !tbaa !5
br label %for.body8
for.body8: ; preds = %entry, %for.body8
%mul6270 = phi i32 [ %mul6, %for.body8 ], [ 6, %entry ]
%add269 = phi i32 [ %add, %for.body8 ], [ 2, %entry ]
%div = udiv i32 %mul6270, 6
%idxprom14 = zext i32 %div to i64
%arrayidx15 = getelementptr inbounds i32, ptr %call, i64 %idxprom14
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
%add = add nuw nsw i32 %add269, 1
%mul = mul nsw i32 %add, %add269
%add5 = add nuw nsw i32 %add269, 2
%mul6 = mul nsw i32 %mul, %add5
%cmp7 = icmp ult i32 %mul6, 6000006
br i1 %cmp7, label %for.body8, label %for.body21, !llvm.loop !9
for.body21: ; preds = %for.body8, %cleanup
%indvars.iv = phi i64 [ %indvars.iv.next, %cleanup ], [ 1, %for.body8 ]
%arrayidx23 = getelementptr inbounds i32, ptr %call, i64 %indvars.iv
%0 = load i32, ptr %arrayidx23, align 4, !tbaa !5
%cmp24.not = icmp eq i32 %0, -1
%cmp31272 = icmp ugt i64 %indvars.iv, 1
%or.cond = and i1 %cmp24.not, %cmp31272
br i1 %or.cond, label %for.body32.preheader, label %cleanup
for.body32.preheader: ; preds = %for.body21
%1 = trunc i64 %indvars.iv to i32
%2 = add i32 %1, -1
%3 = trunc i64 %indvars.iv to i32
br label %for.body32
for.body32: ; preds = %for.body32.preheader, %for.body32
%sub275 = phi i32 [ %sub, %for.body32 ], [ %2, %for.body32.preheader ]
%add26274 = phi i32 [ %add26, %for.body32 ], [ 2, %for.body32.preheader ]
%minLocal.0273 = phi i32 [ %minLocal.1, %for.body32 ], [ 1000000, %for.body32.preheader ]
%idxprom39 = zext i32 %sub275 to i64
%arrayidx40 = getelementptr inbounds i32, ptr %call, i64 %idxprom39
%4 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cmp41.not = icmp eq i32 %4, -1
%add50 = add nuw nsw i32 %4, 1
%spec.select = tail call i32 @llvm.smin.i32(i32 %add50, i32 %minLocal.0273)
%minLocal.1 = select i1 %cmp41.not, i32 %minLocal.0273, i32 %spec.select
%add26 = add nuw nsw i32 %add26274, 1
%mul27 = mul nsw i32 %add26, %add26274
%add28 = add nuw nsw i32 %add26274, 2
%mul29 = mul nsw i32 %mul27, %add28
%div30 = udiv i32 %mul29, 6
%sub = sub nsw i32 %3, %div30
%cmp31 = icmp sgt i32 %sub, 0
br i1 %cmp31, label %for.body32, label %for.end65, !llvm.loop !11
for.end65: ; preds = %for.body32
%cmp66.not = icmp eq i32 %minLocal.1, 1000000
br i1 %cmp66.not, label %cleanup, label %if.then67
if.then67: ; preds = %for.end65
store i32 %minLocal.1, ptr %arrayidx23, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %for.end65, %if.then67, %for.body21
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, 1000001
br i1 %exitcond.not, label %for.body82, label %for.body21, !llvm.loop !12
for.body82: ; preds = %cleanup, %for.inc98
%div80278 = phi i32 [ %div80, %for.inc98 ], [ 1, %cleanup ]
%add76277 = phi i32 [ %add76, %for.inc98 ], [ 2, %cleanup ]
%rem = and i32 %div80278, 1
%cmp88 = icmp eq i32 %rem, 0
br i1 %cmp88, label %for.inc98, label %if.end90
if.end90: ; preds = %for.body82
%idxprom96 = zext i32 %div80278 to i64
%arrayidx97 = getelementptr inbounds i32, ptr %call1, i64 %idxprom96
store i32 1, ptr %arrayidx97, align 4, !tbaa !5
br label %for.inc98
for.inc98: ; preds = %for.body82, %if.end90
%add76 = add nuw nsw i32 %add76277, 1
%mul77 = mul nsw i32 %add76, %add76277
%add78 = add nuw nsw i32 %add76277, 2
%mul79 = mul nsw i32 %mul77, %add78
%div80 = udiv i32 %mul79, 6
%cmp81 = icmp ult i32 %mul79, 6000006
br i1 %cmp81, label %for.body82, label %for.body103, !llvm.loop !13
while.cond.preheader: ; preds = %cleanup168
%call175287 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%5 = load i32, ptr %n, align 4, !tbaa !5
%cmp176.not288 = icmp eq i32 %5, 0
br i1 %cmp176.not288, label %while.end, label %while.body
for.body103: ; preds = %for.inc98, %cleanup168
%indvars.iv293 = phi i64 [ %indvars.iv.next294, %cleanup168 ], [ 1, %for.inc98 ]
%arrayidx107 = getelementptr inbounds i32, ptr %call1, i64 %indvars.iv293
%6 = load i32, ptr %arrayidx107, align 4, !tbaa !5
%cmp108.not = icmp eq i32 %6, -1
%cmp118280 = icmp ugt i64 %indvars.iv293, 1
%or.cond302 = and i1 %cmp108.not, %cmp118280
br i1 %or.cond302, label %for.body119.preheader, label %cleanup168
for.body119.preheader: ; preds = %for.body103
%7 = trunc i64 %indvars.iv293 to i32
%8 = add i32 %7, -1
%9 = trunc i64 %indvars.iv293 to i32
br label %for.body119
for.body119: ; preds = %for.body119.preheader, %for.inc160
%sub117284 = phi i32 [ %sub117, %for.inc160 ], [ %8, %for.body119.preheader ]
%div116283 = phi i32 [ %div116, %for.inc160 ], [ 1, %for.body119.preheader ]
%add112282 = phi i32 [ %add112, %for.inc160 ], [ 2, %for.body119.preheader ]
%minLocal105.0281 = phi i32 [ %minLocal105.1, %for.inc160 ], [ 1000000, %for.body119.preheader ]
%rem125 = and i32 %div116283, 1
%cmp126 = icmp eq i32 %rem125, 0
br i1 %cmp126, label %for.inc160, label %if.end128
if.end128: ; preds = %for.body119
%idxprom135 = zext i32 %sub117284 to i64
%arrayidx136 = getelementptr inbounds i32, ptr %call1, i64 %idxprom135
%10 = load i32, ptr %arrayidx136, align 4, !tbaa !5
%cmp137.not = icmp eq i32 %10, -1
br i1 %cmp137.not, label %for.inc160, label %land.lhs.true138
land.lhs.true138: ; preds = %if.end128
%add147 = add nuw nsw i32 %10, 1
%spec.select267 = tail call i32 @llvm.smin.i32(i32 %add147, i32 %minLocal105.0281)
br label %for.inc160
for.inc160: ; preds = %land.lhs.true138, %if.end128, %for.body119
%minLocal105.1 = phi i32 [ %minLocal105.0281, %for.body119 ], [ %minLocal105.0281, %if.end128 ], [ %spec.select267, %land.lhs.true138 ]
%add112 = add nuw nsw i32 %add112282, 1
%mul113 = mul nsw i32 %add112, %add112282
%add114 = add nuw nsw i32 %add112282, 2
%mul115 = mul nsw i32 %mul113, %add114
%div116 = udiv i32 %mul115, 6
%sub117 = sub nsw i32 %9, %div116
%cmp118 = icmp sgt i32 %sub117, 0
br i1 %cmp118, label %for.body119, label %for.end162, !llvm.loop !14
for.end162: ; preds = %for.inc160
%cmp163.not = icmp eq i32 %minLocal105.1, 1000000
br i1 %cmp163.not, label %cleanup168, label %if.then164
if.then164: ; preds = %for.end162
store i32 %minLocal105.1, ptr %arrayidx107, align 4, !tbaa !5
br label %cleanup168
cleanup168: ; preds = %for.end162, %if.then164, %for.body103
%indvars.iv.next294 = add nuw nsw i64 %indvars.iv293, 1
%exitcond297.not = icmp eq i64 %indvars.iv.next294, 1000001
br i1 %exitcond297.not, label %while.cond.preheader, label %for.body103, !llvm.loop !15
while.body: ; preds = %while.cond.preheader, %while.body
%11 = phi i32 [ %14, %while.body ], [ %5, %while.cond.preheader ]
%idxprom177 = sext i32 %11 to i64
%arrayidx178 = getelementptr inbounds i32, ptr %call, i64 %idxprom177
%12 = load i32, ptr %arrayidx178, align 4, !tbaa !5
%arrayidx180 = getelementptr inbounds i32, ptr %call1, i64 %idxprom177
%13 = load i32, ptr %arrayidx180, align 4, !tbaa !5
%call181 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %12, i32 noundef %13)
%call175 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%14 = load i32, ptr %n, align 4, !tbaa !5
%cmp176.not = icmp eq i32 %14, 0
br i1 %cmp176.not, label %while.end, label %while.body, !llvm.loop !16
while.end: ; preds = %while.body, %while.cond.preheader
call void @free(ptr noundef %call) #8
call void @free(ptr noundef %call1) #8
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #8
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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
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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6
attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
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 = !{!"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 main(void) {
int i,j,n,d[16][16],s;
while(scanf("%d",&n) , n != 0){
for(i = 1;i <= n;i++){
for(j = 1;j <= n;j++){
scanf("%d",&d[i][j]);
}
}
for(i = 1;i <= n;i++){
s = 0;
for(j = 1;j <= n;j++){
s+=d[i][j];
}
d[i][n+1] = s;
}
for(j = 1;j <= n;j++){
s = 0;
for(i = 1;i <= n;i++){
s+=d[i][j];
}
d[n+1][j] = s;
}
s = 0;
for(i = 1;i <= n;i++){
s+=d[n+1][i];
}
d[n+1][n+1] = s;
for(i = 1;i <= n+1;i++){
for(j = 1;j <= n+1;j++){
printf("%5d",d[i][j]);
}
printf("\n");
}
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194519/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194519/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%5d\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%d = alloca [16 x [16 x i32]], align 16
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #5
call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %d) #5
%call152 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not153 = icmp eq i32 %0, 0
br i1 %cmp.not153, label %while.end, label %for.cond.preheader
while.cond.loopexit: ; preds = %for.end87, %for.end65
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%1 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %1, 0
br i1 %cmp.not, label %while.end, label %for.cond.preheader, !llvm.loop !9
for.cond.preheader: ; preds = %entry, %while.cond.loopexit
%2 = phi i32 [ %1, %while.cond.loopexit ], [ %0, %entry ]
%cmp1.not128 = icmp slt i32 %2, 1
br i1 %cmp1.not128, label %for.cond54.preheader.for.end65_crit_edge, label %for.cond2.preheader
for.cond11.preheader: ; preds = %for.inc8
%cmp12.not134 = icmp slt i32 %7, 1
br i1 %cmp12.not134, label %for.cond54.preheader.for.end65_crit_edge, label %for.cond14.preheader.lr.ph
for.cond14.preheader.lr.ph: ; preds = %for.cond11.preheader
%add26 = add nuw i32 %7, 1
%idxprom27 = sext i32 %add26 to i64
%wide.trip.count166 = zext i32 %add26 to i64
%3 = add nsw i64 %wide.trip.count166, -1
%min.iters.check228 = icmp ult i32 %7, 8
%n.vec231 = and i64 %3, -8
%ind.end232 = or i64 %n.vec231, 1
%cmp.n234 = icmp eq i64 %3, %n.vec231
br label %for.cond14.preheader
for.cond2.preheader: ; preds = %for.cond.preheader, %for.inc8
%4 = phi i32 [ %7, %for.inc8 ], [ %2, %for.cond.preheader ]
%indvars.iv157 = phi i64 [ %indvars.iv.next158, %for.inc8 ], [ 1, %for.cond.preheader ]
%cmp3.not126 = icmp slt i32 %4, 1
br i1 %cmp3.not126, label %for.cond2.preheader.for.inc8_crit_edge, label %for.body4
for.cond2.preheader.for.inc8_crit_edge: ; preds = %for.cond2.preheader
%.pre190 = sext i32 %4 to i64
br label %for.inc8
for.body4: ; preds = %for.cond2.preheader, %for.body4
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.cond2.preheader ]
%arrayidx6 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %indvars.iv157, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%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
%cmp3.not.not = icmp slt i64 %indvars.iv, %6
br i1 %cmp3.not.not, label %for.body4, label %for.inc8, !llvm.loop !11
for.inc8: ; preds = %for.body4, %for.cond2.preheader.for.inc8_crit_edge
%.pre-phi = phi i64 [ %.pre190, %for.cond2.preheader.for.inc8_crit_edge ], [ %6, %for.body4 ]
%7 = phi i32 [ %4, %for.cond2.preheader.for.inc8_crit_edge ], [ %5, %for.body4 ]
%indvars.iv.next158 = add nuw nsw i64 %indvars.iv157, 1
%cmp1.not.not = icmp slt i64 %indvars.iv157, %.pre-phi
br i1 %cmp1.not.not, label %for.cond2.preheader, label %for.cond11.preheader, !llvm.loop !12
for.cond32.preheader: ; preds = %for.cond14.for.end23_crit_edge
br i1 %cmp12.not134, label %for.cond54.preheader.for.end65_crit_edge, label %for.cond35.preheader.lr.ph
for.cond35.preheader.lr.ph: ; preds = %for.cond32.preheader
%add46 = add nuw i32 %7, 1
%idxprom47 = sext i32 %add46 to i64
%wide.trip.count176 = zext i32 %add46 to i64
%8 = add nsw i64 %wide.trip.count166, -1
%min.iters.check211 = icmp ult i32 %7, 8
%n.vec214 = and i64 %8, -8
%ind.end215 = or i64 %n.vec214, 1
%cmp.n217 = icmp eq i64 %8, %n.vec214
br label %for.cond35.preheader
for.cond14.preheader: ; preds = %for.cond14.preheader.lr.ph, %for.cond14.for.end23_crit_edge
%indvars.iv163 = phi i64 [ 1, %for.cond14.preheader.lr.ph ], [ %indvars.iv.next164, %for.cond14.for.end23_crit_edge ]
br i1 %min.iters.check228, label %for.body16.preheader, label %vector.body235
vector.body235: ; preds = %for.cond14.preheader, %vector.body235
%index236 = phi i64 [ %index.next242, %vector.body235 ], [ 0, %for.cond14.preheader ]
%vec.phi237 = phi <4 x i32> [ %11, %vector.body235 ], [ zeroinitializer, %for.cond14.preheader ]
%vec.phi238 = phi <4 x i32> [ %12, %vector.body235 ], [ zeroinitializer, %for.cond14.preheader ]
%offset.idx239 = or i64 %index236, 1
%9 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %indvars.iv163, i64 %offset.idx239
%wide.load240 = load <4 x i32>, ptr %9, align 4, !tbaa !5
%10 = getelementptr inbounds i32, ptr %9, i64 4
%wide.load241 = load <4 x i32>, ptr %10, align 4, !tbaa !5
%11 = add <4 x i32> %wide.load240, %vec.phi237
%12 = add <4 x i32> %wide.load241, %vec.phi238
%index.next242 = add nuw i64 %index236, 8
%13 = icmp eq i64 %index.next242, %n.vec231
br i1 %13, label %middle.block226, label %vector.body235, !llvm.loop !14
middle.block226: ; preds = %vector.body235
%bin.rdx243 = add <4 x i32> %12, %11
%14 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx243)
br i1 %cmp.n234, label %for.cond14.for.end23_crit_edge, label %for.body16.preheader
for.body16.preheader: ; preds = %for.cond14.preheader, %middle.block226
%indvars.iv160.ph = phi i64 [ 1, %for.cond14.preheader ], [ %ind.end232, %middle.block226 ]
%s.0132.ph = phi i32 [ 0, %for.cond14.preheader ], [ %14, %middle.block226 ]
br label %for.body16
for.body16: ; preds = %for.body16.preheader, %for.body16
%indvars.iv160 = phi i64 [ %indvars.iv.next161, %for.body16 ], [ %indvars.iv160.ph, %for.body16.preheader ]
%s.0132 = phi i32 [ %add, %for.body16 ], [ %s.0132.ph, %for.body16.preheader ]
%arrayidx20 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %indvars.iv163, i64 %indvars.iv160
%15 = load i32, ptr %arrayidx20, align 4, !tbaa !5
%add = add nsw i32 %15, %s.0132
%indvars.iv.next161 = add nuw nsw i64 %indvars.iv160, 1
%exitcond.not = icmp eq i64 %indvars.iv.next161, %wide.trip.count166
br i1 %exitcond.not, label %for.cond14.for.end23_crit_edge, label %for.body16, !llvm.loop !17
for.cond14.for.end23_crit_edge: ; preds = %for.body16, %middle.block226
%add.lcssa = phi i32 [ %14, %middle.block226 ], [ %add, %for.body16 ]
%arrayidx28 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %indvars.iv163, i64 %idxprom27
store i32 %add.lcssa, ptr %arrayidx28, align 4, !tbaa !5
%indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
%exitcond167.not = icmp eq i64 %indvars.iv.next164, %wide.trip.count166
br i1 %exitcond167.not, label %for.cond32.preheader, label %for.cond14.preheader, !llvm.loop !18
for.cond54.preheader: ; preds = %for.cond35.for.end45_crit_edge
br i1 %cmp12.not134, label %for.cond54.preheader.for.end65_crit_edge, label %for.body56.lr.ph
for.cond54.preheader.for.end65_crit_edge: ; preds = %for.cond.preheader, %for.cond11.preheader, %for.cond32.preheader, %for.cond54.preheader
%.lcssa193198201 = phi i32 [ %7, %for.cond54.preheader ], [ %7, %for.cond32.preheader ], [ %7, %for.cond11.preheader ], [ %2, %for.cond.preheader ]
%.pre = add nsw i32 %.lcssa193198201, 1
%.pre189 = sext i32 %.pre to i64
br label %for.end65
for.body56.lr.ph: ; preds = %for.cond54.preheader
%add57 = add nuw nsw i32 %7, 1
%idxprom58 = sext i32 %add57 to i64
%wide.trip.count181 = zext i32 %add57 to i64
%16 = add nsw i64 %wide.trip.count166, -1
%min.iters.check = icmp ult i32 %7, 8
br i1 %min.iters.check, label %for.body56.preheader, label %vector.ph
vector.ph: ; preds = %for.body56.lr.ph
%n.vec = and i64 %16, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
%vec.phi207 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %20, %vector.body ]
%offset.idx = or i64 %index, 1
%17 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %idxprom58, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %17, align 4, !tbaa !5
%18 = getelementptr inbounds i32, ptr %17, i64 4
%wide.load208 = load <4 x i32>, ptr %18, align 4, !tbaa !5
%19 = add <4 x i32> %wide.load, %vec.phi
%20 = add <4 x i32> %wide.load208, %vec.phi207
%index.next = add nuw i64 %index, 8
%21 = icmp eq i64 %index.next, %n.vec
br i1 %21, label %middle.block, label %vector.body, !llvm.loop !19
middle.block: ; preds = %vector.body
%bin.rdx = add <4 x i32> %20, %19
%22 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
%cmp.n = icmp eq i64 %16, %n.vec
br i1 %cmp.n, label %for.end65, label %for.body56.preheader
for.body56.preheader: ; preds = %for.body56.lr.ph, %middle.block
%indvars.iv178.ph = phi i64 [ 1, %for.body56.lr.ph ], [ %ind.end, %middle.block ]
%s.2144.ph = phi i32 [ 0, %for.body56.lr.ph ], [ %22, %middle.block ]
br label %for.body56
for.cond35.preheader: ; preds = %for.cond35.preheader.lr.ph, %for.cond35.for.end45_crit_edge
%indvars.iv173 = phi i64 [ 1, %for.cond35.preheader.lr.ph ], [ %indvars.iv.next174, %for.cond35.for.end45_crit_edge ]
br i1 %min.iters.check211, label %for.body37.preheader, label %vector.body218
vector.body218: ; preds = %for.cond35.preheader, %vector.body218
%index219 = phi i64 [ %index.next223, %vector.body218 ], [ 0, %for.cond35.preheader ]
%vec.phi220 = phi <4 x i32> [ %54, %vector.body218 ], [ zeroinitializer, %for.cond35.preheader ]
%vec.phi221 = phi <4 x i32> [ %55, %vector.body218 ], [ zeroinitializer, %for.cond35.preheader ]
%offset.idx222 = or i64 %index219, 1
%23 = or i64 %index219, 2
%24 = or i64 %index219, 3
%25 = or i64 %index219, 4
%26 = or i64 %index219, 5
%27 = or i64 %index219, 6
%28 = or i64 %index219, 7
%29 = add i64 %index219, 8
%30 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %offset.idx222, i64 %indvars.iv173
%31 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %23, i64 %indvars.iv173
%32 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %24, i64 %indvars.iv173
%33 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %25, i64 %indvars.iv173
%34 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %26, i64 %indvars.iv173
%35 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %27, i64 %indvars.iv173
%36 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %28, i64 %indvars.iv173
%37 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %29, i64 %indvars.iv173
%38 = load i32, ptr %30, align 4, !tbaa !5
%39 = load i32, ptr %31, align 4, !tbaa !5
%40 = load i32, ptr %32, align 4, !tbaa !5
%41 = load i32, ptr %33, align 4, !tbaa !5
%42 = insertelement <4 x i32> poison, i32 %38, i64 0
%43 = insertelement <4 x i32> %42, i32 %39, i64 1
%44 = insertelement <4 x i32> %43, i32 %40, i64 2
%45 = insertelement <4 x i32> %44, i32 %41, i64 3
%46 = load i32, ptr %34, align 4, !tbaa !5
%47 = load i32, ptr %35, align 4, !tbaa !5
%48 = load i32, ptr %36, align 4, !tbaa !5
%49 = load i32, ptr %37, align 4, !tbaa !5
%50 = insertelement <4 x i32> poison, i32 %46, i64 0
%51 = insertelement <4 x i32> %50, i32 %47, i64 1
%52 = insertelement <4 x i32> %51, i32 %48, i64 2
%53 = insertelement <4 x i32> %52, i32 %49, i64 3
%54 = add <4 x i32> %45, %vec.phi220
%55 = add <4 x i32> %53, %vec.phi221
%index.next223 = add nuw i64 %index219, 8
%56 = icmp eq i64 %index.next223, %n.vec214
br i1 %56, label %middle.block209, label %vector.body218, !llvm.loop !20
middle.block209: ; preds = %vector.body218
%bin.rdx224 = add <4 x i32> %55, %54
%57 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx224)
br i1 %cmp.n217, label %for.cond35.for.end45_crit_edge, label %for.body37.preheader
for.body37.preheader: ; preds = %for.cond35.preheader, %middle.block209
%indvars.iv168.ph = phi i64 [ 1, %for.cond35.preheader ], [ %ind.end215, %middle.block209 ]
%s.1138.ph = phi i32 [ 0, %for.cond35.preheader ], [ %57, %middle.block209 ]
br label %for.body37
for.body37: ; preds = %for.body37.preheader, %for.body37
%indvars.iv168 = phi i64 [ %indvars.iv.next169, %for.body37 ], [ %indvars.iv168.ph, %for.body37.preheader ]
%s.1138 = phi i32 [ %add42, %for.body37 ], [ %s.1138.ph, %for.body37.preheader ]
%arrayidx41 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %indvars.iv168, i64 %indvars.iv173
%58 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%add42 = add nsw i32 %58, %s.1138
%indvars.iv.next169 = add nuw nsw i64 %indvars.iv168, 1
%exitcond172.not = icmp eq i64 %indvars.iv.next169, %wide.trip.count176
br i1 %exitcond172.not, label %for.cond35.for.end45_crit_edge, label %for.body37, !llvm.loop !21
for.cond35.for.end45_crit_edge: ; preds = %for.body37, %middle.block209
%add42.lcssa = phi i32 [ %57, %middle.block209 ], [ %add42, %for.body37 ]
%arrayidx50 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %idxprom47, i64 %indvars.iv173
store i32 %add42.lcssa, ptr %arrayidx50, align 4, !tbaa !5
%indvars.iv.next174 = add nuw nsw i64 %indvars.iv173, 1
%exitcond177.not = icmp eq i64 %indvars.iv.next174, %wide.trip.count176
br i1 %exitcond177.not, label %for.cond54.preheader, label %for.cond35.preheader, !llvm.loop !22
for.body56: ; preds = %for.body56.preheader, %for.body56
%indvars.iv178 = phi i64 [ %indvars.iv.next179, %for.body56 ], [ %indvars.iv178.ph, %for.body56.preheader ]
%s.2144 = phi i32 [ %add62, %for.body56 ], [ %s.2144.ph, %for.body56.preheader ]
%arrayidx61 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %idxprom58, i64 %indvars.iv178
%59 = load i32, ptr %arrayidx61, align 4, !tbaa !5
%add62 = add nsw i32 %59, %s.2144
%indvars.iv.next179 = add nuw nsw i64 %indvars.iv178, 1
%exitcond182.not = icmp eq i64 %indvars.iv.next179, %wide.trip.count181
br i1 %exitcond182.not, label %for.end65, label %for.body56, !llvm.loop !23
for.end65: ; preds = %for.body56, %middle.block, %for.cond54.preheader.for.end65_crit_edge
%.lcssa193198202 = phi i32 [ %.lcssa193198201, %for.cond54.preheader.for.end65_crit_edge ], [ %7, %middle.block ], [ %7, %for.body56 ]
%idxprom67.pre-phi = phi i64 [ %.pre189, %for.cond54.preheader.for.end65_crit_edge ], [ %idxprom58, %middle.block ], [ %idxprom58, %for.body56 ]
%s.2.lcssa = phi i32 [ 0, %for.cond54.preheader.for.end65_crit_edge ], [ %22, %middle.block ], [ %add62, %for.body56 ]
%arrayidx71 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %idxprom67.pre-phi, i64 %idxprom67.pre-phi
store i32 %s.2.lcssa, ptr %arrayidx71, align 4, !tbaa !5
%cmp74.not150 = icmp slt i32 %.lcssa193198202, 0
br i1 %cmp74.not150, label %while.cond.loopexit, label %for.cond76.preheader
for.cond76.preheader: ; preds = %for.end65, %for.end87
%60 = phi i32 [ %64, %for.end87 ], [ %.lcssa193198202, %for.end65 ]
%indvars.iv186 = phi i64 [ %indvars.iv.next187, %for.end87 ], [ 1, %for.end65 ]
%cmp78.not147 = icmp slt i32 %60, 0
br i1 %cmp78.not147, label %for.end87, label %for.body79
for.body79: ; preds = %for.cond76.preheader, %for.body79
%indvars.iv183 = phi i64 [ %indvars.iv.next184, %for.body79 ], [ 1, %for.cond76.preheader ]
%arrayidx83 = getelementptr inbounds [16 x [16 x i32]], ptr %d, i64 0, i64 %indvars.iv186, i64 %indvars.iv183
%61 = load i32, ptr %arrayidx83, align 4, !tbaa !5
%call84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %61)
%indvars.iv.next184 = add nuw nsw i64 %indvars.iv183, 1
%62 = load i32, ptr %n, align 4, !tbaa !5
%63 = sext i32 %62 to i64
%cmp78.not = icmp sgt i64 %indvars.iv183, %63
br i1 %cmp78.not, label %for.end87, label %for.body79, !llvm.loop !24
for.end87: ; preds = %for.body79, %for.cond76.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 1
%64 = load i32, ptr %n, align 4, !tbaa !5
%65 = sext i32 %64 to i64
%cmp74.not = icmp sgt i64 %indvars.iv186, %65
br i1 %cmp74.not, label %while.cond.loopexit, label %for.cond76.preheader, !llvm.loop !25
while.end: ; preds = %while.cond.loopexit, %entry
call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #3
; 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 = { nofree nounwind }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !15, !16}
!20 = distinct !{!20, !10, !15, !16}
!21 = distinct !{!21, !10, !16, !15}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !16, !15}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
|
#include<stdio.h>
#include<stdlib.h>
int main(){
int n,i,j;
int **matrix;
while(1){
scanf("%d",&n);
if(n == 0)
break;
matrix = (int**)malloc(sizeof(int*)*(n+1));
for(i=0;i<n+1;i++){
matrix[i] = (int*)malloc(sizeof(int)*(n+1));
}
for(i=0;i<n+1;i++){
for(j=0;j<n+1;j++){
matrix[i][j]=0;
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%d",&matrix[i][j]);
matrix[n][j]+=matrix[i][j];
matrix[i][n]+=matrix[i][j];
matrix[n][n]+=matrix[i][j];
}
}
for(i=0;i<n+1;i++){
for(j=0;j<n+1;j++){
printf("%5d",matrix[i][j]);
}
puts("");
}
for(i=0;i<n+1;i++)free(matrix[i]);
free(matrix);
}
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194577/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194577/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%5d\00", align 1
; Function Attrs: 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
%call164 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp165 = icmp eq i32 %0, 0
br i1 %cmp165, label %while.end, label %if.end
if.end: ; preds = %entry, %for.end106
%1 = phi i32 [ %34, %for.end106 ], [ %0, %entry ]
%add = add nsw i32 %1, 1
%conv = sext i32 %add to i64
%mul = shl nsw i64 %conv, 3
%call1 = call noalias ptr @malloc(i64 noundef %mul) #7
%cmp3.not148 = icmp slt i32 %1, 0
br i1 %cmp3.not148, label %for.end106, label %for.body.lr.ph
for.body.lr.ph: ; preds = %if.end
%mul7 = shl nsw i64 %conv, 2
%wide.trip.count = zext i32 %add to i64
br label %for.body
for.cond9.preheader: ; preds = %for.body
br i1 %cmp3.not148, label %for.end106, label %for.cond14.preheader
for.body: ; preds = %for.body.lr.ph, %for.body
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
%call8 = call noalias ptr @malloc(i64 noundef %mul7) #7
%arrayidx = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv
store ptr %call8, ptr %arrayidx, align 8, !tbaa !9
%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.cond9.preheader, label %for.body, !llvm.loop !11
for.cond29.preheader: ; preds = %for.inc26
%cmp30156 = icmp sgt i32 %6, 0
br i1 %cmp30156, label %for.cond33.preheader, label %for.cond75.preheader
for.cond14.preheader: ; preds = %for.cond9.preheader, %for.inc26
%2 = phi i32 [ %6, %for.inc26 ], [ %1, %for.cond9.preheader ]
%indvars.iv172 = phi i64 [ %indvars.iv.next173, %for.inc26 ], [ 0, %for.cond9.preheader ]
%cmp16.not150 = icmp slt i32 %2, 0
br i1 %cmp16.not150, label %for.cond14.preheader.for.inc26_crit_edge, label %for.body18.lr.ph
for.cond14.preheader.for.inc26_crit_edge: ; preds = %for.cond14.preheader
%.pre190 = sext i32 %2 to i64
br label %for.inc26
for.body18.lr.ph: ; preds = %for.cond14.preheader
%arrayidx20 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv172
%3 = load ptr, ptr %arrayidx20, align 8, !tbaa !9
br label %for.body18
for.body18: ; preds = %for.body18.lr.ph, %for.body18
%indvars.iv169 = phi i64 [ 0, %for.body18.lr.ph ], [ %indvars.iv.next170, %for.body18 ]
%arrayidx22 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv169
store i32 0, ptr %arrayidx22, align 4, !tbaa !5
%indvars.iv.next170 = add nuw nsw i64 %indvars.iv169, 1
%4 = load i32, ptr %n, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp16.not.not = icmp slt i64 %indvars.iv169, %5
br i1 %cmp16.not.not, label %for.body18, label %for.inc26, !llvm.loop !13
for.inc26: ; preds = %for.body18, %for.cond14.preheader.for.inc26_crit_edge
%.pre-phi191 = phi i64 [ %.pre190, %for.cond14.preheader.for.inc26_crit_edge ], [ %5, %for.body18 ]
%6 = phi i32 [ %2, %for.cond14.preheader.for.inc26_crit_edge ], [ %4, %for.body18 ]
%indvars.iv.next173 = add nuw nsw i64 %indvars.iv172, 1
%cmp11.not.not = icmp slt i64 %indvars.iv172, %.pre-phi191
br i1 %cmp11.not.not, label %for.cond14.preheader, label %for.cond29.preheader, !llvm.loop !14
for.cond75.preheader: ; preds = %for.inc72, %for.cond29.preheader
%7 = phi i32 [ %6, %for.cond29.preheader ], [ %23, %for.inc72 ]
%cmp77.not160 = icmp slt i32 %7, 0
br i1 %cmp77.not160, label %for.end106, label %for.cond80.preheader
for.cond33.preheader: ; preds = %for.cond29.preheader, %for.inc72
%8 = phi i32 [ %23, %for.inc72 ], [ %6, %for.cond29.preheader ]
%indvars.iv178 = phi i64 [ %indvars.iv.next179, %for.inc72 ], [ 0, %for.cond29.preheader ]
%cmp34154 = icmp sgt i32 %8, 0
br i1 %cmp34154, label %for.body36.lr.ph, label %for.cond33.preheader.for.inc72_crit_edge
for.cond33.preheader.for.inc72_crit_edge: ; preds = %for.cond33.preheader
%.pre = sext i32 %8 to i64
br label %for.inc72
for.body36.lr.ph: ; preds = %for.cond33.preheader
%arrayidx38 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv178
%9 = load ptr, ptr %arrayidx38, align 8, !tbaa !9
br label %for.body36
for.body36: ; preds = %for.body36.lr.ph, %for.body36
%indvars.iv175 = phi i64 [ 0, %for.body36.lr.ph ], [ %indvars.iv.next176, %for.body36 ]
%arrayidx40 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv175
%call41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef %arrayidx40)
%10 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%11 = load i32, ptr %n, align 4, !tbaa !5
%idxprom46 = sext i32 %11 to i64
%arrayidx47 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom46
%12 = load ptr, ptr %arrayidx47, align 8, !tbaa !9
%arrayidx49 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv175
%13 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%add50 = add nsw i32 %13, %10
store i32 %add50, ptr %arrayidx49, align 4, !tbaa !5
%14 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%15 = load i32, ptr %n, align 4, !tbaa !5
%idxprom57 = sext i32 %15 to i64
%arrayidx58 = getelementptr inbounds i32, ptr %9, i64 %idxprom57
%16 = load i32, ptr %arrayidx58, align 4, !tbaa !5
%add59 = add nsw i32 %16, %14
store i32 %add59, ptr %arrayidx58, align 4, !tbaa !5
%17 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%18 = load i32, ptr %n, align 4, !tbaa !5
%idxprom64 = sext i32 %18 to i64
%arrayidx65 = getelementptr inbounds ptr, ptr %call1, i64 %idxprom64
%19 = load ptr, ptr %arrayidx65, align 8, !tbaa !9
%arrayidx67 = getelementptr inbounds i32, ptr %19, i64 %idxprom64
%20 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%add68 = add nsw i32 %20, %17
store i32 %add68, ptr %arrayidx67, align 4, !tbaa !5
%indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
%21 = load i32, ptr %n, align 4, !tbaa !5
%22 = sext i32 %21 to i64
%cmp34 = icmp slt i64 %indvars.iv.next176, %22
br i1 %cmp34, label %for.body36, label %for.inc72, !llvm.loop !16
for.inc72: ; preds = %for.body36, %for.cond33.preheader.for.inc72_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond33.preheader.for.inc72_crit_edge ], [ %22, %for.body36 ]
%23 = phi i32 [ %8, %for.cond33.preheader.for.inc72_crit_edge ], [ %21, %for.body36 ]
%indvars.iv.next179 = add nuw nsw i64 %indvars.iv178, 1
%cmp30 = icmp slt i64 %indvars.iv.next179, %.pre-phi
br i1 %cmp30, label %for.cond33.preheader, label %for.cond75.preheader, !llvm.loop !17
for.cond97.preheader: ; preds = %for.end92
%cmp99.not162 = icmp slt i32 %29, 0
br i1 %cmp99.not162, label %for.end106, label %for.body101
for.cond80.preheader: ; preds = %for.cond75.preheader, %for.end92
%24 = phi i32 [ %29, %for.end92 ], [ %7, %for.cond75.preheader ]
%indvars.iv184 = phi i64 [ %indvars.iv.next185, %for.end92 ], [ 0, %for.cond75.preheader ]
%cmp82.not158 = icmp slt i32 %24, 0
br i1 %cmp82.not158, label %for.end92, label %for.body84.lr.ph
for.body84.lr.ph: ; preds = %for.cond80.preheader
%arrayidx86 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv184
%25 = load ptr, ptr %arrayidx86, align 8, !tbaa !9
br label %for.body84
for.body84: ; preds = %for.body84.lr.ph, %for.body84
%indvars.iv181 = phi i64 [ 0, %for.body84.lr.ph ], [ %indvars.iv.next182, %for.body84 ]
%arrayidx88 = getelementptr inbounds i32, ptr %25, i64 %indvars.iv181
%26 = load i32, ptr %arrayidx88, align 4, !tbaa !5
%call89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %26)
%indvars.iv.next182 = add nuw nsw i64 %indvars.iv181, 1
%27 = load i32, ptr %n, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp82.not.not = icmp slt i64 %indvars.iv181, %28
br i1 %cmp82.not.not, label %for.body84, label %for.end92, !llvm.loop !18
for.end92: ; preds = %for.body84, %for.cond80.preheader
%putchar = call i32 @putchar(i32 10)
%indvars.iv.next185 = add nuw nsw i64 %indvars.iv184, 1
%29 = load i32, ptr %n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp77.not.not = icmp slt i64 %indvars.iv184, %30
br i1 %cmp77.not.not, label %for.cond80.preheader, label %for.cond97.preheader, !llvm.loop !19
for.body101: ; preds = %for.cond97.preheader, %for.body101
%indvars.iv187 = phi i64 [ %indvars.iv.next188, %for.body101 ], [ 0, %for.cond97.preheader ]
%arrayidx103 = getelementptr inbounds ptr, ptr %call1, i64 %indvars.iv187
%31 = load ptr, ptr %arrayidx103, align 8, !tbaa !9
call void @free(ptr noundef %31) #6
%indvars.iv.next188 = add nuw nsw i64 %indvars.iv187, 1
%32 = load i32, ptr %n, align 4, !tbaa !5
%33 = sext i32 %32 to i64
%cmp99.not.not = icmp slt i64 %indvars.iv187, %33
br i1 %cmp99.not.not, label %for.body101, label %for.end106, !llvm.loop !20
for.end106: ; preds = %for.body101, %for.cond9.preheader, %if.end, %for.cond75.preheader, %for.cond97.preheader
call void @free(ptr noundef %call1) #6
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%34 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp eq i32 %34, 0
br i1 %cmp, label %while.end, label %if.end
while.end: ; preds = %for.end106, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #6
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @putchar(i32 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !15}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
|
#include <stdio.h>
int main(void)
{
int n;
scanf("%d", &n);
while (n != 0){
int table[10][10] = {{0}};
int i, j;
int sum[10] = {0};
int all_sum = 0;
for (i = 0; i < n; i++){
for (j = 0; j < n; j++){
scanf("%d", &table[i][j]);
sum[i] += table[i][j];
all_sum += table[i][j];
}
}
for (i = 0; i < n; i++){
for (j = 0; j < n; j++){
printf("%5d", table[i][j]);
}
printf("%5d\n", sum[i]);
sum[i] = 0;
}
for (i = 0; i < n; i++){
for (j = 0; j < n; j++){
sum[j] += table[i][j];
}
}
for (i = 0; i < n; i++){
printf("%5d", sum[i]);
}
printf("%5d\n", all_sum);
scanf("%d", &n);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194627/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194627/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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"%5d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%5d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%table = alloca [10 x [10 x i32]], align 16
%sum = alloca [10 x i32], align 16
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.not120 = icmp eq i32 %0, 0
br i1 %cmp.not120, label %while.end, label %while.body
while.body: ; preds = %entry, %for.end71
%1 = phi i32 [ %27, %for.end71 ], [ %0, %entry ]
call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %table) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400) %table, i8 0, i64 400, i1 false)
call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %sum) #4
call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40) %sum, i8 0, i64 40, i1 false)
%cmp1105 = icmp sgt i32 %1, 0
br i1 %cmp1105, label %for.cond2.preheader, label %for.end71
for.cond22.preheader: ; preds = %for.inc19
%cmp23111 = icmp sgt i32 %7, 0
br i1 %cmp23111, label %for.cond25.preheader, label %for.end71
for.cond2.preheader: ; preds = %while.body, %for.inc19
%2 = phi i32 [ %7, %for.inc19 ], [ %1, %while.body ]
%indvars.iv124 = phi i64 [ %indvars.iv.next125, %for.inc19 ], [ 0, %while.body ]
%all_sum.0107 = phi i32 [ %all_sum.1.lcssa, %for.inc19 ], [ 0, %while.body ]
%cmp3102 = icmp sgt i32 %2, 0
br i1 %cmp3102, label %for.body4.lr.ph, label %for.cond2.preheader.for.inc19_crit_edge
for.cond2.preheader.for.inc19_crit_edge: ; preds = %for.cond2.preheader
%.pre = sext i32 %2 to i64
br label %for.inc19
for.body4.lr.ph: ; preds = %for.cond2.preheader
%arrayidx13 = getelementptr inbounds [10 x i32], ptr %sum, i64 0, i64 %indvars.iv124
br label %for.body4
for.body4: ; preds = %for.body4.lr.ph, %for.body4
%indvars.iv = phi i64 [ 0, %for.body4.lr.ph ], [ %indvars.iv.next, %for.body4 ]
%all_sum.1104 = phi i32 [ %all_sum.0107, %for.body4.lr.ph ], [ %add18, %for.body4 ]
%arrayidx6 = getelementptr inbounds [10 x [10 x i32]], ptr %table, i64 0, i64 %indvars.iv124, i64 %indvars.iv
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx6)
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%4 = load i32, ptr %arrayidx13, align 4, !tbaa !5
%add = add nsw i32 %4, %3
store i32 %add, ptr %arrayidx13, align 4, !tbaa !5
%add18 = add nsw i32 %3, %all_sum.1104
%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
%cmp3 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp3, label %for.body4, label %for.inc19, !llvm.loop !9
for.inc19: ; preds = %for.body4, %for.cond2.preheader.for.inc19_crit_edge
%.pre-phi = phi i64 [ %.pre, %for.cond2.preheader.for.inc19_crit_edge ], [ %6, %for.body4 ]
%7 = phi i32 [ %2, %for.cond2.preheader.for.inc19_crit_edge ], [ %5, %for.body4 ]
%all_sum.1.lcssa = phi i32 [ %all_sum.0107, %for.cond2.preheader.for.inc19_crit_edge ], [ %add18, %for.body4 ]
%indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
%cmp1 = icmp slt i64 %indvars.iv.next125, %.pre-phi
br i1 %cmp1, label %for.cond2.preheader, label %for.cond22.preheader, !llvm.loop !11
for.cond44.preheader: ; preds = %for.end35
%cmp45116 = icmp sgt i32 %22, 0
br i1 %cmp45116, label %for.cond47.preheader.us.preheader, label %for.end71
for.cond47.preheader.us.preheader: ; preds = %for.cond44.preheader
%wide.trip.count139 = zext i32 %22 to i64
%min.iters.check = icmp ult i32 %22, 8
%n.vec = and i64 %wide.trip.count139, 4294967288
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count139
br label %for.cond47.preheader.us
for.cond47.preheader.us: ; preds = %for.cond47.preheader.us.preheader, %for.cond47.for.inc60_crit_edge.us
%indvars.iv136 = phi i64 [ 0, %for.cond47.preheader.us.preheader ], [ %indvars.iv.next137, %for.cond47.for.inc60_crit_edge.us ]
br i1 %min.iters.check, label %for.body49.us.preheader, label %vector.body
vector.body: ; preds = %for.cond47.preheader.us, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.cond47.preheader.us ]
%8 = getelementptr inbounds [10 x [10 x i32]], ptr %table, i64 0, i64 %indvars.iv136, i64 %index
%wide.load = load <4 x i32>, ptr %8, align 8, !tbaa !5
%9 = getelementptr inbounds i32, ptr %8, i64 4
%wide.load161 = load <4 x i32>, ptr %9, align 8, !tbaa !5
%10 = getelementptr inbounds [10 x i32], ptr %sum, i64 0, i64 %index
%wide.load162 = load <4 x i32>, ptr %10, align 16, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
%wide.load163 = load <4 x i32>, ptr %11, align 16, !tbaa !5
%12 = add nsw <4 x i32> %wide.load162, %wide.load
%13 = add nsw <4 x i32> %wide.load163, %wide.load161
store <4 x i32> %12, ptr %10, align 16, !tbaa !5
store <4 x i32> %13, ptr %11, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%14 = icmp eq i64 %index.next, %n.vec
br i1 %14, label %middle.block, label %vector.body, !llvm.loop !13
middle.block: ; preds = %vector.body
br i1 %cmp.n, label %for.cond47.for.inc60_crit_edge.us, label %for.body49.us.preheader
for.body49.us.preheader: ; preds = %for.cond47.preheader.us, %middle.block
%indvars.iv133.ph = phi i64 [ 0, %for.cond47.preheader.us ], [ %n.vec, %middle.block ]
br label %for.body49.us
for.body49.us: ; preds = %for.body49.us.preheader, %for.body49.us
%indvars.iv133 = phi i64 [ %indvars.iv.next134, %for.body49.us ], [ %indvars.iv133.ph, %for.body49.us.preheader ]
%arrayidx53.us = getelementptr inbounds [10 x [10 x i32]], ptr %table, i64 0, i64 %indvars.iv136, i64 %indvars.iv133
%15 = load i32, ptr %arrayidx53.us, align 4, !tbaa !5
%arrayidx55.us = getelementptr inbounds [10 x i32], ptr %sum, i64 0, i64 %indvars.iv133
%16 = load i32, ptr %arrayidx55.us, align 4, !tbaa !5
%add56.us = add nsw i32 %16, %15
store i32 %add56.us, ptr %arrayidx55.us, align 4, !tbaa !5
%indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
%exitcond.not = icmp eq i64 %indvars.iv.next134, %wide.trip.count139
br i1 %exitcond.not, label %for.cond47.for.inc60_crit_edge.us, label %for.body49.us, !llvm.loop !16
for.cond47.for.inc60_crit_edge.us: ; preds = %for.body49.us, %middle.block
%indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
%exitcond140.not = icmp eq i64 %indvars.iv.next137, %wide.trip.count139
br i1 %exitcond140.not, label %for.cond63.preheader, label %for.cond47.preheader.us, !llvm.loop !17
for.cond25.preheader: ; preds = %for.cond22.preheader, %for.end35
%17 = phi i32 [ %22, %for.end35 ], [ %7, %for.cond22.preheader ]
%indvars.iv130 = phi i64 [ %indvars.iv.next131, %for.end35 ], [ 0, %for.cond22.preheader ]
%cmp26109 = icmp sgt i32 %17, 0
br i1 %cmp26109, label %for.body27, label %for.end35
for.body27: ; preds = %for.cond25.preheader, %for.body27
%indvars.iv127 = phi i64 [ %indvars.iv.next128, %for.body27 ], [ 0, %for.cond25.preheader ]
%arrayidx31 = getelementptr inbounds [10 x [10 x i32]], ptr %table, i64 0, i64 %indvars.iv130, i64 %indvars.iv127
%18 = load i32, ptr %arrayidx31, align 4, !tbaa !5
%call32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
%indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp26 = icmp slt i64 %indvars.iv.next128, %20
br i1 %cmp26, label %for.body27, label %for.end35, !llvm.loop !18
for.end35: ; preds = %for.body27, %for.cond25.preheader
%arrayidx37 = getelementptr inbounds [10 x i32], ptr %sum, i64 0, i64 %indvars.iv130
%21 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%call38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %21)
store i32 0, ptr %arrayidx37, align 4, !tbaa !5
%indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
%22 = load i32, ptr %n, align 4, !tbaa !5
%23 = sext i32 %22 to i64
%cmp23 = icmp slt i64 %indvars.iv.next131, %23
br i1 %cmp23, label %for.cond25.preheader, label %for.cond44.preheader, !llvm.loop !19
for.cond63.preheader: ; preds = %for.cond47.for.inc60_crit_edge.us
br i1 %cmp45116, label %for.body65, label %for.end71
for.body65: ; preds = %for.cond63.preheader, %for.body65
%indvars.iv141 = phi i64 [ %indvars.iv.next142, %for.body65 ], [ 0, %for.cond63.preheader ]
%arrayidx67 = getelementptr inbounds [10 x i32], ptr %sum, i64 0, i64 %indvars.iv141
%24 = load i32, ptr %arrayidx67, align 4, !tbaa !5
%call68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %24)
%indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
%25 = load i32, ptr %n, align 4, !tbaa !5
%26 = sext i32 %25 to i64
%cmp64 = icmp slt i64 %indvars.iv.next142, %26
br i1 %cmp64, label %for.body65, label %for.end71, !llvm.loop !20
for.end71: ; preds = %for.body65, %for.cond44.preheader, %while.body, %for.cond22.preheader, %for.cond63.preheader
%all_sum.0.lcssa146149153 = phi i32 [ %all_sum.1.lcssa, %for.cond63.preheader ], [ %all_sum.1.lcssa, %for.cond22.preheader ], [ 0, %while.body ], [ %all_sum.1.lcssa, %for.cond44.preheader ], [ %all_sum.1.lcssa, %for.body65 ]
%call72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %all_sum.0.lcssa146149153)
%call73 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %sum) #4
call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %table) #4
%27 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not = icmp eq i32 %27, 0
br i1 %cmp.not, label %while.end, label %while.body, !llvm.loop !21
while.end: ; preds = %for.end71, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,A[100][100],color[100],d[100],f[100],time;
void visit(int u){
int i;
color[u]=GRAY;
d[u]=++time;
for(i=0;i<n;i++){
if(A[u][i]==0)continue;
if(color[i]==WHITE)visit(i);
}
color[i]=BLACK;
f[u]=++time;
}
void dfs(){
int i;
for(i=0;i<n;i++){
color[i]=WHITE;
}
time=0;
for(i=0;i<n;i++){
if(color[i]==WHITE)visit(i);
}
for(i=0;i<n;i++){
printf("%d %d %d\n",i+1,d[i],f[i]);
}
}
int main(){
int i,j,k,l,h;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
A[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&k,&l);
for(j=0;j<l;j++){
scanf("%d",&h);
A[k-1][h-1]=1;
}
}
dfs();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194670/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194670/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@time = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@A = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @time, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @time, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @time, align 4, !tbaa !5
%8 = and i64 %indvars.iv.next, 4294967295
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%9 = phi i32 [ %inc, %entry ], [ %.pre30, %for.end.loopexit ]
%i.0.lcssa = phi i64 [ 0, %entry ], [ %8, %for.end.loopexit ]
%arrayidx15 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %i.0.lcssa
store i32 2, ptr %arrayidx15, align 4, !tbaa !5
%inc16 = add nsw i32 %9, 1
store i32 %inc16, ptr @time, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%k = alloca i32, align 4
%l = alloca i32, align 4
%h = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %h) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @A, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @A, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %k, ptr noundef nonnull %l)
%13 = load i32, ptr %l, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %13, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %h)
%14 = load i32, ptr %k, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom17 = sext i32 %sub to i64
%15 = load i32, ptr %h, align 4, !tbaa !5
%sub19 = add nsw i32 %15, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom17, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%16 = load i32, ptr %l, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %16
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @time, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
%17 = zext i32 %.pr to i64
%18 = shl nuw nsw i64 %17, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %18, i1 false), !tbaa !5
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%19 = icmp sgt i32 %23, 0
br i1 %19, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%20 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %23, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%21 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %21, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%22 = trunc i64 %indvars.iv.i to i32
call void @visit(i32 noundef %22)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%23 = phi i32 [ %20, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%24 = sext i32 %23 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %24
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%25 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %27, i32 noundef %25, i32 noundef %26)
%28 = load i32, ptr @n, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %29
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !12
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %h) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
int color[105],k[105],d[105],f[105],G[105][105];
int u,time,v;
void DFS_Visit(int u){
int i;
color[u]=2;
d[u]=++time;
for(i=0;i<k[u];i++)
if(color[G[u][i]]==1)
DFS_Visit(G[u][i]);
color[u]=0;
f[u]=++time;
}
void DFS(int n){
int i;
for(i=1;i<=n;i++){
color[i]=1;
time=0;
}
for(i=1;i<=n;i++){
if(color[i]==1){
DFS_Visit(i);
}
}
}
int main(void){
int n,i,j,k1;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",&u,&k1);
k[u]=k1;
for(j=0;j<k[u];j++){
scanf("%d",&v);
G[u][j]=v;
}
}
DFS(n);
for(i=1;i<=n;i++)
printf("%d %d %d\n",i,d[i],f[i]);
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194728/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194728/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [105 x i32] zeroinitializer, align 16
@time = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [105 x i32] zeroinitializer, align 16
@k = dso_local local_unnamed_addr global [105 x i32] zeroinitializer, align 16
@G = dso_local local_unnamed_addr global [105 x [105 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [105 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@u = dso_local global i32 0, align 4
@v = dso_local global i32 0, align 4
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @DFS_Visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %idxprom
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @time, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @time, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [105 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [105 x i32], ptr @k, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %1, 0
br i1 %cmp31, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %5, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx8 = getelementptr inbounds [105 x [105 x i32]], ptr @G, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%idxprom9 = sext i32 %3 to i64
%arrayidx10 = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %idxprom9
%4 = load i32, ptr %arrayidx10, align 4, !tbaa !5
%cmp11 = icmp eq i32 %4, 1
br i1 %cmp11, label %if.then, label %for.inc
if.then: ; preds = %for.body
tail call void @DFS_Visit(i32 noundef %3)
%.pre = load i32, ptr %arrayidx4, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%5 = phi i32 [ %2, %for.body ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre34 = load i32, ptr @time, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%7 = phi i32 [ %.pre34, %for.end.loopexit ], [ %inc, %entry ]
store i32 0, ptr %arrayidx, align 4, !tbaa !5
%inc19 = add nsw i32 %7, 1
store i32 %inc19, ptr @time, align 4, !tbaa !5
%arrayidx21 = getelementptr inbounds [105 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc19, ptr %arrayidx21, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @DFS(i32 noundef %n) local_unnamed_addr #2 {
entry:
%cmp.not17 = icmp slt i32 %n, 1
br i1 %cmp.not17, label %for.end9, label %for.body.lr.ph
for.body.lr.ph: ; preds = %entry
store i32 0, ptr @time, align 4, !tbaa !5
%0 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %0 to i64
%1 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader, label %vector.ph
vector.ph: ; preds = %for.body.lr.ph
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !11
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %1, %n.vec
br i1 %cmp.n, label %for.cond1.preheader, label %for.body.preheader
for.body.preheader: ; preds = %for.body.lr.ph, %middle.block
%indvars.iv.ph = phi i64 [ 1, %for.body.lr.ph ], [ %ind.end, %middle.block ]
br label %for.body
for.cond1.preheader: ; preds = %for.body, %middle.block
br i1 %cmp.not17, label %for.end9, label %for.body3.preheader
for.body3.preheader: ; preds = %for.cond1.preheader
%5 = add nuw i32 %n, 1
%wide.trip.count25 = zext i32 %5 to i64
br label %for.body3
for.body: ; preds = %for.body.preheader, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %indvars.iv.ph, %for.body.preheader ]
%arrayidx = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %indvars.iv
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond1.preheader, label %for.body, !llvm.loop !14
for.body3: ; preds = %for.body3.preheader, %for.inc7
%indvars.iv22 = phi i64 [ 1, %for.body3.preheader ], [ %indvars.iv.next23, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %indvars.iv22
%6 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %6, 1
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%7 = trunc i64 %indvars.iv22 to i32
tail call void @DFS_Visit(i32 noundef %7)
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
%exitcond26.not = icmp eq i64 %indvars.iv.next23, %wide.trip.count25
br i1 %exitcond26.not, label %for.end9, label %for.body3, !llvm.loop !15
for.end9: ; preds = %for.inc7, %entry, %for.cond1.preheader
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%n = alloca i32, align 4
%k1 = 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 %k1) #5
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp38 = icmp sgt i32 %0, 0
br i1 %cmp38, label %for.body, label %for.end25
for.body: ; preds = %entry, %for.inc12
%i.039 = phi i32 [ %inc13, %for.inc12 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @u, ptr noundef nonnull %k1)
%1 = load i32, ptr %k1, align 4, !tbaa !5
%2 = load i32, ptr @u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [105 x i32], ptr @k, i64 0, i64 %idxprom
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
%cmp536 = icmp sgt i32 %1, 0
br i1 %cmp536, label %for.body6, label %for.inc12
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.body ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @v)
%3 = load i32, ptr @v, align 4, !tbaa !5
%4 = load i32, ptr @u, align 4, !tbaa !5
%idxprom8 = sext i32 %4 to i64
%arrayidx11 = getelementptr inbounds [105 x [105 x i32]], ptr @G, i64 0, i64 %idxprom8, i64 %indvars.iv
store i32 %3, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx4 = getelementptr inbounds [105 x i32], ptr @k, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp5, label %for.body6, label %for.inc12, !llvm.loop !16
for.inc12: ; preds = %for.body6, %for.body
%inc13 = add nuw nsw i32 %i.039, 1
%7 = load i32, ptr %n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc13, %7
br i1 %cmp, label %for.body, label %for.end14, !llvm.loop !17
for.end14: ; preds = %for.inc12
%cmp.not17.i = icmp slt i32 %7, 1
br i1 %cmp.not17.i, label %for.end25, label %for.body.lr.ph.i
for.body.lr.ph.i: ; preds = %for.end14
store i32 0, ptr @time, align 4, !tbaa !5
%8 = add nuw i32 %7, 1
%wide.trip.count.i = zext i32 %8 to i64
%9 = add nsw i64 %wide.trip.count.i, -1
%min.iters.check = icmp ult i32 %7, 8
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.ph
vector.ph: ; preds = %for.body.lr.ph.i
%n.vec = and i64 %9, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%offset.idx = or i64 %index, 1
%10 = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %offset.idx
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 4, !tbaa !5
%11 = getelementptr inbounds i32, ptr %10, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %11, align 4, !tbaa !5
%index.next = add nuw i64 %index, 8
%12 = icmp eq i64 %index.next, %n.vec
br i1 %12, label %middle.block, label %vector.body, !llvm.loop !18
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %9, %n.vec
br i1 %cmp.n, label %for.body3.i.preheader, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.lr.ph.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 1, %for.body.lr.ph.i ], [ %ind.end, %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 ]
%arrayidx.i = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %indvars.iv.i
store i32 1, ptr %arrayidx.i, align 4, !tbaa !5
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%exitcond.not.i = icmp eq i64 %indvars.iv.next.i, %wide.trip.count.i
br i1 %exitcond.not.i, label %for.body3.i.preheader, label %for.body.i, !llvm.loop !19
for.body3.i.preheader: ; preds = %for.body.i, %middle.block
br label %for.body3.i
for.body3.i: ; preds = %for.body3.i.preheader, %for.inc7.i
%indvars.iv22.i = phi i64 [ %indvars.iv.next23.i, %for.inc7.i ], [ 1, %for.body3.i.preheader ]
%arrayidx5.i = getelementptr inbounds [105 x i32], ptr @color, i64 0, i64 %indvars.iv22.i
%13 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %13, 1
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%14 = trunc i64 %indvars.iv22.i to i32
call void @DFS_Visit(i32 noundef %14)
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%indvars.iv.next23.i = add nuw nsw i64 %indvars.iv22.i, 1
%exitcond26.not.i = icmp eq i64 %indvars.iv.next23.i, %wide.trip.count.i
br i1 %exitcond26.not.i, label %DFS.exit, label %for.body3.i, !llvm.loop !15
DFS.exit: ; preds = %for.inc7.i
%.pre = load i32, ptr %n, align 4, !tbaa !5
%15 = icmp slt i32 %.pre, 1
br i1 %15, label %for.end25, label %for.body17
for.body17: ; preds = %DFS.exit, %for.body17
%indvars.iv44 = phi i64 [ %indvars.iv.next45, %for.body17 ], [ 1, %DFS.exit ]
%arrayidx19 = getelementptr inbounds [105 x i32], ptr @d, i64 0, i64 %indvars.iv44
%16 = load i32, ptr %arrayidx19, align 4, !tbaa !5
%arrayidx21 = getelementptr inbounds [105 x i32], ptr @f, i64 0, i64 %indvars.iv44
%17 = load i32, ptr %arrayidx21, align 4, !tbaa !5
%18 = trunc i64 %indvars.iv44 to i32
%call22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %18, i32 noundef %16, i32 noundef %17)
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%20 = sext i32 %19 to i64
%cmp16.not.not = icmp slt i64 %indvars.iv44, %20
br i1 %cmp16.not.not, label %for.body17, label %for.end25, !llvm.loop !20
for.end25: ; preds = %for.body17, %entry, %for.end14, %DFS.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k1) #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 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !12, !13}
!19 = distinct !{!19, !10, !13, !12}
!20 = distinct !{!20, !10}
|
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, M[N][N];
int color[N], d[N], f[N], tt;
void dfs_visit(int u)
{
int v;
color[u] = GRAY;
d[u] = ++tt;
for ( v = 0; v < n; v++ )
{
if(M[u][v] == 0 ) continue;
if(color[v] == WHITE)
{
dfs_visit(v);
}
}
color[u] = BLACK;
f[u] = ++tt;
}
void dfs()
{
int u;
for (u = 0; u < n; u++ )color[u] = WHITE;
tt = 0;
for(u = 0; u < n; u++)
{
if(color[u] == WHITE)dfs_visit(u);
}
for(u = 0; u < n; u++)
{
printf("%d %d %d\n", u + 1, d[u], f[u]);
}
}
int main()
{
int u, v, k, i, j;
scanf("%d", &n);
for(i = 0; i < n; i++)
{
for(j = 0; j < n; j++)M[i][j] = 0;
}
for(i = 0; i < n; i++)
{
scanf("%d %d", &u, &k);
u--;
for(j = 0; j < k; j++)
{
scanf("%d", &v);
v--;
M[u][v] = 1;
}
}
dfs();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194771/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194771/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@tt = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs_visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @tt, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tt, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @tt, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @tt, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @M, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @M, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @tt, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @dfs_visit(i32 noundef %23)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !12
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int MYINF = 1e9+7;
typedef int bool;
const bool true = 1;
const bool false = 0;
#define MAX_N 128
int G[MAX_N][MAX_N];
int n;
int sz[MAX_N];
int d[MAX_N];
int f[MAX_N];
int t;
void dfs(int v) {
int i;
if (d[v]) return;
d[v] = t++;
for (i = 0; i < sz[v]; i++) {
dfs(G[v][i]);
}
f[v] = t++;
}
int main(int argc, char **argv)
{
int i, j, u, k, v;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d %d", &u, &k);
sz[u] = k;
for (j = 0; j < sz[u]; j++) {
scanf("%d", &v);
G[u][j] = v;
}
}
t = 1;
for (i = 1; i <= n; i++) {
dfs(i);
}
for (i = 1; i <= n; i++) {
printf("%d %d %d\n", i, d[i], f[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194821/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194821/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@MYINF = dso_local local_unnamed_addr constant i32 1000000007, align 4
@true = dso_local local_unnamed_addr constant i32 1, align 4
@false = dso_local local_unnamed_addr constant i32 0, align 4
@d = dso_local local_unnamed_addr global [128 x i32] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global i32 0, align 4
@sz = dso_local local_unnamed_addr global [128 x i32] zeroinitializer, align 16
@G = dso_local local_unnamed_addr global [128 x [128 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [128 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs(i32 noundef %v) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %v to i64
%arrayidx = getelementptr inbounds [128 x i32], ptr @d, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%tobool.not = icmp eq i32 %0, 0
br i1 %tobool.not, label %if.end, label %cleanup
if.end: ; preds = %entry
%1 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %1, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
%arrayidx4 = getelementptr inbounds [128 x i32], ptr @sz, i64 0, i64 %idxprom
%2 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp19 = icmp sgt i32 %2, 0
br i1 %cmp19, label %for.body, label %for.end
for.body: ; preds = %if.end, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %if.end ]
%arrayidx8 = getelementptr inbounds [128 x [128 x i32]], ptr @G, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx8, align 4, !tbaa !5
tail call void @dfs(i32 noundef %3)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%5 = sext i32 %4 to i64
%cmp = icmp slt i64 %indvars.iv.next, %5
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.body
%.pre = load i32, ptr @t, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %if.end
%6 = phi i32 [ %.pre, %for.end.loopexit ], [ %inc, %if.end ]
%inc10 = add nsw i32 %6, 1
store i32 %inc10, ptr @t, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [128 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %6, ptr %arrayidx12, align 4, !tbaa !5
br label %cleanup
cleanup: ; preds = %entry, %for.end
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp47 = icmp sgt i32 %0, 0
br i1 %cmp47, label %for.body, label %for.end14.thread
for.end14.thread: ; preds = %entry
store i32 1, ptr @t, align 4, !tbaa !5
br label %for.end31
for.body: ; preds = %entry, %for.inc12
%i.048 = phi i32 [ %inc13, %for.inc12 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%arrayidx = getelementptr inbounds [128 x i32], ptr @sz, i64 0, i64 %idxprom
store i32 %1, ptr %arrayidx, align 4, !tbaa !5
%cmp545 = icmp sgt i32 %1, 0
br i1 %cmp545, label %for.body6, label %for.inc12
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 0, %for.body ]
%call7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%3 = load i32, ptr %v, align 4, !tbaa !5
%4 = load i32, ptr %u, align 4, !tbaa !5
%idxprom8 = sext i32 %4 to i64
%arrayidx11 = getelementptr inbounds [128 x [128 x i32]], ptr @G, i64 0, i64 %idxprom8, i64 %indvars.iv
store i32 %3, ptr %arrayidx11, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%arrayidx4 = getelementptr inbounds [128 x i32], ptr @sz, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp5, label %for.body6, label %for.inc12, !llvm.loop !11
for.inc12: ; preds = %for.body6, %for.body
%inc13 = add nuw nsw i32 %i.048, 1
%7 = load i32, ptr @n, align 4, !tbaa !5
%cmp = icmp slt i32 %inc13, %7
br i1 %cmp, label %for.body, label %for.end14, !llvm.loop !12
for.end14: ; preds = %for.inc12
%8 = icmp slt i32 %7, 1
store i32 1, ptr @t, align 4, !tbaa !5
br i1 %8, label %for.end31, label %for.body17
for.cond21.preheader: ; preds = %for.body17
%9 = icmp slt i32 %10, 1
br i1 %9, label %for.end31, label %for.body23
for.body17: ; preds = %for.end14, %for.body17
%i.150 = phi i32 [ %inc19, %for.body17 ], [ 1, %for.end14 ]
call void @dfs(i32 noundef %i.150)
%inc19 = add nuw nsw i32 %i.150, 1
%10 = load i32, ptr @n, align 4, !tbaa !5
%cmp16.not.not = icmp slt i32 %i.150, %10
br i1 %cmp16.not.not, label %for.body17, label %for.cond21.preheader, !llvm.loop !13
for.body23: ; preds = %for.cond21.preheader, %for.body23
%indvars.iv54 = phi i64 [ %indvars.iv.next55, %for.body23 ], [ 1, %for.cond21.preheader ]
%arrayidx25 = getelementptr inbounds [128 x i32], ptr @d, i64 0, i64 %indvars.iv54
%11 = load i32, ptr %arrayidx25, align 4, !tbaa !5
%arrayidx27 = getelementptr inbounds [128 x i32], ptr @f, i64 0, i64 %indvars.iv54
%12 = load i32, ptr %arrayidx27, align 4, !tbaa !5
%13 = trunc i64 %indvars.iv54 to i32
%call28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %13, i32 noundef %11, i32 noundef %12)
%indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
%14 = load i32, ptr @n, align 4, !tbaa !5
%15 = sext i32 %14 to i64
%cmp22.not.not = icmp slt i64 %indvars.iv54, %15
br i1 %cmp22.not.not, label %for.body23, label %for.end31, !llvm.loop !14
for.end31: ; preds = %for.body23, %for.end14.thread, %for.end14, %for.cond21.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[500],i,j,t,n,c1,c2,b,h,f;
scanf ("%d",&t);
for (i=0;i<t;i++)
{
c1=1;c2=0;f=0;
scanf ("%d",&n);
scanf ("%d",&a[0]);
b=a[0];
for (j=1;j<n;j++)
{
scanf ("%d",&a[j]);
if (a[j]==b)
c1++;
if (f==0&&a[j]!=b)
{
h=j+1;
f=1;
}
if (a[j]!=b&&f!=0)
c2++;
}
if (c1<c2)
printf ("1\n");
else
printf ("%d\n",h);
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_19488/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_19488/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
@str = private unnamed_addr constant [2 x i8] c"1\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [500 x i32], align 16
%t = alloca i32, align 4
%n = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 2000, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %t)
%0 = load i32, ptr %t, align 4, !tbaa !5
%cmp58 = icmp sgt i32 %0, 0
br i1 %cmp58, label %for.body, label %for.end34
for.body: ; preds = %entry, %for.inc32
%h.060 = phi i32 [ %h.1.lcssa66, %for.inc32 ], [ undef, %entry ]
%i.059 = phi i32 [ %inc33, %for.inc32 ], [ 0, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%1 = load i32, ptr %a, align 16, !tbaa !5
%2 = load i32, ptr %n, align 4, !tbaa !5
%cmp550 = icmp sgt i32 %2, 1
br i1 %cmp550, label %for.body6, label %if.else
for.body6: ; preds = %for.body, %for.body6
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body6 ], [ 1, %for.body ]
%f.055 = phi i1 [ %cmp22, %for.body6 ], [ false, %for.body ]
%h.154 = phi i32 [ %h.2, %for.body6 ], [ %h.060, %for.body ]
%c2.053 = phi i32 [ %spec.select47, %for.body6 ], [ 0, %for.body ]
%c1.052 = phi i32 [ %spec.select, %for.body6 ], [ 1, %for.body ]
%arrayidx7 = getelementptr inbounds [500 x i32], ptr %a, i64 0, i64 %indvars.iv
%call8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx7)
%3 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp11 = icmp eq i32 %3, %1
%inc = zext i1 %cmp11 to i32
%spec.select = add nuw nsw i32 %c1.052, %inc
%brmerge = select i1 %f.055, i1 true, i1 %cmp11
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = trunc i64 %indvars.iv.next to i32
%h.2 = select i1 %brmerge, i32 %h.154, i32 %4
%not.brmerge = xor i1 %brmerge, true
%cmp22 = or i1 %f.055, %not.brmerge
%cmp20 = icmp ne i32 %3, %1
%or.cond = and i1 %cmp20, %cmp22
%inc24 = zext i1 %or.cond to i32
%spec.select47 = add nuw nsw i32 %c2.053, %inc24
%5 = load i32, ptr %n, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp5 = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp5, label %for.body6, label %for.end, !llvm.loop !9
for.end: ; preds = %for.body6
%cmp27 = icmp ult i32 %spec.select, %spec.select47
br i1 %cmp27, label %if.then28, label %if.else
if.then28: ; preds = %for.end
%puts = call i32 @puts(ptr nonnull dereferenceable(1) @str)
br label %for.inc32
if.else: ; preds = %for.body, %for.end
%h.1.lcssa65 = phi i32 [ %h.2, %for.end ], [ %h.060, %for.body ]
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %h.1.lcssa65)
br label %for.inc32
for.inc32: ; preds = %if.then28, %if.else
%h.1.lcssa66 = phi i32 [ %h.2, %if.then28 ], [ %h.1.lcssa65, %if.else ]
%inc33 = add nuw nsw i32 %i.059, 1
%7 = load i32, ptr %t, align 4, !tbaa !5
%cmp = icmp slt i32 %inc33, %7
br i1 %cmp, label %for.body, label %for.end34, !llvm.loop !11
for.end34: ; preds = %for.inc32, %entry
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %t) #4
call void @llvm.lifetime.end.p0(i64 2000, 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
|
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, M[N][N];
int color[N],d[N],f[N],tt;
void dfs_visit(int u){
int v;
color[u] = GRAY;
d[u] = ++tt;
for( v = 0; v < n; v++){
if( M[u][v] == 0)continue;
if(color[v] == WHITE ){
dfs_visit(v);
}
}
color[u] = BLACK;
f[u] = ++tt;
}
void dfs(){
int u;
for( u = 0;u < n; u++)color[u] = WHITE;
tt = 0;
for(u = 0; u < n; u++){
if(color[u] == WHITE)dfs_visit(u);
}
for(u = 0; u < n; u++){
printf("%d %d %d\n",u+1,d[u],f[u]);
}
}
int main(){
int u, v, k, i, j;
scanf("%d",&n);
for(i = 0;i < n;i++){
for(j = 0;j < n; j++)M[i][j] = 0;
}
for(i = 0; i < n; i++){
scanf("%d %d",&u,&k);
u--;
for( j = 0; j < k; j++){
scanf("%d",&v);
v--;
M[u][v] = 1;
}
}
dfs();
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194922/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194922/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@tt = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs_visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @tt, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tt, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @tt, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @tt, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @M, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @M, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @tt, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @dfs_visit(i32 noundef %23)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !12
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define N 101
int n,t=1;
int a[N][N]={0},d[N]={0},f[N]={0};
void dfs(int u){
int i;
d[u]=t++;
for(i=1;i<=n;i++){
if(d[i]==0 && a[u][i]==1)
dfs(i);
}
f[u]=t++;
}
int main(void){
int i,j,u,k,v;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d%d",&u,&k);
for(j=1;j<=k;j++){
scanf("%d",&v);
a[u][v]=1;
}
}
for(i=1;i<=n;i++){
if(d[i]==0)
dfs(i);
}
for(i=1;i<=n;i++){
printf("%d %d %d\n", i, d[i], f[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_194966/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_194966/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@t = dso_local local_unnamed_addr global i32 1, align 4
@a = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs(i32 noundef %u) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not19 = icmp slt i32 %1, 1
br i1 %cmp.not19, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp3 = icmp eq i32 %3, 0
br i1 %cmp3, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %indvars.iv
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp eq i32 %4, 1
br i1 %cmp8, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @dfs(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre22 = load i32, ptr @t, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre22, %for.end.loopexit ], [ %inc, %entry ]
%inc10 = add nsw i32 %8, 1
store i32 %inc10, ptr @t, align 4, !tbaa !5
%arrayidx12 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %8, ptr %arrayidx12, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not44 = icmp slt i32 %0, 1
br i1 %cmp.not44, label %for.end30, label %for.body
for.cond11.preheader: ; preds = %for.inc8
%cmp12.not46 = icmp slt i32 %5, 1
br i1 %cmp12.not46, label %for.end30, label %for.body13
for.body: ; preds = %entry, %for.inc8
%i.045 = phi i32 [ %inc9, %for.inc8 ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not42 = icmp slt i32 %1, 1
br i1 %cmp3.not42, label %for.inc8, label %for.body4
for.body4: ; preds = %for.body, %for.body4
%j.043 = phi i32 [ %inc, %for.body4 ], [ 1, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.043, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %j.043, %4
br i1 %cmp3.not.not, label %for.body4, label %for.inc8, !llvm.loop !11
for.inc8: ; preds = %for.body4, %for.body
%inc9 = add nuw nsw i32 %i.045, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.045, %5
br i1 %cmp.not.not, label %for.body, label %for.cond11.preheader, !llvm.loop !12
for.cond20.preheader: ; preds = %for.inc17
%6 = icmp slt i32 %10, 1
br i1 %6, label %for.end30, label %for.body22
for.body13: ; preds = %for.cond11.preheader, %for.inc17
%7 = phi i32 [ %10, %for.inc17 ], [ %5, %for.cond11.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc17 ], [ 1, %for.cond11.preheader ]
%arrayidx15 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv
%8 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp eq i32 %8, 0
br i1 %cmp16, label %if.then, label %for.inc17
if.then: ; preds = %for.body13
%9 = trunc i64 %indvars.iv to i32
call void @dfs(i32 noundef %9)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc17
for.inc17: ; preds = %for.body13, %if.then
%10 = phi i32 [ %7, %for.body13 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%11 = sext i32 %10 to i64
%cmp12.not.not = icmp slt i64 %indvars.iv, %11
br i1 %cmp12.not.not, label %for.body13, label %for.cond20.preheader, !llvm.loop !13
for.body22: ; preds = %for.cond20.preheader, %for.body22
%indvars.iv51 = phi i64 [ %indvars.iv.next52, %for.body22 ], [ 1, %for.cond20.preheader ]
%arrayidx24 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv51
%12 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%arrayidx26 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %indvars.iv51
%13 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%14 = trunc i64 %indvars.iv51 to i32
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14, i32 noundef %12, i32 noundef %13)
%indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp21.not.not = icmp slt i64 %indvars.iv51, %16
br i1 %cmp21.not.not, label %for.body22, label %for.end30, !llvm.loop !14
for.end30: ; preds = %for.body22, %entry, %for.cond11.preheader, %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,M[MAX][MAX];
int color[MAX],d[MAX],f[MAX],tt;
void depth_First_Search_visit(int u){
int v;
color[u]=GRAY;
d[u]=++tt;
for(v=0;v<n;v++){
if(M[u][v]==0) continue;
if(color[v]==WHITE){
depth_First_Search_visit(v);
}
}
color[u]=BLACK;
f[u]=++tt;
}
void depth_First_Search(){
int u;
for(u=0;u<n;u++) color[u]=WHITE;
tt=0;
for(u=0;u<n;u++) if(color[u]==WHITE)depth_First_Search_visit(u);
for(u=0;u<n;u++) printf("%d %d %d\n",u+1,d[u],f[u]);
}
int main(){
int u,v,k,i,j;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
M[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&u,&k);
u--;
for(j=0;j<k;j++){
scanf("%d",&v);
v--;
M[u][v]=1;
}
}
depth_First_Search();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195008/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195008/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@tt = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @depth_First_Search_visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @tt, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tt, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @depth_First_Search_visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @tt, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @tt, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @depth_First_Search() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @depth_First_Search_visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @M, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @M, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @tt, align 4, !tbaa !5
br label %depth_First_Search.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %depth_First_Search.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @depth_First_Search_visit(i32 noundef %23)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %depth_First_Search.exit, !llvm.loop !12
depth_First_Search.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#define WHITE 0 //non-visited
#define GRAY 1 //visited
#define BLACK 2 //finished
#define N 101
void DFS_Visit(int);
int n = 0;
int tt=0;
int color[N],d[N],f[N];
int A[N][N];
void DFS(void){
int i;
for(i=1 ; i<=n ; i++){
color[i] = WHITE;
tt = 0;
}
for(i=1 ; i<=n ; i++) if(color[i] == WHITE) DFS_Visit(i);
}
void DFS_Visit(int u){
int i;
color[u] = GRAY;
d[u] = ++tt;
for(i=1 ; i<=n ; i++) if(color[i] == WHITE && A[u][i]) DFS_Visit(i);
color[u] = BLACK;
f[u] = ++tt;
}
int main(){
int i,j,u,k,v;
scanf("%d",&n);
for(i=1 ; i<=n ; i++){
for(j=1 ; j<=n ; j++){
A[i][j] = 0;
}
}
for(i=1 ; i<=n ; i++){
scanf("%d%d",&u,&k);
for(j=1 ; j<=k ; j++){
scanf("%d",&v);
A[u][v] = 1;
}
}
DFS();
for(i=1 ; i<=n ; i++){
printf("%d ",i);
printf("%d ",d[i]);
printf("%d\n",f[i]);
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195051/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195051/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@tt = dso_local local_unnamed_addr global i32 0, align 4
@color = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@A = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [4 x i8] c"%d \00", align 1
@.str.3 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @DFS() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not16 = icmp slt i32 %0, 1
br i1 %cmp.not16, label %for.end9, label %for.body3.preheader
for.body3.preheader: ; preds = %entry
store i32 0, ptr @tt, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %2, i1 false), !tbaa !5
br label %for.body3
for.body3: ; preds = %for.body3.preheader, %for.inc7
%3 = phi i32 [ %0, %for.body3.preheader ], [ %6, %for.inc7 ]
%indvars.iv = phi i64 [ 1, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %4, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%5 = trunc i64 %indvars.iv to i32
tail call void @DFS_Visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%6 = phi i32 [ %3, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp2.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp2.not.not, label %for.body3, label %for.end9, !llvm.loop !9
for.end9: ; preds = %for.inc7, %entry
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @DFS_Visit(i32 noundef %u) local_unnamed_addr #2 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @tt, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tt, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not24 = icmp slt i32 %1, 1
br i1 %cmp.not24, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%arrayidx4 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%cmp5 = icmp eq i32 %3, 0
br i1 %cmp5, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %for.inc, label %if.then
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @DFS_Visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.end.loopexit, !llvm.loop !11
for.end.loopexit: ; preds = %for.inc
%.pre27 = load i32, ptr @tt, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre27, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc13 = add nsw i32 %8, 1
store i32 %inc13, ptr @tt, align 4, !tbaa !5
%arrayidx15 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc13, ptr %arrayidx15, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #3 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #6
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not56 = icmp slt i32 %0, 1
br i1 %cmp.not56, label %for.end39, label %for.cond1.preheader.preheader
for.cond1.preheader.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.preheader.new
for.cond1.preheader.preheader.new: ; preds = %for.cond1.preheader.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %indvar.next.7, %for.cond1.preheader ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %niter.next.7, %for.cond1.preheader ]
%4 = mul nuw nsw i64 %indvar, 404
%gep = getelementptr i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 %4
tail call void @llvm.memset.p0.i64(ptr align 8 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 404
%gep70 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 404), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 4 %gep70, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 404
%gep71 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 808), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep71, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep72 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 1212), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 4 %gep72, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep73 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 1616), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 8 %gep73, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep74 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 2020), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 4 %gep74, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep75 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 2424), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep75, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep76 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 2828), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 4 %gep76, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader, !llvm.loop !12
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next.7, %for.cond1.preheader ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.epil
for.cond1.preheader.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 404
%gep.epil = getelementptr i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 %12
tail call void @llvm.memset.p0.i64(ptr align 4 %gep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.epil, !llvm.loop !13
for.cond9.preheader: ; preds = %for.cond1.preheader.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp.not56, label %for.end39, label %for.body11
for.body11: ; preds = %for.cond9.preheader, %for.inc24
%i.161 = phi i32 [ %inc25, %for.inc24 ], [ 1, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %k, align 4, !tbaa !5
%cmp14.not58 = icmp slt i32 %13, 1
br i1 %cmp14.not58, label %for.inc24, label %for.body15
for.body15: ; preds = %for.body11, %for.body15
%j.159 = phi i32 [ %inc22, %for.body15 ], [ 1, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%14 = load i32, ptr %u, align 4, !tbaa !5
%idxprom17 = sext i32 %14 to i64
%15 = load i32, ptr %v, align 4, !tbaa !5
%idxprom19 = sext i32 %15 to i64
%arrayidx20 = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom17, i64 %idxprom19
store i32 1, ptr %arrayidx20, align 4, !tbaa !5
%inc22 = add nuw nsw i32 %j.159, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%cmp14.not.not = icmp slt i32 %j.159, %16
br i1 %cmp14.not.not, label %for.body15, label %for.inc24, !llvm.loop !15
for.inc24: ; preds = %for.body15, %for.body11
%inc25 = add nuw nsw i32 %i.161, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10.not.not = icmp slt i32 %i.161, %.pr
br i1 %cmp10.not.not, label %for.body11, label %for.end26, !llvm.loop !16
for.end26: ; preds = %for.inc24
%cmp.not16.i = icmp slt i32 %.pr, 1
br i1 %cmp.not16.i, label %for.end39, label %for.body3.preheader.i
for.body3.preheader.i: ; preds = %for.end26
store i32 0, ptr @tt, align 4, !tbaa !5
%17 = zext i32 %.pr to i64
%18 = shl nuw nsw i64 %17, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %18, i1 false), !tbaa !5
br label %for.body3.i
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%19 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %22, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 1, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%20 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %20, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%21 = trunc i64 %indvars.iv.i to i32
call void @DFS_Visit(i32 noundef %21)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%22 = phi i32 [ %19, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%23 = sext i32 %22 to i64
%cmp2.not.not.i = icmp slt i64 %indvars.iv.i, %23
br i1 %cmp2.not.not.i, label %for.body3.i, label %DFS.exit, !llvm.loop !9
DFS.exit: ; preds = %for.inc7.i
%24 = icmp slt i32 %22, 1
br i1 %24, label %for.end39, label %for.body29
for.body29: ; preds = %DFS.exit, %for.body29
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body29 ], [ 1, %DFS.exit ]
%25 = trunc i64 %indvars.iv to i32
%call30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25)
%arrayidx32 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv
%26 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%call33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26)
%arrayidx35 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %indvars.iv
%27 = load i32, ptr %arrayidx35, align 4, !tbaa !5
%call36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %27)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%28 = load i32, ptr @n, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp28.not.not = icmp slt i64 %indvars.iv, %29
br i1 %cmp28.not.not, label %for.body29, label %for.end39, !llvm.loop !17
for.end39: ; preds = %for.body29, %entry, %for.cond9.preheader, %for.end26, %DFS.exit
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #6
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #6
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5
attributes #0 = { nofree nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<string.h>
int n,a[110][110],vis[110],d[110],f[110],tag=0;
void dfs(int x){
int u,v,stack[110],top=0;
top++;
stack[top]=x;
vis[x]=1;
tag++;
d[x]=tag;
while(top){
u=stack[top];
for(v=1;v<=n;v++)
if(vis[v]==0){
if(a[u][v]){
top++;
stack[top]=v;
vis[v]=1;
tag++;
d[v]=tag;
break;
}
}
if(v==n+1){
tag++;
f[u]=tag;
top--;
}
}
}
int main(){
int u,k,v,i,j;
memset(a,0,sizeof(a));
memset(vis,0,sizeof(vis));
scanf("%d", &n);
for(i=1; i<=n; i++){
scanf("%d%d",&u,&k);
for(j=1; j<=k;j++){
scanf("%d",&v);
a[u][v]=1;
}
}
for(i=1; i<=n; i++)
if(vis[i]==0)
dfs(i);
for(i=1; i<=n; i++)
printf("%d %d %d\n",i,d[i],f[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195101/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195101/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@tag = dso_local local_unnamed_addr global i32 0, align 4
@vis = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@d = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@a = dso_local local_unnamed_addr global [110 x [110 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs(i32 noundef %x) local_unnamed_addr #0 {
entry:
%stack = alloca [110 x i32], align 16
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %stack) #5
%arrayidx = getelementptr inbounds [110 x i32], ptr %stack, i64 0, i64 1
store i32 %x, ptr %arrayidx, align 4, !tbaa !5
%idxprom1 = sext i32 %x to i64
%arrayidx2 = getelementptr inbounds [110 x i32], ptr @vis, i64 0, i64 %idxprom1
store i32 1, ptr %arrayidx2, align 4, !tbaa !5
%0 = load i32, ptr @tag, align 4, !tbaa !5
%inc3 = add nsw i32 %0, 1
store i32 %inc3, ptr @tag, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds [110 x i32], ptr @d, i64 0, i64 %idxprom1
store i32 %inc3, ptr %arrayidx5, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not52 = icmp slt i32 %1, 1
%add = add i32 %1, 1
br i1 %cmp.not52, label %entry.split.us, label %while.body.preheader
while.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %add to i64
br label %while.body
entry.split.us: ; preds = %entry
%cmp27.us = icmp eq i32 %1, 0
br i1 %cmp27.us, label %while.body.us.us.preheader, label %while.body.us
while.body.us.us.preheader: ; preds = %entry.split.us
%inc29.us.us = add nsw i32 %0, 2
%arrayidx31.us.us = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %idxprom1
store i32 %inc29.us.us, ptr %arrayidx31.us.us, align 4, !tbaa !5
store i32 %inc29.us.us, ptr @tag, align 4, !tbaa !5
br label %while.end
while.body.us: ; preds = %entry.split.us, %while.body.us
br label %while.body.us
while.body: ; preds = %while.body.preheader, %if.end32
%top.059 = phi i32 [ %top.2, %if.end32 ], [ 1, %while.body.preheader ]
%inc295558 = phi i32 [ %inc2956, %if.end32 ], [ %inc3, %while.body.preheader ]
%idxprom6 = sext i32 %top.059 to i64
%arrayidx7 = getelementptr inbounds [110 x i32], ptr %stack, i64 0, i64 %idxprom6
%2 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%idxprom11 = sext i32 %2 to i64
br label %for.body
for.body: ; preds = %while.body, %for.inc
%indvars.iv = phi i64 [ 1, %while.body ], [ %indvars.iv.next, %for.inc ]
%arrayidx9 = getelementptr inbounds [110 x i32], ptr @vis, i64 0, i64 %indvars.iv
%3 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %3, 0
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %for.body
%arrayidx14 = getelementptr inbounds [110 x [110 x i32]], ptr @a, i64 0, i64 %idxprom11, i64 %indvars.iv
%4 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%tobool15.not = icmp eq i32 %4, 0
br i1 %tobool15.not, label %for.inc, label %for.end
for.inc: ; preds = %for.body, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %if.then28, label %for.body, !llvm.loop !9
for.end: ; preds = %if.then
%5 = trunc i64 %indvars.iv to i32
%inc17 = add nsw i32 %top.059, 1
%idxprom18 = sext i32 %inc17 to i64
%arrayidx19 = getelementptr inbounds [110 x i32], ptr %stack, i64 0, i64 %idxprom18
store i32 %5, ptr %arrayidx19, align 4, !tbaa !5
store i32 1, ptr %arrayidx9, align 4, !tbaa !5
%inc22 = add nsw i32 %inc295558, 1
store i32 %inc22, ptr @tag, align 4, !tbaa !5
%arrayidx24 = getelementptr inbounds [110 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 %inc22, ptr %arrayidx24, align 4, !tbaa !5
%cmp27 = icmp eq i32 %add, %5
br i1 %cmp27, label %if.then28, label %if.end32
if.then28: ; preds = %for.inc, %for.end
%top.172 = phi i32 [ %inc17, %for.end ], [ %top.059, %for.inc ]
%inc295771 = phi i32 [ %inc22, %for.end ], [ %inc295558, %for.inc ]
%inc29 = add nsw i32 %inc295771, 1
store i32 %inc29, ptr @tag, align 4, !tbaa !5
%arrayidx31 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %idxprom11
store i32 %inc29, ptr %arrayidx31, align 4, !tbaa !5
%dec = add nsw i32 %top.172, -1
br label %if.end32
if.end32: ; preds = %if.then28, %for.end
%inc2956 = phi i32 [ %inc29, %if.then28 ], [ %inc22, %for.end ]
%top.2 = phi i32 [ %dec, %if.then28 ], [ %inc17, %for.end ]
%tobool.not = icmp eq i32 %top.2, 0
br i1 %tobool.not, label %while.end, label %while.body, !llvm.loop !11
while.end: ; preds = %if.end32, %while.body.us.us.preheader
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %stack) #5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%stack.i = alloca [110 x i32], align 16
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(48400) @a, i8 0, i64 48400, i1 false)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(440) @vis, i8 0, i64 440, i1 false)
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not46 = icmp slt i32 %0, 1
br i1 %cmp.not46, label %for.end30, label %for.body
for.cond11.preheader: ; preds = %for.inc8
%cmp12.not51 = icmp slt i32 %5, 1
br i1 %cmp12.not51, label %for.end30, label %for.body13.preheader
for.body13.preheader: ; preds = %for.cond11.preheader
%arrayidx.i = getelementptr inbounds [110 x i32], ptr %stack.i, i64 0, i64 1
%add.i = add nuw i32 %5, 1
%wide.trip.count.i = zext i32 %add.i to i64
%tag.promoted = load i32, ptr @tag, align 4, !tbaa !5
br label %for.body13
for.body: ; preds = %entry, %for.inc8
%i.047 = phi i32 [ %inc9, %for.inc8 ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not44 = icmp slt i32 %1, 1
br i1 %cmp3.not44, label %for.inc8, label %for.body4
for.body4: ; preds = %for.body, %for.body4
%j.045 = phi i32 [ %inc, %for.body4 ], [ 1, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds [110 x [110 x i32]], ptr @a, i64 0, i64 %idxprom, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.045, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %j.045, %4
br i1 %cmp3.not.not, label %for.body4, label %for.inc8, !llvm.loop !12
for.inc8: ; preds = %for.body4, %for.body
%inc9 = add nuw nsw i32 %i.047, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.047, %5
br i1 %cmp.not.not, label %for.body, label %for.cond11.preheader, !llvm.loop !13
for.cond20.preheader: ; preds = %for.inc17
br i1 %cmp12.not51, label %for.end30, label %for.body22
for.body13: ; preds = %for.body13.preheader, %for.inc17
%indvars.iv = phi i64 [ 1, %for.body13.preheader ], [ %indvars.iv.next, %for.inc17 ]
%inc29.us.us.i4952 = phi i32 [ %tag.promoted, %for.body13.preheader ], [ %inc29.us.us.i48, %for.inc17 ]
%arrayidx15 = getelementptr inbounds [110 x i32], ptr @vis, i64 0, i64 %indvars.iv
%6 = load i32, ptr %arrayidx15, align 4, !tbaa !5
%cmp16 = icmp eq i32 %6, 0
br i1 %cmp16, label %if.then, label %for.inc17
if.then: ; preds = %for.body13
call void @llvm.lifetime.start.p0(i64 440, ptr nonnull %stack.i) #5
%7 = trunc i64 %indvars.iv to i32
store i32 %7, ptr %arrayidx.i, align 4, !tbaa !5
store i32 1, ptr %arrayidx15, align 4, !tbaa !5
%inc3.i = add nsw i32 %inc29.us.us.i4952, 1
%arrayidx5.i = getelementptr inbounds [110 x i32], ptr @d, i64 0, i64 %indvars.iv
store i32 %inc3.i, ptr %arrayidx5.i, align 4, !tbaa !5
br label %while.body.i
while.body.i: ; preds = %if.end32.i, %if.then
%top.059.i = phi i32 [ %top.2.i, %if.end32.i ], [ 1, %if.then ]
%inc295558.i = phi i32 [ %inc2956.i, %if.end32.i ], [ %inc3.i, %if.then ]
%idxprom6.i = sext i32 %top.059.i to i64
%arrayidx7.i = getelementptr inbounds [110 x i32], ptr %stack.i, i64 0, i64 %idxprom6.i
%8 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%idxprom11.i = sext i32 %8 to i64
br label %for.body.i
for.body.i: ; preds = %for.inc.i, %while.body.i
%indvars.iv.i = phi i64 [ 1, %while.body.i ], [ %indvars.iv.next.i, %for.inc.i ]
%arrayidx9.i = getelementptr inbounds [110 x i32], ptr @vis, i64 0, i64 %indvars.iv.i
%9 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%cmp10.i = icmp eq i32 %9, 0
br i1 %cmp10.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%arrayidx14.i = getelementptr inbounds [110 x [110 x i32]], ptr @a, i64 0, i64 %idxprom11.i, i64 %indvars.iv.i
%10 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%tobool15.not.i = icmp eq i32 %10, 0
br i1 %tobool15.not.i, label %for.inc.i, label %for.end.i
for.inc.i: ; preds = %if.then.i, %for.body.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 %if.then28.i, label %for.body.i, !llvm.loop !9
for.end.i: ; preds = %if.then.i
%11 = trunc i64 %indvars.iv.i to i32
%inc17.i = add nsw i32 %top.059.i, 1
%idxprom18.i = sext i32 %inc17.i to i64
%arrayidx19.i = getelementptr inbounds [110 x i32], ptr %stack.i, i64 0, i64 %idxprom18.i
store i32 %11, ptr %arrayidx19.i, align 4, !tbaa !5
store i32 1, ptr %arrayidx9.i, align 4, !tbaa !5
%inc22.i = add nsw i32 %inc295558.i, 1
store i32 %inc22.i, ptr @tag, align 4, !tbaa !5
%arrayidx24.i = getelementptr inbounds [110 x i32], ptr @d, i64 0, i64 %indvars.iv.i
store i32 %inc22.i, ptr %arrayidx24.i, align 4, !tbaa !5
%cmp27.i = icmp eq i32 %add.i, %11
br i1 %cmp27.i, label %if.then28.i, label %if.end32.i
if.then28.i: ; preds = %for.inc.i, %for.end.i
%top.172.i = phi i32 [ %inc17.i, %for.end.i ], [ %top.059.i, %for.inc.i ]
%inc295771.i = phi i32 [ %inc22.i, %for.end.i ], [ %inc295558.i, %for.inc.i ]
%inc29.i = add nsw i32 %inc295771.i, 1
store i32 %inc29.i, ptr @tag, align 4, !tbaa !5
%arrayidx31.i = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %idxprom11.i
store i32 %inc29.i, ptr %arrayidx31.i, align 4, !tbaa !5
%dec.i = add nsw i32 %top.172.i, -1
br label %if.end32.i
if.end32.i: ; preds = %if.then28.i, %for.end.i
%inc2956.i = phi i32 [ %inc29.i, %if.then28.i ], [ %inc22.i, %for.end.i ]
%top.2.i = phi i32 [ %dec.i, %if.then28.i ], [ %inc17.i, %for.end.i ]
%tobool.not.i = icmp eq i32 %top.2.i, 0
br i1 %tobool.not.i, label %dfs.exit.loopexit, label %while.body.i, !llvm.loop !11
dfs.exit.loopexit: ; preds = %if.end32.i
call void @llvm.lifetime.end.p0(i64 440, ptr nonnull %stack.i) #5
br label %for.inc17
for.inc17: ; preds = %for.body13, %dfs.exit.loopexit
%inc29.us.us.i48 = phi i32 [ %inc29.us.us.i4952, %for.body13 ], [ %inc2956.i, %dfs.exit.loopexit ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count.i
br i1 %exitcond.not, label %for.cond20.preheader, label %for.body13, !llvm.loop !14
for.body22: ; preds = %for.cond20.preheader, %for.body22
%indvars.iv64 = phi i64 [ %indvars.iv.next65, %for.body22 ], [ 1, %for.cond20.preheader ]
%arrayidx24 = getelementptr inbounds [110 x i32], ptr @d, i64 0, i64 %indvars.iv64
%12 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%arrayidx26 = getelementptr inbounds [110 x i32], ptr @f, i64 0, i64 %indvars.iv64
%13 = load i32, ptr %arrayidx26, align 4, !tbaa !5
%14 = trunc i64 %indvars.iv64 to i32
%call27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14, i32 noundef %12, i32 noundef %13)
%indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
%15 = load i32, ptr @n, align 4, !tbaa !5
%16 = sext i32 %15 to i64
%cmp21.not.not = icmp slt i64 %indvars.iv64, %16
br i1 %cmp21.not.not, label %for.body22, label %for.end30, !llvm.loop !15
for.end30: ; preds = %for.body22, %entry, %for.cond11.preheader, %for.cond20.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
|
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
void DFS(void);
void DFS_visit(int);
int n, im[N][N];
int color[N],d[N], f[N], t=0;
int main()
{
int i, j, u, k, v;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
im[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&u,&k);
for(j=0;j<k;j++){
scanf("%d",&v);
im[u-1][v-1]=1;
}
}
DFS();
return 0;
}
void DFS()
{
int i;
for(i=0;i<n;i++){
color[i]=WHITE;
}
for(i=0;i<n;i++){
if(color[i]==WHITE) DFS_visit(i);
}
for(i=0;i<n;i++) printf("%d %d %d\n",i+1, d[i],f[i]);
}
void DFS_visit(int a)
{
int b;
color[a]=GRAY;
t++;
d[a]=t;
for(b=0;b<n;b++){
if(im[a][b]==1 && color[b]==WHITE) DFS_visit(b);
}
color[a]=BLACK;
t++;
f[a]=t;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195145/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195145/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@t = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@im = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %DFS.exit
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @im, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @im, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @im, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %DFS.exit
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %13, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%14 = load i32, ptr %u, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom17 = sext i32 %sub to i64
%15 = load i32, ptr %v, align 4, !tbaa !5
%sub19 = add nsw i32 %15, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @im, i64 0, i64 %idxprom17, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %16
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !14
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %DFS.exit
for.body3.preheader.i: ; preds = %for.end27
%17 = zext i32 %.pr to i64
%18 = shl nuw nsw i64 %17, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %18, i1 false), !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%19 = icmp sgt i32 %23, 0
br i1 %19, label %for.body12.i, label %DFS.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%20 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %23, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%21 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %21, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%22 = trunc i64 %indvars.iv.i to i32
call void @DFS_visit(i32 noundef %22)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%23 = phi i32 [ %20, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%24 = sext i32 %23 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %24
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !15
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%25 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27, i32 noundef %25, i32 noundef %26)
%28 = load i32, ptr @n, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %29
br i1 %cmp11.i, label %for.body12.i, label %DFS.exit, !llvm.loop !16
DFS.exit: ; preds = %for.body12.i, %entry, %for.cond9.preheader, %for.end27, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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 uwtable
define dso_local void @DFS() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @DFS_visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !15
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !16
for.end19: ; preds = %for.body12, %entry, %for.cond10.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @DFS_visit(i32 noundef %a) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp25 = icmp sgt i32 %1, 0
br i1 %cmp25, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @im, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 1
br i1 %cmp7, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @DFS_visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !17
for.end.loopexit: ; preds = %for.inc
%.pre28 = load i32, ptr @t, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre28, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc14 = add nsw i32 %8, 1
store i32 %inc14, ptr @t, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc14, ptr %arrayidx16, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#define N 100
#define W 0
#define G 1
#define B 2
void visit(int);
void dfs(void);
int n, m[N][N], color[N], d[N], f[N], t;
int main(){
int u, v, k, i, j;
scanf("%d", &n);
for(i=0; i<n; i++){
for(j=0; j<n; j++){
m[i][j] = 0;
}
}
for(i=0; i<n; i++){
scanf("%d%d", &u, &k);
u--;
for(j=0; j<k; j++){
scanf("%d", &v);
v--;
m[u][v] = 1;
}
}
dfs();
return 0;
}
void dfs(){
int u;
for(u=0; u<n; u++)color[u] = W;
t = 0;
for(u=0; u<n; u++){
if(color[u] == W)visit(u);
}
for(u=0; u<n; u++){
printf("%d %d %d\n", u+1, d[u], f[u]);
}
}
void visit(int u){
int v;
color[u] = G;
d[u] = ++t;
for(v=0; v<n; v++){
if(m[u][v] == 0)continue;
if(color[v] == W){
visit(v);
}
}
color[u] = B;
f[u] = ++t;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195189/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195189/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@m = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@t = dso_local local_unnamed_addr global i32 0, align 4
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @m, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @m, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @m, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !14
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @t, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @t, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @visit(i32 noundef %23)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !15
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !16
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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 uwtable
define dso_local void @dfs() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @t, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @t, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !15
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !16
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @visit(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @m, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !17
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @t, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @t, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
int G[100][100],n,color[100],d[100],f[100],time;
void dfs_visit(int u){
int v;
color[u] = GRAY;
d[u] = ++time;
for(v=0;v<n;v++){
if(G[u][v]==0) continue;
if(color[v] == WHITE){
dfs_visit(v);
}
}
color[u] = BLACK;
f[u] = ++time;
}
void dfs(){
int u;
for(u=0;u<n;u++) color[u] = WHITE;
time = 0;
for(u=0;u<n;u++) {
if(color[u] == WHITE) dfs_visit(u);
}
for(u=0;u<n;u++) {
printf("%d %d %d\n",u+1,d[u],f[u]);
}
}
int main(){
int i,j,u,k,v;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
G[i][j] = 0;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
u--;
for(j=0;j<k;j++){
scanf("%d",&v);
v--;
G[u][v] = 1;
}
}
dfs();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195231/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195231/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@time = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@G = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs_visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @time, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @time, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @time, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @time, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @G, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @G, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @G, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @time, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @dfs_visit(i32 noundef %23)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !12
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
int color[101], A[101][101], d[101], f[101], nt[101], time = 0;
int S[101],s = 1;
void dfs(int);
void dfsvisit(int,int);
void pop(void);
int next(int,int);
void push(int);
int empty(int,int);
void initstack(int);
int top(int);
int main() {
int i,j,n, u, v, k;
scanf("%d",&n);
initstack(n);
for (i = 1; i <= n; i++) {
for (j = 1; j <= n; j++) {
A[i][j] = 0;
}
}
for (i = 1; i <= n; i++) {
scanf("%d", &u);
scanf("%d", &k);
for (j = 1; j <= k; j++) {
scanf("%d", &v);
A[u][v] = 1;
}
}
dfs(n);
}
void dfs(int n) {
int i,u;
for (i = 1; i <= n; i++) {
color[i] = WHITE;
nt[i] = 0;
}
for (u = 1; u <= n; u++) {
if (color[u] == WHITE) {
dfsvisit(u,n);
}
}
for (i = 1; i <= n;i++) {
printf("%d %d %d\n",i,d[i],f[i]);
}
}
void dfsvisit(int u,int n) {
int i,v;
for (i = 1; i <= n; i++) {
nt[i] = 0;
}
push(u);
color[u] = GRAY;
d[u] = ++time;
while (empty(u, n)) {
u = top(n);
if (u == -1)break;
v = next(u, n);
if (v != -1) {
if (color[v] == WHITE) {
color[v] = GRAY;
d[v] = ++time;
push(v);
}
}
else {
pop();
color[u] = BLACK;
f[u] = ++time;
}
}
}
void initstack(int n) {
int i;
for (i = 1; i <= n; i++) {
S[i] = -1;
}
}
void pop() {
//printf("pop = %d\n", S[s-1]);
S[s-1] = -1;
s--;
}
int next(int u,int n) {
int i;
for (i = nt[u]; i <= n;i++) {
nt[u] = i+1;
if (A[u][i]) {
//printf("i = %d\n",i);
return i;
}
}
return -1;
}
void push(int u) {
S[s] = u;
s++;
}
int empty(int u,int n) {
int i,flag = 0;
for(i = 1; i <= n; i++) {
if (S[i] > -1) {
flag = 1;
}
}
return flag;
}
int top(int n) {
int i;
for (i = n; i > 0;i--) {
if (S[i] > 0) {
//printf("top = %d\n",S[i]);
return S[i];
}
}
return -1;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195275/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195275/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@time = dso_local local_unnamed_addr global i32 0, align 4
@s = dso_local local_unnamed_addr global i32 1, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@A = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@color = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@nt = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@S = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %n) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #9
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #9
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %n)
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp.not3.i = icmp slt i32 %0, 1
br i1 %cmp.not3.i, label %dfs.exit, label %for.cond1.preheader.preheader
for.cond1.preheader.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 4 getelementptr inbounds ([101 x i32], ptr @S, i64 0, i64 1), i8 -1, i64 %2, i1 false), !tbaa !5
%3 = zext i32 %0 to i64
%4 = shl nuw nsw i64 %3, 2
%xtraiter = and i64 %3, 7
%5 = icmp ult i32 %0, 8
br i1 %5, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.preheader.new
for.cond1.preheader.preheader.new: ; preds = %for.cond1.preheader.preheader
%unroll_iter = and i64 %3, 4294967288
br label %for.cond1.preheader
for.cond1.preheader: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %indvar.next.7, %for.cond1.preheader ]
%niter = phi i64 [ 0, %for.cond1.preheader.preheader.new ], [ %niter.next.7, %for.cond1.preheader ]
%6 = mul nuw nsw i64 %indvar, 404
%gep = getelementptr i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 %6
call void @llvm.memset.p0.i64(ptr align 8 %gep, i8 0, i64 %4, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep48 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 404), i64 %7
call void @llvm.memset.p0.i64(ptr align 4 %gep48, i8 0, i64 %4, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep49 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 808), i64 %8
call void @llvm.memset.p0.i64(ptr align 16 %gep49, i8 0, i64 %4, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep50 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 1212), i64 %9
call void @llvm.memset.p0.i64(ptr align 4 %gep50, i8 0, i64 %4, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 1616), i64 %10
call void @llvm.memset.p0.i64(ptr align 8 %gep51, i8 0, i64 %4, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 2020), i64 %11
call void @llvm.memset.p0.i64(ptr align 4 %gep52, i8 0, i64 %4, i1 false), !tbaa !5
%12 = mul nuw i64 %indvar, 404
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 2424), i64 %12
call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %4, i1 false), !tbaa !5
%13 = mul nuw i64 %indvar, 404
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 2828), i64 %13
call void @llvm.memset.p0.i64(ptr align 4 %gep54, i8 0, i64 %4, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader, %for.cond1.preheader.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.preheader ], [ %indvar.next.7, %for.cond1.preheader ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.epil
for.cond1.preheader.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%14 = mul nuw nsw i64 %indvar.epil, 404
%gep.epil = getelementptr i8, ptr getelementptr inbounds ([101 x [101 x i32]], ptr @A, i64 0, i64 1, i64 1), i64 %14
call void @llvm.memset.p0.i64(ptr align 4 %gep.epil, i8 0, i64 %4, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp.not3.i, label %dfs.exit, label %for.body11
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.143 = phi i32 [ %inc26, %for.inc25 ], [ 1, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
%call13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %k)
%15 = load i32, ptr %k, align 4, !tbaa !5
%cmp15.not40 = icmp slt i32 %15, 1
br i1 %cmp15.not40, label %for.inc25, label %for.body16
for.body16: ; preds = %for.body11, %for.body16
%j.141 = phi i32 [ %inc23, %for.body16 ], [ 1, %for.body11 ]
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%17 = load i32, ptr %v, align 4, !tbaa !5
%idxprom20 = sext i32 %17 to i64
%arrayidx21 = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.141, 1
%18 = load i32, ptr %k, align 4, !tbaa !5
%cmp15.not.not = icmp slt i32 %j.141, %18
br i1 %cmp15.not.not, label %for.body16, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body16, %for.body11
%inc26 = add nuw nsw i32 %i.143, 1
%19 = load i32, ptr %n, align 4, !tbaa !5
%cmp10.not.not = icmp slt i32 %i.143, %19
br i1 %cmp10.not.not, label %for.body11, label %for.end27, !llvm.loop !14
for.end27: ; preds = %for.inc25
%cmp.not36.i = icmp slt i32 %19, 1
br i1 %cmp.not36.i, label %dfs.exit, label %for.body5.preheader.i
for.body5.preheader.i: ; preds = %for.end27
%20 = zext i32 %19 to i64
%21 = shl nuw nsw i64 %20, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %21, i1 false), !tbaa !5
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @nt, i64 0, i64 1), i8 0, i64 %21, i1 false), !tbaa !5
%22 = add nuw nsw i32 %19, 1
%wide.trip.count.i = zext i32 %22 to i64
br label %for.body5.i
for.body5.i: ; preds = %for.inc9.i, %for.body5.preheader.i
%indvars.iv.i = phi i64 [ 1, %for.body5.preheader.i ], [ %indvars.iv.next.i, %for.inc9.i ]
%arrayidx7.i = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%23 = load i32, ptr %arrayidx7.i, align 4, !tbaa !5
%cmp8.i = icmp eq i32 %23, 0
br i1 %cmp8.i, label %if.then.i, label %for.inc9.i
if.then.i: ; preds = %for.body5.i
%24 = trunc i64 %indvars.iv.i to i32
call void @dfsvisit(i32 noundef %24, i32 noundef %19)
br label %for.inc9.i
for.inc9.i: ; preds = %if.then.i, %for.body5.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 %for.body14.i, label %for.body5.i, !llvm.loop !15
for.body14.i: ; preds = %for.inc9.i, %for.body14.i
%indvars.iv44.i = phi i64 [ %indvars.iv.next45.i, %for.body14.i ], [ 1, %for.inc9.i ]
%arrayidx16.i = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv44.i
%25 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%arrayidx18.i = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %indvars.iv44.i
%26 = load i32, ptr %arrayidx18.i, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv44.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %27, i32 noundef %25, i32 noundef %26)
%indvars.iv.next45.i = add nuw nsw i64 %indvars.iv44.i, 1
%exitcond48.not.i = icmp eq i64 %indvars.iv.next45.i, %wide.trip.count.i
br i1 %exitcond48.not.i, label %dfs.exit, label %for.body14.i, !llvm.loop !16
dfs.exit: ; preds = %for.body14.i, %entry, %for.cond9.preheader, %for.end27
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #9
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #9
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @initstack(i32 noundef %n) local_unnamed_addr #3 {
entry:
%cmp.not3 = icmp slt i32 %n, 1
br i1 %cmp.not3, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @S, i64 0, i64 1), i8 -1, i64 %1, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs(i32 noundef %n) local_unnamed_addr #0 {
entry:
%cmp.not36 = icmp slt i32 %n, 1
br i1 %cmp.not36, label %for.end21, label %for.body5.preheader
for.body5.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %1, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @nt, i64 0, i64 1), i8 0, i64 %1, i1 false), !tbaa !5
%2 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %2 to i64
br label %for.body5
for.cond12.preheader: ; preds = %for.inc9
br i1 %cmp.not36, label %for.end21, label %for.body14.preheader
for.body14.preheader: ; preds = %for.cond12.preheader
%3 = add nuw i32 %n, 1
%wide.trip.count47 = zext i32 %3 to i64
br label %for.body14
for.body5: ; preds = %for.body5.preheader, %for.inc9
%indvars.iv = phi i64 [ 1, %for.body5.preheader ], [ %indvars.iv.next, %for.inc9 ]
%arrayidx7 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx7, align 4, !tbaa !5
%cmp8 = icmp eq i32 %4, 0
br i1 %cmp8, label %if.then, label %for.inc9
if.then: ; preds = %for.body5
%5 = trunc i64 %indvars.iv to i32
tail call void @dfsvisit(i32 noundef %5, i32 noundef %n)
br label %for.inc9
for.inc9: ; preds = %for.body5, %if.then
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
br i1 %exitcond.not, label %for.cond12.preheader, label %for.body5, !llvm.loop !15
for.body14: ; preds = %for.body14.preheader, %for.body14
%indvars.iv44 = phi i64 [ 1, %for.body14.preheader ], [ %indvars.iv.next45, %for.body14 ]
%arrayidx16 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv44
%6 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %indvars.iv44
%7 = load i32, ptr %arrayidx18, align 4, !tbaa !5
%8 = trunc i64 %indvars.iv44 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8, i32 noundef %6, i32 noundef %7)
%indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
%exitcond48.not = icmp eq i64 %indvars.iv.next45, %wide.trip.count47
br i1 %exitcond48.not, label %for.end21, label %for.body14, !llvm.loop !16
for.end21: ; preds = %for.body14, %entry, %for.cond12.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfsvisit(i32 noundef %u, i32 noundef %n) local_unnamed_addr #4 {
entry:
%cmp.not69 = icmp slt i32 %n, 1
br i1 %cmp.not69, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = zext i32 %n to i64
%1 = shl nuw nsw i64 %0, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([101 x i32], ptr @nt, i64 0, i64 1), i8 0, i64 %1, i1 false), !tbaa !5
br label %for.end
for.end: ; preds = %for.body.preheader, %entry
%2 = load i32, ptr @s, align 4, !tbaa !5
%idxprom.i = sext i32 %2 to i64
%arrayidx.i = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i
store i32 %u, ptr %arrayidx.i, align 4, !tbaa !5
%inc.i = add nsw i32 %2, 1
store i32 %inc.i, ptr @s, align 4, !tbaa !5
%idxprom1 = sext i32 %u to i64
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom1
store i32 1, ptr %arrayidx2, align 4, !tbaa !5
%3 = load i32, ptr @time, align 4, !tbaa !5
%inc3 = add nsw i32 %3, 1
store i32 %inc3, ptr @time, align 4, !tbaa !5
%arrayidx5 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom1
store i32 %inc3, ptr %arrayidx5, align 4, !tbaa !5
br i1 %cmp.not69, label %while.end, label %for.body.preheader.i.lr.ph
for.body.preheader.i.lr.ph: ; preds = %for.end
%4 = add nuw i32 %n, 1
%wide.trip.count.i = zext i32 %4 to i64
%5 = zext i32 %n to i64
%6 = add nsw i64 %wide.trip.count.i, -1
%min.iters.check = icmp ult i32 %n, 8
%n.vec = and i64 %6, -8
%ind.end = or i64 %n.vec, 1
%cmp.n = icmp eq i64 %6, %n.vec
br label %for.body.preheader.i.outer
for.body.preheader.i.outer: ; preds = %for.body.preheader.i.outer.backedge, %for.body.preheader.i.lr.ph
%inc237276.ph = phi i32 [ %inc3, %for.body.preheader.i.lr.ph ], [ %inc237276.ph.be, %for.body.preheader.i.outer.backedge ]
%sub.i7475.ph = phi i32 [ %inc.i, %for.body.preheader.i.lr.ph ], [ %sub.i7475.ph.be, %for.body.preheader.i.outer.backedge ]
br label %for.body.preheader.i
for.body.preheader.i: ; preds = %for.body.preheader.i.outer, %if.then10
br i1 %min.iters.check, label %for.body.i.preheader, label %vector.body
vector.body: ; preds = %for.body.preheader.i, %vector.body
%index = phi i64 [ %index.next, %vector.body ], [ 0, %for.body.preheader.i ]
%vec.phi = phi <4 x i32> [ %11, %vector.body ], [ zeroinitializer, %for.body.preheader.i ]
%vec.phi87 = phi <4 x i32> [ %12, %vector.body ], [ zeroinitializer, %for.body.preheader.i ]
%offset.idx = or i64 %index, 1
%7 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
%8 = getelementptr inbounds i32, ptr %7, i64 4
%wide.load88 = load <4 x i32>, ptr %8, align 4, !tbaa !5
%9 = icmp sgt <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
%10 = icmp sgt <4 x i32> %wide.load88, <i32 -1, i32 -1, i32 -1, i32 -1>
%11 = select <4 x i1> %9, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%12 = select <4 x i1> %10, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi87
%index.next = add nuw i64 %index, 8
%13 = icmp eq i64 %index.next, %n.vec
br i1 %13, label %middle.block, label %vector.body, !llvm.loop !17
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %11, zeroinitializer
%rdx.select.cmp8991 = icmp ne <4 x i32> %12, zeroinitializer
%rdx.select.cmp89 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp8991
%14 = bitcast <4 x i1> %rdx.select.cmp89 to i4
%.not = icmp ne i4 %14, 0
%rdx.select90 = zext i1 %.not to i32
br i1 %cmp.n, label %empty.exit, label %for.body.i.preheader
for.body.i.preheader: ; preds = %for.body.preheader.i, %middle.block
%indvars.iv.i.ph = phi i64 [ 1, %for.body.preheader.i ], [ %ind.end, %middle.block ]
%flag.06.i.ph = phi i32 [ 0, %for.body.preheader.i ], [ %rdx.select90, %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 ]
%flag.06.i = phi i32 [ %spec.select.i, %for.body.i ], [ %flag.06.i.ph, %for.body.i.preheader ]
%arrayidx.i43 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %indvars.iv.i
%15 = load i32, ptr %arrayidx.i43, align 4, !tbaa !5
%cmp1.i = icmp sgt i32 %15, -1
%spec.select.i = select i1 %cmp1.i, i32 1, i32 %flag.06.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 %empty.exit, label %for.body.i, !llvm.loop !20
empty.exit: ; preds = %for.body.i, %middle.block
%spec.select.i.lcssa = phi i32 [ %rdx.select90, %middle.block ], [ %spec.select.i, %for.body.i ]
%tobool.not.not = icmp eq i32 %spec.select.i.lcssa, 0
br i1 %tobool.not.not, label %while.end, label %for.body.i44
for.cond.i: ; preds = %for.body.i44
%dec.i = add nsw i32 %i.08.i, -1
%cmp.i = icmp sgt i32 %i.08.i, 1
br i1 %cmp.i, label %for.body.i44, label %while.end, !llvm.loop !21
for.body.i44: ; preds = %empty.exit, %for.cond.i
%i.08.i = phi i32 [ %dec.i, %for.cond.i ], [ %n, %empty.exit ]
%idxprom.i45 = zext i32 %i.08.i to i64
%arrayidx.i46 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i45
%16 = load i32, ptr %arrayidx.i46, align 4, !tbaa !5
%cmp1.i47 = icmp sgt i32 %16, 0
br i1 %cmp1.i47, label %if.end, label %for.cond.i
if.end: ; preds = %for.body.i44
%idxprom.i48 = zext i32 %16 to i64
%arrayidx.i49 = getelementptr inbounds [101 x i32], ptr @nt, i64 0, i64 %idxprom.i48
%17 = load i32, ptr %arrayidx.i49, align 4, !tbaa !5
%18 = sext i32 %17 to i64
br label %for.cond.i50
for.cond.i50: ; preds = %for.body.i52, %if.end
%indvars.iv.i51 = phi i64 [ %indvars.iv.next.i53, %for.body.i52 ], [ %18, %if.end ]
%cmp.not.i = icmp sgt i64 %indvars.iv.i51, %5
br i1 %cmp.not.i, label %if.else, label %for.body.i52
for.body.i52: ; preds = %for.cond.i50
%indvars.iv.next.i53 = add nsw i64 %indvars.iv.i51, 1
%19 = trunc i64 %indvars.iv.next.i53 to i32
store i32 %19, ptr %arrayidx.i49, align 4, !tbaa !5
%arrayidx6.i = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom.i48, i64 %indvars.iv.i51
%20 = load i32, ptr %arrayidx6.i, align 4, !tbaa !5
%tobool.not.i = icmp eq i32 %20, 0
br i1 %tobool.not.i, label %for.cond.i50, label %next.exit, !llvm.loop !22
next.exit: ; preds = %for.body.i52
%21 = trunc i64 %indvars.iv.i51 to i32
%cmp9.not = icmp eq i32 %21, -1
br i1 %cmp9.not, label %if.else, label %if.then10
if.then10: ; preds = %next.exit
%sext = shl i64 %indvars.iv.i51, 32
%idxprom11 = ashr exact i64 %sext, 32
%arrayidx12 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom11
%22 = load i32, ptr %arrayidx12, align 4, !tbaa !5
%cmp13 = icmp eq i32 %22, 0
br i1 %cmp13, label %if.then14, label %for.body.preheader.i
if.then14: ; preds = %if.then10
store i32 1, ptr %arrayidx12, align 4, !tbaa !5
%inc17 = add nsw i32 %inc237276.ph, 1
store i32 %inc17, ptr @time, align 4, !tbaa !5
%arrayidx19 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom11
store i32 %inc17, ptr %arrayidx19, align 4, !tbaa !5
%idxprom.i55 = sext i32 %sub.i7475.ph to i64
%arrayidx.i56 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i55
store i32 %21, ptr %arrayidx.i56, align 4, !tbaa !5
%inc.i57 = add nsw i32 %sub.i7475.ph, 1
store i32 %inc.i57, ptr @s, align 4, !tbaa !5
br label %for.body.preheader.i.outer.backedge
for.body.preheader.i.outer.backedge: ; preds = %if.then14, %if.else
%inc237276.ph.be = phi i32 [ %inc23, %if.else ], [ %inc17, %if.then14 ]
%sub.i7475.ph.be = phi i32 [ %sub.i, %if.else ], [ %inc.i57, %if.then14 ]
br label %for.body.preheader.i.outer
if.else: ; preds = %next.exit, %for.cond.i50
%sub.i = add nsw i32 %sub.i7475.ph, -1
%idxprom.i58 = sext i32 %sub.i to i64
%arrayidx.i59 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom.i58
store i32 -1, ptr %arrayidx.i59, align 4, !tbaa !5
store i32 %sub.i, ptr @s, align 4, !tbaa !5
%arrayidx22 = getelementptr inbounds [101 x i32], ptr @color, i64 0, i64 %idxprom.i48
store i32 2, ptr %arrayidx22, align 4, !tbaa !5
%inc23 = add nsw i32 %inc237276.ph, 1
store i32 %inc23, ptr @time, align 4, !tbaa !5
%arrayidx25 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %idxprom.i48
store i32 %inc23, ptr %arrayidx25, align 4, !tbaa !5
br label %for.body.preheader.i.outer.backedge
while.end: ; preds = %empty.exit, %for.cond.i, %for.end
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @push(i32 noundef %u) local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @s, align 4, !tbaa !5
%idxprom = sext i32 %0 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
store i32 %u, ptr %arrayidx, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @s, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @empty(i32 noundef %u, i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp.not4 = icmp slt i32 %n, 1
br i1 %cmp.not4, label %for.end, label %for.body.preheader
for.body.preheader: ; preds = %entry
%0 = add nuw i32 %n, 1
%wide.trip.count = zext i32 %0 to i64
%1 = add nsw i64 %wide.trip.count, -1
%min.iters.check = icmp ult i32 %n, 8
br i1 %min.iters.check, label %for.body.preheader13, label %vector.ph
vector.ph: ; preds = %for.body.preheader
%n.vec = and i64 %1, -8
%ind.end = or i64 %n.vec, 1
br label %vector.body
vector.body: ; preds = %vector.body, %vector.ph
%index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
%vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %6, %vector.body ]
%vec.phi8 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %7, %vector.body ]
%offset.idx = or i64 %index, 1
%2 = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %offset.idx
%wide.load = load <4 x i32>, ptr %2, align 4, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
%wide.load9 = load <4 x i32>, ptr %3, align 4, !tbaa !5
%4 = icmp sgt <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
%5 = icmp sgt <4 x i32> %wide.load9, <i32 -1, i32 -1, i32 -1, i32 -1>
%6 = select <4 x i1> %4, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
%7 = select <4 x i1> %5, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi8
%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 !23
middle.block: ; preds = %vector.body
%rdx.select.cmp.not = icmp ne <4 x i32> %6, zeroinitializer
%rdx.select.cmp1012 = icmp ne <4 x i32> %7, zeroinitializer
%rdx.select.cmp10 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp1012
%9 = bitcast <4 x i1> %rdx.select.cmp10 to i4
%.not = icmp ne i4 %9, 0
%rdx.select11 = zext i1 %.not to i32
%cmp.n = icmp eq i64 %1, %n.vec
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 [ 1, %for.body.preheader ], [ %ind.end, %middle.block ]
%flag.06.ph = phi i32 [ 0, %for.body.preheader ], [ %rdx.select11, %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 ]
%flag.06 = phi i32 [ %spec.select, %for.body ], [ %flag.06.ph, %for.body.preheader13 ]
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %indvars.iv
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %10, -1
%spec.select = select i1 %cmp1, i32 1, i32 %flag.06
%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 !24
for.end: ; preds = %for.body, %middle.block, %entry
%flag.0.lcssa = phi i32 [ 0, %entry ], [ %rdx.select11, %middle.block ], [ %spec.select, %for.body ]
ret i32 %flag.0.lcssa
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @top(i32 noundef %n) local_unnamed_addr #6 {
entry:
%cmp7 = icmp sgt i32 %n, 0
br i1 %cmp7, label %for.body, label %cleanup
for.cond: ; preds = %for.body
%dec = add nsw i32 %i.08, -1
%cmp = icmp sgt i32 %i.08, 1
br i1 %cmp, label %for.body, label %cleanup, !llvm.loop !21
for.body: ; preds = %entry, %for.cond
%i.08 = phi i32 [ %dec, %for.cond ], [ %n, %entry ]
%idxprom = zext i32 %i.08 to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp1 = icmp sgt i32 %0, 0
br i1 %cmp1, label %cleanup, label %for.cond
cleanup: ; preds = %for.body, %for.cond, %entry
%retval.0 = phi i32 [ -1, %entry ], [ -1, %for.cond ], [ %0, %for.body ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @next(i32 noundef %u, i32 noundef %n) local_unnamed_addr #7 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @nt, i64 0, i64 %idxprom
%0 = load i32, ptr %arrayidx, align 4, !tbaa !5
%1 = sext i32 %0 to i64
%2 = sext i32 %n to i64
br label %for.cond
for.cond: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ %1, %entry ]
%cmp.not = icmp sgt i64 %indvars.iv, %2
br i1 %cmp.not, label %cleanup, label %for.body
for.body: ; preds = %for.cond
%indvars.iv.next = add nsw i64 %indvars.iv, 1
%3 = trunc i64 %indvars.iv.next to i32
store i32 %3, ptr %arrayidx, align 4, !tbaa !5
%arrayidx6 = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom, i64 %indvars.iv
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %for.cond, label %cleanup.split.loop.exit14, !llvm.loop !22
cleanup.split.loop.exit14: ; preds = %for.body
%5 = trunc i64 %indvars.iv to i32
br label %cleanup
cleanup: ; preds = %for.cond, %cleanup.split.loop.exit14
%retval.0 = phi i32 [ %5, %cleanup.split.loop.exit14 ], [ -1, %for.cond ]
ret i32 %retval.0
}
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @pop() local_unnamed_addr #5 {
entry:
%0 = load i32, ptr @s, align 4, !tbaa !5
%sub = add nsw i32 %0, -1
%idxprom = sext i32 %sub to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @S, i64 0, i64 %idxprom
store i32 -1, ptr %arrayidx, align 4, !tbaa !5
store i32 %sub, ptr @s, align 4, !tbaa !5
ret void
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !10, !19, !18}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !18, !19}
!24 = distinct !{!24, !10, !19, !18}
|
#include<stdio.h>
#define N 101
int sum[N][N],num[N],tum[N];
int n,i;
void rum(int xu){
int a;
tum[xu]=++i;
for(a=0;a<n;a++)
{
if(sum[xu][a] && tum[a]==0)rum(a);
}
num[xu]=++i;
}
int main()
{
int a,b,c,d,e;
scanf("%d",&n);
for(a=0;a<n;a++)
{
tum[a]=0;
num[a]=0;
for(b=0;b<n;b++)sum[a][b]=0;
}
for(a=0;a<n;a++)
{
scanf("%d",&c);
scanf("%d",&d);
for(b=0;b<d;b++)
{
scanf("%d",&e);
sum[c-1][e-1]=1;
}
}
i=0;
for(a=0;a<n;a++)
{
if(tum[a]==0)
rum(a);
}
for(a=0;a<n;a++)printf("%d %d %d\n",a+1,tum[a],num[a]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195318/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195318/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@i = dso_local local_unnamed_addr global i32 0, align 4
@tum = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@sum = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@num = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @rum(i32 noundef %xu) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @i, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @i, align 4, !tbaa !5
%idxprom = sext i32 %xu to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @tum, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp18 = icmp sgt i32 %1, 0
br i1 %cmp18, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx4 = getelementptr inbounds [101 x [101 x i32]], ptr @sum, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx4, align 4, !tbaa !5
%tobool.not = icmp eq i32 %3, 0
br i1 %tobool.not, label %for.inc, label %land.lhs.true
land.lhs.true: ; preds = %for.body
%arrayidx6 = getelementptr inbounds [101 x i32], ptr @tum, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %4, 0
br i1 %cmp7, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @rum(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre21 = load i32, ptr @i, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre21, %for.end.loopexit ], [ %inc, %entry ]
%inc9 = add nsw i32 %8, 1
store i32 %inc9, ptr @i, align 4, !tbaa !5
%arrayidx11 = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %idxprom
store i32 %inc9, ptr %arrayidx11, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %e) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp74 = icmp sgt i32 %0, 0
br i1 %cmp74, label %for.body.us.preheader, label %for.end32.thread
for.body.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @tum, i8 0, i64 %2, i1 false), !tbaa !5
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @num, i8 0, i64 %2, i1 false), !tbaa !5
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond13.preheader.unr-lcssa, label %for.body.us.preheader.new
for.body.us.preheader.new: ; preds = %for.body.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.body.us
for.body.us: ; preds = %for.body.us, %for.body.us.preheader.new
%indvar = phi i64 [ 0, %for.body.us.preheader.new ], [ %indvar.next.7, %for.body.us ]
%niter = phi i64 [ 0, %for.body.us.preheader.new ], [ %niter.next.7, %for.body.us ]
%4 = mul nuw nsw i64 %indvar, 404
%scevgep = getelementptr i8, ptr @sum, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 404
%gep = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 404), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 4 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 404
%gep96 = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 808), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 8 %gep96, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep97 = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 1212), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 4 %gep97, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep98 = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 1616), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep98, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep99 = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 2020), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 4 %gep99, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep100 = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 2424), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 8 %gep100, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep101 = getelementptr i8, ptr getelementptr (i8, ptr @sum, i64 2828), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 4 %gep101, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond13.preheader.unr-lcssa, label %for.body.us, !llvm.loop !11
for.cond13.preheader.unr-lcssa: ; preds = %for.body.us, %for.body.us.preheader
%indvar.unr = phi i64 [ 0, %for.body.us.preheader ], [ %indvar.next.7, %for.body.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond13.preheader, label %for.body.us.epil
for.body.us.epil: ; preds = %for.cond13.preheader.unr-lcssa, %for.body.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.body.us.epil ], [ %indvar.unr, %for.cond13.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.body.us.epil ], [ 0, %for.cond13.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 404
%scevgep.epil = getelementptr i8, ptr @sum, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.body.us.epil, !llvm.loop !12
for.cond13.preheader: ; preds = %for.body.us.epil, %for.cond13.preheader.unr-lcssa
br i1 %cmp74, label %for.body15, label %for.end32.thread
for.body15: ; preds = %for.cond13.preheader, %for.inc30
%a.179 = phi i32 [ %inc31, %for.inc30 ], [ 0, %for.cond13.preheader ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%call17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %d)
%13 = load i32, ptr %d, align 4, !tbaa !5
%cmp1976 = icmp sgt i32 %13, 0
br i1 %cmp1976, label %for.body20, label %for.inc30
for.body20: ; preds = %for.body15, %for.body20
%b.177 = phi i32 [ %inc28, %for.body20 ], [ 0, %for.body15 ]
%call21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %e)
%14 = load i32, ptr %c, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom22 = sext i32 %sub to i64
%15 = load i32, ptr %e, align 4, !tbaa !5
%sub24 = add nsw i32 %15, -1
%idxprom25 = sext i32 %sub24 to i64
%arrayidx26 = getelementptr inbounds [101 x [101 x i32]], ptr @sum, i64 0, i64 %idxprom22, i64 %idxprom25
store i32 1, ptr %arrayidx26, align 4, !tbaa !5
%inc28 = add nuw nsw i32 %b.177, 1
%16 = load i32, ptr %d, align 4, !tbaa !5
%cmp19 = icmp slt i32 %inc28, %16
br i1 %cmp19, label %for.body20, label %for.inc30, !llvm.loop !14
for.inc30: ; preds = %for.body20, %for.body15
%inc31 = add nuw nsw i32 %a.179, 1
%17 = load i32, ptr @n, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc31, %17
br i1 %cmp14, label %for.body15, label %for.end32, !llvm.loop !15
for.end32.thread: ; preds = %for.cond13.preheader, %entry
store i32 0, ptr @i, align 4, !tbaa !5
br label %for.end52
for.end32: ; preds = %for.inc30
store i32 0, ptr @i, align 4, !tbaa !5
%cmp3480 = icmp sgt i32 %17, 0
br i1 %cmp3480, label %for.body35, label %for.end52
for.cond42.preheader: ; preds = %for.inc39
%18 = icmp sgt i32 %22, 0
br i1 %18, label %for.body44, label %for.end52
for.body35: ; preds = %for.end32, %for.inc39
%19 = phi i32 [ %22, %for.inc39 ], [ %17, %for.end32 ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc39 ], [ 0, %for.end32 ]
%arrayidx37 = getelementptr inbounds [101 x i32], ptr @tum, i64 0, i64 %indvars.iv
%20 = load i32, ptr %arrayidx37, align 4, !tbaa !5
%cmp38 = icmp eq i32 %20, 0
br i1 %cmp38, label %if.then, label %for.inc39
if.then: ; preds = %for.body35
%21 = trunc i64 %indvars.iv to i32
call void @rum(i32 noundef %21)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc39
for.inc39: ; preds = %for.body35, %if.then
%22 = phi i32 [ %19, %for.body35 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = sext i32 %22 to i64
%cmp34 = icmp slt i64 %indvars.iv.next, %23
br i1 %cmp34, label %for.body35, label %for.cond42.preheader, !llvm.loop !16
for.body44: ; preds = %for.cond42.preheader, %for.body44
%indvars.iv87 = phi i64 [ %indvars.iv.next88, %for.body44 ], [ 0, %for.cond42.preheader ]
%indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
%arrayidx46 = getelementptr inbounds [101 x i32], ptr @tum, i64 0, i64 %indvars.iv87
%24 = load i32, ptr %arrayidx46, align 4, !tbaa !5
%arrayidx48 = getelementptr inbounds [101 x i32], ptr @num, i64 0, i64 %indvars.iv87
%25 = load i32, ptr %arrayidx48, align 4, !tbaa !5
%26 = trunc i64 %indvars.iv.next88 to i32
%call49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %26, i32 noundef %24, i32 noundef %25)
%27 = load i32, ptr @n, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp43 = icmp slt i64 %indvars.iv.next88, %28
br i1 %cmp43, label %for.body44, label %for.end52, !llvm.loop !17
for.end52: ; preds = %for.body44, %for.end32.thread, %for.end32, %for.cond42.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %e) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %d) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #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 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 = { 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 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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define MAX 100
#define WHITE 0
#define GLAY 1
#define BLACK 2
int n,color[MAX],d[MAX],f[MAX],time,A[MAX][MAX];
void dfs_visit(int u){
int v,i;
color[u]=1;
d[u]=++time;
for(v=0;v<n;v++){
if(A[u][v]==0)continue;
if(color[v]==0)dfs_visit(v);
}
color[u]=2;
f[u]=++time;
}
void dfs(void){
int i;
for(i=0;i<n;i++){
color[i]=0;
time=0;
}
for(i=0;i<n;i++){
if(color[i]==0) dfs_visit(i);
}
for(i=0;i<n;i++){
printf("%d %d %d\n",i+1,d[i],f[i]);
}
}
int main(){
int i,j,u,k,v;
scanf("%d",&n);
for(i=0;i<n;i++){
for(j=0;j<n;j++){
A[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d %d",&u,&k);
for(j=0;j<k;j++){
scanf("%d",&v);
A[u-1][v-1]=1;
}
}
dfs();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195361/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195361/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@time = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@A = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs_visit(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @time, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @time, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @time, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @time, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.end19
for.body3.preheader: ; preds = %entry
store i32 0, ptr @time, align 4, !tbaa !5
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %entry, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%k = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %dfs.exit
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @A, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @A, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @A, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %dfs.exit
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %13, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%14 = load i32, ptr %u, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom17 = sext i32 %sub to i64
%15 = load i32, ptr %v, align 4, !tbaa !5
%sub19 = add nsw i32 %15, -1
%idxprom20 = sext i32 %sub19 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %idxprom17, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%16 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %16
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
store i32 0, ptr @time, align 4, !tbaa !5
%17 = zext i32 %.pr to i64
%18 = shl nuw nsw i64 %17, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %18, i1 false), !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%19 = icmp sgt i32 %23, 0
br i1 %19, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%20 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %23, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%21 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %21, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%22 = trunc i64 %indvars.iv.i to i32
call void @dfs_visit(i32 noundef %22)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%23 = phi i32 [ %20, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%24 = sext i32 %23 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %24
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%25 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %27, i32 noundef %25, i32 noundef %26)
%28 = load i32, ptr @n, align 4, !tbaa !5
%29 = sext i32 %28 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %29
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !12
dfs.exit: ; preds = %for.body12.i, %entry, %for.cond9.preheader, %for.end27, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n, M[N][N];
int color[N], d[N], f[N], tt;
void kaneko(int u) {
int v;
color[u] = GRAY;
d[u] = ++tt;
for (v = 0; v < n; v++) {
if (M[u][v] == 0) {
continue;
}
if (color[v] == WHITE) {
kaneko(v);
}
}
color[u] = BLACK;
f[u] = ++tt;
}
void emiko() {
int u;
for (u = 0; u < n; u++) {
color[u] = WHITE;
}
tt = 0;
for (u = 0; u < n; u++) {
if (color[u] == WHITE) {
kaneko(u);
}
}
for (u = 0; u < n; u++) {
printf("%d %d %d\n", u + 1, d[u], f[u]);
}
}
int main() {
int u, v, k, i, j;
scanf("%d", &n);
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
M[i][j] = 0;
}
}
for (i = 0; i < n; i++) {
scanf("%d %d", &u, &k);
u--;
for (j = 0; j < k; j++) {
scanf("%d", &v);
v--;
M[u][v] = 1;
}
}
emiko();
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195404/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195404/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@tt = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@n = dso_local global i32 0, align 4
@M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@.str.1 = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @kaneko(i32 noundef %u) local_unnamed_addr #0 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @tt, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @tt, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @kaneko(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @tt, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @tt, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local void @emiko() local_unnamed_addr #2 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @kaneko(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !11
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !12
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @M, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @M, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !13
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @M, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !14
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !16
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !17
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @tt, align 4, !tbaa !5
br label %emiko.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @tt, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %emiko.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @kaneko(i32 noundef %23)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !11
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %emiko.exit, !llvm.loop !12
emiko.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#define MAX 110
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,time;
int dis[MAX],fin[MAX],color[MAX],num[MAX][MAX];
void dfs(void);
void visit(int);
int main(){
int i,j,k,u,v;
scanf("%d",&n);
for(i=1;i<=n;i++){
scanf("%d%d",&u,&k);
for(j=1;j<=k;j++){
scanf("%d",&v);
num[u][v] = 1;
}
}
dfs();
return 0;
}
void visit(int u){
int v;
color[u] = GRAY;
dis[u] = ++time;
for(v=1; v<=n; v++){
if(num[u][v] == 1 && color[v] == WHITE) visit(v);
}
color[u] = BLACK;
fin[u] = ++time;
}
void dfs(){
int u;//for each vertex u in v. use in this part count "u" convenientry.
for(u=1;u<=n;u++){
color[u] = WHITE;
}
time = 0;
for(u=1;u<=n;u++){
if (color[u] == WHITE) visit(u);
}
for(u=1;u<=n;u++){
printf("%d %d %d\n",u,dis[u],fin[u]);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195448/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195448/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@num = dso_local local_unnamed_addr global [110 x [110 x i32]] zeroinitializer, align 16
@color = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@time = dso_local local_unnamed_addr global i32 0, align 4
@dis = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@fin = dso_local local_unnamed_addr global [110 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%u = alloca i32, align 4
%v = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not16 = icmp slt i32 %0, 1
br i1 %cmp.not16, label %for.cond10.preheader.thread.i, label %for.body
for.body: ; preds = %entry, %for.inc8
%i.017 = phi i32 [ %inc9, %for.inc8 ], [ 1, %entry ]
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%1 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not14 = icmp slt i32 %1, 1
br i1 %cmp3.not14, label %for.inc8, label %for.body4
for.body4: ; preds = %for.body, %for.body4
%j.015 = phi i32 [ %inc, %for.body4 ], [ 1, %for.body ]
%call5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom = sext i32 %2 to i64
%3 = load i32, ptr %v, align 4, !tbaa !5
%idxprom6 = sext i32 %3 to i64
%arrayidx7 = getelementptr inbounds [110 x [110 x i32]], ptr @num, i64 0, i64 %idxprom, i64 %idxprom6
store i32 1, ptr %arrayidx7, align 4, !tbaa !5
%inc = add nuw nsw i32 %j.015, 1
%4 = load i32, ptr %k, align 4, !tbaa !5
%cmp3.not.not = icmp slt i32 %j.015, %4
br i1 %cmp3.not.not, label %for.body4, label %for.inc8, !llvm.loop !9
for.inc8: ; preds = %for.body4, %for.body
%inc9 = add nuw nsw i32 %i.017, 1
%5 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not.not = icmp slt i32 %i.017, %5
br i1 %cmp.not.not, label %for.body, label %for.end10, !llvm.loop !11
for.end10: ; preds = %for.inc8
%cmp.not31.i = icmp slt i32 %5, 1
br i1 %cmp.not31.i, label %for.cond10.preheader.thread.i, label %for.body3.preheader.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.end10
store i32 0, ptr @time, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end10
%6 = zext i32 %5 to i64
%7 = shl nuw nsw i64 %6, 2
call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([110 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %7, i1 false), !tbaa !5
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%8 = icmp slt i32 %12, 1
br i1 %8, label %dfs.exit, label %for.body12.i
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%9 = phi i32 [ %5, %for.body3.preheader.i ], [ %12, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 1, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [110 x i32], ptr @color, i64 0, i64 %indvars.iv.i
%10 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %10, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%11 = trunc i64 %indvars.iv.i to i32
call void @visit(i32 noundef %11)
%.pre.i = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%12 = phi i32 [ %9, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%13 = sext i32 %12 to i64
%cmp2.not.not.i = icmp slt i64 %indvars.iv.i, %13
br i1 %cmp2.not.not.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !12
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 1, %for.cond10.preheader.i ]
%arrayidx14.i = getelementptr inbounds [110 x i32], ptr @dis, i64 0, i64 %indvars.iv39.i
%14 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [110 x i32], ptr @fin, i64 0, i64 %indvars.iv39.i
%15 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%16 = trunc i64 %indvars.iv39.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %16, i32 noundef %14, i32 noundef %15)
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%17 = load i32, ptr @n, align 4, !tbaa !5
%18 = sext i32 %17 to i64
%cmp11.not.not.i = icmp slt i64 %indvars.iv39.i, %18
br i1 %cmp11.not.not.i, label %for.body12.i, label %dfs.exit, !llvm.loop !13
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 uwtable
define dso_local void @dfs() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not31 = icmp slt i32 %0, 1
br i1 %cmp.not31, label %for.cond10.preheader.thread, label %for.body3.preheader
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds ([110 x i32], ptr @color, i64 0, i64 1), i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @time, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp slt i32 %7, 1
br i1 %3, label %for.end19, label %for.body12
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 1, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [110 x i32], ptr @color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %6)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2.not.not = icmp slt i64 %indvars.iv, %8
br i1 %cmp2.not.not, label %for.body3, label %for.cond10.preheader, !llvm.loop !12
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 1, %for.cond10.preheader ]
%arrayidx14 = getelementptr inbounds [110 x i32], ptr @dis, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [110 x i32], ptr @fin, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv39 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%12 = load i32, ptr @n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11.not.not = icmp slt i64 %indvars.iv39, %13
br i1 %cmp11.not.not, label %for.body12, label %for.end19, !llvm.loop !13
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @visit(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [110 x i32], ptr @color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @time, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @time, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [110 x i32], ptr @dis, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not25 = icmp slt i32 %1, 1
br i1 %cmp.not25, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%arrayidx6 = getelementptr inbounds [110 x [110 x i32]], ptr @num, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 1
br i1 %cmp7, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [110 x i32], ptr @color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp.not.not = icmp slt i64 %indvars.iv, %7
br i1 %cmp.not.not, label %for.body, label %for.end.loopexit, !llvm.loop !14
for.end.loopexit: ; preds = %for.inc
%.pre28 = load i32, ptr @time, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre28, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc14 = add nsw i32 %8, 1
store i32 %inc14, ptr @time, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [110 x i32], ptr @fin, i64 0, i64 %idxprom
store i32 %inc14, ptr %arrayidx16, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
void dfs_visit(int);
void dfs();
int g_n, g_M[N][N];
int g_color[N], d[N], f[N], count;
int main(){
int u,v,k,i,j;
scanf("%d",&g_n);
for(i = 0; i < g_n; i++){
for(j = 0; j < g_n; j++){
g_M[i][j] = 0;
}
}
for(i = 0; i < g_n; i++){
scanf("%d %d", &u, &k);
u--;
for(j = 0; j < k; j++){
scanf("%d",&v);
v--;
g_M[u][v] = 1;
}
}
dfs();
return 0;
}
void dfs_visit(int u){
int v;
g_color[u] = GRAY;
d[u] = ++count;
for(v = 0; v < g_n; v++){
if(g_M[u][v] == 0) continue;
if(g_color[v] == WHITE) dfs_visit(v);
}
g_color[u] = BLACK;
f[u] = ++count;
}
void dfs(){
int u;
for(u = 0; u < g_n; u++) g_color[u] = WHITE;
count = 0;
for(u = 0; u < g_n; u++){
if(g_color[u] == WHITE) dfs_visit(u);
}
for(u = 0; u < g_n; u++){
printf("%d %d %d\n",u+1, d[u], f[u]);
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195499/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195499/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@g_n = dso_local global i32 0, align 4
@g_M = dso_local local_unnamed_addr global [100 x [100 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [6 x i8] c"%d %d\00", align 1
@g_color = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@count = dso_local local_unnamed_addr global i32 0, align 4
@d = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [100 x i32] zeroinitializer, align 16
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%u = alloca i32, align 4
%v = alloca i32, align 4
%k = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @g_n)
%0 = load i32, ptr @g_n, align 4, !tbaa !5
%cmp40 = icmp sgt i32 %0, 0
br i1 %cmp40, label %for.cond1.preheader.us.preheader, label %for.cond10.preheader.thread.i
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 400
%scevgep = getelementptr i8, ptr @g_M, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 400
%gep = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 400), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 400
%gep51 = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 800), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 16 %gep51, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 400
%gep52 = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 1200), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 16 %gep52, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 400
%gep53 = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 1600), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep53, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 400
%gep54 = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 2000), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 16 %gep54, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 400
%gep55 = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 2400), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 16 %gep55, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 400
%gep56 = getelementptr i8, ptr getelementptr (i8, ptr @g_M, i64 2800), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 16 %gep56, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 400
%scevgep.epil = getelementptr i8, ptr @g_M, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp40, label %for.body11, label %for.cond10.preheader.thread.i
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.145 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1442 = icmp sgt i32 %14, 0
br i1 %cmp1442, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.143 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [100 x [100 x i32]], ptr @g_M, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.143, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.145, 1
%.pr = load i32, ptr @g_n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %.pr
br i1 %cmp10, label %for.body11, label %for.end27, !llvm.loop !14
for.end27: ; preds = %for.inc25
%cmp31.i = icmp sgt i32 %.pr, 0
br i1 %cmp31.i, label %for.body3.preheader.i, label %for.cond10.preheader.thread.i
for.cond10.preheader.thread.i: ; preds = %entry, %for.cond9.preheader, %for.end27
store i32 0, ptr @count, align 4, !tbaa !5
br label %dfs.exit
for.body3.preheader.i: ; preds = %for.end27
%18 = zext i32 %.pr to i64
%19 = shl nuw nsw i64 %18, 2
call void @llvm.memset.p0.i64(ptr nonnull align 16 @g_color, i8 0, i64 %19, i1 false), !tbaa !5
store i32 0, ptr @count, align 4, !tbaa !5
br label %for.body3.i
for.cond10.preheader.i: ; preds = %for.inc7.i
%20 = icmp sgt i32 %24, 0
br i1 %20, label %for.body12.i, label %dfs.exit
for.body3.i: ; preds = %for.inc7.i, %for.body3.preheader.i
%21 = phi i32 [ %.pr, %for.body3.preheader.i ], [ %24, %for.inc7.i ]
%indvars.iv.i = phi i64 [ 0, %for.body3.preheader.i ], [ %indvars.iv.next.i, %for.inc7.i ]
%arrayidx5.i = getelementptr inbounds [100 x i32], ptr @g_color, i64 0, i64 %indvars.iv.i
%22 = load i32, ptr %arrayidx5.i, align 4, !tbaa !5
%cmp6.i = icmp eq i32 %22, 0
br i1 %cmp6.i, label %if.then.i, label %for.inc7.i
if.then.i: ; preds = %for.body3.i
%23 = trunc i64 %indvars.iv.i to i32
call void @dfs_visit(i32 noundef %23)
%.pre.i = load i32, ptr @g_n, align 4, !tbaa !5
br label %for.inc7.i
for.inc7.i: ; preds = %if.then.i, %for.body3.i
%24 = phi i32 [ %21, %for.body3.i ], [ %.pre.i, %if.then.i ]
%indvars.iv.next.i = add nuw nsw i64 %indvars.iv.i, 1
%25 = sext i32 %24 to i64
%cmp2.i = icmp slt i64 %indvars.iv.next.i, %25
br i1 %cmp2.i, label %for.body3.i, label %for.cond10.preheader.i, !llvm.loop !15
for.body12.i: ; preds = %for.cond10.preheader.i, %for.body12.i
%indvars.iv39.i = phi i64 [ %indvars.iv.next40.i, %for.body12.i ], [ 0, %for.cond10.preheader.i ]
%indvars.iv.next40.i = add nuw nsw i64 %indvars.iv39.i, 1
%arrayidx14.i = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39.i
%26 = load i32, ptr %arrayidx14.i, align 4, !tbaa !5
%arrayidx16.i = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39.i
%27 = load i32, ptr %arrayidx16.i, align 4, !tbaa !5
%28 = trunc i64 %indvars.iv.next40.i to i32
%call.i = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28, i32 noundef %26, i32 noundef %27)
%29 = load i32, ptr @g_n, align 4, !tbaa !5
%30 = sext i32 %29 to i64
%cmp11.i = icmp slt i64 %indvars.iv.next40.i, %30
br i1 %cmp11.i, label %for.body12.i, label %dfs.exit, !llvm.loop !16
dfs.exit: ; preds = %for.body12.i, %for.cond10.preheader.thread.i, %for.cond10.preheader.i
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @dfs_visit(i32 noundef %u) local_unnamed_addr #3 {
entry:
%idxprom = sext i32 %u to i64
%arrayidx = getelementptr inbounds [100 x i32], ptr @g_color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx, align 4, !tbaa !5
%0 = load i32, ptr @count, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @count, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @g_n, align 4, !tbaa !5
%cmp27 = icmp sgt i32 %1, 0
br i1 %cmp27, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [100 x [100 x i32]], ptr @g_M, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 0
br i1 %cmp7, label %for.inc, label %if.end
if.end: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [100 x i32], ptr @g_color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then11, label %for.inc
if.then11: ; preds = %if.end
%5 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %5)
%.pre = load i32, ptr @g_n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %if.end, %if.then11, %for.body
%6 = phi i32 [ %2, %if.end ], [ %.pre, %if.then11 ], [ %2, %for.body ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !17
for.end.loopexit: ; preds = %for.inc
%.pre30 = load i32, ptr @count, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre30, %for.end.loopexit ], [ %inc, %entry ]
store i32 2, ptr %arrayidx, align 4, !tbaa !5
%inc16 = add nsw i32 %8, 1
store i32 %inc16, ptr @count, align 4, !tbaa !5
%arrayidx18 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc16, ptr %arrayidx18, align 4, !tbaa !5
ret void
}
; Function Attrs: nofree nounwind uwtable
define dso_local void @dfs() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @g_n, align 4, !tbaa !5
%cmp31 = icmp sgt i32 %0, 0
br i1 %cmp31, label %for.body3.preheader, label %for.cond10.preheader.thread
for.cond10.preheader.thread: ; preds = %entry
store i32 0, ptr @count, align 4, !tbaa !5
br label %for.end19
for.body3.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @g_color, i8 0, i64 %2, i1 false), !tbaa !5
store i32 0, ptr @count, align 4, !tbaa !5
br label %for.body3
for.cond10.preheader: ; preds = %for.inc7
%3 = icmp sgt i32 %7, 0
br i1 %3, label %for.body12, label %for.end19
for.body3: ; preds = %for.body3.preheader, %for.inc7
%4 = phi i32 [ %0, %for.body3.preheader ], [ %7, %for.inc7 ]
%indvars.iv = phi i64 [ 0, %for.body3.preheader ], [ %indvars.iv.next, %for.inc7 ]
%arrayidx5 = getelementptr inbounds [100 x i32], ptr @g_color, i64 0, i64 %indvars.iv
%5 = load i32, ptr %arrayidx5, align 4, !tbaa !5
%cmp6 = icmp eq i32 %5, 0
br i1 %cmp6, label %if.then, label %for.inc7
if.then: ; preds = %for.body3
%6 = trunc i64 %indvars.iv to i32
tail call void @dfs_visit(i32 noundef %6)
%.pre = load i32, ptr @g_n, align 4, !tbaa !5
br label %for.inc7
for.inc7: ; preds = %for.body3, %if.then
%7 = phi i32 [ %4, %for.body3 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%8 = sext i32 %7 to i64
%cmp2 = icmp slt i64 %indvars.iv.next, %8
br i1 %cmp2, label %for.body3, label %for.cond10.preheader, !llvm.loop !15
for.body12: ; preds = %for.cond10.preheader, %for.body12
%indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body12 ], [ 0, %for.cond10.preheader ]
%indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
%arrayidx14 = getelementptr inbounds [100 x i32], ptr @d, i64 0, i64 %indvars.iv39
%9 = load i32, ptr %arrayidx14, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [100 x i32], ptr @f, i64 0, i64 %indvars.iv39
%10 = load i32, ptr %arrayidx16, align 4, !tbaa !5
%11 = trunc i64 %indvars.iv.next40 to i32
%call = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %11, i32 noundef %9, i32 noundef %10)
%12 = load i32, ptr @g_n, align 4, !tbaa !5
%13 = sext i32 %12 to i64
%cmp11 = icmp slt i64 %indvars.iv.next40, %13
br i1 %cmp11, label %for.body12, label %for.end19, !llvm.loop !16
for.end19: ; preds = %for.body12, %for.cond10.preheader.thread, %for.cond10.preheader
ret void
}
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#define MAX 101
void Depth(int);
int G[MAX][MAX],D[MAX],d[MAX],f[MAX];
int n,count=1;
int main( ){
int i,j,k,l,v,u;
scanf("%d",&n);
D[0] = 0;
for(i=0;i<n;i++){
for(j=0;j<n;j++){
G[i][j]=0;
}
}
for(i=0;i<n;i++){
scanf("%d%d",&u,&k);
u--;
for(j=0;j<k;j++){
scanf("%d",&v);
v--;
G[u][v] = 1;
}
}
for(i=0;i<n;i++){
if(D[i]==0){
Depth(i);
}
}
for(i=0;i<n-1;i++){
printf("%d %d %d\n",i+1,d[i],f[i]);
}
printf("%d %d %d\n",i+1,d[i],f[i]);
return 0;
}
void Depth(int a) {
int b;
d[a] = count++;
D[a] = 1;
for(b = 0 ; b < n ; b++) {
if(G[a][b] == 1 && D[b] == 0) {
Depth(b);
}
}
f[a] = count++;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195541/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195541/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@count = dso_local local_unnamed_addr global i32 1, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@D = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@G = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%k = alloca i32, align 4
%v = alloca i32, align 4
%u = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 0, ptr @D, align 16, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp76 = icmp sgt i32 %0, 0
br i1 %cmp76, label %for.cond1.preheader.us.preheader, label %for.end47
for.cond1.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us.preheader.new
for.cond1.preheader.us.preheader.new: ; preds = %for.cond1.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond1.preheader.us
for.cond1.preheader.us: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond1.preheader.us ]
%niter = phi i64 [ 0, %for.cond1.preheader.us.preheader.new ], [ %niter.next.7, %for.cond1.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 404
%scevgep = getelementptr i8, ptr @G, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 404
%gep = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 404), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 4 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 404
%gep103 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 808), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 8 %gep103, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep104 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 1212), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 4 %gep104, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep105 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 1616), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep105, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep106 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2020), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 4 %gep106, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep107 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2424), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 8 %gep107, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep108 = getelementptr i8, ptr getelementptr (i8, ptr @G, i64 2828), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 4 %gep108, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond9.preheader.unr-lcssa, label %for.cond1.preheader.us, !llvm.loop !9
for.cond9.preheader.unr-lcssa: ; preds = %for.cond1.preheader.us, %for.cond1.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond1.preheader.us.preheader ], [ %indvar.next.7, %for.cond1.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond9.preheader, label %for.cond1.preheader.us.epil
for.cond1.preheader.us.epil: ; preds = %for.cond9.preheader.unr-lcssa, %for.cond1.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond1.preheader.us.epil ], [ %indvar.unr, %for.cond9.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond1.preheader.us.epil ], [ 0, %for.cond9.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 404
%scevgep.epil = getelementptr i8, ptr @G, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond9.preheader, label %for.cond1.preheader.us.epil, !llvm.loop !11
for.cond9.preheader: ; preds = %for.cond1.preheader.us.epil, %for.cond9.preheader.unr-lcssa
br i1 %cmp76, label %for.body11, label %for.end47
for.cond28.preheader: ; preds = %for.inc25
%cmp2982 = icmp sgt i32 %18, 0
br i1 %cmp2982, label %for.body30, label %for.end47
for.body11: ; preds = %for.cond9.preheader, %for.inc25
%i.181 = phi i32 [ %inc26, %for.inc25 ], [ 0, %for.cond9.preheader ]
%call12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %u, ptr noundef nonnull %k)
%13 = load i32, ptr %u, align 4, !tbaa !5
%dec = add nsw i32 %13, -1
store i32 %dec, ptr %u, align 4, !tbaa !5
%14 = load i32, ptr %k, align 4, !tbaa !5
%cmp1478 = icmp sgt i32 %14, 0
br i1 %cmp1478, label %for.body15, label %for.inc25
for.body15: ; preds = %for.body11, %for.body15
%j.179 = phi i32 [ %inc23, %for.body15 ], [ 0, %for.body11 ]
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %v)
%15 = load i32, ptr %v, align 4, !tbaa !5
%dec17 = add nsw i32 %15, -1
store i32 %dec17, ptr %v, align 4, !tbaa !5
%16 = load i32, ptr %u, align 4, !tbaa !5
%idxprom18 = sext i32 %16 to i64
%idxprom20 = sext i32 %dec17 to i64
%arrayidx21 = getelementptr inbounds [101 x [101 x i32]], ptr @G, i64 0, i64 %idxprom18, i64 %idxprom20
store i32 1, ptr %arrayidx21, align 4, !tbaa !5
%inc23 = add nuw nsw i32 %j.179, 1
%17 = load i32, ptr %k, align 4, !tbaa !5
%cmp14 = icmp slt i32 %inc23, %17
br i1 %cmp14, label %for.body15, label %for.inc25, !llvm.loop !13
for.inc25: ; preds = %for.body15, %for.body11
%inc26 = add nuw nsw i32 %i.181, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%cmp10 = icmp slt i32 %inc26, %18
br i1 %cmp10, label %for.body11, label %for.cond28.preheader, !llvm.loop !14
for.cond37.preheader: ; preds = %for.inc34
%19 = icmp sgt i32 %23, 1
br i1 %19, label %for.body39, label %for.end47
for.body30: ; preds = %for.cond28.preheader, %for.inc34
%20 = phi i32 [ %23, %for.inc34 ], [ %18, %for.cond28.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc34 ], [ 0, %for.cond28.preheader ]
%arrayidx32 = getelementptr inbounds [101 x i32], ptr @D, i64 0, i64 %indvars.iv
%21 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%cmp33 = icmp eq i32 %21, 0
br i1 %cmp33, label %if.then, label %for.inc34
if.then: ; preds = %for.body30
%22 = trunc i64 %indvars.iv to i32
call void @Depth(i32 noundef %22)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc34
for.inc34: ; preds = %for.body30, %if.then
%23 = phi i32 [ %20, %for.body30 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%24 = sext i32 %23 to i64
%cmp29 = icmp slt i64 %indvars.iv.next, %24
br i1 %cmp29, label %for.body30, label %for.cond37.preheader, !llvm.loop !15
for.body39: ; preds = %for.cond37.preheader, %for.body39
%indvars.iv90 = phi i64 [ %indvars.iv.next91, %for.body39 ], [ 0, %for.cond37.preheader ]
%indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
%arrayidx41 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv90
%25 = load i32, ptr %arrayidx41, align 4, !tbaa !5
%arrayidx43 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %indvars.iv90
%26 = load i32, ptr %arrayidx43, align 4, !tbaa !5
%27 = trunc i64 %indvars.iv.next91 to i32
%call44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %27, i32 noundef %25, i32 noundef %26)
%28 = load i32, ptr @n, align 4, !tbaa !5
%sub = add nsw i32 %28, -1
%29 = sext i32 %sub to i64
%cmp38 = icmp slt i64 %indvars.iv.next91, %29
br i1 %cmp38, label %for.body39, label %for.end47, !llvm.loop !16
for.end47: ; preds = %for.body39, %entry, %for.cond9.preheader, %for.cond28.preheader, %for.cond37.preheader
%i.3.lcssa = phi i32 [ 0, %for.cond37.preheader ], [ 0, %for.cond28.preheader ], [ 0, %for.cond9.preheader ], [ 0, %entry ], [ %27, %for.body39 ]
%add48 = add nuw nsw i32 %i.3.lcssa, 1
%idxprom49 = zext i32 %i.3.lcssa to i64
%arrayidx50 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom49
%30 = load i32, ptr %arrayidx50, align 4, !tbaa !5
%arrayidx52 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %idxprom49
%31 = load i32, ptr %arrayidx52, align 4, !tbaa !5
%call53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %add48, i32 noundef %30, i32 noundef %31)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %v) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k) #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 nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @Depth(i32 noundef %a) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @count, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @count, align 4, !tbaa !5
%idxprom = sext i32 %a to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @D, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %1, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [101 x [101 x i32]], ptr @G, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 1
br i1 %cmp7, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [101 x i32], ptr @D, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @Depth(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !17
for.end.loopexit: ; preds = %for.inc
%.pre25 = load i32, ptr @count, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre25, %for.end.loopexit ], [ %inc, %entry ]
%inc12 = add nsw i32 %8, 1
store i32 %inc12, ptr @count, align 4, !tbaa !5
%arrayidx14 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %8, ptr %arrayidx14, align 4, !tbaa !5
ret void
}
; 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include <stdio.h>
#define N 100
int A[N+1][N+1], s[N+1], b[N+1], c[N+1], n, t;
void d(int p){
int i;
b[p] = t++;
for(i=1;i<=s[p];i++) if(!b[A[p][i]]) d(A[p][i]);
c[p] = t++;
}
int main(){
int i, j, u, v;
scanf("%d", &n);
t = 1;
for(i=1;i<=n;i++){
b[i] = c[i] = 0;
scanf("%d", &u);
scanf("%d", &s[u]);
for(j=1;j<=s[u];j++) scanf("%d", &A[u][j]);
}
for(i=1;i<=n;i++) if(!b[i]) d(i);
for(i=1;i<=n;i++) printf("%d %d %d\n", i, b[i], c[i]);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195592/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195592/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@t = dso_local local_unnamed_addr global i32 0, align 4
@b = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@s = dso_local global [101 x i32] zeroinitializer, align 16
@A = dso_local global [101 x [101 x i32]] zeroinitializer, align 16
@c = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@.str.1 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @d(i32 noundef %p) local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @t, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @t, align 4, !tbaa !5
%idxprom = sext i32 %p to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %idxprom
store i32 %0, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %idxprom
%1 = load i32, ptr %arrayidx2, align 4, !tbaa !5
%cmp.not24 = icmp slt i32 %1, 1
br i1 %cmp.not24, label %for.end, label %for.body
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %5, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 1, %entry ]
%arrayidx6 = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%idxprom7 = sext i32 %3 to i64
%arrayidx8 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %idxprom7
%4 = load i32, ptr %arrayidx8, align 4, !tbaa !5
%tobool.not = icmp eq i32 %4, 0
br i1 %tobool.not, label %if.then, label %for.inc
if.then: ; preds = %for.body
tail call void @d(i32 noundef %3)
%.pre = load i32, ptr %arrayidx2, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%5 = phi i32 [ %2, %for.body ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%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.end.loopexit, !llvm.loop !9
for.end.loopexit: ; preds = %for.inc
%.pre27 = load i32, ptr @t, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%7 = phi i32 [ %.pre27, %for.end.loopexit ], [ %inc, %entry ]
%inc14 = add nsw i32 %7, 1
store i32 %inc14, ptr @t, align 4, !tbaa !5
%arrayidx16 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %idxprom
store i32 %7, ptr %arrayidx16, align 4, !tbaa !5
ret void
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%u = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %u) #4
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
store i32 1, ptr @t, align 4, !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp.not58 = icmp slt i32 %0, 1
br i1 %cmp.not58, label %for.end38, label %for.body
for.cond20.preheader: ; preds = %for.inc17
%cmp21.not60 = icmp slt i32 %7, 1
br i1 %cmp21.not60, label %for.end38, label %for.body22
for.body: ; preds = %entry, %for.inc17
%indvars.iv65 = phi i64 [ %indvars.iv.next66, %for.inc17 ], [ 1, %entry ]
%arrayidx = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv65
store i32 0, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv65
store i32 0, ptr %arrayidx2, align 4, !tbaa !5
%call3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %u)
%1 = load i32, ptr %u, align 4, !tbaa !5
%idxprom4 = sext i32 %1 to i64
%arrayidx5 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %idxprom4
%call6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx5)
%2 = load i32, ptr %u, align 4, !tbaa !5
%idxprom853 = sext i32 %2 to i64
%arrayidx954 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %idxprom853
%3 = load i32, ptr %arrayidx954, align 4, !tbaa !5
%cmp10.not55 = icmp slt i32 %3, 1
br i1 %cmp10.not55, label %for.inc17, label %for.body11
for.body11: ; preds = %for.body, %for.body11
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body11 ], [ 1, %for.body ]
%idxprom857 = phi i64 [ %idxprom8, %for.body11 ], [ %idxprom853, %for.body ]
%arrayidx15 = getelementptr inbounds [101 x [101 x i32]], ptr @A, i64 0, i64 %idxprom857, i64 %indvars.iv
%call16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx15)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%4 = load i32, ptr %u, align 4, !tbaa !5
%idxprom8 = sext i32 %4 to i64
%arrayidx9 = getelementptr inbounds [101 x i32], ptr @s, i64 0, i64 %idxprom8
%5 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp10.not.not = icmp slt i64 %indvars.iv, %6
br i1 %cmp10.not.not, label %for.body11, label %for.inc17, !llvm.loop !11
for.inc17: ; preds = %for.body11, %for.body
%indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
%7 = load i32, ptr @n, align 4, !tbaa !5
%8 = sext i32 %7 to i64
%cmp.not.not = icmp slt i64 %indvars.iv65, %8
br i1 %cmp.not.not, label %for.body, label %for.cond20.preheader, !llvm.loop !12
for.cond28.preheader: ; preds = %for.inc25
%9 = icmp slt i32 %13, 1
br i1 %9, label %for.end38, label %for.body30
for.body22: ; preds = %for.cond20.preheader, %for.inc25
%10 = phi i32 [ %13, %for.inc25 ], [ %7, %for.cond20.preheader ]
%indvars.iv68 = phi i64 [ %indvars.iv.next69, %for.inc25 ], [ 1, %for.cond20.preheader ]
%arrayidx24 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv68
%11 = load i32, ptr %arrayidx24, align 4, !tbaa !5
%tobool.not = icmp eq i32 %11, 0
br i1 %tobool.not, label %if.then, label %for.inc25
if.then: ; preds = %for.body22
%12 = trunc i64 %indvars.iv68 to i32
call void @d(i32 noundef %12)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc25
for.inc25: ; preds = %for.body22, %if.then
%13 = phi i32 [ %10, %for.body22 ], [ %.pre, %if.then ]
%indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
%14 = sext i32 %13 to i64
%cmp21.not.not = icmp slt i64 %indvars.iv68, %14
br i1 %cmp21.not.not, label %for.body22, label %for.cond28.preheader, !llvm.loop !13
for.body30: ; preds = %for.cond28.preheader, %for.body30
%indvars.iv71 = phi i64 [ %indvars.iv.next72, %for.body30 ], [ 1, %for.cond28.preheader ]
%arrayidx32 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv71
%15 = load i32, ptr %arrayidx32, align 4, !tbaa !5
%arrayidx34 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv71
%16 = load i32, ptr %arrayidx34, align 4, !tbaa !5
%17 = trunc i64 %indvars.iv71 to i32
%call35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %17, i32 noundef %15, i32 noundef %16)
%indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
%18 = load i32, ptr @n, align 4, !tbaa !5
%19 = sext i32 %18 to i64
%cmp29.not.not = icmp slt i64 %indvars.iv71, %19
br i1 %cmp29.not.not, label %for.body30, label %for.end38, !llvm.loop !14
for.end38: ; preds = %for.body30, %entry, %for.cond20.preheader, %for.cond28.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %u) #4
ret i32 0
}
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3
attributes #0 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
|
#include<stdio.h>
int P[101][101],f[101],d[101];
int Color[101],time=0,n;
void visit(int);
int main() {
int i,a,b,c,j;
scanf("%d",&n);
for(i=0;i<101;i++) Color[i]=0;
for(i=0;i<n;i++) {
for(j=0;j<n;j++) {
P[i][j]=0;
}
}
for(i=0;i<n;i++) {
scanf("%d%d",&a,&b);
for(j=0;j<b;j++) {
scanf("%d",&c);
P[a-1][c-1]=1;
}
}
for(i=0;i<n;i++)
if(Color[i]==0) visit(i);
for(i=0;i<n;i++) printf("%d %d %d\n",i+1,d[i],f[i]);
return 0;
}
void visit( int r) {
int v;
d[r]= ++time;
Color[r]=1;
for(v=0;v<n;v++) {
if(P[r][v]==1 && Color[v]==0)
visit(v);
}
f[r]=++time;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195635/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195635/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@time = dso_local local_unnamed_addr global i32 0, align 4
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@n = dso_local global i32 0, align 4
@Color = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@P = dso_local local_unnamed_addr global [101 x [101 x i32]] zeroinitializer, align 16
@.str.1 = private unnamed_addr constant [5 x i8] c"%d%d\00", align 1
@.str.2 = private unnamed_addr constant [10 x i8] c"%d %d %d\0A\00", align 1
@d = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
@f = dso_local local_unnamed_addr global [101 x i32] zeroinitializer, align 16
; 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) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #5
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(404) @Color, i8 0, i64 404, i1 false), !tbaa !5
%0 = load i32, ptr @n, align 4, !tbaa !5
%cmp279 = icmp sgt i32 %0, 0
br i1 %cmp279, label %for.cond4.preheader.us.preheader, label %for.end55
for.cond4.preheader.us.preheader: ; preds = %entry
%1 = zext i32 %0 to i64
%2 = shl nuw nsw i64 %1, 2
%xtraiter = and i64 %1, 7
%3 = icmp ult i32 %0, 8
br i1 %3, label %for.cond17.preheader.unr-lcssa, label %for.cond4.preheader.us.preheader.new
for.cond4.preheader.us.preheader.new: ; preds = %for.cond4.preheader.us.preheader
%unroll_iter = and i64 %1, 4294967288
br label %for.cond4.preheader.us
for.cond4.preheader.us: ; preds = %for.cond4.preheader.us, %for.cond4.preheader.us.preheader.new
%indvar = phi i64 [ 0, %for.cond4.preheader.us.preheader.new ], [ %indvar.next.7, %for.cond4.preheader.us ]
%niter = phi i64 [ 0, %for.cond4.preheader.us.preheader.new ], [ %niter.next.7, %for.cond4.preheader.us ]
%4 = mul nuw nsw i64 %indvar, 404
%scevgep = getelementptr i8, ptr @P, i64 %4
tail call void @llvm.memset.p0.i64(ptr align 16 %scevgep, i8 0, i64 %2, i1 false), !tbaa !5
%5 = mul nuw i64 %indvar, 404
%gep = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 404), i64 %5
tail call void @llvm.memset.p0.i64(ptr align 4 %gep, i8 0, i64 %2, i1 false), !tbaa !5
%6 = mul nuw i64 %indvar, 404
%gep102 = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 808), i64 %6
tail call void @llvm.memset.p0.i64(ptr align 8 %gep102, i8 0, i64 %2, i1 false), !tbaa !5
%7 = mul nuw i64 %indvar, 404
%gep103 = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 1212), i64 %7
tail call void @llvm.memset.p0.i64(ptr align 4 %gep103, i8 0, i64 %2, i1 false), !tbaa !5
%8 = mul nuw i64 %indvar, 404
%gep104 = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 1616), i64 %8
tail call void @llvm.memset.p0.i64(ptr align 16 %gep104, i8 0, i64 %2, i1 false), !tbaa !5
%9 = mul nuw i64 %indvar, 404
%gep105 = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 2020), i64 %9
tail call void @llvm.memset.p0.i64(ptr align 4 %gep105, i8 0, i64 %2, i1 false), !tbaa !5
%10 = mul nuw i64 %indvar, 404
%gep106 = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 2424), i64 %10
tail call void @llvm.memset.p0.i64(ptr align 8 %gep106, i8 0, i64 %2, i1 false), !tbaa !5
%11 = mul nuw i64 %indvar, 404
%gep107 = getelementptr i8, ptr getelementptr (i8, ptr @P, i64 2828), i64 %11
tail call void @llvm.memset.p0.i64(ptr align 4 %gep107, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.7 = add nuw nsw i64 %indvar, 8
%niter.next.7 = add i64 %niter, 8
%niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
br i1 %niter.ncmp.7, label %for.cond17.preheader.unr-lcssa, label %for.cond4.preheader.us, !llvm.loop !9
for.cond17.preheader.unr-lcssa: ; preds = %for.cond4.preheader.us, %for.cond4.preheader.us.preheader
%indvar.unr = phi i64 [ 0, %for.cond4.preheader.us.preheader ], [ %indvar.next.7, %for.cond4.preheader.us ]
%lcmp.mod.not = icmp eq i64 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.cond17.preheader, label %for.cond4.preheader.us.epil
for.cond4.preheader.us.epil: ; preds = %for.cond17.preheader.unr-lcssa, %for.cond4.preheader.us.epil
%indvar.epil = phi i64 [ %indvar.next.epil, %for.cond4.preheader.us.epil ], [ %indvar.unr, %for.cond17.preheader.unr-lcssa ]
%epil.iter = phi i64 [ %epil.iter.next, %for.cond4.preheader.us.epil ], [ 0, %for.cond17.preheader.unr-lcssa ]
%12 = mul nuw nsw i64 %indvar.epil, 404
%scevgep.epil = getelementptr i8, ptr @P, i64 %12
tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep.epil, i8 0, i64 %2, i1 false), !tbaa !5
%indvar.next.epil = add nuw nsw i64 %indvar.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.cond17.preheader, label %for.cond4.preheader.us.epil, !llvm.loop !11
for.cond17.preheader: ; preds = %for.cond4.preheader.us.epil, %for.cond17.preheader.unr-lcssa
br i1 %cmp279, label %for.body19, label %for.end55
for.cond36.preheader: ; preds = %for.inc33
%cmp3785 = icmp sgt i32 %17, 0
br i1 %cmp3785, label %for.body38, label %for.end55
for.body19: ; preds = %for.cond17.preheader, %for.inc33
%i.284 = phi i32 [ %inc34, %for.inc33 ], [ 0, %for.cond17.preheader ]
%call20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %a, ptr noundef nonnull %b)
%13 = load i32, ptr %b, align 4, !tbaa !5
%cmp2281 = icmp sgt i32 %13, 0
br i1 %cmp2281, label %for.body23, label %for.inc33
for.body23: ; preds = %for.body19, %for.body23
%j.182 = phi i32 [ %inc31, %for.body23 ], [ 0, %for.body19 ]
%call24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%14 = load i32, ptr %a, align 4, !tbaa !5
%sub = add nsw i32 %14, -1
%idxprom25 = sext i32 %sub to i64
%15 = load i32, ptr %c, align 4, !tbaa !5
%sub27 = add nsw i32 %15, -1
%idxprom28 = sext i32 %sub27 to i64
%arrayidx29 = getelementptr inbounds [101 x [101 x i32]], ptr @P, i64 0, i64 %idxprom25, i64 %idxprom28
store i32 1, ptr %arrayidx29, align 4, !tbaa !5
%inc31 = add nuw nsw i32 %j.182, 1
%16 = load i32, ptr %b, align 4, !tbaa !5
%cmp22 = icmp slt i32 %inc31, %16
br i1 %cmp22, label %for.body23, label %for.inc33, !llvm.loop !13
for.inc33: ; preds = %for.body23, %for.body19
%inc34 = add nuw nsw i32 %i.284, 1
%17 = load i32, ptr @n, align 4, !tbaa !5
%cmp18 = icmp slt i32 %inc34, %17
br i1 %cmp18, label %for.body19, label %for.cond36.preheader, !llvm.loop !14
for.cond45.preheader: ; preds = %for.inc42
%18 = icmp sgt i32 %22, 0
br i1 %18, label %for.body47, label %for.end55
for.body38: ; preds = %for.cond36.preheader, %for.inc42
%19 = phi i32 [ %22, %for.inc42 ], [ %17, %for.cond36.preheader ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc42 ], [ 0, %for.cond36.preheader ]
%arrayidx40 = getelementptr inbounds [101 x i32], ptr @Color, i64 0, i64 %indvars.iv
%20 = load i32, ptr %arrayidx40, align 4, !tbaa !5
%cmp41 = icmp eq i32 %20, 0
br i1 %cmp41, label %if.then, label %for.inc42
if.then: ; preds = %for.body38
%21 = trunc i64 %indvars.iv to i32
call void @visit(i32 noundef %21)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc42
for.inc42: ; preds = %for.body38, %if.then
%22 = phi i32 [ %19, %for.body38 ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%23 = sext i32 %22 to i64
%cmp37 = icmp slt i64 %indvars.iv.next, %23
br i1 %cmp37, label %for.body38, label %for.cond45.preheader, !llvm.loop !15
for.body47: ; preds = %for.cond45.preheader, %for.body47
%indvars.iv93 = phi i64 [ %indvars.iv.next94, %for.body47 ], [ 0, %for.cond45.preheader ]
%indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
%arrayidx49 = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %indvars.iv93
%24 = load i32, ptr %arrayidx49, align 4, !tbaa !5
%arrayidx51 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %indvars.iv93
%25 = load i32, ptr %arrayidx51, align 4, !tbaa !5
%26 = trunc i64 %indvars.iv.next94 to i32
%call52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %26, i32 noundef %24, i32 noundef %25)
%27 = load i32, ptr @n, align 4, !tbaa !5
%28 = sext i32 %27 to i64
%cmp46 = icmp slt i64 %indvars.iv.next94, %28
br i1 %cmp46, label %for.body47, label %for.end55, !llvm.loop !16
for.end55: ; preds = %for.body47, %entry, %for.cond17.preheader, %for.cond36.preheader, %for.cond45.preheader
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #5
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #5
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @visit(i32 noundef %r) local_unnamed_addr #3 {
entry:
%0 = load i32, ptr @time, align 4, !tbaa !5
%inc = add nsw i32 %0, 1
store i32 %inc, ptr @time, align 4, !tbaa !5
%idxprom = sext i32 %r to i64
%arrayidx = getelementptr inbounds [101 x i32], ptr @d, i64 0, i64 %idxprom
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%arrayidx2 = getelementptr inbounds [101 x i32], ptr @Color, i64 0, i64 %idxprom
store i32 1, ptr %arrayidx2, align 4, !tbaa !5
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp22 = icmp sgt i32 %1, 0
br i1 %cmp22, label %for.body, label %for.end
for.body: ; preds = %entry, %for.inc
%2 = phi i32 [ %6, %for.inc ], [ %1, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%arrayidx6 = getelementptr inbounds [101 x [101 x i32]], ptr @P, i64 0, i64 %idxprom, i64 %indvars.iv
%3 = load i32, ptr %arrayidx6, align 4, !tbaa !5
%cmp7 = icmp eq i32 %3, 1
br i1 %cmp7, label %land.lhs.true, label %for.inc
land.lhs.true: ; preds = %for.body
%arrayidx9 = getelementptr inbounds [101 x i32], ptr @Color, i64 0, i64 %indvars.iv
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%cmp10 = icmp eq i32 %4, 0
br i1 %cmp10, label %if.then, label %for.inc
if.then: ; preds = %land.lhs.true
%5 = trunc i64 %indvars.iv to i32
tail call void @visit(i32 noundef %5)
%.pre = load i32, ptr @n, align 4, !tbaa !5
br label %for.inc
for.inc: ; preds = %for.body, %land.lhs.true, %if.then
%6 = phi i32 [ %2, %for.body ], [ %2, %land.lhs.true ], [ %.pre, %if.then ]
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%7 = sext i32 %6 to i64
%cmp = icmp slt i64 %indvars.iv.next, %7
br i1 %cmp, label %for.body, label %for.end.loopexit, !llvm.loop !17
for.end.loopexit: ; preds = %for.inc
%.pre25 = load i32, ptr @time, align 4, !tbaa !5
br label %for.end
for.end: ; preds = %for.end.loopexit, %entry
%8 = phi i32 [ %.pre25, %for.end.loopexit ], [ %inc, %entry ]
%inc12 = add nsw i32 %8, 1
store i32 %inc12, ptr @time, align 4, !tbaa !5
%arrayidx14 = getelementptr inbounds [101 x i32], ptr @f, i64 0, i64 %idxprom
store i32 %inc12, ptr %arrayidx14, align 4, !tbaa !5
ret void
}
; 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
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long int
int n,m,q;
int abcd[50][4];
int retu[10];
int next(){
int tmp=n-1;
while(retu[tmp]==m && tmp>=0){
tmp--;}
if(tmp<0) return 0;
retu[tmp]++;
for(int i=tmp+1;i<n;i++){
retu[i]=retu[tmp];}
return 1;
}
ll check(){
ll sum=0;
for(int i=0;i<q;i++){
if(retu[abcd[i][1]-1]-retu[abcd[i][0]-1]==abcd[i][2]) sum+=abcd[i][3];
}
return sum;
}
int main(){
scanf("%d%d%d",&n,&m,&q);
for(int i=0;i<q;i++){
scanf("%d%d%d%d",&abcd[i][0],&abcd[i][1],&abcd[i][2],&abcd[i][3]);}
for(int i=0;i<n;i++){
retu[i]=1;}
ll max=check();
while(next()){
ll tmp=check();
//printf("%lld\n",tmp);
if(max<tmp) max=tmp;}
printf("%lld\n",max);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195721/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195721/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@n = dso_local global i32 0, align 4
@retu = dso_local local_unnamed_addr global [10 x i32] zeroinitializer, align 16
@m = dso_local global i32 0, align 4
@q = dso_local global i32 0, align 4
@abcd = dso_local global [50 x [4 x i32]] zeroinitializer, align 16
@.str = private unnamed_addr constant [7 x i8] c"%d%d%d\00", align 1
@.str.1 = private unnamed_addr constant [9 x i8] c"%d%d%d%d\00", align 1
@.str.2 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local i32 @next() local_unnamed_addr #0 {
entry:
%0 = load i32, ptr @n, align 4, !tbaa !5
%1 = load i32, ptr @m, align 4, !tbaa !5
%2 = sext i32 %0 to i64
br label %while.cond
while.cond: ; preds = %while.cond, %entry
%indvar = phi i32 [ %indvar.next, %while.cond ], [ 0, %entry ]
%indvars.iv = phi i64 [ %indvars.iv.next, %while.cond ], [ %2, %entry ]
%indvars.iv.next = add nsw i64 %indvars.iv, -1
%arrayidx = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next
%3 = load i32, ptr %arrayidx, align 4, !tbaa !5
%cmp = icmp eq i32 %3, %1
%cmp1 = icmp sgt i64 %indvars.iv, 0
%4 = and i1 %cmp1, %cmp
%indvar.next = add i32 %indvar, 1
br i1 %4, label %while.cond, label %while.end, !llvm.loop !9
while.end: ; preds = %while.cond
%5 = trunc i64 %indvars.iv to i32
%cmp2 = icmp slt i32 %5, 1
br i1 %cmp2, label %cleanup, label %if.end
if.end: ; preds = %while.end
%inc = add nsw i32 %3, 1
store i32 %inc, ptr %arrayidx, align 4, !tbaa !5
%cmp519 = icmp sgt i32 %0, %5
br i1 %cmp519, label %for.body.preheader, label %cleanup
for.body.preheader: ; preds = %if.end
%6 = add i32 %indvar, -1
%xtraiter = and i32 %indvar, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.prol.loopexit, label %for.body.prol
for.body.prol: ; preds = %for.body.preheader, %for.body.prol
%indvars.iv22.prol = phi i64 [ %indvars.iv.next23.prol, %for.body.prol ], [ %indvars.iv, %for.body.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body.prol ], [ 0, %for.body.preheader ]
%7 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx9.prol = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv22.prol
store i32 %7, ptr %arrayidx9.prol, align 4, !tbaa !5
%indvars.iv.next23.prol = add nsw i64 %indvars.iv22.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.prol.loopexit, label %for.body.prol, !llvm.loop !11
for.body.prol.loopexit: ; preds = %for.body.prol, %for.body.preheader
%indvars.iv22.unr = phi i64 [ %indvars.iv, %for.body.preheader ], [ %indvars.iv.next23.prol, %for.body.prol ]
%8 = icmp ult i32 %6, 3
br i1 %8, label %cleanup, label %for.body
for.body: ; preds = %for.body.prol.loopexit, %for.body
%indvars.iv22 = phi i64 [ %indvars.iv.next23.3, %for.body ], [ %indvars.iv22.unr, %for.body.prol.loopexit ]
%9 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx9 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv22
store i32 %9, ptr %arrayidx9, align 4, !tbaa !5
%indvars.iv.next23 = add nsw i64 %indvars.iv22, 1
%10 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx9.1 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next23
store i32 %10, ptr %arrayidx9.1, align 4, !tbaa !5
%indvars.iv.next23.1 = add nsw i64 %indvars.iv22, 2
%11 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx9.2 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next23.1
store i32 %11, ptr %arrayidx9.2, align 4, !tbaa !5
%indvars.iv.next23.2 = add nsw i64 %indvars.iv22, 3
%12 = load i32, ptr %arrayidx, align 4, !tbaa !5
%arrayidx9.3 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next23.2
store i32 %12, ptr %arrayidx9.3, align 4, !tbaa !5
%indvars.iv.next23.3 = add nsw i64 %indvars.iv22, 4
%lftr.wideiv.3 = trunc i64 %indvars.iv.next23.3 to i32
%exitcond.not.3 = icmp eq i32 %0, %lftr.wideiv.3
br i1 %exitcond.not.3, label %cleanup, label %for.body, !llvm.loop !13
cleanup: ; preds = %for.body.prol.loopexit, %for.body, %if.end, %while.end
%retval.0 = phi i32 [ 0, %while.end ], [ 1, %if.end ], [ 1, %for.body ], [ 1, %for.body.prol.loopexit ]
ret i32 %retval.0
}
; Function Attrs: nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable
define dso_local i64 @check() local_unnamed_addr #1 {
entry:
%0 = load i32, ptr @q, align 4, !tbaa !5
%cmp24 = icmp sgt i32 %0, 0
br i1 %cmp24, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %entry
%wide.trip.count = zext i32 %0 to i64
br label %for.body
for.cond.cleanup: ; preds = %for.inc, %entry
%sum.0.lcssa = phi i64 [ 0, %entry ], [ %sum.1, %for.inc ]
ret i64 %sum.0.lcssa
for.body: ; preds = %for.body.preheader, %for.inc
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
%sum.025 = phi i64 [ 0, %for.body.preheader ], [ %sum.1, %for.inc ]
%arrayidx = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv
%arrayidx1 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv, i64 1
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%sub = add nsw i32 %1, -1
%idxprom2 = sext i32 %sub to i64
%arrayidx3 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %idxprom2
%2 = load i32, ptr %arrayidx3, align 4, !tbaa !5
%3 = load i32, ptr %arrayidx, align 16, !tbaa !5
%sub7 = add nsw i32 %3, -1
%idxprom8 = sext i32 %sub7 to i64
%arrayidx9 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %idxprom8
%4 = load i32, ptr %arrayidx9, align 4, !tbaa !5
%sub10 = sub nsw i32 %2, %4
%arrayidx13 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv, i64 2
%5 = load i32, ptr %arrayidx13, align 8, !tbaa !5
%cmp14 = icmp eq i32 %sub10, %5
br i1 %cmp14, label %if.then, label %for.inc
if.then: ; preds = %for.body
%arrayidx17 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv, i64 3
%6 = load i32, ptr %arrayidx17, align 4, !tbaa !5
%conv = sext i32 %6 to i64
%add = add nsw i64 %sum.025, %conv
br label %for.inc
for.inc: ; preds = %for.body, %if.then
%sum.1 = phi i64 [ %add, %if.then ], [ %sum.025, %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.cond.cleanup, label %for.body, !llvm.loop !14
}
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #2 {
entry:
%call = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
%0 = load i32, ptr @q, align 4, !tbaa !5
%cmp73 = icmp sgt i32 %0, 0
br i1 %cmp73, label %for.body, label %for.cond13.preheader
for.cond13.preheader: ; preds = %for.body, %entry
%.lcssa72 = phi i32 [ %0, %entry ], [ %5, %for.body ]
%1 = load i32, ptr @n, align 4, !tbaa !5
%cmp1475 = icmp sgt i32 %1, 0
br i1 %cmp1475, label %for.body16.preheader, label %for.cond.cleanup15
for.body16.preheader: ; preds = %for.cond13.preheader
%wide.trip.count = zext i32 %1 to i64
%min.iters.check = icmp ult i32 %1, 8
br i1 %min.iters.check, label %for.body16.preheader85, label %vector.ph
vector.ph: ; preds = %for.body16.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 ]
%2 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %index
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %2, align 16, !tbaa !5
%3 = getelementptr inbounds i32, ptr %2, i64 4
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %3, align 16, !tbaa !5
%index.next = add nuw i64 %index, 8
%4 = icmp eq i64 %index.next, %n.vec
br i1 %4, label %middle.block, label %vector.body, !llvm.loop !15
middle.block: ; preds = %vector.body
%cmp.n = icmp eq i64 %n.vec, %wide.trip.count
br i1 %cmp.n, label %for.cond.cleanup15, label %for.body16.preheader85
for.body16.preheader85: ; preds = %for.body16.preheader, %middle.block
%indvars.iv80.ph = phi i64 [ 0, %for.body16.preheader ], [ %n.vec, %middle.block ]
br label %for.body16
for.body: ; preds = %entry, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv
%arrayidx4 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv, i64 1
%arrayidx7 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv, i64 2
%arrayidx10 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv, i64 3
%call11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %arrayidx, ptr noundef nonnull %arrayidx4, ptr noundef nonnull %arrayidx7, ptr noundef nonnull %arrayidx10)
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%5 = load i32, ptr @q, align 4, !tbaa !5
%6 = sext i32 %5 to i64
%cmp = icmp slt i64 %indvars.iv.next, %6
br i1 %cmp, label %for.body, label %for.cond13.preheader, !llvm.loop !18
for.cond.cleanup15: ; preds = %for.body16, %middle.block, %for.cond13.preheader
%cmp24.i = icmp sgt i32 %.lcssa72, 0
%wide.trip.count.i = zext i32 %.lcssa72 to i64
br i1 %cmp24.i, label %for.body.i, label %check.exit
for.body.i: ; preds = %for.cond.cleanup15, %for.inc.i
%indvars.iv.i = phi i64 [ %indvars.iv.next.i, %for.inc.i ], [ 0, %for.cond.cleanup15 ]
%sum.025.i = phi i64 [ %sum.1.i, %for.inc.i ], [ 0, %for.cond.cleanup15 ]
%arrayidx.i = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i
%arrayidx1.i = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i, i64 1
%7 = load i32, ptr %arrayidx1.i, align 4, !tbaa !5
%sub.i = add nsw i32 %7, -1
%idxprom2.i = sext i32 %sub.i to i64
%arrayidx3.i = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %idxprom2.i
%8 = load i32, ptr %arrayidx3.i, align 4, !tbaa !5
%9 = load i32, ptr %arrayidx.i, align 16, !tbaa !5
%sub7.i = add nsw i32 %9, -1
%idxprom8.i = sext i32 %sub7.i to i64
%arrayidx9.i = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %idxprom8.i
%10 = load i32, ptr %arrayidx9.i, align 4, !tbaa !5
%sub10.i = sub nsw i32 %8, %10
%arrayidx13.i = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i, i64 2
%11 = load i32, ptr %arrayidx13.i, align 8, !tbaa !5
%cmp14.i = icmp eq i32 %sub10.i, %11
br i1 %cmp14.i, label %if.then.i, label %for.inc.i
if.then.i: ; preds = %for.body.i
%arrayidx17.i = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i, i64 3
%12 = load i32, ptr %arrayidx17.i, align 4, !tbaa !5
%conv.i = sext i32 %12 to i64
%add.i = add nsw i64 %sum.025.i, %conv.i
br label %for.inc.i
for.inc.i: ; preds = %if.then.i, %for.body.i
%sum.1.i = phi i64 [ %add.i, %if.then.i ], [ %sum.025.i, %for.body.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 %check.exit, label %for.body.i, !llvm.loop !14
check.exit: ; preds = %for.inc.i, %for.cond.cleanup15
%sum.0.lcssa.i = phi i64 [ 0, %for.cond.cleanup15 ], [ %sum.1.i, %for.inc.i ]
%13 = load i32, ptr @m, align 4, !tbaa !5
%14 = sext i32 %1 to i64
br label %while.cond
for.body16: ; preds = %for.body16.preheader85, %for.body16
%indvars.iv80 = phi i64 [ %indvars.iv.next81, %for.body16 ], [ %indvars.iv80.ph, %for.body16.preheader85 ]
%arrayidx18 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv80
store i32 1, ptr %arrayidx18, align 4, !tbaa !5
%indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
%exitcond.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count
br i1 %exitcond.not, label %for.cond.cleanup15, label %for.body16, !llvm.loop !19
while.cond: ; preds = %check.exit68, %check.exit
%max.0 = phi i64 [ %sum.0.lcssa.i, %check.exit ], [ %spec.select, %check.exit68 ]
br label %while.cond.i
while.cond.i: ; preds = %while.cond.i, %while.cond
%indvar = phi i32 [ %indvar.next, %while.cond.i ], [ 0, %while.cond ]
%indvars.iv.i36 = phi i64 [ %indvars.iv.next.i37, %while.cond.i ], [ %14, %while.cond ]
%indvars.iv.next.i37 = add nsw i64 %indvars.iv.i36, -1
%arrayidx.i38 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next.i37
%15 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%cmp.i = icmp eq i32 %15, %13
%cmp1.i = icmp sgt i64 %indvars.iv.i36, 0
%16 = and i1 %cmp1.i, %cmp.i
%indvar.next = add i32 %indvar, 1
br i1 %16, label %while.cond.i, label %while.end.i, !llvm.loop !9
while.end.i: ; preds = %while.cond.i
%17 = trunc i64 %indvars.iv.i36 to i32
%cmp2.i = icmp slt i32 %17, 1
br i1 %cmp2.i, label %while.end, label %if.end.i
if.end.i: ; preds = %while.end.i
%inc.i = add nsw i32 %15, 1
store i32 %inc.i, ptr %arrayidx.i38, align 4, !tbaa !5
%cmp519.i = icmp sgt i32 %1, %17
br i1 %cmp519.i, label %for.body.i39.preheader, label %while.body
for.body.i39.preheader: ; preds = %if.end.i
%18 = add i32 %indvar, -1
%xtraiter = and i32 %indvar, 3
%lcmp.mod.not = icmp eq i32 %xtraiter, 0
br i1 %lcmp.mod.not, label %for.body.i39.prol.loopexit, label %for.body.i39.prol
for.body.i39.prol: ; preds = %for.body.i39.preheader, %for.body.i39.prol
%indvars.iv22.i.prol = phi i64 [ %indvars.iv.next23.i.prol, %for.body.i39.prol ], [ %indvars.iv.i36, %for.body.i39.preheader ]
%prol.iter = phi i32 [ %prol.iter.next, %for.body.i39.prol ], [ 0, %for.body.i39.preheader ]
%19 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%arrayidx9.i40.prol = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv22.i.prol
store i32 %19, ptr %arrayidx9.i40.prol, align 4, !tbaa !5
%indvars.iv.next23.i.prol = add nsw i64 %indvars.iv22.i.prol, 1
%prol.iter.next = add i32 %prol.iter, 1
%prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
br i1 %prol.iter.cmp.not, label %for.body.i39.prol.loopexit, label %for.body.i39.prol, !llvm.loop !20
for.body.i39.prol.loopexit: ; preds = %for.body.i39.prol, %for.body.i39.preheader
%indvars.iv22.i.unr = phi i64 [ %indvars.iv.i36, %for.body.i39.preheader ], [ %indvars.iv.next23.i.prol, %for.body.i39.prol ]
%20 = icmp ult i32 %18, 3
br i1 %20, label %while.body, label %for.body.i39
for.body.i39: ; preds = %for.body.i39.prol.loopexit, %for.body.i39
%indvars.iv22.i = phi i64 [ %indvars.iv.next23.i.3, %for.body.i39 ], [ %indvars.iv22.i.unr, %for.body.i39.prol.loopexit ]
%21 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%arrayidx9.i40 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv22.i
store i32 %21, ptr %arrayidx9.i40, align 4, !tbaa !5
%indvars.iv.next23.i = add nsw i64 %indvars.iv22.i, 1
%22 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%arrayidx9.i40.1 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next23.i
store i32 %22, ptr %arrayidx9.i40.1, align 4, !tbaa !5
%indvars.iv.next23.i.1 = add nsw i64 %indvars.iv22.i, 2
%23 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%arrayidx9.i40.2 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next23.i.1
store i32 %23, ptr %arrayidx9.i40.2, align 4, !tbaa !5
%indvars.iv.next23.i.2 = add nsw i64 %indvars.iv22.i, 3
%24 = load i32, ptr %arrayidx.i38, align 4, !tbaa !5
%arrayidx9.i40.3 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %indvars.iv.next23.i.2
store i32 %24, ptr %arrayidx9.i40.3, align 4, !tbaa !5
%indvars.iv.next23.i.3 = add nsw i64 %indvars.iv22.i, 4
%lftr.wideiv.i.3 = trunc i64 %indvars.iv.next23.i.3 to i32
%exitcond.not.i41.3 = icmp eq i32 %1, %lftr.wideiv.i.3
br i1 %exitcond.not.i41.3, label %while.body, label %for.body.i39, !llvm.loop !13
while.body: ; preds = %for.body.i39.prol.loopexit, %for.body.i39, %if.end.i
br i1 %cmp24.i, label %for.body.i46, label %check.exit68
for.body.i46: ; preds = %while.body, %for.inc.i60
%indvars.iv.i47 = phi i64 [ %indvars.iv.next.i62, %for.inc.i60 ], [ 0, %while.body ]
%sum.025.i48 = phi i64 [ %sum.1.i61, %for.inc.i60 ], [ 0, %while.body ]
%arrayidx.i49 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i47
%arrayidx1.i50 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i47, i64 1
%25 = load i32, ptr %arrayidx1.i50, align 4, !tbaa !5
%sub.i51 = add nsw i32 %25, -1
%idxprom2.i52 = sext i32 %sub.i51 to i64
%arrayidx3.i53 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %idxprom2.i52
%26 = load i32, ptr %arrayidx3.i53, align 4, !tbaa !5
%27 = load i32, ptr %arrayidx.i49, align 16, !tbaa !5
%sub7.i54 = add nsw i32 %27, -1
%idxprom8.i55 = sext i32 %sub7.i54 to i64
%arrayidx9.i56 = getelementptr inbounds [10 x i32], ptr @retu, i64 0, i64 %idxprom8.i55
%28 = load i32, ptr %arrayidx9.i56, align 4, !tbaa !5
%sub10.i57 = sub nsw i32 %26, %28
%arrayidx13.i58 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i47, i64 2
%29 = load i32, ptr %arrayidx13.i58, align 8, !tbaa !5
%cmp14.i59 = icmp eq i32 %sub10.i57, %29
br i1 %cmp14.i59, label %if.then.i64, label %for.inc.i60
if.then.i64: ; preds = %for.body.i46
%arrayidx17.i65 = getelementptr inbounds [50 x [4 x i32]], ptr @abcd, i64 0, i64 %indvars.iv.i47, i64 3
%30 = load i32, ptr %arrayidx17.i65, align 4, !tbaa !5
%conv.i66 = sext i32 %30 to i64
%add.i67 = add nsw i64 %sum.025.i48, %conv.i66
br label %for.inc.i60
for.inc.i60: ; preds = %if.then.i64, %for.body.i46
%sum.1.i61 = phi i64 [ %add.i67, %if.then.i64 ], [ %sum.025.i48, %for.body.i46 ]
%indvars.iv.next.i62 = add nuw nsw i64 %indvars.iv.i47, 1
%exitcond.not.i63 = icmp eq i64 %indvars.iv.next.i62, %wide.trip.count.i
br i1 %exitcond.not.i63, label %check.exit68, label %for.body.i46, !llvm.loop !14
check.exit68: ; preds = %for.inc.i60, %while.body
%sum.0.lcssa.i43 = phi i64 [ 0, %while.body ], [ %sum.1.i61, %for.inc.i60 ]
%spec.select = tail call i64 @llvm.smax.i64(i64 %max.0, i64 %sum.0.lcssa.i43)
br label %while.cond, !llvm.loop !21
while.end: ; preds = %while.end.i
%call26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %max.0)
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 i64 @llvm.smax.i64(i64, i64) #4
attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree norecurse nosync nounwind memory(read, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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) }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~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}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !17, !16}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !10}
|
#include <stdio.h>
int
main(int argc, char *argv[])
{
int n;
scanf("%d", &n);
int p[100000];
int ans = 0, l;
for(int i = 0; i < n; i++){
scanf("%d", &p[i]);
if(p[i] == i + 1) l++;
else{
ans += l / 2 + l % 2;
l = 0;
}
}
ans += l / 2 + l % 2;
printf("%d\n", ans);
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195765/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195765/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@.str.1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main(i32 noundef %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
entry:
%n = alloca i32, align 4
%p = alloca [100000 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 400000, ptr nonnull %p) #3
%0 = load i32, ptr %n, align 4, !tbaa !5
%cmp23 = icmp sgt i32 %0, 0
br i1 %cmp23, label %for.body, label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.inc, %entry
%ans.0.lcssa = phi i32 [ 0, %entry ], [ %ans.1, %for.inc ]
%l.0.lcssa = phi i32 [ undef, %entry ], [ %l.1, %for.inc ]
%div8 = sdiv i32 %l.0.lcssa, 2
%rem9 = srem i32 %l.0.lcssa, 2
%add10 = add i32 %rem9, %ans.0.lcssa
%add11 = add i32 %add10, %div8
%call12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %add11)
call void @llvm.lifetime.end.p0(i64 400000, ptr nonnull %p) #3
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %n) #3
ret i32 0
for.body: ; preds = %entry, %for.inc
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
%l.025 = phi i32 [ %l.1, %for.inc ], [ undef, %entry ]
%ans.024 = phi i32 [ %ans.1, %for.inc ], [ 0, %entry ]
%arrayidx = getelementptr inbounds [100000 x i32], ptr %p, i64 0, i64 %indvars.iv
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %arrayidx)
%1 = load i32, ptr %arrayidx, align 4, !tbaa !5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
%2 = zext i32 %1 to i64
%cmp4 = icmp eq i64 %indvars.iv.next, %2
br i1 %cmp4, label %if.then, label %if.else
if.then: ; preds = %for.body
%inc = add nsw i32 %l.025, 1
br label %for.inc
if.else: ; preds = %for.body
%div = sdiv i32 %l.025, 2
%rem = srem i32 %l.025, 2
%add5 = add i32 %rem, %ans.024
%add6 = add i32 %add5, %div
br label %for.inc
for.inc: ; preds = %if.then, %if.else
%ans.1 = phi i32 [ %ans.024, %if.then ], [ %add6, %if.else ]
%l.1 = phi i32 [ %inc, %if.then ], [ 0, %if.else ]
%3 = load i32, ptr %n, align 4, !tbaa !5
%4 = sext i32 %3 to i64
%cmp = icmp slt i64 %indvars.iv.next, %4
br i1 %cmp, label %for.body, label %for.cond.cleanup, !llvm.loop !9
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
|
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a<b && b<c){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195808/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195808/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = 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
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp1 = icmp slt i32 %1, %2
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void)
{
int i;
int a[3];
scanf("%d %d %d", &a[0], &a[1], &a[2]);
if (a[0] < a[1] && a[1] < a[2]) {
printf("Yes\n");
} else {
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195851/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195851/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca [3 x i32], align 4
call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %a) #4
%arrayidx1 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 1
%arrayidx2 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 2
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a, ptr noundef nonnull %arrayidx1, ptr noundef nonnull %arrayidx2)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %arrayidx1, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %arrayidx2, align 4
%cmp7 = icmp slt i32 %1, %2
%or.cond = select i1 %cmp, i1 %cmp7, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a < b && b < c) {
printf("Yes\n");
} else {
printf("No\n");
}
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195895/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195895/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = 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
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp1 = icmp slt i32 %1, %2
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a<b&&b<c)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
return 0;
}
| ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195938/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195938/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = 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
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp1 = icmp slt i32 %1, %2
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include<stdio.h>
int main(void){
int a,b,c;
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
if((a < b) && (b < c) ){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_195989/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_195989/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
@.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1
@str = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %a)
%call1 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %b)
%call2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %c)
%0 = load i32, ptr %a, align 4, !tbaa !5
%1 = load i32, ptr %b, align 4, !tbaa !5
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp3 = icmp slt i32 %1, %2
%or.cond = select i1 %cmp, i1 %cmp3, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a < b && a < c && b < c){
printf("Yes\n");
}
else{
printf("No\n");
}
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_196030/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_196030/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = 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
%cmp = icmp slt i32 %0, %1
br i1 %cmp, label %land.lhs.true, label %if.else
land.lhs.true: ; preds = %entry
%2 = load i32, ptr %c, align 4, !tbaa !5
%cmp1 = icmp slt i32 %0, %2
%cmp3 = icmp slt i32 %1, %2
%or.cond = and i1 %cmp1, %cmp3
br i1 %or.cond, label %if.end, label %if.else
if.else: ; preds = %land.lhs.true, %entry
br label %if.end
if.end: ; preds = %land.lhs.true, %if.else
%str.sink = phi ptr [ @str, %if.else ], [ @str.3, %land.lhs.true ]
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.sink)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
#include <stdio.h>
int main(void){
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(a < b && b < c){
printf("Yes\n");
}else
printf("No\n");
return 0;
} | ; ModuleID = '/data/TheStack_IR/OJ_Samples/Collated/C/Source_196074/source.c'
source_filename = "/data/TheStack_IR/OJ_Samples/Collated/C/Source_196074/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-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 = private unnamed_addr constant [3 x i8] c"No\00", align 1
@str.3 = private unnamed_addr constant [4 x i8] c"Yes\00", align 1
; Function Attrs: nofree nounwind uwtable
define dso_local i32 @main() local_unnamed_addr #0 {
entry:
%a = alloca i32, align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %c) #4
%call = 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
%cmp = icmp slt i32 %0, %1
%2 = load i32, ptr %c, align 4
%cmp1 = icmp slt i32 %1, %2
%or.cond = select i1 %cmp, i1 %cmp1, i1 false
%str.3.str = select i1 %or.cond, ptr @str.3, ptr @str
%puts = call i32 @puts(ptr nonnull dereferenceable(1) %str.3.str)
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %c) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %b) #4
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a) #4
ret i32 0
}
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3
attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind }
attributes #4 = { nounwind }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"Ubuntu clang version 18.0.0 (++20231007042255+8abb2ace888b-1~exp1~20231007042414.1230)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.