#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*/ printf(char *, int);
int functionWithBreak(int n) {
  int count = 0;
  int i = 0, j;
  for (i = n / 2; i < n; i++) {
    j = 1;
    count++;
    while (j + n / 2 <= n) {
      break;
      j = j * 2;
    }
  }
  printf("%d\n", count);
}


x86 assembly (clang, -O0):
<functionWithBreak>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118c <functionWithBreak+0x7c>
movl   $0x1,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
cmp    -0x8(%rbp),%eax
jg     1179 <functionWithBreak+0x69>
jmp    1179 <functionWithBreak+0x69>
jmp    117e <functionWithBreak+0x6e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <functionWithBreak+0x27>
mov    -0xc(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<functionWithBreak>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
xor    %esi,%esi
sub    %eax,%edi
cmovg  %edi,%esi
lea    0xed9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @functionWithBreak(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* %3
%8 = sdiv i32 %7, 2
store i32 %8, i32* %5
br label %9
9: ; preds = %25, %1
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
store i32 1, i32* %6
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %16
16: ; preds = %13
%17 = load i32, i32* %6
%18 = load i32, i32* %3
%19 = sdiv i32 %18, 2
%20 = add nsw i32 %17, %19
%21 = load i32, i32* %3
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %16
br label %24
24: ; preds = %23, %16
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %9
28: ; preds = %9
%29 = load i32, i32* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @functionWithBreak(i32 %0) {
%2 = sdiv i32 %0, 2
%3 = icmp slt i32 %2, %0
%4 = sub i32 %0, %2
%5 = select i1 %3, i32 %4, i32 0
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 undef
}