#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 */
struct lexer {
  int dummy;
};
struct codegen {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ codegen_destroy(struct codegen **);
int /*<<< orphan*/ codegen_init(struct codegen **, char *);
int /*<<< orphan*/ lexer_destroy(struct lexer **);
int /*<<< orphan*/ lexer_init(struct lexer **, char *);
int /*<<< orphan*/ program(struct lexer *, struct codegen *);
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  struct lexer *lexer = NULL;
  struct codegen *codegen = NULL;
  lexer_init(&lexer, "test.c");
  codegen_init(&codegen, "test.asm");
  program(lexer, codegen);
  lexer_destroy(&lexer);
  codegen_destroy(&codegen);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1060 <lexer_init@plt>
lea    -0x20(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1080 <codegen_init@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <program@plt>
lea    -0x18(%rbp),%rdi
call   1070 <lexer_destroy@plt>
lea    -0x20(%rbp),%rdi
call   1040 <codegen_destroy@plt>
lea    0xe44(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xe80(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1060 <lexer_init@plt>
lea    0xe73(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <codegen_init@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%rsi
call   1050 <program@plt>
mov    %r14,%rdi
call   1070 <lexer_destroy@plt>
mov    %rbx,%rdi
call   1040 <codegen_destroy@plt>
lea    0xe49(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.lexer = type { i32 }
%struct.codegen = type { i32 }
@.str = [7 x i8] c"test.c\00"
@.str.1 = [9 x i8] c"test.asm\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.lexer*
%7 = alloca %struct.codegen*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.lexer* null, %struct.lexer** %6
store %struct.codegen* null, %struct.codegen** %7
%8 = call i32 @lexer_init(%struct.lexer** %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @codegen_init(%struct.codegen** %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = load %struct.lexer*, %struct.lexer** %6
%11 = load %struct.codegen*, %struct.codegen** %7
%12 = call i32 @program(%struct.lexer* %10, %struct.codegen* %11)
%13 = call i32 @lexer_destroy(%struct.lexer** %6)
%14 = call i32 @codegen_destroy(%struct.codegen** %7)
%15 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.lexer = type { i32 }
%struct.codegen = type { i32 }
@.str = [7 x i8] c"test.c\00"
@.str.1 = [9 x i8] c"test.asm\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.lexer*
%4 = alloca %struct.codegen*
%5 = bitcast %struct.lexer** %3 to i8*
store %struct.lexer* null, %struct.lexer** %3
%6 = bitcast %struct.codegen** %4 to i8*
store %struct.codegen* null, %struct.codegen** %4
%7 = call i32 @lexer_init(%struct.lexer** %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @codegen_init(%struct.codegen** %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = load %struct.lexer*, %struct.lexer** %3
%10 = load %struct.codegen*, %struct.codegen** %4
%11 = call i32 @program(%struct.lexer* %9, %struct.codegen* %10)
%12 = call i32 @lexer_destroy(%struct.lexer** %3)
%13 = call i32 @codegen_destroy(%struct.codegen** %4)
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}