#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*/ Delay();
int /*<<< orphan*/ FT800_I2C_HostCommand(int);
int /*<<< orphan*/ FT800_I2C_HostCommandDummyRead();
int FT800_I2C_RegRead32(unsigned long);
char FT800_I2C_RegRead8(unsigned long);
int /*<<< orphan*/ FT800_I2C_RegWrite16(unsigned long, int);
int /*<<< orphan*/ FT800_I2C_RegWrite32(unsigned long, int);
int /*<<< orphan*/ FT800_I2C_RegWrite8(unsigned long, int);
int FT800_IncCMDOffset(int, int);
int /*<<< orphan*/ HAL_init_ft800();
void main(void) {
  int CMD_Offset = 0;
  char chipid = 0;
  int cmdBufferRd = 0x0000;
  int cmdBufferWr = 0x0000;
  char toggle = 0x00;
  HAL_init_ft800();
  FT800_I2C_HostCommandDummyRead();
  FT800_I2C_HostCommand(0x44);
  FT800_I2C_HostCommand(0x62);
  Delay();
  FT800_I2C_HostCommand(0x68);
  chipid = 0x00;
  while (chipid != 0x7C) {
    chipid = FT800_I2C_RegRead8(1057792UL);
  }
  FT800_I2C_RegWrite16(1057832UL, 548);
  FT800_I2C_RegWrite16(1057836UL, 43);
  FT800_I2C_RegWrite16(1057844UL, 0);
  FT800_I2C_RegWrite16(1057848UL, 41);
  FT800_I2C_RegWrite16(1057852UL, 292);
  FT800_I2C_RegWrite16(1057856UL, 12);
  FT800_I2C_RegWrite16(1057864UL, 0);
  FT800_I2C_RegWrite16(1057868UL, 10);
  FT800_I2C_RegWrite16(1057888UL, 0);
  FT800_I2C_RegWrite16(1057896UL, 1);
  FT800_I2C_RegWrite16(1057840UL, 480);
  FT800_I2C_RegWrite16(1057860UL, 272);
  FT800_I2C_RegWrite16(1057900UL, 5);
  FT800_I2C_RegWrite16(1058052UL, 1200);
  FT800_I2C_RegWrite32(1048576UL + 0, 0x020000FF);
  FT800_I2C_RegWrite32(1048576UL + 4, 0x26000007);
  FT800_I2C_RegWrite32(1048576UL + 8, 0x00000000);
  FT800_I2C_RegWrite32(1057872UL, 0x00000002);
  FT800_I2C_RegWrite8(1057932UL, 0x83);
  FT800_I2C_RegWrite8(1057936UL, 0x83);
  Delay();
  Delay();
  Delay();
  Delay();
  Delay();
  Delay();
  while (1) {
    do {
      cmdBufferWr = FT800_I2C_RegRead32(1058024UL);
      cmdBufferRd = FT800_I2C_RegRead32(1058020UL);
    } while (cmdBufferWr != cmdBufferRd);
    CMD_Offset = cmdBufferWr;
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0xFFFFFF00);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x02000000);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x26000007);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    if (toggle == 0xFF) {
      FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x04FFFFFF);
      toggle = 0x00;
    } else {
      FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x04FF0000);
      toggle = 0xFF;
    }
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x0D0000FF);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x1F000002);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x43000880);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x21000000);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0x00000000);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite32(1081344UL + CMD_Offset, 0xFFFFFF01);
    CMD_Offset = FT800_IncCMDOffset(CMD_Offset, 4);
    FT800_I2C_RegWrite16(1058024UL, CMD_Offset);
    Delay();
    Delay();
    Delay();
    Delay();
    Delay();
    Delay();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
mov    $0x0,%al
call   10a0 <HAL_init_ft800@plt>
mov    $0x0,%al
call   1050 <FT800_I2C_HostCommandDummyRead@plt>
mov    $0x44,%edi
call   1090 <FT800_I2C_HostCommand@plt>
mov    $0x62,%edi
call   1090 <FT800_I2C_HostCommand@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x68,%edi
call   1090 <FT800_I2C_HostCommand@plt>
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x7c,%eax
je     121b <main+0x7b>
mov    $0x102400,%edi
call   1080 <FT800_I2C_RegRead8@plt>
mov    %al,-0x5(%rbp)
jmp    11fc <main+0x5c>
mov    $0x102428,%edi
mov    $0x224,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10242c,%edi
mov    $0x2b,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102434,%edi
xor    %esi,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102438,%edi
mov    $0x29,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10243c,%edi
mov    $0x124,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102440,%edi
mov    $0xc,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102448,%edi
xor    %esi,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10244c,%edi
mov    $0xa,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102460,%edi
xor    %esi,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102468,%edi
mov    $0x1,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102430,%edi
mov    $0x1e0,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102444,%edi
mov    $0x110,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10246c,%edi
mov    $0x5,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102504,%edi
mov    $0x4b0,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x100000,%edi
mov    $0x20000ff,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x100004,%edi
mov    $0x26000007,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x100008,%edi
xor    %esi,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x102450,%edi
mov    $0x2,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x10248c,%edi
mov    $0x83,%esi
call   10b0 <FT800_I2C_RegWrite8@plt>
mov    $0x102490,%edi
mov    $0x83,%esi
call   10b0 <FT800_I2C_RegWrite8@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
jmp    136a <main+0x1ca>
mov    $0x1024e8,%edi
call   10c0 <FT800_I2C_RegRead32@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1024e4,%edi
call   10c0 <FT800_I2C_RegRead32@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    136a <main+0x1ca>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0xffffff00,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x2000000,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x26000007,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0xff,%eax
jne    1432 <main+0x292>
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x4ffffff,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
movb   $0x0,-0x11(%rbp)
jmp    144b <main+0x2ab>
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x4ff0000,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
movb   $0xff,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0xd0000ff,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x1f000002,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x43000880,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0x21000000,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
xor    %esi,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
add    $0x108000,%rdi
mov    $0xffffff01,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1024e8,%edi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
mov    $0x0,%al
call   1030 <Delay@plt>
jmp    1365 <main+0x1c5>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   10a0 <HAL_init_ft800@plt>
xor    %eax,%eax
call   1050 <FT800_I2C_HostCommandDummyRead@plt>
mov    $0x44,%edi
call   1090 <FT800_I2C_HostCommand@plt>
mov    $0x62,%edi
call   1090 <FT800_I2C_HostCommand@plt>
xor    %eax,%eax
call   1030 <Delay@plt>
mov    $0x68,%edi
call   1090 <FT800_I2C_HostCommand@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x102400,%edi
call   1080 <FT800_I2C_RegRead8@plt>
cmp    $0x7c,%al
jne    11e0 <main+0x40>
mov    $0x102428,%edi
mov    $0x224,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10242c,%edi
mov    $0x2b,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102434,%edi
xor    %esi,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102438,%edi
mov    $0x29,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10243c,%edi
mov    $0x124,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102440,%edi
mov    $0xc,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102448,%edi
xor    %esi,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10244c,%edi
mov    $0xa,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102460,%edi
xor    %esi,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102468,%edi
mov    $0x1,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102430,%edi
mov    $0x1e0,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102444,%edi
mov    $0x110,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x10246c,%edi
mov    $0x5,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x102504,%edi
mov    $0x4b0,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
mov    $0x100000,%edi
mov    $0x20000ff,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x100004,%edi
mov    $0x26000007,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x100008,%edi
xor    %esi,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x102450,%edi
mov    $0x2,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    $0x10248c,%edi
mov    $0x83,%esi
call   10b0 <FT800_I2C_RegWrite8@plt>
mov    $0x102490,%edi
mov    $0x83,%esi
call   10b0 <FT800_I2C_RegWrite8@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <Delay@plt>
xor    %eax,%eax
call   1030 <Delay@plt>
xor    %eax,%eax
call   1030 <Delay@plt>
xor    %eax,%eax
call   1030 <Delay@plt>
xor    %eax,%eax
call   1030 <Delay@plt>
xor    %eax,%eax
call   1030 <Delay@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x1024e8,%edi
call   10c0 <FT800_I2C_RegRead32@plt>
mov    %eax,%ebx
mov    $0x1024e4,%edi
call   10c0 <FT800_I2C_RegRead32@plt>
cmp    %eax,%ebx
jne    1340 <main+0x1a0>
movslq %ebx,%rdi
add    $0x108000,%rdi
mov    $0xffffff00,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0x2000000,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0x26000007,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0x4ff0000,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0xd0000ff,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0x1f000002,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0x43000880,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0x21000000,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
xor    %esi,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
movslq %eax,%rbx
lea    0x108000(%rbx),%rdi
mov    $0xffffff01,%esi
call   1060 <FT800_I2C_RegWrite32@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1070 <FT800_IncCMDOffset@plt>
mov    $0x1024e8,%edi
mov    %eax,%esi
call   1040 <FT800_I2C_RegWrite16@plt>
jmp    1310 <main+0x170>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i8 0, i8* %5
%6 = call i32 (...) @HAL_init_ft800()
%7 = call i32 (...) @FT800_I2C_HostCommandDummyRead()
%8 = call i32 @FT800_I2C_HostCommand(i32 68)
%9 = call i32 @FT800_I2C_HostCommand(i32 98)
%10 = call i32 (...) @Delay()
%11 = call i32 @FT800_I2C_HostCommand(i32 104)
store i8 0, i8* %2
br label %12
12: ; preds = %16, %0
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 124
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call signext i8 @FT800_I2C_RegRead8(i64 1057792)
store i8 %17, i8* %2
br label %12
18: ; preds = %12
%19 = call i32 @FT800_I2C_RegWrite16(i64 1057832, i32 548)
%20 = call i32 @FT800_I2C_RegWrite16(i64 1057836, i32 43)
%21 = call i32 @FT800_I2C_RegWrite16(i64 1057844, i32 0)
%22 = call i32 @FT800_I2C_RegWrite16(i64 1057848, i32 41)
%23 = call i32 @FT800_I2C_RegWrite16(i64 1057852, i32 292)
%24 = call i32 @FT800_I2C_RegWrite16(i64 1057856, i32 12)
%25 = call i32 @FT800_I2C_RegWrite16(i64 1057864, i32 0)
%26 = call i32 @FT800_I2C_RegWrite16(i64 1057868, i32 10)
%27 = call i32 @FT800_I2C_RegWrite16(i64 1057888, i32 0)
%28 = call i32 @FT800_I2C_RegWrite16(i64 1057896, i32 1)
%29 = call i32 @FT800_I2C_RegWrite16(i64 1057840, i32 480)
%30 = call i32 @FT800_I2C_RegWrite16(i64 1057860, i32 272)
%31 = call i32 @FT800_I2C_RegWrite16(i64 1057900, i32 5)
%32 = call i32 @FT800_I2C_RegWrite16(i64 1058052, i32 1200)
%33 = call i32 @FT800_I2C_RegWrite32(i64 1048576, i32 33554687)
%34 = call i32 @FT800_I2C_RegWrite32(i64 1048580, i32 637534215)
%35 = call i32 @FT800_I2C_RegWrite32(i64 1048584, i32 0)
%36 = call i32 @FT800_I2C_RegWrite32(i64 1057872, i32 2)
%37 = call i32 @FT800_I2C_RegWrite8(i64 1057932, i32 131)
%38 = call i32 @FT800_I2C_RegWrite8(i64 1057936, i32 131)
%39 = call i32 (...) @Delay()
%40 = call i32 (...) @Delay()
%41 = call i32 (...) @Delay()
%42 = call i32 (...) @Delay()
%43 = call i32 (...) @Delay()
%44 = call i32 (...) @Delay()
br label %45
45: ; preds = %18, %86
br label %46
46: ; preds = %49, %45
%47 = call i32 @FT800_I2C_RegRead32(i64 1058024)
store i32 %47, i32* %4
%48 = call i32 @FT800_I2C_RegRead32(i64 1058020)
store i32 %48, i32* %3
br label %49
49: ; preds = %46
%50 = load i32, i32* %4
%51 = load i32, i32* %3
%52 = icmp ne i32 %50, %51
br i1 %52, label %46, label %53
53: ; preds = %49
%54 = load i32, i32* %4
store i32 %54, i32* %1
%55 = load i32, i32* %1
%56 = sext i32 %55 to i64
%57 = add i64 1081344, %56
%58 = call i32 @FT800_I2C_RegWrite32(i64 %57, i32 -256)
%59 = load i32, i32* %1
%60 = call i32 @FT800_IncCMDOffset(i32 %59, i32 4)
store i32 %60, i32* %1
%61 = load i32, i32* %1
%62 = sext i32 %61 to i64
%63 = add i64 1081344, %62
%64 = call i32 @FT800_I2C_RegWrite32(i64 %63, i32 33554432)
%65 = load i32, i32* %1
%66 = call i32 @FT800_IncCMDOffset(i32 %65, i32 4)
store i32 %66, i32* %1
%67 = load i32, i32* %1
%68 = sext i32 %67 to i64
%69 = add i64 1081344, %68
%70 = call i32 @FT800_I2C_RegWrite32(i64 %69, i32 637534215)
%71 = load i32, i32* %1
%72 = call i32 @FT800_IncCMDOffset(i32 %71, i32 4)
store i32 %72, i32* %1
%73 = load i8, i8* %5
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 255
br i1 %75, label %76, label %81
76: ; preds = %53
%77 = load i32, i32* %1
%78 = sext i32 %77 to i64
%79 = add i64 1081344, %78
%80 = call i32 @FT800_I2C_RegWrite32(i64 %79, i32 83886079)
store i8 0, i8* %5
br label %86
81: ; preds = %53
%82 = load i32, i32* %1
%83 = sext i32 %82 to i64
%84 = add i64 1081344, %83
%85 = call i32 @FT800_I2C_RegWrite32(i64 %84, i32 83820544)
store i8 -1, i8* %5
br label %86
86: ; preds = %81, %76
%87 = load i32, i32* %1
%88 = call i32 @FT800_IncCMDOffset(i32 %87, i32 4)
store i32 %88, i32* %1
%89 = load i32, i32* %1
%90 = sext i32 %89 to i64
%91 = add i64 1081344, %90
%92 = call i32 @FT800_I2C_RegWrite32(i64 %91, i32 218104063)
%93 = load i32, i32* %1
%94 = call i32 @FT800_IncCMDOffset(i32 %93, i32 4)
store i32 %94, i32* %1
%95 = load i32, i32* %1
%96 = sext i32 %95 to i64
%97 = add i64 1081344, %96
%98 = call i32 @FT800_I2C_RegWrite32(i64 %97, i32 520093698)
%99 = load i32, i32* %1
%100 = call i32 @FT800_IncCMDOffset(i32 %99, i32 4)
store i32 %100, i32* %1
%101 = load i32, i32* %1
%102 = sext i32 %101 to i64
%103 = add i64 1081344, %102
%104 = call i32 @FT800_I2C_RegWrite32(i64 %103, i32 1124075648)
%105 = load i32, i32* %1
%106 = call i32 @FT800_IncCMDOffset(i32 %105, i32 4)
store i32 %106, i32* %1
%107 = load i32, i32* %1
%108 = sext i32 %107 to i64
%109 = add i64 1081344, %108
%110 = call i32 @FT800_I2C_RegWrite32(i64 %109, i32 553648128)
%111 = load i32, i32* %1
%112 = call i32 @FT800_IncCMDOffset(i32 %111, i32 4)
store i32 %112, i32* %1
%113 = load i32, i32* %1
%114 = sext i32 %113 to i64
%115 = add i64 1081344, %114
%116 = call i32 @FT800_I2C_RegWrite32(i64 %115, i32 0)
%117 = load i32, i32* %1
%118 = call i32 @FT800_IncCMDOffset(i32 %117, i32 4)
store i32 %118, i32* %1
%119 = load i32, i32* %1
%120 = sext i32 %119 to i64
%121 = add i64 1081344, %120
%122 = call i32 @FT800_I2C_RegWrite32(i64 %121, i32 -255)
%123 = load i32, i32* %1
%124 = call i32 @FT800_IncCMDOffset(i32 %123, i32 4)
store i32 %124, i32* %1
%125 = load i32, i32* %1
%126 = call i32 @FT800_I2C_RegWrite16(i64 1058024, i32 %125)
%127 = call i32 (...) @Delay()
%128 = call i32 (...) @Delay()
%129 = call i32 (...) @Delay()
%130 = call i32 (...) @Delay()
%131 = call i32 (...) @Delay()
%132 = call i32 (...) @Delay()
br label %45
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @HAL_init_ft800()
%2 = tail call i32 (...) @FT800_I2C_HostCommandDummyRead()
%3 = tail call i32 @FT800_I2C_HostCommand(i32 68)
%4 = tail call i32 @FT800_I2C_HostCommand(i32 98)
%5 = tail call i32 (...) @Delay()
%6 = tail call i32 @FT800_I2C_HostCommand(i32 104)
br label %7
7: ; preds = %0, %7
%8 = tail call signext i8 @FT800_I2C_RegRead8(i64 1057792)
%9 = icmp eq i8 %8, 124
br i1 %9, label %10, label %7
10: ; preds = %7
%11 = tail call i32 @FT800_I2C_RegWrite16(i64 1057832, i32 548)
%12 = tail call i32 @FT800_I2C_RegWrite16(i64 1057836, i32 43)
%13 = tail call i32 @FT800_I2C_RegWrite16(i64 1057844, i32 0)
%14 = tail call i32 @FT800_I2C_RegWrite16(i64 1057848, i32 41)
%15 = tail call i32 @FT800_I2C_RegWrite16(i64 1057852, i32 292)
%16 = tail call i32 @FT800_I2C_RegWrite16(i64 1057856, i32 12)
%17 = tail call i32 @FT800_I2C_RegWrite16(i64 1057864, i32 0)
%18 = tail call i32 @FT800_I2C_RegWrite16(i64 1057868, i32 10)
%19 = tail call i32 @FT800_I2C_RegWrite16(i64 1057888, i32 0)
%20 = tail call i32 @FT800_I2C_RegWrite16(i64 1057896, i32 1)
%21 = tail call i32 @FT800_I2C_RegWrite16(i64 1057840, i32 480)
%22 = tail call i32 @FT800_I2C_RegWrite16(i64 1057860, i32 272)
%23 = tail call i32 @FT800_I2C_RegWrite16(i64 1057900, i32 5)
%24 = tail call i32 @FT800_I2C_RegWrite16(i64 1058052, i32 1200)
%25 = tail call i32 @FT800_I2C_RegWrite32(i64 1048576, i32 33554687)
%26 = tail call i32 @FT800_I2C_RegWrite32(i64 1048580, i32 637534215)
%27 = tail call i32 @FT800_I2C_RegWrite32(i64 1048584, i32 0)
%28 = tail call i32 @FT800_I2C_RegWrite32(i64 1057872, i32 2)
%29 = tail call i32 @FT800_I2C_RegWrite8(i64 1057932, i32 131)
%30 = tail call i32 @FT800_I2C_RegWrite8(i64 1057936, i32 131)
br label %31
31: ; preds = %42, %10
%32 = tail call i32 (...) @Delay()
%33 = tail call i32 (...) @Delay()
%34 = tail call i32 (...) @Delay()
%35 = tail call i32 (...) @Delay()
%36 = tail call i32 (...) @Delay()
%37 = tail call i32 (...) @Delay()
br label %38
38: ; preds = %38, %31
%39 = tail call i32 @FT800_I2C_RegRead32(i64 1058024)
%40 = tail call i32 @FT800_I2C_RegRead32(i64 1058020)
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %38
42: ; preds = %38
%43 = sext i32 %39 to i64
%44 = add nsw i64 %43, 1081344
%45 = tail call i32 @FT800_I2C_RegWrite32(i64 %44, i32 -256)
%46 = tail call i32 @FT800_IncCMDOffset(i32 %39, i32 4)
%47 = sext i32 %46 to i64
%48 = add nsw i64 %47, 1081344
%49 = tail call i32 @FT800_I2C_RegWrite32(i64 %48, i32 33554432)
%50 = tail call i32 @FT800_IncCMDOffset(i32 %46, i32 4)
%51 = sext i32 %50 to i64
%52 = add nsw i64 %51, 1081344
%53 = tail call i32 @FT800_I2C_RegWrite32(i64 %52, i32 637534215)
%54 = tail call i32 @FT800_IncCMDOffset(i32 %50, i32 4)
%55 = sext i32 %54 to i64
%56 = add nsw i64 %55, 1081344
%57 = tail call i32 @FT800_I2C_RegWrite32(i64 %56, i32 83820544)
%58 = tail call i32 @FT800_IncCMDOffset(i32 %54, i32 4)
%59 = sext i32 %58 to i64
%60 = add nsw i64 %59, 1081344
%61 = tail call i32 @FT800_I2C_RegWrite32(i64 %60, i32 218104063)
%62 = tail call i32 @FT800_IncCMDOffset(i32 %58, i32 4)
%63 = sext i32 %62 to i64
%64 = add nsw i64 %63, 1081344
%65 = tail call i32 @FT800_I2C_RegWrite32(i64 %64, i32 520093698)
%66 = tail call i32 @FT800_IncCMDOffset(i32 %62, i32 4)
%67 = sext i32 %66 to i64
%68 = add nsw i64 %67, 1081344
%69 = tail call i32 @FT800_I2C_RegWrite32(i64 %68, i32 1124075648)
%70 = tail call i32 @FT800_IncCMDOffset(i32 %66, i32 4)
%71 = sext i32 %70 to i64
%72 = add nsw i64 %71, 1081344
%73 = tail call i32 @FT800_I2C_RegWrite32(i64 %72, i32 553648128)
%74 = tail call i32 @FT800_IncCMDOffset(i32 %70, i32 4)
%75 = sext i32 %74 to i64
%76 = add nsw i64 %75, 1081344
%77 = tail call i32 @FT800_I2C_RegWrite32(i64 %76, i32 0)
%78 = tail call i32 @FT800_IncCMDOffset(i32 %74, i32 4)
%79 = sext i32 %78 to i64
%80 = add nsw i64 %79, 1081344
%81 = tail call i32 @FT800_I2C_RegWrite32(i64 %80, i32 -255)
%82 = tail call i32 @FT800_IncCMDOffset(i32 %78, i32 4)
%83 = tail call i32 @FT800_I2C_RegWrite16(i64 1058024, i32 %82)
br label %31
}