#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 */
scalar_t__ unknown1();
scalar_t__ unknown2();
void main() {
  int x = 0;
  int y = 0;
  int i = 0;
  int j = 0;
  while (unknown1()) {
    while (unknown2()) {
      if (x == y)
        i++;
      else
        j++;
    }
    if (i >= j) {
      x++;
      y++;
    } else
      y++;
  }
  if (i <= j - 1) {
    goto ERROR;
  ERROR:;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <unknown1@plt>
cmp    $0x0,%rax
je     11c4 <main+0xa4>
jmp    115a <main+0x3a>
mov    $0x0,%al
call   1040 <unknown2@plt>
cmp    $0x0,%rax
je     1193 <main+0x73>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1185 <main+0x65>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118e <main+0x6e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115a <main+0x3a>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     11b6 <main+0x96>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bf <main+0x9f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11df <main+0xbf>
jmp    11da <main+0xba>
jmp    11df <main+0xbf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <unknown1@plt>
test   %rax,%rax
je     114e <main+0x2e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <unknown2@plt>
test   %rax,%rax
jne    1140 <main+0x20>
jmp    1130 <main+0x10>
pop    %rax
ret

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i64 (...) @unknown1()
%2 = icmp eq i64 %1, 0
br i1 %2, label %12, label %3
3: ; preds = %0, %9
%4 = tail call i64 (...) @unknown2()
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3, %6
%7 = tail call i64 (...) @unknown2()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %6
9: ; preds = %6, %3
%10 = tail call i64 (...) @unknown1()
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %9, %0
ret void
}