#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 /*<<< orphan*/ calc_earliest_node_times(int **, int **, int **, int);
int /*<<< orphan*/ calc_latest_node_times(int **, int **, int **, int);
int /*<<< orphan*/ init_graph(int **, int **, int **, int **);
int /*<<< orphan*/ pr_edge_all(int **);
int /*<<< orphan*/ pr_vertex_all(int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_data(int **, char *);
int /*<<< orphan*/ trace_critical_path(int **, int **, int **, int);
void main(void) {
  int *g[3];
  int vs[10][(4 + 2)];
  int es[100][3];
  int cs[(2 * 100)][3];
  char *fname = "graph-kadai.dat";
  int num_of_vertex = 8;
  int vid, v1, v2, eid;
  init_graph(g, vs, es, cs);
  read_data(g, fname);
  printf("Edge Data\n");
  pr_edge_all(g);
  printf("Vertex Data\n");
  pr_vertex_all(g);
  printf("Å_\n");
  calc_earliest_node_times(g, es, vs, num_of_vertex);
  printf("Åx_\n");
  calc_latest_node_times(g, es, vs, num_of_vertex);
  printf("NeBJpX\n");
  trace_critical_path(g, es, vs, num_of_vertex);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf40,%rsp
lea    0xe6e(%rip),%rax
mov    %rax,-0xf28(%rbp)
movl   $0x8,-0xf2c(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x5c0(%rbp),%rdx
lea    -0xf20(%rbp),%rcx
call   10a0 <init_graph@plt>
lea    -0x20(%rbp),%rdi
mov    -0xf28(%rbp),%rsi
call   1030 <read_data@plt>
lea    0xe38(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1090 <pr_edge_all@plt>
lea    0xe2e(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <pr_vertex_all@plt>
lea    0xe26(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x5c0(%rbp),%rsi
lea    -0x110(%rbp),%rdx
mov    -0xf2c(%rbp),%ecx
call   1070 <calc_earliest_node_times@plt>
lea    0xe1a(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x5c0(%rbp),%rsi
lea    -0x110(%rbp),%rdx
mov    -0xf2c(%rbp),%ecx
call   1050 <calc_latest_node_times@plt>
lea    0xe0d(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x5c0(%rbp),%rsi
lea    -0x110(%rbp),%rdx
mov    -0xf2c(%rbp),%ecx
call   1080 <trace_critical_path@plt>
add    $0xf40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xf20,%rsp
mov    %rsp,%rbx
lea    0x20(%rsp),%r14
lea    0x110(%rsp),%r15
lea    0x5c0(%rsp),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <init_graph@plt>
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
call   1030 <read_data@plt>
lea    0xe48(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1090 <pr_edge_all@plt>
lea    0xe3e(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1040 <pr_vertex_all@plt>
lea    0xe36(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x8,%ecx
call   1070 <calc_earliest_node_times@plt>
lea    0xe33(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x8,%ecx
call   1060 <calc_latest_node_times@plt>
lea    0xe2f(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x8,%ecx
call   1080 <trace_critical_path@plt>
add    $0xf20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"graph-kadai.dat\00"
@.str.1 = [11 x i8] c"Edge Data\0A\00"
@.str.2 = [13 x i8] c"Vertex Data\0A\00"
@.str.3 = [29 x i8] c"\C2\8D\C3\85\C2\91\C2\81\C2\8C\C2\8B\C2\8D\C2\87\C2\93_\C2\8E\C2\9E\C2\8D\C2\8F\0A\00"
@.str.4 = [28 x i8] c"\C2\8D\C3\85\C2\92x\C2\8C\C2\8B\C2\8D\C2\87\C2\93_\C2\8E\C2\9E\C2\8D\C2\8F\0A\00"
@.str.5 = [28 x i8] c"\C2\83N\C2\83\C2\8A\C2\83e\C2\83B\C2\83J\C2\83\C2\8B\C2\83p\C2\83X\0A\00"
define void @main() {
%1 = alloca [3 x i32*]
%2 = alloca [10 x [6 x i32]]
%3 = alloca [100 x [3 x i32]]
%4 = alloca [200 x [3 x i32]]
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %5
store i32 8, i32* %6
%11 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%12 = getelementptr inbounds [10 x [6 x i32]], [10 x [6 x i32]]* %2, i64 0, i64 0
%13 = bitcast [6 x i32]* %12 to i32**
%14 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %3, i64 0, i64 0
%15 = bitcast [3 x i32]* %14 to i32**
%16 = getelementptr inbounds [200 x [3 x i32]], [200 x [3 x i32]]* %4, i64 0, i64 0
%17 = bitcast [3 x i32]* %16 to i32**
%18 = call i32 @init_graph(i32** %11, i32** %13, i32** %15, i32** %17)
%19 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%20 = load i8*, i8** %5
%21 = call i32 @read_data(i32** %19, i8* %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%24 = call i32 @pr_edge_all(i32** %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%26 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%27 = call i32 @pr_vertex_all(i32** %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%29 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%30 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %3, i64 0, i64 0
%31 = bitcast [3 x i32]* %30 to i32**
%32 = getelementptr inbounds [10 x [6 x i32]], [10 x [6 x i32]]* %2, i64 0, i64 0
%33 = bitcast [6 x i32]* %32 to i32**
%34 = load i32, i32* %6
%35 = call i32 @calc_earliest_node_times(i32** %29, i32** %31, i32** %33, i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%37 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%38 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %3, i64 0, i64 0
%39 = bitcast [3 x i32]* %38 to i32**
%40 = getelementptr inbounds [10 x [6 x i32]], [10 x [6 x i32]]* %2, i64 0, i64 0
%41 = bitcast [6 x i32]* %40 to i32**
%42 = load i32, i32* %6
%43 = call i32 @calc_latest_node_times(i32** %37, i32** %39, i32** %41, i32 %42)
%44 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
%45 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%46 = getelementptr inbounds [100 x [3 x i32]], [100 x [3 x i32]]* %3, i64 0, i64 0
%47 = bitcast [3 x i32]* %46 to i32**
%48 = getelementptr inbounds [10 x [6 x i32]], [10 x [6 x i32]]* %2, i64 0, i64 0
%49 = bitcast [6 x i32]* %48 to i32**
%50 = load i32, i32* %6
%51 = call i32 @trace_critical_path(i32** %45, i32** %47, i32** %49, i32 %50)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"graph-kadai.dat\00"
@str = [10 x i8] c"Edge Data\00"
@str.6 = [12 x i8] c"Vertex Data\00"
@str.7 = [28 x i8] c"\C2\8D\C3\85\C2\91\C2\81\C2\8C\C2\8B\C2\8D\C2\87\C2\93_\C2\8E\C2\9E\C2\8D\C2\8F\00"
@str.8 = [27 x i8] c"\C2\8D\C3\85\C2\92x\C2\8C\C2\8B\C2\8D\C2\87\C2\93_\C2\8E\C2\9E\C2\8D\C2\8F\00"
@str.9 = [27 x i8] c"\C2\83N\C2\83\C2\8A\C2\83e\C2\83B\C2\83J\C2\83\C2\8B\C2\83p\C2\83X\00"
define void @main() {
%1 = alloca [3 x i32*]
%2 = alloca [10 x [6 x i32]]
%3 = alloca [100 x [3 x i32]]
%4 = alloca [200 x [3 x i32]]
%5 = bitcast [3 x i32*]* %1 to i8*
%6 = bitcast [10 x [6 x i32]]* %2 to i8*
%7 = bitcast [100 x [3 x i32]]* %3 to i8*
%8 = bitcast [200 x [3 x i32]]* %4 to i8*
%9 = getelementptr inbounds [3 x i32*], [3 x i32*]* %1, i64 0, i64 0
%10 = bitcast [10 x [6 x i32]]* %2 to i32**
%11 = bitcast [100 x [3 x i32]]* %3 to i32**
%12 = bitcast [200 x [3 x i32]]* %4 to i32**
%13 = call i32 @init_graph(i32** %9, i32** %10, i32** %11, i32** %12)
%14 = call i32 @read_data(i32** %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%16 = call i32 @pr_edge_all(i32** %9)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.6, i64 0, i64 0))
%18 = call i32 @pr_vertex_all(i32** %9)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%20 = call i32 @calc_earliest_node_times(i32** %9, i32** %11, i32** %10, i32 8)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.8, i64 0, i64 0))
%22 = call i32 @calc_latest_node_times(i32** %9, i32** %11, i32** %10, i32 8)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
%24 = call i32 @trace_critical_path(i32** %9, i32** %11, i32** %10, i32 8)
ret void
}