#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ ArduCAM(int);
int /*<<< orphan*/ InitCAM();
int /*<<< orphan*/ InitLCD();
int /*<<< orphan*/ UTFT();
int /*<<< orphan*/ printf(char *);
int read_reg(int);
int /*<<< orphan*/ write_reg(int, int);
void setup() {
  uint8_t vid, pid;
  uint8_t temp;
  UTFT();
  ArduCAM(5);
  printf("ArduCAM Start!\n");
  write_reg(0x00, 0x55);
  temp = read_reg(0x00);
  if (temp != 0x55) {
    printf("SPI interface Error!");
    while (1)
      ;
  }
  InitLCD();
  InitCAM();
}


x86 assembly (clang, -O0):
<setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1080 <UTFT@plt>
mov    $0x5,%edi
call   1060 <ArduCAM@plt>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x55,%esi
call   1030 <write_reg@plt>
xor    %edi,%edi
call   1050 <read_reg@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x55,-0xc(%rbp)
je     11c6 <setup+0x56>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
jmp    11c1 <setup+0x51>
mov    $0x0,%al
call   1090 <InitLCD@plt>
mov    $0x0,%al
call   1070 <InitCAM@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup>:
push   %rax
xor    %eax,%eax
call   1090 <UTFT@plt>
mov    $0x5,%edi
call   1070 <ArduCAM@plt>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x55,%esi
call   1040 <write_reg@plt>
xor    %edi,%edi
call   1060 <read_reg@plt>
cmp    $0x55,%eax
jne    11c5 <setup+0x45>
xor    %eax,%eax
call   10a0 <InitLCD@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <InitCAM@plt>
lea    0xe34(%rip),%rdi
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    11e0 <setup+0x60>

LLVM IR (-O0):
@.str = [16 x i8] c"ArduCAM Start!\0A\00"
@.str.1 = [21 x i8] c"SPI interface Error!\00"
define void @setup() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @UTFT()
%5 = call i32 @ArduCAM(i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @write_reg(i32 0, i32 85)
%8 = call i32 @read_reg(i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 85
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %13
br label %13
14: ; preds = %0
%15 = call i32 (...) @InitLCD()
%16 = call i32 (...) @InitCAM()
ret void
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"SPI interface Error!\00"
@str = [15 x i8] c"ArduCAM Start!\00"
define void @setup() {
%1 = tail call i32 (...) @UTFT()
%2 = tail call i32 @ArduCAM(i32 5)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @write_reg(i32 0, i32 85)
%5 = tail call i32 @read_reg(i32 0)
%6 = icmp eq i32 %5, 85
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %9, %7
br label %9
10: ; preds = %0
%11 = tail call i32 (...) @InitLCD()
%12 = tail call i32 (...) @InitCAM()
ret void
}