#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 unknown1();
void main() {
  int x = 0;
  int m = 0;
  int n = unknown1();
  while (x <= n - 1) {
    if (unknown1()) {
      m = x;
    }
    x = x + 1;
  }
  if (x < n)
    return;
  if (n >= 1 && (m <= -1 || m >= n)) {
    goto ERROR;
  ERROR:;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <unknown1@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1165 <main+0x55>
mov    $0x0,%al
call   1030 <unknown1@plt>
cmp    $0x0,%eax
je     1157 <main+0x47>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1130 <main+0x20>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1176 <main+0x66>
jmp    11a0 <main+0x90>
cmpl   $0x1,-0xc(%rbp)
jl     11a0 <main+0x90>
cmpl   $0xffffffff,-0x8(%rbp)
jle    1196 <main+0x86>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11a0 <main+0x90>
jmp    119b <main+0x8b>
jmp    11a0 <main+0x90>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <unknown1@plt>
test   %eax,%eax
jle    112c <main+0x1c>
mov    %eax,%ebx
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <unknown1@plt>
add    $0xffffffff,%ebx
jne    1120 <main+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @unknown1()
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ 0, %0 ]
%5 = tail call i32 (...) @unknown1()
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %1
br i1 %7, label %8, label %3
8: ; preds = %3, %0
ret void
}