#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*/ printf(char *, int);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
int cli_pprog(int val, int max) {
  float j = (float)val / (float)max;
  int i, p = (int)(j * 100.0);
  printf("%3d%% |", p);
  for (i = 0; i < 10; i++)
    putchar((i < (int)(j * 10.0)) ? '=' : ' ');
  putchar('|');
  putchar(' ');
  fflush(stdout);
  for (i = 0; i < 18; i++)
    putchar('\b');
  return p;
}


x86 assembly (clang, -O0):
<cli_pprog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11ce <cli_pprog+0x9e>
mov    -0x10(%rbp),%edx
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe67(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0x20,%eax
mov    $0x3d,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <cli_pprog+0x53>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x12,-0x10(%rbp)
jge    1219 <cli_pprog+0xe9>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f7 <cli_pprog+0xc7>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_pprog>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cvtsi2ss %edi,%xmm0
cvtsi2ss %esi,%xmm1
divss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0xea9(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r14d
lea    0xea9(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
mulsd  0xe8c(%rip),%xmm0
cvttsd2si %xmm0,%ebx
test   %ebx,%ebx
mov    $0x3d,%ebp
mov    $0x20,%r15d
mov    $0x20,%edi
cmovg  %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x3,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x4,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x5,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x6,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x7,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x8,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0x9,%ebx
mov    $0x20,%edi
cmovge %ebp,%edi
call   1030 <putchar@plt>
cmp    $0xa,%ebx
cmovl  %r15d,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%3d%% |\00"
@stdout = global i32 0
define i32 @cli_pprog(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to float
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to float
%12 = fdiv float %9, %11
store float %12, float* %5
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fmul double %14, 1.000000e+02
%16 = fptosi double %15 to i32
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %17)
store i32 0, i32* %6
br label %19
19: ; preds = %33, %2
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i32, i32* %6
%24 = load float, float* %5
%25 = fpext float %24 to double
%26 = fmul double %25, 1.000000e+01
%27 = fptosi double %26 to i32
%28 = icmp slt i32 %23, %27
%29 = zext i1 %28 to i64
%30 = select i1 %28, i32 61, i32 32
%31 = trunc i32 %30 to i8
%32 = call i32 @putchar(i8 signext %31)
br label %33
33: ; preds = %22
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %19
36: ; preds = %19
%37 = call i32 @putchar(i8 signext 124)
%38 = call i32 @putchar(i8 signext 32)
%39 = load i32, i32* @stdout
%40 = call i32 @fflush(i32 %39)
store i32 0, i32* %6
br label %41
41: ; preds = %46, %36
%42 = load i32, i32* %6
%43 = icmp slt i32 %42, 18
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = call i32 @putchar(i8 signext 8)
br label %46
46: ; preds = %44
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %41
49: ; preds = %41
%50 = load i32, i32* %7
ret i32 %50
}

LLVM IR (-O2):
@.str = [8 x i8] c"%3d%% |\00"
@stdout = global i32 0
define i32 @cli_pprog(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = sitofp i32 %1 to float
%5 = fdiv float %3, %4
%6 = fpext float %5 to double
%7 = fmul double %6, 1.000000e+02
%8 = fptosi double %7 to i32
%9 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = fmul double %6, 1.000000e+01
%11 = fptosi double %10 to i32
%12 = icmp sgt i32 %11, 0
%13 = select i1 %12, i8 61, i8 32
%14 = tail call i32 @putchar(i8 signext %13)
%15 = icmp sgt i32 %11, 1
%16 = select i1 %15, i8 61, i8 32
%17 = tail call i32 @putchar(i8 signext %16)
%18 = icmp sgt i32 %11, 2
%19 = select i1 %18, i8 61, i8 32
%20 = tail call i32 @putchar(i8 signext %19)
%21 = icmp sgt i32 %11, 3
%22 = select i1 %21, i8 61, i8 32
%23 = tail call i32 @putchar(i8 signext %22)
%24 = icmp sgt i32 %11, 4
%25 = select i1 %24, i8 61, i8 32
%26 = tail call i32 @putchar(i8 signext %25)
%27 = icmp sgt i32 %11, 5
%28 = select i1 %27, i8 61, i8 32
%29 = tail call i32 @putchar(i8 signext %28)
%30 = icmp sgt i32 %11, 6
%31 = select i1 %30, i8 61, i8 32
%32 = tail call i32 @putchar(i8 signext %31)
%33 = icmp sgt i32 %11, 7
%34 = select i1 %33, i8 61, i8 32
%35 = tail call i32 @putchar(i8 signext %34)
%36 = icmp sgt i32 %11, 8
%37 = select i1 %36, i8 61, i8 32
%38 = tail call i32 @putchar(i8 signext %37)
%39 = icmp sgt i32 %11, 9
%40 = select i1 %39, i8 61, i8 32
%41 = tail call i32 @putchar(i8 signext %40)
%42 = tail call i32 @putchar(i8 signext 124)
%43 = tail call i32 @putchar(i8 signext 32)
%44 = load i32, i32* @stdout
%45 = tail call i32 @fflush(i32 %44)
%46 = tail call i32 @putchar(i8 signext 8)
%47 = tail call i32 @putchar(i8 signext 8)
%48 = tail call i32 @putchar(i8 signext 8)
%49 = tail call i32 @putchar(i8 signext 8)
%50 = tail call i32 @putchar(i8 signext 8)
%51 = tail call i32 @putchar(i8 signext 8)
%52 = tail call i32 @putchar(i8 signext 8)
%53 = tail call i32 @putchar(i8 signext 8)
%54 = tail call i32 @putchar(i8 signext 8)
%55 = tail call i32 @putchar(i8 signext 8)
%56 = tail call i32 @putchar(i8 signext 8)
%57 = tail call i32 @putchar(i8 signext 8)
%58 = tail call i32 @putchar(i8 signext 8)
%59 = tail call i32 @putchar(i8 signext 8)
%60 = tail call i32 @putchar(i8 signext 8)
%61 = tail call i32 @putchar(i8 signext 8)
%62 = tail call i32 @putchar(i8 signext 8)
%63 = tail call i32 @putchar(i8 signext 8)
ret i32 %8
}