#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();
void main() {
  int x = 0;
  int y = 0;
  int z = 0;
  int k = 0;
  while (unknown1()) {
    if (k % 3 == 0)
      x++;
    y++;
    z++;
    k = x + y + z;
  }
  static_assert(x == y);
  static_assert(y == z);
}


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     1195 <main+0x75>
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1172 <main+0x52>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <main+0x24>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <static_assert@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <static_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <unknown1@plt>
mov    $0x0,%ebp
test   %rax,%rax
je     116f <main+0x4f>
xor    %r14d,%r14d
xor    %ecx,%ecx
xor    %ebx,%ebx
xchg   %ax,%ax
imul   $0xaaaaaaab,%r14d,%eax
add    $0x2aaaaaaa,%eax
cmp    $0x55555555,%eax
adc    $0x0,%ebx
mov    %ecx,%ebp
add    $0x1,%ebp
lea    (%rbx,%rcx,2),%r14d
add    $0x2,%r14d
xor    %eax,%eax
call   1030 <unknown1@plt>
mov    %ebp,%ecx
test   %rax,%rax
jne    1140 <main+0x20>
xor    %edi,%edi
cmp    %ebp,%ebx
sete   %dil
call   1040 <static_assert@plt>
mov    $0x1,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <static_assert@plt>

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 = %15, %0
%6 = call i64 (...) @unknown1()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = load i32, i32* %4
%10 = srem i32 %9, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %15
15: ; preds = %12, %8
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = add nsw i32 %20, %21
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
store i32 %24, i32* %4
br label %5
25: ; preds = %5
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = icmp eq i32 %26, %27
%29 = zext i1 %28 to i32
%30 = call i32 @static_assert(i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = icmp eq i32 %31, %32
%34 = zext i1 %33 to i32
%35 = call i32 @static_assert(i32 %34)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i64 (...) @unknown1()
%2 = icmp eq i64 %1, 0
br i1 %2, label %16, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %13, %3 ], [ 0, %0 ]
%5 = phi i32 [ %11, %3 ], [ 0, %0 ]
%6 = phi i32 [ %10, %3 ], [ 0, %0 ]
%7 = srem i32 %4, 3
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %6, %9
%11 = add nuw nsw i32 %5, 1
%12 = shl nuw i32 %11, 1
%13 = add i32 %12, %10
%14 = tail call i64 (...) @unknown1()
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %3
16: ; preds = %3, %0
%17 = phi i32 [ 0, %0 ], [ %10, %3 ]
%18 = phi i32 [ 0, %0 ], [ %11, %3 ]
%19 = icmp eq i32 %17, %18
%20 = zext i1 %19 to i32
%21 = tail call i32 @static_assert(i32 %20)
%22 = tail call i32 @static_assert(i32 1)
ret void
}