#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*/ assem_debug(char *, int, int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ output_byte(int);
int /*<<< orphan*/ output_modrm(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ output_w32(int);
void emit_cmpmem_imm_byte(int addr, int imm) {
  assert(imm < 128 && imm >= -127);
  assem_debug("cmpb $%d,%x", imm, addr);
  output_byte(0x80);
  output_modrm(0, 5, 7);
  output_w32(addr);
  output_byte(imm);
}


x86 assembly (clang, -O0):
<emit_cmpmem_imm_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x80,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jge    117a <emit_cmpmem_imm_byte+0x2a>
cmpl   $0xffffff81,-0x8(%rbp)
setge  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe6c(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0x80,%edi
call   1050 <output_byte@plt>
xor    %edi,%edi
mov    $0x5,%esi
mov    $0x7,%edx
call   1060 <output_modrm@plt>
mov    -0x4(%rbp),%edi
call   1040 <output_w32@plt>
mov    -0x8(%rbp),%edi
call   1050 <output_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_cmpmem_imm_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0x7f(%rbx),%eax
xor    %edi,%edi
cmp    $0xff,%eax
setb   %dil
call   1070 <assert@plt>
lea    0xe8f(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <assem_debug@plt>
mov    $0x80,%edi
call   1050 <output_byte@plt>
xor    %edi,%edi
mov    $0x5,%esi
mov    $0x7,%edx
call   1060 <output_modrm@plt>
mov    %ebp,%edi
call   1040 <output_w32@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <output_byte@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"cmpb $%d,%x\00"
define void @emit_cmpmem_imm_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 128
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, -127
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = call i32 @assem_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%17 = call i32 @output_byte(i32 128)
%18 = call i32 @output_modrm(i32 0, i32 5, i32 7)
%19 = load i32, i32* %3
%20 = call i32 @output_w32(i32 %19)
%21 = load i32, i32* %4
%22 = call i32 @output_byte(i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"cmpb $%d,%x\00"
define void @emit_cmpmem_imm_byte(i32 %0, i32 %1) {
%3 = add i32 %1, 127
%4 = icmp ult i32 %3, 255
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @assem_debug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
%8 = tail call i32 @output_byte(i32 128)
%9 = tail call i32 @output_modrm(i32 0, i32 5, i32 7)
%10 = tail call i32 @output_w32(i32 %0)
%11 = tail call i32 @output_byte(i32 %1)
ret void
}