#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*/ bar();
int /*<<< orphan*/ bla();
scalar_t__ foo();
void test5(void) {
  unsigned i, j;
  i = j = 0;
  while (1) {
    j++;
    foo();
    if (j < 100)
      continue;
    j = 0;
    i++;
    if (i == 100)
      break;
    if (foo())
      bla();
    else
      bar();
  }
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <foo@plt>
cmpl   $0x64,-0x8(%rbp)
jae    1165 <test5+0x35>
jmp    1146 <test5+0x16>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jne    1184 <test5+0x54>
jmp    11ad <test5+0x7d>
mov    $0x0,%al
call   1050 <foo@plt>
cmp    $0x0,%rax
je     11a1 <test5+0x71>
mov    $0x0,%al
call   1040 <bla@plt>
jmp    11a8 <test5+0x78>
mov    $0x0,%al
call   1030 <bar@plt>
jmp    1146 <test5+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
jmp    1147 <test5+0x17>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <bla@plt>
mov    $0x64,%ebp
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <foo@plt>
add    $0xffffffff,%ebp
jne    1150 <test5+0x20>
add    $0x1,%ebx
cmp    $0x64,%ebx
je     1179 <test5+0x49>
xor    %eax,%eax
call   1050 <foo@plt>
test   %rax,%rax
jne    1140 <test5+0x10>
xor    %eax,%eax
call   1030 <bar@plt>
jmp    1147 <test5+0x17>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @test5() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %1
br label %3
3: ; preds = %0, %9, %23
%4 = load i32, i32* %2
%5 = add i32 %4, 1
store i32 %5, i32* %2
%6 = call i64 (...) @foo()
%7 = load i32, i32* %2
%8 = icmp ult i32 %7, 100
br i1 %8, label %9, label %10
9: ; preds = %3
br label %3
10: ; preds = %3
store i32 0, i32* %2
%11 = load i32, i32* %1
%12 = add i32 %11, 1
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 100
br i1 %14, label %15, label %16
15: ; preds = %10
br label %24
16: ; preds = %10
%17 = call i64 (...) @foo()
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @bla()
br label %23
21: ; preds = %16
%22 = call i32 (...) @bar()
br label %23
23: ; preds = %21, %19
br label %3
24: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @test5() {
br label %1
1: ; preds = %18, %0
%2 = phi i32 [ 0, %0 ], [ %9, %18 ]
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ 0, %1 ]
%5 = add nuw nsw i32 %4, 1
%6 = tail call i64 (...) @foo()
%7 = icmp eq i32 %5, 100
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = tail call i64 (...) @foo()
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 (...) @bla()
br label %18
16: ; preds = %11
%17 = tail call i32 (...) @bar()
br label %18
18: ; preds = %16, %14
br label %1
19: ; preds = %8
ret void
}