#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_cmovl_imm(int, int);
int /*<<< orphan*/ emit_cmp(int, int);
int /*<<< orphan*/ emit_movimm(int /*<<< orphan*/, int);
int /*<<< orphan*/ emit_zeroreg(int);
void emit_set_if_less32(int rs1, int rs2, int rt) {
  if (rs1 != rt && rs2 != rt)
    emit_zeroreg(rt);
  emit_cmp(rs1, rs2);
  if (rs1 == rt || rs2 == rt)
    emit_movimm(0, rt);
  emit_cmovl_imm(1, rt);
}


x86 assembly (clang, -O0):
<emit_set_if_less32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1171 <emit_set_if_less32+0x31>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1171 <emit_set_if_less32+0x31>
mov    -0xc(%rbp),%edi
call   1040 <emit_zeroreg@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <emit_cmp@plt>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1194 <emit_set_if_less32+0x54>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    119e <emit_set_if_less32+0x5e>
mov    -0xc(%rbp),%esi
xor    %edi,%edi
call   1060 <emit_movimm@plt>
mov    -0xc(%rbp),%esi
mov    $0x1,%edi
call   1050 <emit_cmovl_imm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_set_if_less32>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
cmp    %edx,%edi
je     1167 <emit_set_if_less32+0x27>
cmp    %ebx,%r14d
je     1167 <emit_set_if_less32+0x27>
mov    %ebx,%edi
call   1040 <emit_zeroreg@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <emit_cmp@plt>
jmp    117a <emit_set_if_less32+0x3a>
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <emit_cmp@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1060 <emit_movimm@plt>
mov    $0x1,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <emit_cmovl_imm@plt>

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

LLVM IR (-O2):
define void @emit_set_if_less32(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, %2
%5 = icmp eq i32 %1, %2
%6 = or i1 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = tail call i32 @emit_zeroreg(i32 %2)
%9 = tail call i32 @emit_cmp(i32 %0, i32 %1)
br label %13
10: ; preds = %3
%11 = tail call i32 @emit_cmp(i32 %0, i32 %1)
%12 = tail call i32 @emit_movimm(i32 0, i32 %2)
br label %13
13: ; preds = %7, %10
%14 = tail call i32 @emit_cmovl_imm(i32 1, i32 %2)
ret void
}