#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 EXIT_FAILURE;
int EXIT_SUCCESS;
char *basename(char *);
scalar_t__ check_debug_flags(char *);
int /*<<< orphan*/ debug_print(char *, int /*<<< orphan*/, char *, ...);
int fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int preprocess_hal(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strcpy(char *, char *);
char *strrchr(char *, char);
int assemble_hummus(char *file_name_path) {
  char file_name_in[1024];
  char file_name_out[1024];
  char file_name_log[1024];
  FILE *file_data_in;
  FILE *file_data_out;
  FILE *file_data_log;
  strcpy(file_name_in, basename(file_name_path));
  strcpy(file_name_out, file_name_in);
  char *dot = strrchr(file_name_out, '.');
  strcpy(dot, ".hex");
  strcpy(file_name_log, "(STDOUT)");
  file_data_in = fopen(file_name_path, "r");
  file_data_out = fopen(file_name_out, "wb");
  file_data_log = stdout;
  if (check_debug_flags("w")) {
    strcpy(file_name_log, file_name_in);
    dot = strrchr(file_name_log, '.');
    strcpy(dot, ".log");
    file_data_log = fopen(file_name_log, "w");
  }
  debug_print("@b", stdout, "\nInput File  -> %s\n", file_name_in);
  debug_print("@b", stdout, "Output File -> %s\n", file_name_out);
  debug_print("@b", stdout, "Log File    -> %s\n", file_name_log);
  if (file_data_in == NULL) {
    fprintf(stderr, "Unable to open file; %s\n", file_name_in);
    debug_print("@b", stderr, "File Open in assemble_hummus() has failed.\n");
    return EXIT_FAILURE;
  }
  debug_print("@b", stdout, "Input file was successfully opened!\n");
  if (preprocess_hal(file_data_in, file_data_out, file_data_log) ==
      EXIT_FAILURE)
    return EXIT_FAILURE;
  int flclose_rc_01 = fclose(file_data_in);
  int flclose_rc_02 = fclose(file_data_out);
  int flclose_rc_03 = 0;
  if (check_debug_flags("w"))
    flclose_rc_03 = fclose(file_data_log);
  if (flclose_rc_01 != 0 || flclose_rc_02 != 0 || flclose_rc_03 != 0) {
    fprintf(stderr, "Files were unable to be closed!\n");
    debug_print("@b", stderr, "plclose_rc_01: %x (%s)\n", flclose_rc_01,
                file_name_in);
    debug_print("@b", stderr, "plclose_rc_02: %x (%s)\n", flclose_rc_02,
                file_name_out);
    debug_print("@b", stderr, "plclose_rc_03: %x (%s)\n", flclose_rc_03,
                file_name_log);
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<assemble_hummus>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc50,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0xc48(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <basename@plt>
mov    -0xc48(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x810(%rbp),%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
mov    %rax,-0xc30(%rbp)
mov    -0xc30(%rbp),%rdi
lea    0xe02(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xc10(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xded(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0xc18(%rbp)
lea    -0x810(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0xc20(%rbp)
mov    0x2d82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xc28(%rbp)
lea    0xdb4(%rip),%rdi
call   1030 <check_debug_flags@plt>
cmp    $0x0,%rax
je     12c6 <assemble_hummus+0x136>
lea    -0xc10(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0xc10(%rbp),%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
mov    %rax,-0xc30(%rbp)
mov    -0xc30(%rbp),%rdi
lea    0xd6e(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0xc10(%rbp),%rdi
lea    0xd59(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0xc28(%rbp)
mov    0x2d03(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0x410(%rbp),%rcx
lea    0xd3a(%rip),%rdi
lea    0xd36(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    0x2cdb(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0x810(%rbp),%rcx
lea    0xd12(%rip),%rdi
lea    0xd22(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0xc10(%rbp),%rcx
lea    0xcea(%rip),%rdi
lea    0xd0d(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
cmpq   $0x0,-0xc18(%rbp)
jne    1399 <assemble_hummus+0x209>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rdx
lea    0xcf4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c6f(%rip),%rax
mov    (%rax),%esi
lea    0xca0(%rip),%rdi
lea    0xcef(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    0x2c49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1526 <assemble_hummus+0x396>
mov    0x2c30(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    0xc6e(%rip),%rdi
lea    0xce9(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    -0xc18(%rbp),%rdi
mov    -0xc20(%rbp),%rsi
mov    -0xc28(%rbp),%rdx
call   1070 <preprocess_hal@plt>
mov    0x2bfd(%rip),%rcx
cmp    (%rcx),%eax
jne    13f4 <assemble_hummus+0x264>
mov    0x2bee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1526 <assemble_hummus+0x396>
mov    -0xc18(%rbp),%rdi
call   1050 <fclose@plt>
mov    %eax,-0xc34(%rbp)
mov    -0xc20(%rbp),%rdi
call   1050 <fclose@plt>
mov    %eax,-0xc38(%rbp)
movl   $0x0,-0xc3c(%rbp)
lea    0xbea(%rip),%rdi
call   1030 <check_debug_flags@plt>
cmp    $0x0,%rax
je     144a <assemble_hummus+0x2ba>
mov    -0xc28(%rbp),%rdi
call   1050 <fclose@plt>
mov    %eax,-0xc3c(%rbp)
cmpl   $0x0,-0xc34(%rbp)
jne    1471 <assemble_hummus+0x2e1>
cmpl   $0x0,-0xc38(%rbp)
jne    1471 <assemble_hummus+0x2e1>
cmpl   $0x0,-0xc3c(%rbp)
je     151a <assemble_hummus+0x38a>
mov    0x2b68(%rip),%rax
mov    (%rax),%edi
lea    0xc40(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2b51(%rip),%rax
mov    (%rax),%esi
mov    -0xc34(%rbp),%ecx
lea    -0x410(%rbp),%r8
lea    0xb75(%rip),%rdi
lea    0xc36(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    0x2b26(%rip),%rax
mov    (%rax),%esi
mov    -0xc38(%rbp),%ecx
lea    -0x810(%rbp),%r8
lea    0xb4a(%rip),%rdi
lea    0xc23(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    0x2afb(%rip),%rax
mov    (%rax),%esi
mov    -0xc3c(%rbp),%ecx
lea    -0xc10(%rbp),%r8
lea    0xb1f(%rip),%rdi
lea    0xc10(%rip),%rdx
mov    $0x0,%al
call   10b0 <debug_print@plt>
mov    0x2ac8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1526 <assemble_hummus+0x396>
mov    0x2aa7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble_hummus>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc08,%rsp
mov    %rdi,%rbx
call   1090 <basename@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    0x800(%rsp),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
lea    0xe22(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
lea    0xe18(%rip),%rsi
lea    0x400(%rsp),%rdi
call   1040 <strcpy@plt>
lea    0xe0d(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r13
lea    0xdfd(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
mov    0x2dab(%rip),%rbx
mov    (%rbx),%r15
lea    0xde4(%rip),%rdi
call   1030 <check_debug_flags@plt>
test   %rax,%rax
je     127a <assemble_hummus+0xea>
lea    0x400(%rsp),%rbp
mov    %rsp,%rsi
mov    %rbp,%rdi
call   1040 <strcpy@plt>
mov    %rbp,%rdi
mov    $0x2e,%esi
call   1060 <strrchr@plt>
lea    0xdb5(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
lea    0xda4(%rip),%rsi
mov    %rbp,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r15
mov    (%rbx),%esi
lea    0xd97(%rip),%rbp
lea    0xd93(%rip),%rdx
mov    %rsp,%rcx
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <debug_print@plt>
mov    (%rbx),%esi
lea    0xd91(%rip),%rdx
lea    0x800(%rsp),%rcx
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <debug_print@plt>
mov    (%rbx),%esi
lea    0xd89(%rip),%rdx
lea    0x400(%rsp),%rcx
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <debug_print@plt>
test   %r13,%r13
je     13c9 <assemble_hummus+0x239>
mov    (%rbx),%esi
lea    0xd3b(%rip),%rdi
lea    0xdb6(%rip),%rdx
xor    %r12d,%r12d
xor    %eax,%eax
call   10b0 <debug_print@plt>
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <preprocess_hal@plt>
mov    0x2cd3(%rip),%rbp
cmp    0x0(%rbp),%eax
je     140d <assemble_hummus+0x27d>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %eax,%r14d
lea    0xce9(%rip),%rdi
call   1030 <check_debug_flags@plt>
test   %rax,%rax
je     133f <assemble_hummus+0x1af>
mov    %r15,%rdi
call   1050 <fclose@plt>
mov    %eax,%r12d
mov    %r14d,%eax
or     %ebx,%eax
or     %r12d,%eax
je     1403 <assemble_hummus+0x273>
mov    0x2c8c(%rip),%r13
mov    0x0(%r13),%edi
lea    0xd62(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x0(%r13),%esi
lea    0xca9(%rip),%r15
lea    0xd6a(%rip),%rdx
mov    %rsp,%r8
mov    %r15,%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   10b0 <debug_print@plt>
mov    0x0(%r13),%esi
lea    0xd68(%rip),%rdx
lea    0x800(%rsp),%r8
mov    %r15,%rdi
mov    %r14d,%ecx
xor    %eax,%eax
call   10b0 <debug_print@plt>
mov    0x0(%r13),%esi
lea    0xd60(%rip),%rdx
lea    0x400(%rsp),%r8
mov    %r15,%rdi
mov    %r12d,%ecx
xor    %eax,%eax
call   10b0 <debug_print@plt>
jmp    140a <assemble_hummus+0x27a>
mov    0x2c10(%rip),%rbx
mov    (%rbx),%edi
lea    0xc7e(%rip),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%esi
lea    0xc2e(%rip),%rdi
lea    0xc7d(%rip),%rdx
xor    %eax,%eax
call   10b0 <debug_print@plt>
mov    0x2bd7(%rip),%rbp
jmp    140a <assemble_hummus+0x27a>
mov    0x2bbe(%rip),%rbp
mov    0x0(%rbp),%eax
add    $0xc08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".hex\00"
@.str.1 = [9 x i8] c"(STDOUT)\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"wb\00"
@stdout = global i32* null
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [5 x i8] c".log\00"
@.str.6 = [3 x i8] c"@b\00"
@.str.7 = [20 x i8] c"\0AInput File -> %s\0A\00"
@.str.8 = [19 x i8] c"Output File -> %s\0A\00"
@.str.9 = [19 x i8] c"Log File -> %s\0A\00"
@stderr = global i32 0
@.str.10 = [25 x i8] c"Unable to open file; %s\0A\00"
@.str.11 = [44 x i8] c"File Open in assemble_hummus() has failed.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.12 = [37 x i8] c"Input file was successfully opened!\0A\00"
@.str.13 = [33 x i8] c"Files were unable to be closed!\0A\00"
@.str.14 = [24 x i8] c"plclose_rc_01: %x (%s)\0A\00"
@.str.15 = [24 x i8] c"plclose_rc_02: %x (%s)\0A\00"
@.str.16 = [24 x i8] c"plclose_rc_03: %x (%s)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @assemble_hummus(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %3
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = call i8* @basename(i8* %15)
%17 = call i32 @strcpy(i8* %14, i8* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%20 = call i32 @strcpy(i8* %18, i8* %19)
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%22 = call i8* @strrchr(i8* %21, i8 signext 46)
store i8* %22, i8** %10
%23 = load i8*, i8** %10
%24 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%27 = load i8*, i8** %3
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %7
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %30, i32** %8
%31 = load i32*, i32** @stdout
store i32* %31, i32** %9
%32 = call i64 @check_debug_flags(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %1
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%37 = call i32 @strcpy(i8* %35, i8* %36)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%39 = call i8* @strrchr(i8* %38, i8 signext 46)
store i8* %39, i8** %10
%40 = load i8*, i8** %10
%41 = call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %43, i32** %9
br label %44
44: ; preds = %34, %1
%45 = load i32*, i32** @stdout
%46 = ptrtoint i32* %45 to i32
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%48 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %46, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %47)
%49 = load i32*, i32** @stdout
%50 = ptrtoint i32* %49 to i32
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%52 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %51)
%53 = load i32*, i32** @stdout
%54 = ptrtoint i32* %53 to i32
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%56 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %54, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %55)
%57 = load i32*, i32** %7
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %66
59: ; preds = %44
%60 = load i32, i32* @stderr
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8* %61)
%63 = load i32, i32* @stderr
%64 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %63, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0))
%65 = load i32, i32* @EXIT_FAILURE
store i32 %65, i32* %2
br label %115
66: ; preds = %44
%67 = load i32*, i32** @stdout
%68 = ptrtoint i32* %67 to i32
%69 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %68, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%70 = load i32*, i32** %7
%71 = load i32*, i32** %8
%72 = load i32*, i32** %9
%73 = call i32 @preprocess_hal(i32* %70, i32* %71, i32* %72)
%74 = load i32, i32* @EXIT_FAILURE
%75 = icmp eq i32 %73, %74
br i1 %75, label %76, label %78
76: ; preds = %66
%77 = load i32, i32* @EXIT_FAILURE
store i32 %77, i32* %2
br label %115
78: ; preds = %66
%79 = load i32*, i32** %7
%80 = call i32 @fclose(i32* %79)
store i32 %80, i32* %11
%81 = load i32*, i32** %8
%82 = call i32 @fclose(i32* %81)
store i32 %82, i32* %12
store i32 0, i32* %13
%83 = call i64 @check_debug_flags(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %78
%86 = load i32*, i32** %9
%87 = call i32 @fclose(i32* %86)
store i32 %87, i32* %13
br label %88
88: ; preds = %85, %78
%89 = load i32, i32* %11
%90 = icmp ne i32 %89, 0
br i1 %90, label %97, label %91
91: ; preds = %88
%92 = load i32, i32* %12
%93 = icmp ne i32 %92, 0
br i1 %93, label %97, label %94
94: ; preds = %91
%95 = load i32, i32* %13
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %113
97: ; preds = %94, %91, %88
%98 = load i32, i32* @stderr
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0))
%100 = load i32, i32* @stderr
%101 = load i32, i32* %11
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%103 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %100, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 %101, i8* %102)
%104 = load i32, i32* @stderr
%105 = load i32, i32* %12
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%107 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %104, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i32 %105, i8* %106)
%108 = load i32, i32* @stderr
%109 = load i32, i32* %13
%110 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%111 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %108, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i32 %109, i8* %110)
%112 = load i32, i32* @EXIT_FAILURE
store i32 %112, i32* %2
br label %115
113: ; preds = %94
%114 = load i32, i32* @EXIT_SUCCESS
store i32 %114, i32* %2
br label %115
115: ; preds = %113, %97, %76, %59
%116 = load i32, i32* %2
ret i32 %116
}

LLVM IR (-O2):
@.str = [5 x i8] c".hex\00"
@.str.1 = [9 x i8] c"(STDOUT)\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"wb\00"
@stdout = global i32* null
@.str.4 = [2 x i8] c"w\00"
@.str.5 = [5 x i8] c".log\00"
@.str.6 = [3 x i8] c"@b\00"
@.str.7 = [20 x i8] c"\0AInput File -> %s\0A\00"
@.str.8 = [19 x i8] c"Output File -> %s\0A\00"
@.str.9 = [19 x i8] c"Log File -> %s\0A\00"
@stderr = global i32 0
@.str.10 = [25 x i8] c"Unable to open file; %s\0A\00"
@.str.11 = [44 x i8] c"File Open in assemble_hummus() has failed.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.12 = [37 x i8] c"Input file was successfully opened!\0A\00"
@.str.13 = [33 x i8] c"Files were unable to be closed!\0A\00"
@.str.14 = [24 x i8] c"plclose_rc_01: %x (%s)\0A\00"
@.str.15 = [24 x i8] c"plclose_rc_02: %x (%s)\0A\00"
@.str.16 = [24 x i8] c"plclose_rc_03: %x (%s)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @assemble_hummus(i8* %0) {
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = tail call i8* @basename(i8* %0)
%9 = call i32 @strcpy(i8* %5, i8* %8)
%10 = call i32 @strcpy(i8* %6, i8* %5)
%11 = call i8* @strrchr(i8* %6, i8 signext 46)
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%16 = load i32*, i32** @stdout
%17 = call i64 @check_debug_flags(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %1
%20 = call i32 @strcpy(i8* %7, i8* %5)
%21 = call i8* @strrchr(i8* %7, i8 signext 46)
%22 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %19, %1
%25 = phi i32* [ %23, %19 ], [ %16, %1 ]
%26 = load i32*, i32** @stdout
%27 = ptrtoint i32* %26 to i64
%28 = trunc i64 %27 to i32
%29 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %5)
%30 = load i32*, i32** @stdout
%31 = ptrtoint i32* %30 to i64
%32 = trunc i64 %31 to i32
%33 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %6)
%34 = load i32*, i32** @stdout
%35 = ptrtoint i32* %34 to i64
%36 = trunc i64 %35 to i32
%37 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %36, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0), i8* %7)
%38 = icmp eq i32* %14, null
br i1 %38, label %39, label %44
39: ; preds = %24
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i8* %5)
%42 = load i32, i32* @stderr
%43 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %42, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0))
br label %73
44: ; preds = %24
%45 = load i32*, i32** @stdout
%46 = ptrtoint i32* %45 to i64
%47 = trunc i64 %46 to i32
%48 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %47, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%49 = call i32 @preprocess_hal(i32* %14, i32* %15, i32* %25)
%50 = load i32, i32* @EXIT_FAILURE
%51 = icmp eq i32 %49, %50
br i1 %51, label %76, label %52
52: ; preds = %44
%53 = call i32 @fclose(i32* %14)
%54 = call i32 @fclose(i32* %15)
%55 = call i64 @check_debug_flags(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %52
%58 = call i32 @fclose(i32* %25)
br label %59
59: ; preds = %57, %52
%60 = phi i32 [ %58, %57 ], [ 0, %52 ]
%61 = or i32 %54, %53
%62 = or i32 %61, %60
%63 = icmp eq i32 %62, 0
br i1 %63, label %73, label %64
64: ; preds = %59
%65 = load i32, i32* @stderr
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.13, i64 0, i64 0))
%67 = load i32, i32* @stderr
%68 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %67, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i32 %53, i8* %5)
%69 = load i32, i32* @stderr
%70 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %69, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0), i32 %54, i8* %6)
%71 = load i32, i32* @stderr
%72 = call i32 (i8*, i32, i8*, ...) @debug_print(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %71, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i32 %60, i8* %7)
br label %73
73: ; preds = %64, %59, %39
%74 = phi i32* [ @EXIT_FAILURE, %39 ], [ @EXIT_FAILURE, %64 ], [ @EXIT_SUCCESS, %59 ]
%75 = load i32, i32* %74
br label %76
76: ; preds = %73, %44
%77 = phi i32 [ %49, %44 ], [ %75, %73 ]
ret i32 %77
}