#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 read_data_cmd();
int /*<<< orphan*/ send_ctrl_cmd(int);
unsigned int lcm_check_status(void) {
  send_ctrl_cmd(0xB9);
  if (read_data_cmd() != 0x00)
    return 0;
  if (read_data_cmd() != 0xff)
    return 0;
  if (read_data_cmd() != 0x83)
    return 0;
  if (read_data_cmd() != 0x69)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<lcm_check_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xb9,%edi
call   1040 <send_ctrl_cmd@plt>
mov    $0x0,%al
call   1030 <read_data_cmd@plt>
cmp    $0x0,%eax
je     114e <lcm_check_status+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11ad <lcm_check_status+0x8d>
mov    $0x0,%al
call   1030 <read_data_cmd@plt>
cmp    $0xff,%eax
je     116c <lcm_check_status+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    11ad <lcm_check_status+0x8d>
mov    $0x0,%al
call   1030 <read_data_cmd@plt>
cmp    $0x83,%eax
je     118a <lcm_check_status+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    11ad <lcm_check_status+0x8d>
mov    $0x0,%al
call   1030 <read_data_cmd@plt>
cmp    $0x69,%eax
je     11a6 <lcm_check_status+0x86>
movl   $0x0,-0x4(%rbp)
jmp    11ad <lcm_check_status+0x8d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm_check_status>:
push   %rbx
mov    $0xb9,%edi
call   1040 <send_ctrl_cmd@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <read_data_cmd@plt>
test   %eax,%eax
jne    1167 <lcm_check_status+0x47>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <read_data_cmd@plt>
cmp    $0xff,%eax
jne    1167 <lcm_check_status+0x47>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <read_data_cmd@plt>
cmp    $0x83,%eax
jne    1167 <lcm_check_status+0x47>
xor    %eax,%eax
call   1030 <read_data_cmd@plt>
xor    %ebx,%ebx
cmp    $0x69,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lcm_check_status() {
%1 = alloca i32
%2 = call i32 @send_ctrl_cmd(i32 185)
%3 = call i32 (...) @read_data_cmd()
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %19
6: ; preds = %0
%7 = call i32 (...) @read_data_cmd()
%8 = icmp ne i32 %7, 255
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 0, i32* %1
br label %19
10: ; preds = %6
%11 = call i32 (...) @read_data_cmd()
%12 = icmp ne i32 %11, 131
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 0, i32* %1
br label %19
14: ; preds = %10
%15 = call i32 (...) @read_data_cmd()
%16 = icmp ne i32 %15, 105
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 0, i32* %1
br label %19
18: ; preds = %14
store i32 1, i32* %1
br label %19
19: ; preds = %18, %17, %13, %9, %5
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @lcm_check_status() {
%1 = tail call i32 @send_ctrl_cmd(i32 185)
%2 = tail call i32 (...) @read_data_cmd()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %0
%5 = tail call i32 (...) @read_data_cmd()
%6 = icmp eq i32 %5, 255
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = tail call i32 (...) @read_data_cmd()
%9 = icmp eq i32 %8, 131
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = tail call i32 (...) @read_data_cmd()
%12 = icmp eq i32 %11, 105
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %10, %7, %4, %0
%15 = phi i32 [ 0, %0 ], [ 0, %4 ], [ 0, %7 ], [ %13, %10 ]
ret i32 %15
}