#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();
scalar_t__ unknown3();
void main() {
  int i, pvlen;
  int t;
  int k = 0;
  int n;
  int j;
  i = 0;
  while (unknown1())
    i = i + 1;
  if (i >= pvlen + 1) {
    pvlen = i;
  } else {
    if (i > pvlen)
      return;
  }
  i = 0;
  while (unknown2()) {
    t = i;
    i = i + 1;
    k = k + 1;
  }
  while (unknown3())
    ;
  j = 0;
  n = i;
  while (1) {
    if (k <= -1) {
      goto ERROR;
    ERROR:;
    }
    k = k - 1;
    i = i - 1;
    j = j + 1;
    if (j <= n - 1) {
    } else {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <unknown1@plt>
cmp    $0x0,%rax
je     1165 <main+0x35>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jl     1181 <main+0x51>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1197 <main+0x67>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1192 <main+0x62>
jmp    1243 <main+0x113>
jmp    1197 <main+0x67>
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <unknown2@plt>
cmp    $0x0,%rax
je     11cc <main+0x9c>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119e <main+0x6e>
jmp    11d1 <main+0xa1>
mov    $0x0,%al
call   1050 <unknown3@plt>
cmp    $0x0,%rax
je     11e7 <main+0xb7>
jmp    11d1 <main+0xa1>
movl   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jg     1208 <main+0xd8>
jmp    1203 <main+0xd3>
jmp    1208 <main+0xd8>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1239 <main+0x109>
jmp    123e <main+0x10e>
jmp    1243 <main+0x113>
jmp    11f4 <main+0xc4>
add    $0x20,%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
jne    1140 <main+0x10>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <unknown2@plt>
test   %rax,%rax
jne    1150 <main+0x20>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <unknown3@plt>
test   %rax,%rax
jne    1160 <main+0x30>
pop    %rax
ret

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

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