#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int calc_local_earliest_times(int **, int **, int **, int);
int /*<<< orphan*/ printf(char *, int, int);
int calc_earliest_node_times(int *g[3], int es[][3], int vs[][(4 + 2)],
                             int vmax) {
  int eid = 0;
  int max = 0;
  int tmp = 0;
  int vid = 0;
  vs[0][4] = 0;
  for (vid = 1; vid < vmax + 1; vid++) {
    vs[vid][4] = calc_local_earliest_times(g, es, vs, vid);
    printf("vs[%d] : %d\n", vid, vs[vid][4]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<calc_earliest_node_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,0x10(%rax)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    11cd <calc_earliest_node_times+0xad>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1030 <calc_local_earliest_times@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rdx
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x10(%rax)
mov    -0x2c(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x10(%rax),%edx
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1165 <calc_earliest_node_times+0x45>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_earliest_node_times>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x10(%rdx)
test   %ecx,%ecx
jle    1180 <calc_earliest_node_times+0x60>
mov    %ecx,%r13d
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
add    $0x1,%r13d
lea    0x28(%rdx),%rbp
mov    $0x1,%ebx
nop
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
call   1030 <calc_local_earliest_times@plt>
mov    %eax,0x0(%rbp)
lea    0xe96(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
add    $0x1,%rbx
add    $0x18,%rbp
cmp    %rbx,%r13
jne    1150 <calc_earliest_node_times+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"vs[%d] : %d\0A\00"
define i32 @calc_earliest_node_times(i32** %0, [3 x i32]* %1, [6 x i32]* %2, i32 %3) {
%5 = alloca i32**
%6 = alloca [3 x i32]*
%7 = alloca [6 x i32]*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32** %0, i32*** %5
store [3 x i32]* %1, [3 x i32]** %6
store [6 x i32]* %2, [6 x i32]** %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%13 = load [6 x i32]*, [6 x i32]** %7
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 0
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %14, i64 0, i64 4
store i32 0, i32* %15
store i32 1, i32* %12
br label %16
16: ; preds = %42, %4
%17 = load i32, i32* %12
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %45
21: ; preds = %16
%22 = load i32**, i32*** %5
%23 = load [3 x i32]*, [3 x i32]** %6
%24 = bitcast [3 x i32]* %23 to i32**
%25 = load [6 x i32]*, [6 x i32]** %7
%26 = bitcast [6 x i32]* %25 to i32**
%27 = load i32, i32* %12
%28 = call i32 @calc_local_earliest_times(i32** %22, i32** %24, i32** %26, i32 %27)
%29 = load [6 x i32]*, [6 x i32]** %7
%30 = load i32, i32* %12
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %29, i64 %31
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %32, i64 0, i64 4
store i32 %28, i32* %33
%34 = load i32, i32* %12
%35 = load [6 x i32]*, [6 x i32]** %7
%36 = load i32, i32* %12
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [6 x i32], [6 x i32]* %35, i64 %37
%39 = getelementptr inbounds [6 x i32], [6 x i32]* %38, i64 0, i64 4
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %34, i32 %40)
br label %42
42: ; preds = %21
%43 = load i32, i32* %12
%44 = add nsw i32 %43, 1
store i32 %44, i32* %12
br label %16
45: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"vs[%d] : %d\0A\00"
define i32 @calc_earliest_node_times(i32** %0, [3 x i32]* %1, [6 x i32]* %2, i32 %3) {
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 4
store i32 0, i32* %5
%6 = icmp slt i32 %3, 1
br i1 %6, label %20, label %7
7: ; preds = %4
%8 = bitcast [3 x i32]* %1 to i32**
%9 = bitcast [6 x i32]* %2 to i32**
%10 = add nuw i32 %3, 1
%11 = zext i32 %10 to i64
br label %12
12: ; preds = %7, %12
%13 = phi i64 [ 1, %7 ], [ %18, %12 ]
%14 = trunc i64 %13 to i32
%15 = tail call i32 @calc_local_earliest_times(i32** %0, i32** %8, i32** %9, i32 %14)
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 %13, i64 4
store i32 %15, i32* %16
%17 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %11
br i1 %19, label %20, label %12
20: ; preds = %12, %4
ret i32 0
}