#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*/ __assert_fail();
int main() {
  int x1 = 0;
  int x2 = 0;
  int i = 1;
  while (1) {
    if (i == 1) {
      x1++;
    } else if (i == 2) {
      x2++;
    }
    i++;
    if (i == 3) {
      i = 1;
      if (!(x1 == x2)) {
        __assert_fail();
        return 1;
      }
    }
  }
}


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   $0x1,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    114c <main+0x3c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x54>
cmpl   $0x2,-0x10(%rbp)
jne    115f <main+0x4f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1164 <main+0x54>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jne    11a1 <main+0x91>
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     119c <main+0x8c>
mov    $0x0,%al
call   1030 <__assert_fail@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    11a1 <main+0x91>
jmp    1134 <main+0x24>

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%sil
xor    %eax,%eax
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1125 <main+0x15>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%esi
xor    $0x1,%cl
mov    %edx,%edi
mov    %eax,%edx
movzbl %sil,%esi
mov    %esi,%eax
and    $0x1,%eax
add    %edx,%eax
not    %sil
movzbl %sil,%edx
and    $0x1,%edx
add    %edi,%edx
test   $0x1,%cl
je     1120 <main+0x10>
cmp    %edx,%eax
je     1120 <main+0x10>
push   %rax
xor    %eax,%eax
call   1030 <__assert_fail@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @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 1, i32* %4
br label %5
5: ; preds = %0, %30
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %18
11: ; preds = %5
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %11
br label %18
18: ; preds = %17, %8
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %30
23: ; preds = %18
store i32 1, i32* %4
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = icmp eq i32 %24, %25
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = call i32 (...) @__assert_fail()
ret i32 1
29: ; preds = %23
br label %30
30: ; preds = %29, %18
br label %5
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %14, %0
%2 = phi i32 [ 0, %0 ], [ %7, %14 ]
%3 = phi i32 [ 0, %0 ], [ %10, %14 ]
%4 = phi i1 [ true, %0 ], [ %5, %14 ]
%5 = phi i1 [ false, %0 ], [ %15, %14 ]
%6 = zext i1 %4 to i32
%7 = add nuw nsw i32 %2, %6
%8 = xor i1 %4, true
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %3, %9
%11 = xor i1 %5, true
%12 = icmp eq i32 %7, %10
%13 = select i1 %11, i1 true, i1 %12
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = xor i1 %5, true
br label %1
16: ; preds = %1
%17 = tail call i32 (...) @__assert_fail()
ret i32 1
}