#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*/ assert(int);
int /*<<< orphan*/ emit_readword_dualindexedx4(int, int, int);
int /*<<< orphan*/ emit_readword_indexed(int, int, int);
void emit_readword_indexed_tlb(int addr, int rs, int map, int rt) {
  assert(map >= 0);
  if (map < 0)
    emit_readword_indexed(addr, rs, rt);
  else {
    assert(addr == 0);
    emit_readword_dualindexedx4(rs, map, rt);
  }
}


x86 assembly (clang, -O0):
<emit_readword_indexed_tlb>:
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)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0xc(%rbp)
jge    1172 <emit_readword_indexed_tlb+0x42>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <emit_readword_indexed@plt>
jmp    1191 <emit_readword_indexed_tlb+0x61>
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <emit_readword_dualindexedx4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_readword_indexed_tlb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%r15d
mov    %edi,%ebp
mov    %edx,%edi
not    %edi
shr    $0x1f,%edi
call   1040 <assert@plt>
test   %ebx,%ebx
js     1175 <emit_readword_indexed_tlb+0x45>
xor    %edi,%edi
test   %ebp,%ebp
sete   %dil
call   1040 <assert@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <emit_readword_dualindexedx4@plt>
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <emit_readword_indexed@plt>

LLVM IR (-O0):
define void @emit_readword_indexed_tlb(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 sge i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = load i32, i32* %8
%19 = call i32 @emit_readword_indexed(i32 %16, i32 %17, i32 %18)
br label %29
20: ; preds = %4
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = call i32 @emit_readword_dualindexedx4(i32 %25, i32 %26, i32 %27)
br label %29
29: ; preds = %20, %15
ret void
}

LLVM IR (-O2):
define void @emit_readword_indexed_tlb(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = xor i32 %2, -1
%6 = lshr i32 %5, 31
%7 = tail call i32 @assert(i32 %6)
%8 = icmp slt i32 %2, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @emit_readword_indexed(i32 %0, i32 %1, i32 %3)
br label %16
11: ; preds = %4
%12 = icmp eq i32 %0, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @emit_readword_dualindexedx4(i32 %1, i32 %2, i32 %3)
br label %16
16: ; preds = %11, %9
ret void
}