#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 *u = alloca(sizeof(int));
  int *x = alloca(sizeof(int));
  int *v = alloca(sizeof(int));
  int *y = alloca(sizeof(int));
  int *w = alloca(sizeof(int));
  int *z = alloca(sizeof(int));
  int *c = alloca(sizeof(int));
  *u = *x;
  *v = *y;
  *w = *z;
  *c = 0;
  while (*x >= *y) {
    *c = *c + 1;
    if (*z > 1) {
      *z = *z - 1;
      *x = *x + *z;
    } else {
      *y = *y + 1;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x30(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x38(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jl     1217 <main+0x107>
mov    -0x40(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x40(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
cmpl   $0x1,(%rax)
jle    1203 <main+0xf3>
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x38(%rbp),%rax
add    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1212 <main+0x102>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    11af <main+0x9f>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r12
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r13
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbp
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    (%r14),%ecx
mov    %ecx,(%r12)
mov    (%r15),%ecx
mov    %ecx,0x0(%r13)
mov    (%rbx),%ecx
mov    %ecx,0x0(%rbp)
movl   $0x0,(%rax)
mov    (%r14),%ecx
cmp    (%r15),%ecx
jge    11a5 <main+0x95>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    (%rbx),%ecx
cmp    $0x2,%ecx
jl     11d0 <main+0xc0>
add    $0xffffffff,%ecx
mov    %ecx,(%rbx)
add    (%r14),%ecx
mov    %ecx,(%r14)
mov    (%r15),%edx
cmp    %edx,%ecx
jge    11e0 <main+0xd0>
jmp    1194 <main+0x84>
mov    (%r15),%edx
add    $0x1,%edx
mov    %edx,(%r15)
mov    (%r14),%ecx
cmp    %edx,%ecx
jl     1194 <main+0x84>
mov    (%rax),%ecx
jmp    11b0 <main+0xa0>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 0, i32* %1
%9 = call i32* @alloca(i32 4)
store i32* %9, i32** %2
%10 = call i32* @alloca(i32 4)
store i32* %10, i32** %3
%11 = call i32* @alloca(i32 4)
store i32* %11, i32** %4
%12 = call i32* @alloca(i32 4)
store i32* %12, i32** %5
%13 = call i32* @alloca(i32 4)
store i32* %13, i32** %6
%14 = call i32* @alloca(i32 4)
store i32* %14, i32** %7
%15 = call i32* @alloca(i32 4)
store i32* %15, i32** %8
%16 = load i32*, i32** %3
%17 = load i32, i32* %16
%18 = load i32*, i32** %2
store i32 %17, i32* %18
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = load i32*, i32** %4
store i32 %20, i32* %21
%22 = load i32*, i32** %7
%23 = load i32, i32* %22
%24 = load i32*, i32** %6
store i32 %23, i32* %24
%25 = load i32*, i32** %8
store i32 0, i32* %25
br label %26
26: ; preds = %56, %0
%27 = load i32*, i32** %3
%28 = load i32, i32* %27
%29 = load i32*, i32** %5
%30 = load i32, i32* %29
%31 = icmp sge i32 %28, %30
br i1 %31, label %32, label %57
32: ; preds = %26
%33 = load i32*, i32** %8
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
%36 = load i32*, i32** %8
store i32 %35, i32* %36
%37 = load i32*, i32** %7
%38 = load i32, i32* %37
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %51
40: ; preds = %32
%41 = load i32*, i32** %7
%42 = load i32, i32* %41
%43 = sub nsw i32 %42, 1
%44 = load i32*, i32** %7
store i32 %43, i32* %44
%45 = load i32*, i32** %3
%46 = load i32, i32* %45
%47 = load i32*, i32** %7
%48 = load i32, i32* %47
%49 = add nsw i32 %46, %48
%50 = load i32*, i32** %3
store i32 %49, i32* %50
br label %56
51: ; preds = %32
%52 = load i32*, i32** %5
%53 = load i32, i32* %52
%54 = add nsw i32 %53, 1
%55 = load i32*, i32** %5
store i32 %54, i32* %55
br label %56
56: ; preds = %51, %40
br label %26
57: ; preds = %26
%58 = load i32, i32* %1
ret i32 %58
}

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)
%5 = tail call i32* @alloca(i32 4)
%6 = tail call i32* @alloca(i32 4)
%7 = tail call i32* @alloca(i32 4)
%8 = load i32, i32* %2
store i32 %8, i32* %1
%9 = load i32, i32* %4
store i32 %9, i32* %3
%10 = load i32, i32* %6
store i32 %10, i32* %5
store i32 0, i32* %7
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %34, label %14
14: ; preds = %0, %32
%15 = phi i32 [ %33, %32 ], [ 0, %0 ]
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = add nsw i32 %17, -1
store i32 %20, i32* %6
%21 = load i32, i32* %2
%22 = add nsw i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %4
br label %28
24: ; preds = %14
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
%27 = load i32, i32* %2
br label %28
28: ; preds = %24, %19
%29 = phi i32 [ %26, %24 ], [ %23, %19 ]
%30 = phi i32 [ %27, %24 ], [ %22, %19 ]
%31 = icmp slt i32 %30, %29
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = load i32, i32* %7
br label %14
34: ; preds = %28, %0
ret i32 0
}