#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 *alloca(int);
int main() {
  int *x0 = alloca(sizeof(int));
  int *x1 = alloca(sizeof(int));
  int *x2 = alloca(sizeof(int));
  int *x3 = alloca(sizeof(int));
  *x0 = 0;
  *x1 = 0;
  *x2 = 0;
  *x3 = 0;
  while (*x3 == 0) {
    if (*x0 == 0) {
      *x0 = 1;
    } else {
      *x0 = 0;
      if (*x1 == 0) {
        *x1 = 1;
      } else {
        *x1 = 0;
        if (*x2 == 0) {
          *x2 = 1;
        } else {
          *x2 = 0;
          *x3 = 1;
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1217 <main+0x107>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11a8 <main+0x98>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1212 <main+0x102>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11ce <main+0xbe>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    120d <main+0xfd>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11f4 <main+0xe4>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    1208 <main+0xf8>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    120d <main+0xfd>
jmp    1212 <main+0x102>
jmp    117f <main+0x6f>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1030 <alloca@plt>
movl   $0x0,(%rbx)
movl   $0x0,(%r14)
movl   $0x0,(%r15)
movl   $0x0,(%rax)
jmp    117b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x1,(%rcx)
cmpl   $0x0,(%rax)
jne    11af <main+0x9f>
cmpl   $0x0,(%rbx)
mov    %rbx,%rcx
je     1170 <main+0x60>
movl   $0x0,(%rbx)
cmpl   $0x0,(%r14)
mov    %r14,%rcx
je     1170 <main+0x60>
movl   $0x0,(%r14)
cmpl   $0x0,(%r15)
mov    %r15,%rcx
je     1170 <main+0x60>
movl   $0x0,(%r15)
movl   $0x1,(%rax)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32 0, i32* %1
%6 = call i32* @alloca(i32 4)
store i32* %6, i32** %2
%7 = call i32* @alloca(i32 4)
store i32* %7, i32** %3
%8 = call i32* @alloca(i32 4)
store i32* %8, i32** %4
%9 = call i32* @alloca(i32 4)
store i32* %9, i32** %5
%10 = load i32*, i32** %2
store i32 0, i32* %10
%11 = load i32*, i32** %3
store i32 0, i32* %11
%12 = load i32*, i32** %4
store i32 0, i32* %12
%13 = load i32*, i32** %5
store i32 0, i32* %13
br label %14
14: ; preds = %43, %0
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %44
18: ; preds = %14
%19 = load i32*, i32** %2
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32*, i32** %2
store i32 1, i32* %23
br label %43
24: ; preds = %18
%25 = load i32*, i32** %2
store i32 0, i32* %25
%26 = load i32*, i32** %3
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = load i32*, i32** %3
store i32 1, i32* %30
br label %42
31: ; preds = %24
%32 = load i32*, i32** %3
store i32 0, i32* %32
%33 = load i32*, i32** %4
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = load i32*, i32** %4
store i32 1, i32* %37
br label %41
38: ; preds = %31
%39 = load i32*, i32** %4
store i32 0, i32* %39
%40 = load i32*, i32** %5
store i32 1, i32* %40
br label %41
41: ; preds = %38, %36
br label %42
42: ; preds = %41, %29
br label %43
43: ; preds = %42, %22
br label %14
44: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
%3 = tail call i32* @alloca(i32 4)
%4 = tail call i32* @alloca(i32 4)
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %0, %15
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %5
store i32 0, i32* %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
store i32 0, i32* %2
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %11
store i32 0, i32* %3
store i32 1, i32* %4
br label %19
15: ; preds = %11, %8, %5
%16 = phi i32* [ %1, %5 ], [ %2, %8 ], [ %3, %11 ]
store i32 1, i32* %16
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 0
br i1 %18, label %5, label %19
19: ; preds = %15, %14
ret i32 0
}