#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*/ emit_addimm(int, int, int);
int /*<<< orphan*/ emit_movzbl_dualindexedx4(int, int, int);
int /*<<< orphan*/ emit_movzbl_indexed(int, int, int);
void emit_movzbl_indexed_map(int addr, int rs, int map, int rt) {
  if (map < 0)
    emit_movzbl_indexed(addr, rs, rt);
  else {
    if (addr == 0) {
      emit_movzbl_dualindexedx4(rs, map, rt);
    } else {
      emit_addimm(rs, addr, rt);
      emit_movzbl_dualindexedx4(rt, map, rt);
    }
  }
}


x86 assembly (clang, -O0):
<emit_movzbl_indexed_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1161 <emit_movzbl_indexed_map+0x31>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <emit_movzbl_indexed@plt>
jmp    119f <emit_movzbl_indexed_map+0x6f>
cmpl   $0x0,-0x4(%rbp)
jne    117e <emit_movzbl_indexed_map+0x4e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <emit_movzbl_dualindexedx4@plt>
jmp    119a <emit_movzbl_indexed_map+0x6a>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <emit_addimm@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <emit_movzbl_dualindexedx4@plt>
jmp    119f <emit_movzbl_indexed_map+0x6f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_movzbl_indexed_map>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edi,%eax
test   %edx,%edx
js     115d <emit_movzbl_indexed_map+0x2d>
mov    %edx,%ebp
mov    %esi,%edi
test   %eax,%eax
je     114e <emit_movzbl_indexed_map+0x1e>
mov    %eax,%esi
mov    %ebx,%edx
call   1040 <emit_addimm@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <emit_movzbl_dualindexedx4@plt>
mov    %eax,%edi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <emit_movzbl_indexed@plt>

LLVM IR (-O0):
define void @emit_movzbl_indexed_map(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = load i32, i32* %8
%15 = call i32 @emit_movzbl_indexed(i32 %12, i32 %13, i32 %14)
br label %34
16: ; preds = %4
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = call i32 @emit_movzbl_dualindexedx4(i32 %20, i32 %21, i32 %22)
br label %33
24: ; preds = %16
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = load i32, i32* %8
%28 = call i32 @emit_addimm(i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %8
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = call i32 @emit_movzbl_dualindexedx4(i32 %29, i32 %30, i32 %31)
br label %33
33: ; preds = %24, %19
br label %34
34: ; preds = %33, %11
ret void
}

LLVM IR (-O2):
define void @emit_movzbl_indexed_map(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @emit_movzbl_indexed(i32 %0, i32 %1, i32 %3)
br label %15
8: ; preds = %4
%9 = icmp eq i32 %0, 0
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = tail call i32 @emit_movzbl_dualindexedx4(i32 %1, i32 %2, i32 %3)
br label %15
12: ; preds = %8
%13 = tail call i32 @emit_addimm(i32 %1, i32 %0, i32 %3)
%14 = tail call i32 @emit_movzbl_dualindexedx4(i32 %3, i32 %2, i32 %3)
br label %15
15: ; preds = %10, %12, %6
ret void
}