#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*/ print_bus_write_(char const *, char *, char *, char *, int);
int /*<<< orphan*/ printf(char *);
void address_exception() {
  const char *func_name = "address_exception";
  begin_function(func_name);
  printf("\tif (!SUPERVISOR) {USP = SP; SP = SSP;}\n");
  printf("\tif (SP&1) HALT;\n");
  print_bus_write_(func_name, "_pcl", "SP-2", "PC", 1);
  print_bus_write_(func_name, "_sr", "SP-6", "SR", 1);
  print_bus_write_(func_name, "_pch", "SP-4", "PC>>16", 1);
  print_bus_write_(func_name, "_op", "SP-8", "m68k->opcode", 1);
  print_bus_write_(func_name, "_eal", "SP-10", "EA", 1);
  print_bus_write_(func_name, "_fc", "SP-14", "0", 1);
  print_bus_write_(func_name, "_eah", "SP-12", "EA>>16", 1);
  print_bus_read_(func_name, "_vec", "12", "PC", 2);
  printf("\tif (PC&1) HALT;\n");
  printf("\tSR = (SR | M68K_FLAG_S_MASK) & (~M68K_FLAG_T1_MASK);\n");
  printf("\tSP -= 14;\n");
  opcode_read();
}


x86 assembly (clang, -O0):
<address_exception>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <begin_function@plt>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
lea    0xebc(%rip),%rdx
lea    0xeba(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
lea    0xea4(%rip),%rdx
lea    0xea2(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
lea    0xe8d(%rip),%rdx
lea    0xe8b(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
lea    0xe79(%rip),%rdx
lea    0xe77(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xe6e(%rip),%rsi
lea    0xe6c(%rip),%rdx
lea    0xe6b(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xe58(%rip),%rsi
lea    0xe55(%rip),%rdx
lea    0xe45(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xe3e(%rip),%rsi
lea    0xe3c(%rip),%rdx
lea    0xe3b(%rip),%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
mov    -0x8(%rbp),%rdi
lea    0xe2c(%rip),%rsi
lea    0xe1b(%rip),%rdx
lea    0xdbe(%rip),%rcx
mov    $0x2,%r8d
call   1060 <print_bus_read_@plt>
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
lea    0xe17(%rip),%rdi
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <opcode_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<address_exception>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rbx
mov    %rbx,%rdi
call   1070 <begin_function@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xf33(%rip),%rdi
call   1030 <puts@plt>
lea    0xe90(%rip),%rsi
lea    0xe8e(%rip),%rdx
lea    0xe8c(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rcx
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe77(%rip),%rsi
lea    0xe74(%rip),%rdx
lea    0xe72(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe60(%rip),%rsi
lea    0xe5e(%rip),%rdx
lea    0xe5c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe4e(%rip),%rsi
lea    0xe4b(%rip),%rdx
lea    0xe49(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe41(%rip),%rsi
lea    0xe3f(%rip),%rdx
lea    0xe3e(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe2c(%rip),%rsi
lea    0xe29(%rip),%rdx
lea    0xe19(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe13(%rip),%rsi
lea    0xe11(%rip),%rdx
lea    0xe10(%rip),%rcx
mov    %rbx,%rdi
mov    $0x1,%r8d
call   1040 <print_bus_write_@plt>
lea    0xe02(%rip),%rsi
lea    0xdf1(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rcx
mov    $0x2,%r8d
call   1060 <print_bus_read_@plt>
lea    0xe21(%rip),%rdi
call   1030 <puts@plt>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <opcode_read@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"address_exception\00"
@.str.1 = [41 x i8] c"\09if (!SUPERVISOR) {USP = SP; SP = SSP;}\0A\00"
@.str.2 = [18 x i8] c"\09if (SP&1) HALT;\0A\00"
@.str.3 = [5 x i8] c"_pcl\00"
@.str.4 = [5 x i8] c"SP-2\00"
@.str.5 = [3 x i8] c"PC\00"
@.str.6 = [4 x i8] c"_sr\00"
@.str.7 = [5 x i8] c"SP-6\00"
@.str.8 = [3 x i8] c"SR\00"
@.str.9 = [5 x i8] c"_pch\00"
@.str.10 = [5 x i8] c"SP-4\00"
@.str.11 = [7 x i8] c"PC>>16\00"
@.str.12 = [4 x i8] c"_op\00"
@.str.13 = [5 x i8] c"SP-8\00"
@.str.14 = [13 x i8] c"m68k->opcode\00"
@.str.15 = [5 x i8] c"_eal\00"
@.str.16 = [6 x i8] c"SP-10\00"
@.str.17 = [3 x i8] c"EA\00"
@.str.18 = [4 x i8] c"_fc\00"
@.str.19 = [6 x i8] c"SP-14\00"
@.str.20 = [2 x i8] c"0\00"
@.str.21 = [5 x i8] c"_eah\00"
@.str.22 = [6 x i8] c"SP-12\00"
@.str.23 = [7 x i8] c"EA>>16\00"
@.str.24 = [5 x i8] c"_vec\00"
@.str.25 = [3 x i8] c"12\00"
@.str.26 = [18 x i8] c"\09if (PC&1) HALT;\0A\00"
@.str.27 = [55 x i8] c"\09SR = (SR | M68K_FLAG_S_MASK) & (~M68K_FLAG_T1_MASK);\0A\00"
@.str.28 = [12 x i8] c"\09SP -= 14;\0A\00"
define void @address_exception() {
%1 = alloca i8*
store i8* getelementptr inbounds ([18 x i8], [18 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 ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = call i32 @print_bus_write_(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 1)
%8 = load i8*, i8** %1
%9 = call i32 @print_bus_write_(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 1)
%10 = load i8*, i8** %1
%11 = call i32 @print_bus_write_(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 1)
%12 = load i8*, i8** %1
%13 = call i32 @print_bus_write_(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 1)
%14 = load i8*, i8** %1
%15 = call i32 @print_bus_write_(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 1)
%16 = load i8*, i8** %1
%17 = call i32 @print_bus_write_(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i32 1)
%18 = load i8*, i8** %1
%19 = call i32 @print_bus_write_(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.23, i64 0, i64 0), i32 1)
%20 = load i8*, i8** %1
%21 = call i32 @print_bus_read_(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%22 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.26, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.27, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.28, i64 0, i64 0))
%25 = call i32 (...) @opcode_read()
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"address_exception\00"
@.str.3 = [5 x i8] c"_pcl\00"
@.str.4 = [5 x i8] c"SP-2\00"
@.str.5 = [3 x i8] c"PC\00"
@.str.6 = [4 x i8] c"_sr\00"
@.str.7 = [5 x i8] c"SP-6\00"
@.str.8 = [3 x i8] c"SR\00"
@.str.9 = [5 x i8] c"_pch\00"
@.str.10 = [5 x i8] c"SP-4\00"
@.str.11 = [7 x i8] c"PC>>16\00"
@.str.12 = [4 x i8] c"_op\00"
@.str.13 = [5 x i8] c"SP-8\00"
@.str.14 = [13 x i8] c"m68k->opcode\00"
@.str.15 = [5 x i8] c"_eal\00"
@.str.16 = [6 x i8] c"SP-10\00"
@.str.17 = [3 x i8] c"EA\00"
@.str.18 = [4 x i8] c"_fc\00"
@.str.19 = [6 x i8] c"SP-14\00"
@.str.20 = [2 x i8] c"0\00"
@.str.21 = [5 x i8] c"_eah\00"
@.str.22 = [6 x i8] c"SP-12\00"
@.str.23 = [7 x i8] c"EA>>16\00"
@.str.24 = [5 x i8] c"_vec\00"
@.str.25 = [3 x i8] c"12\00"
@str = [40 x i8] c"\09if (!SUPERVISOR) {USP = SP; SP = SSP;}\00"
@str.29 = [17 x i8] c"\09if (SP&1) HALT;\00"
@str.30 = [17 x i8] c"\09if (PC&1) HALT;\00"
@str.31 = [54 x i8] c"\09SR = (SR | M68K_FLAG_S_MASK) & (~M68K_FLAG_T1_MASK);\00"
@str.32 = [11 x i8] c"\09SP -= 14;\00"
define void @address_exception() {
%1 = tail call i32 @begin_function(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.29, i64 0, i64 0))
%4 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 1)
%5 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 1)
%6 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 1)
%7 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 1)
%8 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32 1)
%9 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0), i32 1)
%10 = tail call i32 @print_bus_write_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.23, i64 0, i64 0), i32 1)
%11 = tail call i32 @print_bus_read_(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.30, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.31, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.32, i64 0, i64 0))
%15 = tail call i32 (...) @opcode_read()
ret void
}