#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 */
typedef int /*<<< orphan*/ XdmcpBufferPtr;

/* Variables and functions */
int FALSE;
int TRUE;
int /*<<< orphan*/ XdmcpWriteCARD8(int /*<<< orphan*/, unsigned int);
int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value) {
  if (!XdmcpWriteCARD8(buffer, value >> 24))
    return FALSE;
  if (!XdmcpWriteCARD8(buffer, (value >> 16) & 0xff))
    return FALSE;
  if (!XdmcpWriteCARD8(buffer, (value >> 8) & 0xff))
    return FALSE;
  if (!XdmcpWriteCARD8(buffer, value & 0xff))
    return FALSE;
  return TRUE;
}


x86 assembly (clang, -O0):
<XdmcpWriteCARD32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
shr    $0x18,%esi
call   1030 <XdmcpWriteCARD8@plt>
cmp    $0x0,%eax
jne    1146 <XdmcpWriteCARD32+0x36>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d9 <XdmcpWriteCARD32+0xc9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
shr    $0x10,%esi
and    $0xff,%esi
call   1030 <XdmcpWriteCARD8@plt>
cmp    $0x0,%eax
jne    1174 <XdmcpWriteCARD32+0x64>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d9 <XdmcpWriteCARD32+0xc9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
shr    $0x8,%esi
and    $0xff,%esi
call   1030 <XdmcpWriteCARD8@plt>
cmp    $0x0,%eax
jne    11a2 <XdmcpWriteCARD32+0x92>
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d9 <XdmcpWriteCARD32+0xc9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
and    $0xff,%esi
call   1030 <XdmcpWriteCARD8@plt>
cmp    $0x0,%eax
jne    11cd <XdmcpWriteCARD32+0xbd>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d9 <XdmcpWriteCARD32+0xc9>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XdmcpWriteCARD32>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%eax
shr    $0x18,%eax
mov    %eax,%esi
call   1030 <XdmcpWriteCARD8@plt>
mov    0x2ead(%rip),%r14
test   %eax,%eax
je     116e <XdmcpWriteCARD32+0x5e>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%esi
mov    %ebp,%edi
call   1030 <XdmcpWriteCARD8@plt>
test   %eax,%eax
je     116e <XdmcpWriteCARD32+0x5e>
movzbl %bh,%esi
mov    %ebp,%edi
call   1030 <XdmcpWriteCARD8@plt>
test   %eax,%eax
je     116e <XdmcpWriteCARD32+0x5e>
movzbl %bl,%esi
mov    %ebp,%edi
call   1030 <XdmcpWriteCARD8@plt>
test   %eax,%eax
jne    1167 <XdmcpWriteCARD32+0x57>
mov    0x2e73(%rip),%r14
jmp    116e <XdmcpWriteCARD32+0x5e>
mov    0x2e7a(%rip),%r14
mov    (%r14),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @XdmcpWriteCARD32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = lshr i32 %7, 24
%9 = call i32 @XdmcpWriteCARD8(i32 %6, i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = load i32, i32* @FALSE
store i32 %12, i32* %3
br label %41
13: ; preds = %2
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = lshr i32 %15, 16
%17 = and i32 %16, 255
%18 = call i32 @XdmcpWriteCARD8(i32 %14, i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %13
%21 = load i32, i32* @FALSE
store i32 %21, i32* %3
br label %41
22: ; preds = %13
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = lshr i32 %24, 8
%26 = and i32 %25, 255
%27 = call i32 @XdmcpWriteCARD8(i32 %23, i32 %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %22
%30 = load i32, i32* @FALSE
store i32 %30, i32* %3
br label %41
31: ; preds = %22
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = and i32 %33, 255
%35 = call i32 @XdmcpWriteCARD8(i32 %32, i32 %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %39, label %37
37: ; preds = %31
%38 = load i32, i32* @FALSE
store i32 %38, i32* %3
br label %41
39: ; preds = %31
%40 = load i32, i32* @TRUE
store i32 %40, i32* %3
br label %41
41: ; preds = %39, %37, %29, %20, %11
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @XdmcpWriteCARD32(i32 %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = tail call i32 @XdmcpWriteCARD8(i32 %0, i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %21, label %6
6: ; preds = %2
%7 = lshr i32 %1, 16
%8 = and i32 %7, 255
%9 = tail call i32 @XdmcpWriteCARD8(i32 %0, i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %6
%12 = lshr i32 %1, 8
%13 = and i32 %12, 255
%14 = tail call i32 @XdmcpWriteCARD8(i32 %0, i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = and i32 %1, 255
%18 = tail call i32 @XdmcpWriteCARD8(i32 %0, i32 %17)
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32* @FALSE, i32* @TRUE
br label %21
21: ; preds = %16, %11, %6, %2
%22 = phi i32* [ @FALSE, %2 ], [ @FALSE, %6 ], [ @FALSE, %11 ], [ %20, %16 ]
%23 = load i32, i32* %22
ret i32 %23
}