#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 /*<<< orphan*/ static_assert(int);
scalar_t__ unknown1();
scalar_t__ unknown2();
scalar_t__ unknown4();
void main() {
  int w = 1, z = 0, x = 0, y = 0;
  while (unknown1()) {
    while (unknown2()) {
      if (w % 2 == 1)
        x++;
      if (z % 2 == 0)
        y++;
    }
    while (unknown4()) {
      z = x + y;
      w = z + 1;
    }
  }
  static_assert(x == y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-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     11fc <main+0xbc>
jmp    117a <main+0x3a>
mov    $0x0,%al
call   1040 <unknown2@plt>
cmp    $0x0,%rax
je     11ca <main+0x8a>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11a8 <main+0x68>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11c5 <main+0x85>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117a <main+0x3a>
jmp    11cf <main+0x8f>
mov    $0x0,%al
call   1050 <unknown4@plt>
cmp    $0x0,%rax
je     11f7 <main+0xb7>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11cf <main+0x8f>
jmp    1164 <main+0x24>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <static_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <unknown1@plt>
mov    $0x0,%ebx
test   %rax,%rax
je     11fa <main+0xba>
mov    $0x1,%r12d
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %r15d,%r15d
jmp    118c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <unknown1@plt>
test   %rax,%rax
je     11fa <main+0xba>
xor    %eax,%eax
call   1040 <unknown2@plt>
test   %rax,%rax
je     11d1 <main+0x91>
mov    %r12d,%eax
shr    $0x1f,%eax
add    %r12d,%eax
and    $0xfffffffe,%eax
mov    %r12d,%ecx
sub    %eax,%ecx
xor    %r13d,%r13d
cmp    $0x1,%ecx
sete   %r13b
mov    %r15d,%ebp
not    %ebp
and    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
add    %ebp,%ebx
add    %r13d,%r14d
xor    %eax,%eax
call   1040 <unknown2@plt>
test   %rax,%rax
jne    11c0 <main+0x80>
xor    %eax,%eax
call   1050 <unknown4@plt>
test   %rax,%rax
je     1180 <main+0x40>
nopl   (%rax)
xor    %eax,%eax
call   1050 <unknown4@plt>
test   %rax,%rax
jne    11e0 <main+0xa0>
lea    (%rbx,%r14,1),%r15d
lea    (%rbx,%r14,1),%r12d
add    $0x1,%r12d
jmp    1180 <main+0x40>
xor    %edi,%edi
cmp    %ebx,%r14d
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <static_assert@plt>

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i64 (...) @unknown1()
%2 = icmp eq i64 %1, 0
br i1 %2, label %39, label %11
3: ; preds = %36
%4 = add nsw i32 %26, %25
%5 = add nsw i32 %4, 1
br label %6
6: ; preds = %3, %24
%7 = phi i32 [ %5, %3 ], [ %15, %24 ]
%8 = phi i32 [ %4, %3 ], [ %14, %24 ]
%9 = tail call i64 (...) @unknown1()
%10 = icmp eq i64 %9, 0
br i1 %10, label %39, label %11
11: ; preds = %0, %6
%12 = phi i32 [ %26, %6 ], [ 0, %0 ]
%13 = phi i32 [ %25, %6 ], [ 0, %0 ]
%14 = phi i32 [ %8, %6 ], [ 0, %0 ]
%15 = phi i32 [ %7, %6 ], [ 1, %0 ]
%16 = tail call i64 (...) @unknown2()
%17 = icmp eq i64 %16, 0
br i1 %17, label %24, label %18
18: ; preds = %11
%19 = srem i32 %15, 2
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = and i32 %14, 1
%23 = xor i32 %22, 1
br label %29
24: ; preds = %29, %11
%25 = phi i32 [ %13, %11 ], [ %32, %29 ]
%26 = phi i32 [ %12, %11 ], [ %33, %29 ]
%27 = tail call i64 (...) @unknown4()
%28 = icmp eq i64 %27, 0
br i1 %28, label %6, label %36
29: ; preds = %18, %29
%30 = phi i32 [ %12, %18 ], [ %33, %29 ]
%31 = phi i32 [ %13, %18 ], [ %32, %29 ]
%32 = add nsw i32 %31, %21
%33 = add nsw i32 %30, %23
%34 = tail call i64 (...) @unknown2()
%35 = icmp eq i64 %34, 0
br i1 %35, label %24, label %29
36: ; preds = %24, %36
%37 = tail call i64 (...) @unknown4()
%38 = icmp eq i64 %37, 0
br i1 %38, label %3, label %36
39: ; preds = %6, %0
%40 = phi i32 [ 0, %0 ], [ %25, %6 ]
%41 = phi i32 [ 0, %0 ], [ %26, %6 ]
%42 = icmp eq i32 %40, %41
%43 = zext i1 %42 to i32
%44 = tail call i32 @static_assert(i32 %43)
ret void
}