#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 */
typedef int /*<<< orphan*/ stars;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void progress_mode1_cb(const char *msg, int pos, int size) {
  if (pos != -1 && size != -1) {
    char stars[51];
    int i;
    int count = (pos * sizeof(stars) / size);
    for (i = 0; i < sizeof(stars); i++)
      stars[i] = (i < count) ? '*' : ' ';
    stars[sizeof(stars) - 1] = 0;
    printf("%-15s: [%s] (%d)\r", msg, stars, pos);
  }
  if (pos == size)
    printf("\n");
}


x86 assembly (clang, -O0):
<progress_mode1_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     11a9 <progress_mode1_cb+0x99>
cmpl   $0xffffffff,-0x10(%rbp)
je     11a9 <progress_mode1_cb+0x99>
movslq -0xc(%rbp),%rax
imul   $0x33,%rax,%rax
movslq -0x10(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x58(%rbp)
movl   $0x0,-0x54(%rbp)
movslq -0x54(%rbp),%rax
cmp    $0x33,%rax
jae    118c <progress_mode1_cb+0x7c>
mov    -0x54(%rbp),%edx
mov    -0x58(%rbp),%esi
mov    $0x20,%eax
mov    $0x2a,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
mov    %al,%cl
movslq -0x54(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1151 <progress_mode1_cb+0x41>
movb   $0x0,-0x1e(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0x50(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11c3 <progress_mode1_cb+0xb3>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progress_mode1_cb>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
cmp    $0xffffffff,%esi
je     168b <progress_mode1_cb+0x56b>
cmp    $0xffffffff,%ebx
je     168b <progress_mode1_cb+0x56b>
mov    %rdi,%rsi
movslq %ebp,%rax
imul   $0x33,%rax,%rax
movslq %ebx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     115c <progress_mode1_cb+0x3c>
xor    %edx,%edx
div    %rcx
jmp    1160 <progress_mode1_cb+0x40>
xor    %edx,%edx
div    %ebx
mov    %rax,%rcx
shl    $0x20,%rcx
cltq
movq   %rax,%xmm0
pshufd $0x44,%xmm0,%xmm0
pxor   0xe85(%rip),%xmm0
movdqa 0xe8d(%rip),%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pcmpeqd %xmm0,%xmm1
pshufd $0xf5,%xmm1,%xmm1
pand   %xmm2,%xmm1
pshufd $0xf5,%xmm2,%xmm2
por    %xmm1,%xmm2
movdqa 0xe77(%rip),%xmm1
pand   %xmm1,%xmm2
movdqa 0xe7b(%rip),%xmm3
movdqa %xmm0,%xmm4
pcmpgtd %xmm3,%xmm4
pcmpeqd %xmm0,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm4,%xmm3
pshufd $0xf5,%xmm4,%xmm4
por    %xmm3,%xmm4
pand   %xmm1,%xmm4
packuswb %xmm2,%xmm4
packuswb %xmm4,%xmm3
movdqa 0xe59(%rip),%xmm2
movdqa %xmm0,%xmm4
pcmpgtd %xmm2,%xmm4
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm4,%xmm2
pshufd $0xf5,%xmm4,%xmm4
por    %xmm2,%xmm4
pand   %xmm1,%xmm4
movdqa 0xe3f(%rip),%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm2,%xmm5
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm6
pand   %xmm5,%xmm6
pshufd $0xf5,%xmm5,%xmm2
por    %xmm6,%xmm2
pand   %xmm1,%xmm2
packuswb %xmm4,%xmm2
packuswb %xmm2,%xmm2
packuswb %xmm3,%xmm2
movdqa 0xe19(%rip),%xmm3
movdqa %xmm0,%xmm4
pcmpgtd %xmm3,%xmm4
pcmpeqd %xmm0,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm4,%xmm3
pshufd $0xf5,%xmm4,%xmm4
por    %xmm3,%xmm4
pand   %xmm1,%xmm4
movdqa 0xdff(%rip),%xmm3
movdqa %xmm0,%xmm5
pcmpgtd %xmm3,%xmm5
pcmpeqd %xmm0,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm5,%xmm3
pshufd $0xf5,%xmm5,%xmm5
por    %xmm3,%xmm5
pand   %xmm1,%xmm5
packuswb %xmm4,%xmm5
packuswb %xmm5,%xmm3
movdqa 0xddd(%rip),%xmm4
movdqa %xmm0,%xmm5
pcmpgtd %xmm4,%xmm5
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm5,%xmm4
pshufd $0xf5,%xmm5,%xmm5
por    %xmm4,%xmm5
pand   %xmm1,%xmm5
movdqa 0xdc3(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm6,%xmm4
pshufd $0xf5,%xmm6,%xmm6
por    %xmm4,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm6
packuswb %xmm3,%xmm6
shufps $0xcc,%xmm2,%xmm6
movaps 0xd99(%rip),%xmm8
movaps %xmm6,%xmm4
andnps %xmm8,%xmm4
movaps 0xd9b(%rip),%xmm3
andps  %xmm3,%xmm6
orps   %xmm4,%xmm6
movaps %xmm6,(%rsp)
movdqa 0xd99(%rip),%xmm4
movdqa %xmm0,%xmm5
pcmpgtd %xmm4,%xmm5
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm5,%xmm4
pshufd $0xf5,%xmm5,%xmm5
por    %xmm4,%xmm5
pand   %xmm1,%xmm5
movdqa 0xd7f(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm6,%xmm4
pshufd $0xf5,%xmm6,%xmm6
por    %xmm4,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm5
movdqa 0xd5d(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm6,%xmm4
pshufd $0xf5,%xmm6,%xmm6
por    %xmm4,%xmm6
pand   %xmm1,%xmm6
movdqa 0xd43(%rip),%xmm4
movdqa %xmm0,%xmm7
pcmpgtd %xmm4,%xmm7
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm2
pand   %xmm7,%xmm2
pshufd $0xf5,%xmm7,%xmm4
por    %xmm2,%xmm4
pand   %xmm1,%xmm4
packuswb %xmm6,%xmm4
packuswb %xmm4,%xmm4
packuswb %xmm5,%xmm4
movdqa 0xd1d(%rip),%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm2,%xmm5
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm5,%xmm2
pshufd $0xf5,%xmm5,%xmm5
por    %xmm2,%xmm5
pand   %xmm1,%xmm5
movdqa 0xd03(%rip),%xmm2
movdqa %xmm0,%xmm6
pcmpgtd %xmm2,%xmm6
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm6,%xmm2
pshufd $0xf5,%xmm6,%xmm6
por    %xmm2,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm2
movdqa 0xce1(%rip),%xmm5
movdqa %xmm0,%xmm6
pcmpgtd %xmm5,%xmm6
pcmpeqd %xmm0,%xmm5
pshufd $0xf5,%xmm5,%xmm5
pand   %xmm6,%xmm5
pshufd $0xf5,%xmm6,%xmm6
por    %xmm5,%xmm6
pand   %xmm1,%xmm6
movdqa 0xcc7(%rip),%xmm5
movdqa %xmm0,%xmm7
pcmpgtd %xmm5,%xmm7
pcmpeqd %xmm0,%xmm5
pshufd $0xf5,%xmm5,%xmm5
pand   %xmm7,%xmm5
pshufd $0xf5,%xmm7,%xmm7
por    %xmm5,%xmm7
pand   %xmm1,%xmm7
packuswb %xmm6,%xmm7
packuswb %xmm7,%xmm7
packuswb %xmm2,%xmm7
shufps $0xcc,%xmm4,%xmm7
movaps %xmm7,%xmm2
andnps %xmm8,%xmm2
andps  %xmm3,%xmm7
orps   %xmm2,%xmm7
movaps %xmm7,0x10(%rsp)
movdqa 0xc8b(%rip),%xmm2
movdqa %xmm0,%xmm4
pcmpgtd %xmm2,%xmm4
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm4,%xmm2
pshufd $0xf5,%xmm4,%xmm4
por    %xmm2,%xmm4
pand   %xmm1,%xmm4
movdqa 0xc71(%rip),%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm2,%xmm5
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm5,%xmm2
pshufd $0xf5,%xmm5,%xmm5
por    %xmm2,%xmm5
pand   %xmm1,%xmm5
packuswb %xmm4,%xmm5
packuswb %xmm5,%xmm2
movdqa 0xc4f(%rip),%xmm4
movdqa %xmm0,%xmm5
pcmpgtd %xmm4,%xmm5
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm5,%xmm4
pshufd $0xf5,%xmm5,%xmm5
por    %xmm4,%xmm5
pand   %xmm1,%xmm5
movdqa 0xc35(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm7
pand   %xmm6,%xmm7
pshufd $0xf5,%xmm6,%xmm4
por    %xmm7,%xmm4
pand   %xmm1,%xmm4
packuswb %xmm5,%xmm4
packuswb %xmm4,%xmm4
packuswb %xmm2,%xmm4
movdqa 0xc0f(%rip),%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm2,%xmm5
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm5,%xmm2
pshufd $0xf5,%xmm5,%xmm5
por    %xmm2,%xmm5
pand   %xmm1,%xmm5
movdqa 0xbf5(%rip),%xmm2
movdqa %xmm0,%xmm6
pcmpgtd %xmm2,%xmm6
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm6,%xmm2
pshufd $0xf5,%xmm6,%xmm6
por    %xmm2,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm2
movdqa 0xbd3(%rip),%xmm5
movdqa %xmm0,%xmm6
pcmpgtd %xmm5,%xmm6
pcmpeqd %xmm0,%xmm5
pshufd $0xf5,%xmm5,%xmm5
pand   %xmm6,%xmm5
pshufd $0xf5,%xmm6,%xmm6
por    %xmm5,%xmm6
pand   %xmm1,%xmm6
movdqa 0xbb9(%rip),%xmm5
movdqa %xmm0,%xmm7
pcmpgtd %xmm5,%xmm7
pcmpeqd %xmm5,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm7,%xmm0
pshufd $0xf5,%xmm7,%xmm5
por    %xmm0,%xmm5
pand   %xmm1,%xmm5
packuswb %xmm6,%xmm5
packuswb %xmm5,%xmm5
packuswb %xmm2,%xmm5
shufps $0xcc,%xmm4,%xmm5
movaps %xmm5,%xmm0
andnps %xmm8,%xmm0
andps  %xmm3,%xmm5
orps   %xmm0,%xmm5
movaps %xmm5,0x20(%rsp)
movabs $0x3000000000,%rax
cmp    %rax,%rcx
mov    $0x2a,%eax
mov    $0x20,%edx
cmovg  %eax,%edx
mov    $0x20,%edi
mov    %dl,0x30(%rsp)
movabs $0x3100000000,%rdx
cmp    %rdx,%rcx
cmovg  %eax,%edi
mov    %dil,0x31(%rsp)
movb   $0x0,0x32(%rsp)
lea    0xb41(%rip),%rdi
mov    %rsp,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebx,%ebp
jne    1699 <progress_mode1_cb+0x579>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%-15s: [%s] (%d)\0D\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @progress_mode1_cb(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [51 x i8]
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %46
12: ; preds = %3
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %46
15: ; preds = %12
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = mul i64 %17, 51
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = udiv i64 %18, %20
%22 = trunc i64 %21 to i32
store i32 %22, i32* %9
store i32 0, i32* %8
br label %23
23: ; preds = %37, %15
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = icmp ult i64 %25, 51
br i1 %26, label %27, label %40
27: ; preds = %23
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = icmp slt i32 %28, %29
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 42, i32 32
%33 = trunc i32 %32 to i8
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [51 x i8], [51 x i8]* %7, i64 0, i64 %35
store i8 %33, i8* %36
br label %37
37: ; preds = %27
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %23
40: ; preds = %23
%41 = getelementptr inbounds [51 x i8], [51 x i8]* %7, i64 0, i64 50
store i8 0, i8* %41
%42 = load i8*, i8** %4
%43 = getelementptr inbounds [51 x i8], [51 x i8]* %7, i64 0, i64 0
%44 = load i32, i32* %5
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %42, i8* %43, i32 %44)
br label %46
46: ; preds = %40, %12, %3
%47 = load i32, i32* %5
%48 = load i32, i32* %6
%49 = icmp eq i32 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %52
52: ; preds = %50, %46
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%-15s: [%s] (%d)\0D\00"
define void @progress_mode1_cb(i8* %0, i32 %1, i32 %2) {
%4 = alloca [51 x i8]
%5 = icmp ne i32 %1, -1
%6 = icmp ne i32 %2, -1
%7 = and i1 %5, %6
br i1 %7, label %8, label %37
8: ; preds = %3
%9 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 0
%10 = sext i32 %1 to i64
%11 = mul nsw i64 %10, 51
%12 = sext i32 %2 to i64
%13 = udiv i64 %11, %12
%14 = shl i64 %13, 32
%15 = ashr exact i64 %14, 32
%16 = insertelement <16 x i64> poison, i64 %15, i64 0
%17 = shufflevector <16 x i64> %16, <16 x i64> poison, <16 x i32> zeroinitializer
%18 = icmp sgt <16 x i64> %17, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>
%19 = select <16 x i1> %18, <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>, <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%20 = bitcast [51 x i8]* %4 to <16 x i8>*
store <16 x i8> %19, <16 x i8>* %20
%21 = icmp sgt <16 x i64> %17, <i64 16, i64 17, i64 18, i64 19, i64 20, i64 21, i64 22, i64 23, i64 24, i64 25, i64 26, i64 27, i64 28, i64 29, i64 30, i64 31>
%22 = select <16 x i1> %21, <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>, <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%23 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 16
%24 = bitcast i8* %23 to <16 x i8>*
store <16 x i8> %22, <16 x i8>* %24
%25 = icmp sgt <16 x i64> %17, <i64 32, i64 33, i64 34, i64 35, i64 36, i64 37, i64 38, i64 39, i64 40, i64 41, i64 42, i64 43, i64 44, i64 45, i64 46, i64 47>
%26 = select <16 x i1> %25, <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>, <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%27 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 32
%28 = bitcast i8* %27 to <16 x i8>*
store <16 x i8> %26, <16 x i8>* %28
%29 = icmp sgt i64 %14, 206158430208
%30 = select i1 %29, i8 42, i8 32
%31 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 48
store i8 %30, i8* %31
%32 = icmp sgt i64 %14, 210453397504
%33 = select i1 %32, i8 42, i8 32
%34 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 49
store i8 %33, i8* %34
%35 = getelementptr inbounds [51 x i8], [51 x i8]* %4, i64 0, i64 50
store i8 0, i8* %35
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %9, i32 %1)
br label %37
37: ; preds = %8, %3
%38 = icmp eq i32 %1, %2
br i1 %38, label %39, label %41
39: ; preds = %37
%40 = call i32 @putchar(i32 10)
br label %41
41: ; preds = %39, %37
ret void
}