#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int start_child(char *, int /*<<< orphan*/ **, int /*<<< orphan*/ **);
void main(int argc, char **argv) {
  char *source_path = "/home/tkr/SYMPHONY/DrawGraph/IGD_1.0/";
  char *graph_name = NULL;
  FILE *read_from, *write_to;
  int childpid;
  if (argc > 1)
    graph_name = argv[1];
  childpid = start_child((char *)"wish", &read_from, &write_to);
  fprintf(write_to, "source %s/Init.tcl\n", source_path);
  fprintf(write_to, "source %s/Tools.tcl\n", source_path);
  fprintf(write_to, "source %s/NodeEdgeBasics.tcl\n", source_path);
  fprintf(write_to, "source %s/FileMenu.tcl\n", source_path);
  fprintf(write_to, "source %s/WindowMenu.tcl\n", source_path);
  fprintf(write_to, "source %s/NodeMenu.tcl\n", source_path);
  fprintf(write_to, "source %s/EdgeMenu.tcl\n", source_path);
  fprintf(write_to, "Igd_StartUp\n");
  fprintf(write_to, "Igd_CopyApplDefaultToWindow 1\n");
  fprintf(write_to, "Igd_InitWindow 1 first\n");
  fprintf(write_to, "Igd_DisplayWindow 1\n");
  if (graph_name)
    fprintf(write_to, "Igd_LoadGraph 1 %s\n", graph_name);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1158 <main+0x38>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <start_child@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x20(%rbp)
je     1272 <main+0x152>
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     1142 <main+0x12>
mov    0x8(%rsi),%r14
jmp    1145 <main+0x15>
xor    %r14d,%r14d
lea    0xeda(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <start_child@plt>
mov    0x8(%rsp),%rdi
lea    0xec4(%rip),%rsi
lea    0xe92(%rip),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xebb(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xeba(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xec2(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xec4(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xec8(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rdi
lea    0xeca(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x8(%rsp),%rcx
lea    0xecc(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    0x8(%rsp),%rcx
lea    0xebe(%rip),%rdi
mov    $0x1e,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    0x8(%rsp),%rcx
lea    0xec2(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    0x8(%rsp),%rcx
lea    0xebf(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
test   %r14,%r14
je     1283 <main+0x153>
mov    0x8(%rsp),%rdi
lea    0xeb4(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [38 x i8] c"/home/tkr/SYMPHONY/DrawGraph/IGD_1.0/\00"
@.str.1 = [5 x i8] c"wish\00"
@.str.2 = [20 x i8] c"source %s/Init.tcl\0A\00"
@.str.3 = [21 x i8] c"source %s/Tools.tcl\0A\00"
@.str.4 = [30 x i8] c"source %s/NodeEdgeBasics.tcl\0A\00"
@.str.5 = [24 x i8] c"source %s/FileMenu.tcl\0A\00"
@.str.6 = [26 x i8] c"source %s/WindowMenu.tcl\0A\00"
@.str.7 = [24 x i8] c"source %s/NodeMenu.tcl\0A\00"
@.str.8 = [24 x i8] c"source %s/EdgeMenu.tcl\0A\00"
@.str.9 = [13 x i8] c"Igd_StartUp\0A\00"
@.str.10 = [31 x i8] c"Igd_CopyApplDefaultToWindow 1\0A\00"
@.str.11 = [24 x i8] c"Igd_InitWindow 1 first\0A\00"
@.str.12 = [21 x i8] c"Igd_DisplayWindow 1\0A\00"
@.str.13 = [20 x i8] c"Igd_LoadGraph 1 %s\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* null, i8** %6
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %6
br label %16
16: ; preds = %12, %2
%17 = call i32 @start_child(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32** %7, i32** %8)
store i32 %17, i32* %9
%18 = load i32*, i32** %8
%19 = load i8*, i8** %5
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i32*, i32** %8
%22 = load i8*, i8** %5
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load i32*, i32** %8
%25 = load i8*, i8** %5
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%27 = load i32*, i32** %8
%28 = load i8*, i8** %5
%29 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %28)
%30 = load i32*, i32** %8
%31 = load i8*, i8** %5
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%33 = load i32*, i32** %8
%34 = load i8*, i8** %5
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %34)
%36 = load i32*, i32** %8
%37 = load i8*, i8** %5
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8* %37)
%39 = load i32*, i32** %8
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%41 = load i32*, i32** %8
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%43 = load i32*, i32** %8
%44 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
%45 = load i32*, i32** %8
%46 = call i32 (i32*, i8*, ...) @fprintf(i32* %45, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0))
%47 = load i8*, i8** %6
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %53
49: ; preds = %16
%50 = load i32*, i32** %8
%51 = load i8*, i8** %6
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %49, %16
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"/home/tkr/SYMPHONY/DrawGraph/IGD_1.0/\00"
@.str.1 = [5 x i8] c"wish\00"
@.str.2 = [20 x i8] c"source %s/Init.tcl\0A\00"
@.str.3 = [21 x i8] c"source %s/Tools.tcl\0A\00"
@.str.4 = [30 x i8] c"source %s/NodeEdgeBasics.tcl\0A\00"
@.str.5 = [24 x i8] c"source %s/FileMenu.tcl\0A\00"
@.str.6 = [26 x i8] c"source %s/WindowMenu.tcl\0A\00"
@.str.7 = [24 x i8] c"source %s/NodeMenu.tcl\0A\00"
@.str.8 = [24 x i8] c"source %s/EdgeMenu.tcl\0A\00"
@.str.9 = [13 x i8] c"Igd_StartUp\0A\00"
@.str.10 = [31 x i8] c"Igd_CopyApplDefaultToWindow 1\0A\00"
@.str.11 = [24 x i8] c"Igd_InitWindow 1 first\0A\00"
@.str.12 = [21 x i8] c"Igd_DisplayWindow 1\0A\00"
@.str.13 = [20 x i8] c"Igd_LoadGraph 1 %s\0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = bitcast i32** %3 to i8*
%6 = bitcast i32** %4 to i8*
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
br label %11
11: ; preds = %8, %2
%12 = phi i8* [ %10, %8 ], [ null, %2 ]
%13 = call i32 @start_child(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32** %3, i32** %4)
%14 = load i32*, i32** %4
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%16 = load i32*, i32** %4
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%18 = load i32*, i32** %4
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%20 = load i32*, i32** %4
%21 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%22 = load i32*, i32** %4
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%24 = load i32*, i32** %4
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%26 = load i32*, i32** %4
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%28 = load i32*, i32** %4
%29 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i64 12, i64 1, i32* %28)
%30 = load i32*, i32** %4
%31 = call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i64 30, i64 1, i32* %30)
%32 = load i32*, i32** %4
%33 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i64 23, i64 1, i32* %32)
%34 = load i32*, i32** %4
%35 = call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i64 0, i64 0), i64 20, i64 1, i32* %34)
%36 = icmp eq i8* %12, null
br i1 %36, label %40, label %37
37: ; preds = %11
%38 = load i32*, i32** %4
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %38, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8* %12)
br label %40
40: ; preds = %37, %11
ret void
}