#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 */
unsigned int exynos_5410_gpio_read_raw_reg(int);
int /*<<< orphan*/ exynos_5410_gpio_write_raw_reg(int, unsigned int);
int /*<<< orphan*/ odroid_xu_gpio_setup_all_output();
int main(int argc, char *argv[]) {
  odroid_xu_gpio_setup_all_output();
  unsigned int regval = exynos_5410_gpio_read_raw_reg(0x0C60 + 4);
  for (int i = 0; i < 5000000; i++) {
    exynos_5410_gpio_write_raw_reg(0x0C60 + 4, regval ^ (1U << 1));
    exynos_5410_gpio_write_raw_reg(0x0C60 + 4, regval);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <odroid_xu_gpio_setup_all_output@plt>
mov    $0xc64,%edi
call   1040 <exynos_5410_gpio_read_raw_reg@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x4c4b40,-0x18(%rbp)
jge    1199 <main+0x69>
mov    -0x14(%rbp),%esi
xor    $0x2,%esi
mov    $0xc64,%edi
call   1050 <exynos_5410_gpio_write_raw_reg@plt>
mov    -0x14(%rbp),%esi
mov    $0xc64,%edi
call   1050 <exynos_5410_gpio_write_raw_reg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1161 <main+0x31>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <odroid_xu_gpio_setup_all_output@plt>
mov    $0xc64,%edi
call   1040 <exynos_5410_gpio_read_raw_reg@plt>
mov    %eax,%r14d
mov    %eax,%ebp
xor    $0x2,%ebp
mov    $0x4c4b40,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xc64,%edi
mov    %ebp,%esi
call   1050 <exynos_5410_gpio_write_raw_reg@plt>
mov    $0xc64,%edi
mov    %r14d,%esi
call   1050 <exynos_5410_gpio_write_raw_reg@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @odroid_xu_gpio_setup_all_output()
%9 = call i32 @exynos_5410_gpio_read_raw_reg(i32 3172)
store i32 %9, i32* %6
store i32 0, i32* %7
br label %10
10: ; preds = %19, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 5000000
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i32, i32* %6
%15 = xor i32 %14, 2
%16 = call i32 @exynos_5410_gpio_write_raw_reg(i32 3172, i32 %15)
%17 = load i32, i32* %6
%18 = call i32 @exynos_5410_gpio_write_raw_reg(i32 3172, i32 %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %10
22: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @odroid_xu_gpio_setup_all_output()
%4 = tail call i32 @exynos_5410_gpio_read_raw_reg(i32 3172)
%5 = xor i32 %4, 2
br label %7
6: ; preds = %7
ret i32 0
7: ; preds = %2, %7
%8 = phi i32 [ 0, %2 ], [ %11, %7 ]
%9 = tail call i32 @exynos_5410_gpio_write_raw_reg(i32 3172, i32 %5)
%10 = tail call i32 @exynos_5410_gpio_write_raw_reg(i32 3172, i32 %4)
%11 = add nuw nsw i32 %8, 1
%12 = icmp eq i32 %11, 5000000
br i1 %12, label %6, label %7
}