#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*/ lcm_reset();
int /*<<< orphan*/ printk(char *, int);
int read_data_cmd();
int /*<<< orphan*/ send_ctrl_cmd(int);
unsigned int lcm_compare_id() {
  int para1, para2, para3, para4;
  lcm_reset();
  send_ctrl_cmd(0xD3);
  para1 = read_data_cmd();
  para2 = read_data_cmd();
  para3 = read_data_cmd();
  para4 = read_data_cmd();
  printk("il9486l LCD read id1 = %x \n", para1);
  printk("il9486l LCD read id2 = %x \n", para2);
  printk("il9486l LCD read id3 = %x \n", para3);
  printk("il9486l LCD read id4 = %x \n", para4);
  para1 = para1 & 0xFF;
  para2 = para2 & 0xFF;
  para3 = para3 & 0xFF;
  para4 = para4 & 0xFF;
  printk("il9486l LCD read id1 = %x \n", para1);
  printk("il9486l LCD read id2 = %x \n", para2);
  printk("il9486l LCD read id3 = %x \n", para3);
  printk("il9486l LCD read id4 = %x \n", para4);
  if ((para3 == 0x94) && (para4 == 0x86))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<lcm_compare_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <lcm_reset@plt>
mov    $0xd3,%edi
call   1060 <send_ctrl_cmd@plt>
mov    $0x0,%al
call   1050 <read_data_cmd@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <read_data_cmd@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <read_data_cmd@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <read_data_cmd@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printk@plt>
mov    -0xc(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printk@plt>
mov    -0x10(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printk@plt>
mov    -0x14(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printk@plt>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe0d(%rip),%rdi
call   1030 <printk@plt>
mov    -0xc(%rbp),%esi
lea    0xe1a(%rip),%rdi
call   1030 <printk@plt>
mov    -0x10(%rbp),%esi
lea    0xe27(%rip),%rdi
call   1030 <printk@plt>
mov    -0x14(%rbp),%esi
lea    0xe34(%rip),%rdi
call   1030 <printk@plt>
cmpl   $0x94,-0x10(%rbp)
jne    124b <lcm_compare_id+0x10b>
cmpl   $0x86,-0x14(%rbp)
jne    124b <lcm_compare_id+0x10b>
movl   $0x1,-0x4(%rbp)
jmp    1252 <lcm_compare_id+0x112>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcm_compare_id>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <lcm_reset@plt>
mov    $0xd3,%edi
call   1060 <send_ctrl_cmd@plt>
xor    %eax,%eax
call   1050 <read_data_cmd@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <read_data_cmd@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <read_data_cmd@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1050 <read_data_cmd@plt>
mov    %eax,%r13d
lea    0xe75(%rip),%rdi
mov    %r14d,%esi
call   1030 <printk@plt>
lea    0xe82(%rip),%rdi
mov    %r15d,%esi
call   1030 <printk@plt>
lea    0xe8f(%rip),%rdi
mov    %r12d,%esi
call   1030 <printk@plt>
lea    0xe9c(%rip),%rdi
mov    %r13d,%esi
call   1030 <printk@plt>
movzbl %r14b,%esi
movzbl %r15b,%r14d
movzbl %r12b,%ebp
movzbl %r13b,%ebx
lea    0xe29(%rip),%rdi
call   1030 <printk@plt>
lea    0xe39(%rip),%rdi
mov    %r14d,%esi
call   1030 <printk@plt>
lea    0xe46(%rip),%rdi
mov    %ebp,%esi
call   1030 <printk@plt>
lea    0xe54(%rip),%rdi
mov    %ebx,%esi
call   1030 <printk@plt>
xor    $0x94,%ebp
xor    $0x86,%ebx
xor    %eax,%eax
or     %ebp,%ebx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"il9486l LCD read id1 = %x \0A\00"
@.str.1 = [28 x i8] c"il9486l LCD read id2 = %x \0A\00"
@.str.2 = [28 x i8] c"il9486l LCD read id3 = %x \0A\00"
@.str.3 = [28 x i8] c"il9486l LCD read id4 = %x \0A\00"
define i32 @lcm_compare_id() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (...) @lcm_reset()
%7 = call i32 @send_ctrl_cmd(i32 211)
%8 = call i32 (...) @read_data_cmd()
store i32 %8, i32* %2
%9 = call i32 (...) @read_data_cmd()
store i32 %9, i32* %3
%10 = call i32 (...) @read_data_cmd()
store i32 %10, i32* %4
%11 = call i32 (...) @read_data_cmd()
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %3
%15 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %4
%17 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %5
%19 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %2
%21 = and i32 %20, 255
store i32 %21, i32* %2
%22 = load i32, i32* %3
%23 = and i32 %22, 255
store i32 %23, i32* %3
%24 = load i32, i32* %4
%25 = and i32 %24, 255
store i32 %25, i32* %4
%26 = load i32, i32* %5
%27 = and i32 %26, 255
store i32 %27, i32* %5
%28 = load i32, i32* %2
%29 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %3
%31 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %4
%33 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %5
%35 = call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 148
br i1 %37, label %38, label %42
38: ; preds = %0
%39 = load i32, i32* %5
%40 = icmp eq i32 %39, 134
br i1 %40, label %41, label %42
41: ; preds = %38
store i32 1, i32* %1
br label %43
42: ; preds = %38, %0
store i32 0, i32* %1
br label %43
43: ; preds = %42, %41
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
@.str = [28 x i8] c"il9486l LCD read id1 = %x \0A\00"
@.str.1 = [28 x i8] c"il9486l LCD read id2 = %x \0A\00"
@.str.2 = [28 x i8] c"il9486l LCD read id3 = %x \0A\00"
@.str.3 = [28 x i8] c"il9486l LCD read id4 = %x \0A\00"
define i32 @lcm_compare_id() {
%1 = tail call i32 (...) @lcm_reset()
%2 = tail call i32 @send_ctrl_cmd(i32 211)
%3 = tail call i32 (...) @read_data_cmd()
%4 = tail call i32 (...) @read_data_cmd()
%5 = tail call i32 (...) @read_data_cmd()
%6 = tail call i32 (...) @read_data_cmd()
%7 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %3)
%8 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%9 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%10 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%11 = and i32 %3, 255
%12 = and i32 %4, 255
%13 = and i32 %5, 255
%14 = and i32 %6, 255
%15 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %11)
%16 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%17 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%18 = tail call i32 @printk(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%19 = icmp eq i32 %13, 148
%20 = icmp eq i32 %14, 134
%21 = select i1 %19, i1 %20, i1 false
%22 = zext i1 %21 to i32
ret i32 %22
}