#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*/ cc3_timer_wait_ms(int);
int /*<<< orphan*/ cc3_uart0_write(char *);
bool cc3_camera_init() {
  (*(volatile unsigned long *)((0xE002C000))) =
      ((~0x000000F0) & (*(volatile unsigned long *)((0xE002C000)))) |
      0x00000050;
  cc3_uart0_write("i2c PCB set\r\n");
  (*(volatile unsigned long *)((0x3FFFC01C))) = 0x2000;
  (*(volatile unsigned long *)((0x3FFFC01C))) = 0x1000;
  cc3_timer_wait_ms(500);
  (*(volatile unsigned long *)((0x3FFFC018))) = 0x1000;
  cc3_timer_wait_ms(1);
  (*(volatile unsigned long *)((0x3FFFC018))) = 0x2000;
  cc3_timer_wait_ms(353);
  return true;
}


x86 assembly (clang, -O0):
<cc3_camera_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe002c000,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff0f,%rcx
or     $0x50,%rcx
mov    $0xe002c000,%eax
mov    %rcx,(%rax)
lea    0xeba(%rip),%rdi
call   1030 <cc3_uart0_write@plt>
mov    $0x3fffc01c,%eax
movq   $0x2000,(%rax)
mov    $0x3fffc01c,%eax
movq   $0x1000,(%rax)
mov    $0x1f4,%edi
call   1040 <cc3_timer_wait_ms@plt>
mov    $0x3fffc018,%eax
movq   $0x1000,(%rax)
mov    $0x1,%edi
call   1040 <cc3_timer_wait_ms@plt>
mov    $0x3fffc018,%eax
movq   $0x2000,(%rax)
mov    $0x161,%edi
call   1040 <cc3_timer_wait_ms@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cc3_camera_init>:
push   %rax
mov    $0xe002c000,%eax
mov    $0xffffffffffffff0f,%rcx
and    (%rax),%rcx
or     $0x50,%rcx
mov    %rcx,(%rax)
lea    0xec2(%rip),%rdi
call   1030 <cc3_uart0_write@plt>
movq   $0x2000,0x3fffc01c
movq   $0x1000,0x3fffc01c
mov    $0x1f4,%edi
call   1040 <cc3_timer_wait_ms@plt>
movq   $0x1000,0x3fffc018
mov    $0x1,%edi
call   1040 <cc3_timer_wait_ms@plt>
movq   $0x2000,0x3fffc018
mov    $0x161,%edi
call   1040 <cc3_timer_wait_ms@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"i2c PCB set\0D\0A\00"
define i32 @cc3_camera_init() {
%1 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
%2 = and i64 -241, %1
%3 = or i64 %2, 80
store volatile i64 %3, i64* inttoptr (i64 3758276608 to i64*)
%4 = call i32 @cc3_uart0_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store volatile i64 8192, i64* inttoptr (i64 1073725468 to i64*)
store volatile i64 4096, i64* inttoptr (i64 1073725468 to i64*)
%5 = call i32 @cc3_timer_wait_ms(i32 500)
store volatile i64 4096, i64* inttoptr (i64 1073725464 to i64*)
%6 = call i32 @cc3_timer_wait_ms(i32 1)
store volatile i64 8192, i64* inttoptr (i64 1073725464 to i64*)
%7 = call i32 @cc3_timer_wait_ms(i32 353)
ret i32 1
}

LLVM IR (-O2):
@.str = [14 x i8] c"i2c PCB set\0D\0A\00"
define i32 @cc3_camera_init() {
%1 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
%2 = and i64 %1, -241
%3 = or i64 %2, 80
store volatile i64 %3, i64* inttoptr (i64 3758276608 to i64*)
%4 = tail call i32 @cc3_uart0_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store volatile i64 8192, i64* inttoptr (i64 1073725468 to i64*)
store volatile i64 4096, i64* inttoptr (i64 1073725468 to i64*)
%5 = tail call i32 @cc3_timer_wait_ms(i32 500)
store volatile i64 4096, i64* inttoptr (i64 1073725464 to i64*)
%6 = tail call i32 @cc3_timer_wait_ms(i32 1)
store volatile i64 8192, i64* inttoptr (i64 1073725464 to i64*)
%7 = tail call i32 @cc3_timer_wait_ms(i32 353)
ret i32 1
}