#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 */
char *decode_instruction(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  FILE *input = fopen("./mcode.txt", "r");
  FILE *output = fopen("./stacktrace.txt", "w");
  FILE *assemblyout = fopen("./assembly.txt", "w");
  FILE *executiontrace = fopen("executiontrace.txt", "w");
  int *opcode = malloc(sizeof(int) * 30000);
  int *lexlevel = malloc(sizeof(int) * 30000);
  int *modifier = malloc(sizeof(int) * 30000);
  int linenum = 0;
  int test1, test2, test3;
  fscanf(input, "%d %d %d", &test1, &test2, &test3);
  char *insName = decode_instruction(3, 0, 0);
  printf("%s", insName);
  free(opcode);
  free(lexlevel);
  free(modifier);
  fclose(input);
  fclose(output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe71(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe6d(%rip),%rdi
lea    0xe64(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    0xe65(%rip),%rdi
lea    0xe4d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    $0x1d4c0,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x1d4c0,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x1d4c0,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe2c(%rip),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x4c(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1060 <fscanf@plt>
mov    $0x3,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1090 <decode_instruction@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xe07(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe7c(%rip),%rdi
lea    0xe81(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
lea    0xe74(%rip),%rdi
lea    0xe7e(%rip),%rbx
mov    %rbx,%rsi
call   1080 <fopen@plt>
mov    %rax,%r14
lea    0xe6e(%rip),%rdi
mov    %rbx,%rsi
call   1080 <fopen@plt>
lea    0xe6e(%rip),%rdi
mov    %rbx,%rsi
call   1080 <fopen@plt>
mov    $0x1d4c0,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    $0x1d4c0,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    $0x1d4c0,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe4b(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %r15,%rdi
call   1060 <fscanf@plt>
mov    $0x3,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <decode_instruction@plt>
lea    0xe28(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"./mcode.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"./stacktrace.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [15 x i8] c"./assembly.txt\00"
@.str.5 = [19 x i8] c"executiontrace.txt\00"
@.str.6 = [9 x i8] c"%d %d %d\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i32 0, i32* %1
%14 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %2
%15 = call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %15, i32** %3
%16 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %16, i32** %4
%17 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %17, i32** %5
%18 = call i32* @malloc(i32 120000)
store i32* %18, i32** %6
%19 = call i32* @malloc(i32 120000)
store i32* %19, i32** %7
%20 = call i32* @malloc(i32 120000)
store i32* %20, i32** %8
store i32 0, i32* %9
%21 = load i32*, i32** %2
%22 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32* %10, i32* %11, i32* %12)
%23 = call i8* @decode_instruction(i32 3, i32 0, i32 0)
store i8* %23, i8** %13
%24 = load i8*, i8** %13
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %24)
%26 = load i32*, i32** %6
%27 = call i32 @free(i32* %26)
%28 = load i32*, i32** %7
%29 = call i32 @free(i32* %28)
%30 = load i32*, i32** %8
%31 = call i32 @free(i32* %30)
%32 = load i32*, i32** %2
%33 = call i32 @fclose(i32* %32)
%34 = load i32*, i32** %3
%35 = call i32 @fclose(i32* %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"./mcode.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"./stacktrace.txt\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [15 x i8] c"./assembly.txt\00"
@.str.5 = [19 x i8] c"executiontrace.txt\00"
@.str.6 = [9 x i8] c"%d %d %d\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32* @malloc(i32 120000)
%9 = tail call i32* @malloc(i32 120000)
%10 = tail call i32* @malloc(i32 120000)
%11 = bitcast i32* %1 to i8*
%12 = bitcast i32* %2 to i8*
%13 = bitcast i32* %3 to i8*
%14 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%15 = call i8* @decode_instruction(i32 3, i32 0, i32 0)
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %15)
%17 = call i32 @free(i32* %8)
%18 = call i32 @free(i32* %9)
%19 = call i32 @free(i32* %10)
%20 = call i32 @fclose(i32* %4)
%21 = call i32 @fclose(i32* %5)
ret i32 0
}