#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 getRAM(int);
int /*<<< orphan*/ printf(char *, ...);
void regdump() {
  printf("[REGISTERS]\n");
  printf("AX: %02x | BX: %02x | CX: %02x\n", getRAM(0xFFFA), getRAM(0xFFFB),
         getRAM(0xFFFC));
  printf("DX: %02x | CF: %02x | NF: %02x\n", getRAM(0xFFFD), getRAM(0xFFFE),
         getRAM(0xFFFF));
}


x86 assembly (clang, -O0):
<regdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfffa,%edi
call   1040 <getRAM@plt>
mov    %eax,-0x10(%rbp)
mov    $0xfffb,%edi
call   1040 <getRAM@plt>
mov    %eax,-0xc(%rbp)
mov    $0xfffc,%edi
call   1040 <getRAM@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfffd,%edi
call   1040 <getRAM@plt>
mov    %eax,-0x8(%rbp)
mov    $0xfffe,%edi
call   1040 <getRAM@plt>
mov    %eax,-0x4(%rbp)
mov    $0xffff,%edi
call   1040 <getRAM@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    %eax,%ecx
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regdump>:
push   %rbp
push   %rbx
push   %rax
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
mov    $0xfffa,%edi
call   1050 <getRAM@plt>
mov    %eax,%ebx
mov    $0xfffb,%edi
call   1050 <getRAM@plt>
mov    %eax,%ebp
mov    $0xfffc,%edi
call   1050 <getRAM@plt>
lea    0xe98(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffd,%edi
call   1050 <getRAM@plt>
mov    %eax,%ebx
mov    $0xfffe,%edi
call   1050 <getRAM@plt>
mov    %eax,%ebp
mov    $0xffff,%edi
call   1050 <getRAM@plt>
lea    0xe82(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"[REGISTERS]\0A\00"
@.str.1 = [32 x i8] c"AX: %02x | BX: %02x | CX: %02x\0A\00"
@.str.2 = [32 x i8] c"DX: %02x | CF: %02x | NF: %02x\0A\00"
define void @regdump() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @getRAM(i32 65530)
%3 = call i32 @getRAM(i32 65531)
%4 = call i32 @getRAM(i32 65532)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3, i32 %4)
%6 = call i32 @getRAM(i32 65533)
%7 = call i32 @getRAM(i32 65534)
%8 = call i32 @getRAM(i32 65535)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"AX: %02x | BX: %02x | CX: %02x\0A\00"
@.str.2 = [32 x i8] c"DX: %02x | CF: %02x | NF: %02x\0A\00"
@str = [12 x i8] c"[REGISTERS]\00"
define void @regdump() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @getRAM(i32 65530)
%3 = tail call i32 @getRAM(i32 65531)
%4 = tail call i32 @getRAM(i32 65532)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3, i32 %4)
%6 = tail call i32 @getRAM(i32 65533)
%7 = tail call i32 @getRAM(i32 65534)
%8 = tail call i32 @getRAM(i32 65535)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7, i32 %8)
ret void
}