#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*/ rcc_printf(char *, ...);
void emit_load(const char *dst, int sz) {
  switch (sz) {
  case 'l':
    rcc_printf("  mov "
               "r0"
               ", %s\n",
               dst);
    rcc_printf("  mov "
               "r0"
               ", ["
               "r0"
               "]\n");
  case 'b':
    rcc_printf("  mov "
               "r0"
               ", %s\n",
               dst);
    rcc_printf("  movz "
               "r0"
               ", ["
               "r0"
               "]\n");
    break;
  default:
    rcc_printf("  mov "
               "r0"
               ", %s\n",
               dst);
    rcc_printf("  mov "
               "r0"
               ", ["
               "r0"
               "]\n");
  }
}


x86 assembly (clang, -O0):
<emit_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x62,%eax
je     1164 <emit_load+0x54>
jmp    1133 <emit_load+0x23>
mov    -0x10(%rbp),%eax
sub    $0x6c,%eax
jne    1189 <emit_load+0x79>
jmp    1144 <emit_load+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
jmp    11a9 <emit_load+0x99>
mov    -0x8(%rbp),%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <rcc_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_load>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf00(%rip),%r14
cmp    $0x62,%esi
je     1150 <emit_load+0x40>
cmp    $0x6c,%esi
jne    1149 <emit_load+0x39>
lea    0xed1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <rcc_printf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <rcc_printf@plt>
jmp    1150 <emit_load+0x40>
lea    0xebe(%rip),%r14
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <rcc_printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <rcc_printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c" mov r0, %s\0A\00"
@.str.1 = [16 x i8] c" mov r0, [r0]\0A\00"
@.str.2 = [17 x i8] c" movz r0, [r0]\0A\00"
define void @emit_load(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %14 [
i32 108, label %6
i32 98, label %10
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %2, %6
%11 = load i8*, i8** %3
%12 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %18
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c" mov r0, %s\0A\00"
@.str.1 = [16 x i8] c" mov r0, [r0]\0A\00"
@.str.2 = [17 x i8] c" movz r0, [r0]\0A\00"
define void @emit_load(i8* %0, i32 %1) {
switch i32 %1, label %6 [
i32 108, label %3
i32 98, label %7
]
3: ; preds = %2
%4 = tail call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %7
6: ; preds = %2
br label %7
7: ; preds = %3, %2, %6
%8 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), %3 ]
%9 = tail call i32 (i8*, ...) @rcc_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
%10 = tail call i32 (i8*, ...) @rcc_printf(i8* %8)
ret void
}