#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*/ begin_function(char const *);
int /*<<< orphan*/ opcode_read();
int /*<<< orphan*/ print_bus_read_(char const *, char *, char *, char *, int);
int /*<<< orphan*/ printf(char *);
void reset_exception() {
  const char *func_name = "reset_exception";
  begin_function(func_name);
  printf("\tif (!SUPERVISOR) USP = SP;\n");
  print_bus_read_(func_name, "", "0", "REG_A(7)", 2);
  print_bus_read_(func_name, "_pc", "4", "PC", 2);
  printf("\tSR = M68K_FLAG_S_MASK | M68K_FLAG_I0_MASK | M68K_FLAG_I1_MASK | "
         "M68K_FLAG_I2_MASK;\n");
  printf("\tif (PC&1) ADDRESS_EXCEPTION;\n");
  opcode_read();
}


x86 assembly (clang, -O0):
<reset_exception>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <begin_function@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf22(%rip),%rsi
lea    0xeb3(%rip),%rdx
lea    0xeae(%rip),%rcx
mov    $0x2,%r8d
call   1050 <print_bus_read_@plt>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
lea    0xe9e(%rip),%rdx
lea    0xe99(%rip),%rcx
mov    $0x2,%r8d
call   1050 <print_bus_read_@plt>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <opcode_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_exception>:
push   %rbx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
call   1060 <begin_function@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb7(%rip),%rsi
lea    0xea6(%rip),%rdx
lea    0xea1(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%r8d
call   1050 <print_bus_read_@plt>
lea    0xe95(%rip),%rsi
lea    0xe92(%rip),%rdx
lea    0xe8d(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%r8d
call   1050 <print_bus_read_@plt>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <opcode_read@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"reset_exception\00"
@.str.1 = [29 x i8] c"\09if (!SUPERVISOR) USP = SP;\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [9 x i8] c"REG_A(7)\00"
@.str.5 = [4 x i8] c"_pc\00"
@.str.6 = [2 x i8] c"4\00"
@.str.7 = [3 x i8] c"PC\00"
@.str.8 = [85 x i8] c"\09SR = M68K_FLAG_S_MASK | M68K_FLAG_I0_MASK | M68K_FLAG_I1_MASK | M68K_FLAG_I2_MASK;\0A\00"
@.str.9 = [31 x i8] c"\09if (PC&1) ADDRESS_EXCEPTION;\0A\00"
define void @reset_exception() {
%1 = alloca i8*
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i32 @begin_function(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8*, i8** %1
%6 = call i32 @print_bus_read_(i8* %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 2)
%7 = load i8*, i8** %1
%8 = call i32 @print_bus_read_(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
%9 = call i32 @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.8, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%11 = call i32 (...) @opcode_read()
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"reset_exception\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [9 x i8] c"REG_A(7)\00"
@.str.5 = [4 x i8] c"_pc\00"
@.str.6 = [2 x i8] c"4\00"
@.str.7 = [3 x i8] c"PC\00"
@str = [28 x i8] c"\09if (!SUPERVISOR) USP = SP;\00"
@str.10 = [84 x i8] c"\09SR = M68K_FLAG_S_MASK | M68K_FLAG_I0_MASK | M68K_FLAG_I1_MASK | M68K_FLAG_I2_MASK;\00"
@str.11 = [30 x i8] c"\09if (PC&1) ADDRESS_EXCEPTION;\00"
define void @reset_exception() {
%1 = tail call i32 @begin_function(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @print_bus_read_(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 2)
%4 = tail call i32 @print_bus_read_(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 (...) @opcode_read()
ret void
}