#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*/ lcd_crlf();
int /*<<< orphan*/ lcdout(char);
unsigned int read_wordL(int);
int /*<<< orphan*/ write_word(int, int);
unsigned char cs_test(void) {
  unsigned int nReturn;
  nReturn = read_wordL(0x000C);
  if (nReturn != 0x630E)
    return 0;
  write_word(0x000A, 0x0102);
  nReturn = read_wordL(0x000C);
  if (nReturn != 0x0003)
    return 0;
  lcdout('O');
  lcdout('K');
  lcdout(' ');
  lcd_crlf();
  return 1;
}


x86 assembly (clang, -O0):
<cs_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1050 <read_wordL@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x630e,-0x8(%rbp)
je     116b <cs_test+0x2b>
movb   $0x0,-0x1(%rbp)
jmp    11c3 <cs_test+0x83>
mov    $0xa,%edi
mov    $0x102,%esi
call   1060 <write_word@plt>
mov    $0xc,%edi
call   1050 <read_wordL@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     119a <cs_test+0x5a>
movb   $0x0,-0x1(%rbp)
jmp    11c3 <cs_test+0x83>
mov    $0x4f,%edi
call   1030 <lcdout@plt>
mov    $0x4b,%edi
call   1030 <lcdout@plt>
mov    $0x20,%edi
call   1030 <lcdout@plt>
mov    $0x0,%al
call   1040 <lcd_crlf@plt>
movb   $0x1,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cs_test>:
push   %rax
mov    $0xc,%edi
call   1050 <read_wordL@plt>
cmp    $0x630e,%eax
jne    1199 <cs_test+0x59>
mov    $0xa,%edi
mov    $0x102,%esi
call   1060 <write_word@plt>
mov    $0xc,%edi
call   1050 <read_wordL@plt>
cmp    $0x3,%eax
jne    1199 <cs_test+0x59>
mov    $0x4f,%edi
call   1030 <lcdout@plt>
mov    $0x4b,%edi
call   1030 <lcdout@plt>
mov    $0x20,%edi
call   1030 <lcdout@plt>
xor    %eax,%eax
call   1040 <lcd_crlf@plt>
mov    $0x1,%al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @cs_test() {
%1 = alloca i8
%2 = alloca i32
%3 = call i32 @read_wordL(i32 12)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 25358
br i1 %5, label %6, label %7
6: ; preds = %0
store i8 0, i8* %1
br label %18
7: ; preds = %0
%8 = call i32 @write_word(i32 10, i32 258)
%9 = call i32 @read_wordL(i32 12)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %7
store i8 0, i8* %1
br label %18
13: ; preds = %7
%14 = call i32 @lcdout(i8 signext 79)
%15 = call i32 @lcdout(i8 signext 75)
%16 = call i32 @lcdout(i8 signext 32)
%17 = call i32 (...) @lcd_crlf()
store i8 1, i8* %1
br label %18
18: ; preds = %13, %12, %6
%19 = load i8, i8* %1
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @cs_test() {
%1 = tail call i32 @read_wordL(i32 12)
%2 = icmp eq i32 %1, 25358
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = tail call i32 @write_word(i32 10, i32 258)
%5 = tail call i32 @read_wordL(i32 12)
%6 = icmp eq i32 %5, 3
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = tail call i32 @lcdout(i8 signext 79)
%9 = tail call i32 @lcdout(i8 signext 75)
%10 = tail call i32 @lcdout(i8 signext 32)
%11 = tail call i32 (...) @lcd_crlf()
br label %12
12: ; preds = %3, %0, %7
%13 = phi i8 [ 1, %7 ], [ 0, %0 ], [ 0, %3 ]
ret i8 %13
}