#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 *, ...);
void main_percent(int percent_bar) {
  int progress_bar, progress_space;
  printf("%d%% [:", percent_bar);
  for (progress_bar = 1; progress_bar <= (int)(percent_bar / 5); progress_bar++)
    printf("=");
  printf(">");
  for (progress_space = 0; progress_space < (20 - progress_bar);
       progress_space++)
    printf(" ");
  printf(":]\r");
}


x86 assembly (clang, -O0):
<main_percent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     116d <main_percent+0x5d>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <main_percent+0x23>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x14,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11b1 <main_percent+0xa1>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1182 <main_percent+0x72>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_percent>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
lea    0xed2(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x4,%r14d
jg     114f <main_percent+0x2f>
mov    $0x3e,%edi
call   1030 <putchar@plt>
mov    $0xffffffff,%ebp
jmp    118f <main_percent+0x6f>
mov    %r14d,%eax
mov    $0xcccccccd,%ebx
imul   %rax,%rbx
shr    $0x22,%rbx
mov    %ebx,%ebp
not    %ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1170 <main_percent+0x50>
mov    $0x3e,%edi
call   1030 <putchar@plt>
cmp    $0x5e,%r14d
ja     11af <main_percent+0x8f>
add    $0x14,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main_percent+0x80>
lea    0xe52(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d%% [:\00"
@.str.4 = [4 x i8] c":]\0D\00"
define void @main_percent(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp slt i32 %0, 5
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @putchar(i32 62)
br label %17
6: ; preds = %1
%7 = udiv i32 %0, 5
%8 = xor i32 %7, -1
br label %9
9: ; preds = %6, %9
%10 = phi i32 [ %12, %9 ], [ 1, %6 ]
%11 = tail call i32 @putchar(i32 61)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %10, %7
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = tail call i32 @putchar(i32 62)
%16 = icmp ult i32 %0, 95
br i1 %16, label %17, label %25
17: ; preds = %4, %14
%18 = phi i32 [ -1, %4 ], [ %8, %14 ]
%19 = add nsw i32 %18, 19
br label %20
20: ; preds = %17, %20
%21 = phi i32 [ %23, %20 ], [ 0, %17 ]
%22 = tail call i32 @putchar(i32 32)
%23 = add nuw nsw i32 %21, 1
%24 = icmp eq i32 %21, %19
br i1 %24, label %25, label %20
25: ; preds = %20, %14
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret void
}