#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 /*<<< orphan*/ putchar(char);
void show_print(int percent, int barlen) {
  int i;
  putchar('[');
  for (i = 1; i <= barlen; ++i)
    putchar(i * 100 <= percent * barlen ? '>' : ' ');
  putchar(']');
  printf("%3d%%", percent);
  for (i = 0; i != barlen + 6; ++i)
    putchar('\b');
}


x86 assembly (clang, -O0):
<show_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x5b,%edi
call   1030 <putchar@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     117b <show_print+0x5b>
imul   $0x64,-0xc(%rbp),%edx
mov    -0x4(%rbp),%esi
imul   -0x8(%rbp),%esi
mov    $0x20,%eax
mov    $0x3e,%ecx
cmp    %esi,%edx
cmovle %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <show_print+0x1f>
mov    $0x5d,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x6,%ecx
cmp    %ecx,%eax
je     11c4 <show_print+0xa4>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119b <show_print+0x7b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %edi,%r14d
mov    $0x5b,%edi
call   1030 <putchar@plt>
test   %r13d,%r13d
jle    1179 <show_print+0x59>
mov    %r13d,%r15d
imul   %r14d,%r15d
mov    $0x64,%ebp
mov    $0x20,%r12d
mov    %r13d,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r15d,%ebp
mov    $0x3e,%edi
cmovg  %r12d,%edi
call   1030 <putchar@plt>
add    $0x64,%ebp
add    $0xffffffff,%ebx
jne    1160 <show_print+0x40>
mov    $0x5d,%edi
call   1030 <putchar@plt>
lea    0xe76(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
add    $0x6,%r13d
je     11b0 <show_print+0x90>
nopl   0x0(%rax,%rax,1)
mov    $0x8,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r13d
jne    11a0 <show_print+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%3d%%\00"
define void @show_print(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 @putchar(i8 signext 91)
store i32 1, i32* %5
br label %7
7: ; preds = %22, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i32, i32* %5
%13 = mul nsw i32 %12, 100
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = mul nsw i32 %14, %15
%17 = icmp sle i32 %13, %16
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 62, i32 32
%20 = trunc i32 %19 to i8
%21 = call i32 @putchar(i8 signext %20)
br label %22
22: ; preds = %11
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %7
25: ; preds = %7
%26 = call i32 @putchar(i8 signext 93)
%27 = load i32, i32* %3
%28 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %27)
store i32 0, i32* %5
br label %29
29: ; preds = %36, %25
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 6
%33 = icmp ne i32 %30, %32
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = call i32 @putchar(i8 signext 8)
br label %36
36: ; preds = %34
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %29
39: ; preds = %29
ret void
}

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