#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void print_progress_bar(int percent) {
  int i;
  int p;
  if (percent > 100)
    percent = 100;
  putc('\r', stderr);
  putc('|', stderr);
  for (i = 0; i < 70; i++)
    putc(' ', stderr);
  putc('|', stderr);
  putc('\r', stderr);
  putc('|', stderr);
  p = 70 * percent / 100;
  for (i = 0; i < p; i++)
    putc('-', stderr);
  fflush(stderr);
}


x86 assembly (clang, -O0):
<print_progress_bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jle    113c <print_progress_bar+0x1c>
movl   $0x64,-0x4(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <putc@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
mov    $0x7c,%edi
call   1030 <putc@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x46,-0x8(%rbp)
jge    1194 <print_progress_bar+0x74>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1030 <putc@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <print_progress_bar+0x49>
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
mov    $0x7c,%edi
call   1030 <putc@plt>
mov    0x2e32(%rip),%rax
mov    (%rax),%esi
mov    $0xd,%edi
call   1030 <putc@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
mov    $0x7c,%edi
call   1030 <putc@plt>
imul   $0x46,-0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1210 <print_progress_bar+0xf0>
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
mov    $0x2d,%edi
call   1030 <putc@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e3 <print_progress_bar+0xc3>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_progress_bar>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    0x2eb2(%rip),%rbx
mov    (%rbx),%esi
mov    $0xd,%edi
call   1030 <putc@plt>
mov    (%rbx),%esi
mov    $0x7c,%edi
call   1030 <putc@plt>
mov    $0x46,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    $0x20,%edi
call   1030 <putc@plt>
add    $0xffffffff,%ebp
jne    1150 <print_progress_bar+0x30>
cmp    $0x64,%r14d
mov    $0x64,%ebp
cmovl  %r14d,%ebp
mov    (%rbx),%esi
mov    $0x7c,%edi
call   1030 <putc@plt>
mov    (%rbx),%esi
mov    $0xd,%edi
call   1030 <putc@plt>
mov    (%rbx),%esi
mov    $0x7c,%edi
call   1030 <putc@plt>
imul   $0x46,%ebp,%eax
cmp    $0x64,%eax
jl     11c1 <print_progress_bar+0xa1>
cltq
imul   $0x51eb851f,%rax,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
sar    $0x25,%rbp
add    %eax,%ebp
mov    (%rbx),%esi
mov    $0x2d,%edi
call   1030 <putc@plt>
add    $0xffffffff,%ebp
jne    11b0 <print_progress_bar+0x90>
mov    (%rbx),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @print_progress_bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 100
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 100, i32* %2
br label %8
8: ; preds = %7, %1
%9 = load i32, i32* @stderr
%10 = call i32 @putc(i8 signext 13, i32 %9)
%11 = load i32, i32* @stderr
%12 = call i32 @putc(i8 signext 124, i32 %11)
store i32 0, i32* %3
br label %13
13: ; preds = %19, %8
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 70
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = call i32 @putc(i8 signext 32, i32 %17)
br label %19
19: ; preds = %16
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %13
22: ; preds = %13
%23 = load i32, i32* @stderr
%24 = call i32 @putc(i8 signext 124, i32 %23)
%25 = load i32, i32* @stderr
%26 = call i32 @putc(i8 signext 13, i32 %25)
%27 = load i32, i32* @stderr
%28 = call i32 @putc(i8 signext 124, i32 %27)
%29 = load i32, i32* %2
%30 = mul nsw i32 70, %29
%31 = sdiv i32 %30, 100
store i32 %31, i32* %4
store i32 0, i32* %3
br label %32
32: ; preds = %39, %22
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = call i32 @putc(i8 signext 45, i32 %37)
br label %39
39: ; preds = %36
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %32
42: ; preds = %32
%43 = load i32, i32* @stderr
%44 = call i32 @fflush(i32 %43)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @print_progress_bar(i32 %0) {
%2 = icmp slt i32 %0, 100
%3 = load i32, i32* @stderr
%4 = tail call i32 @putc(i8 signext 13, i32 %3)
%5 = load i32, i32* @stderr
%6 = tail call i32 @putc(i8 signext 124, i32 %5)
br label %7
7: ; preds = %1, %7
%8 = phi i32 [ 0, %1 ], [ %11, %7 ]
%9 = load i32, i32* @stderr
%10 = tail call i32 @putc(i8 signext 32, i32 %9)
%11 = add nuw nsw i32 %8, 1
%12 = icmp eq i32 %11, 70
br i1 %12, label %13, label %7
13: ; preds = %7
%14 = select i1 %2, i32 %0, i32 100
%15 = load i32, i32* @stderr
%16 = tail call i32 @putc(i8 signext 124, i32 %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 @putc(i8 signext 13, i32 %17)
%19 = load i32, i32* @stderr
%20 = tail call i32 @putc(i8 signext 124, i32 %19)
%21 = mul nsw i32 %14, 70
%22 = sdiv i32 %21, 100
%23 = icmp sgt i32 %21, 99
br i1 %23, label %24, label %30
24: ; preds = %13, %24
%25 = phi i32 [ %28, %24 ], [ 0, %13 ]
%26 = load i32, i32* @stderr
%27 = tail call i32 @putc(i8 signext 45, i32 %26)
%28 = add nuw nsw i32 %25, 1
%29 = icmp eq i32 %28, %22
br i1 %29, label %30, label %24
30: ; preds = %24, %13
%31 = load i32, i32* @stderr
%32 = tail call i32 @fflush(i32 %31)
ret void
}