#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_writebyte_dualindexedx4(int, int, int);
int /*<<< orphan*/ emit_writebyte_indexed(int, int, int);
void emit_writebyte_indexed_tlb(int rt, int addr, int rs, int map, int temp) {
  if (map < 0)
    emit_writebyte_indexed(rt, addr, rs);
  else {
    if (addr == 0) {
      emit_writebyte_dualindexedx4(rt, rs, map);
    } else {
      emit_addimm(rs, addr, temp);
      emit_writebyte_dualindexedx4(rt, temp, map);
    }
  }
}


x86 assembly (clang, -O0):
<emit_writebyte_indexed_tlb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1165 <emit_writebyte_indexed_tlb+0x35>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <emit_writebyte_indexed@plt>
jmp    11a3 <emit_writebyte_indexed_tlb+0x73>
cmpl   $0x0,-0x8(%rbp)
jne    1182 <emit_writebyte_indexed_tlb+0x52>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <emit_writebyte_dualindexedx4@plt>
jmp    119e <emit_writebyte_indexed_tlb+0x6e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <emit_addimm@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <emit_writebyte_dualindexedx4@plt>
jmp    11a3 <emit_writebyte_indexed_tlb+0x73>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_writebyte_indexed_tlb>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
test   %ecx,%ecx
js     1154 <emit_writebyte_indexed_tlb+0x24>
mov    %ecx,%ebx
test   %esi,%esi
je     115f <emit_writebyte_indexed_tlb+0x2f>
mov    %r8d,%r14d
mov    %edx,%edi
mov    %r8d,%edx
call   1040 <emit_addimm@plt>
mov    %ebp,%edi
mov    %r14d,%esi
jmp    1163 <emit_writebyte_indexed_tlb+0x33>
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <emit_writebyte_indexed@plt>
mov    %ebp,%edi
mov    %edx,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <emit_writebyte_dualindexedx4@plt>

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

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