#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_latest_times(int **, int **, int **, int);
int /*<<< orphan*/ printf(char *, int, int);
int calc_latest_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[vmax][5] = vs[vmax][4];
  for (vid = vmax; vid > 0; vid--) {
    vs[vid][5] = calc_local_latest_times(g, es, vs, vid);
    printf("vs[%d] : %d\n", vid, vs[vid][5]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<calc_latest_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
movslq -0x1c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x10(%rax),%ecx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rdx
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    11de <calc_latest_node_times+0xbe>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1040 <calc_local_latest_times@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rdx
imul   $0x18,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
mov    -0x2c(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x14(%rax),%edx
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    117d <calc_latest_node_times+0x5d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_latest_node_times>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
movslq %ecx,%rax
lea    (%rax,%rax,2),%rdx
mov    0x10(%r12,%rdx,8),%esi
mov    %esi,0x14(%r12,%rdx,8)
test   %eax,%eax
jle    1190 <calc_latest_node_times+0x70>
mov    %rdi,%r15
mov    %ecx,%ebx
lea    (%rbx,%rbx,2),%rax
lea    (%r12,%rax,8),%rbp
add    $0x14,%rbp
lea    0xea2(%rip),%r13
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
call   1040 <calc_local_latest_times@plt>
mov    %eax,0x0(%rbp)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
lea    -0x1(%rbx),%rax
add    $0xffffffffffffffe8,%rbp
cmp    $0x1,%rbx
mov    %rax,%rbx
ja     1160 <calc_latest_node_times+0x40>
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_latest_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 = load i32, i32* %8
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %13, i64 %15
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %16, i64 0, i64 4
%18 = load i32, i32* %17
%19 = load [6 x i32]*, [6 x i32]** %7
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [6 x i32], [6 x i32]* %19, i64 %21
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %22, i64 0, i64 5
store i32 %18, i32* %23
%24 = load i32, i32* %8
store i32 %24, i32* %12
br label %25
25: ; preds = %49, %4
%26 = load i32, i32* %12
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %52
28: ; preds = %25
%29 = load i32**, i32*** %5
%30 = load [3 x i32]*, [3 x i32]** %6
%31 = bitcast [3 x i32]* %30 to i32**
%32 = load [6 x i32]*, [6 x i32]** %7
%33 = bitcast [6 x i32]* %32 to i32**
%34 = load i32, i32* %12
%35 = call i32 @calc_local_latest_times(i32** %29, i32** %31, i32** %33, i32 %34)
%36 = load [6 x i32]*, [6 x i32]** %7
%37 = load i32, i32* %12
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [6 x i32], [6 x i32]* %36, i64 %38
%40 = getelementptr inbounds [6 x i32], [6 x i32]* %39, i64 0, i64 5
store i32 %35, i32* %40
%41 = load i32, i32* %12
%42 = load [6 x i32]*, [6 x i32]** %7
%43 = load i32, i32* %12
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [6 x i32], [6 x i32]* %42, i64 %44
%46 = getelementptr inbounds [6 x i32], [6 x i32]* %45, i64 0, i64 5
%47 = load i32, i32* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %41, i32 %47)
br label %49
49: ; preds = %28
%50 = load i32, i32* %12
%51 = add nsw i32 %50, -1
store i32 %51, i32* %12
br label %25
52: ; preds = %25
ret i32 0
}

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