#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 /*<<< orphan*/ stdout;
void print_bar(int *i, int *j, int Niter) {
  int shell_size = 77;
  int shell_unit = (int)(Niter / shell_size);
  int jp;
  if (*i < shell_unit)
    (*i)++;
  else {
    (*j)++;
    for (*i = 0; *i < 100; (*i)++) {
      printf("\b");
    }
    printf("\r[");
    *i = 0;
    for (jp = 0; jp < *j; jp++)
      printf("=");
    for (jp = *j; jp < shell_size - 5; jp++)
      printf(" ");
    printf("]");
  }
  fflush(stdout);
}


x86 assembly (clang, -O0):
<print_bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x4d,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
jge    1163 <print_bar+0x43>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1227 <print_bar+0x107>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x64,(%rax)
jge    11a1 <print_bar+0x81>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1178 <print_bar+0x58>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11e7 <print_bar+0xc7>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11be <print_bar+0x9e>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x5,%ecx
cmp    %ecx,%eax
jge    121b <print_bar+0xfb>
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f0 <print_bar+0xd0>
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bar>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movslq %edx,%rax
imul   $0x3531dec1,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x24,%rcx
add    %eax,%ecx
mov    (%rdi),%eax
cmp    %ecx,%eax
jge    115e <print_bar+0x2e>
add    $0x1,%eax
mov    %eax,(%rbx)
jmp    11e8 <print_bar+0xb8>
mov    %rsi,%r14
addl   $0x1,(%rsi)
movl   $0x0,(%rbx)
nopw   0x0(%rax,%rax,1)
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    (%rbx),%eax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
cmp    $0x63,%eax
jl     1170 <print_bar+0x40>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,(%rbx)
mov    (%r14),%ebx
test   %ebx,%ebx
jle    11c9 <print_bar+0x99>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
mov    (%r14),%ebx
cmp    %ebx,%ebp
jl     11b0 <print_bar+0x80>
cmp    $0x47,%ebx
jg     11de <print_bar+0xae>
add    $0xffffffb8,%ebx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    11d0 <print_bar+0xa0>
mov    $0x5d,%edi
call   1030 <putchar@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\08\00"
@.str.1 = [3 x i8] c"\0D[\00"
@.str.2 = [2 x i8] c"=\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"]\00"
@stdout = global i32 0
define void @print_bar(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 77, i32* %7
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = sdiv i32 %10, %11
store i32 %12, i32* %8
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %3
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %18
br label %64
21: ; preds = %3
%22 = load i32*, i32** %5
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
%25 = load i32*, i32** %4
store i32 0, i32* %25
br label %26
26: ; preds = %32, %21
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = icmp slt i32 %28, 100
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32*, i32** %4
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %26
36: ; preds = %26
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32*, i32** %4
store i32 0, i32* %38
store i32 0, i32* %9
br label %39
39: ; preds = %46, %36
%40 = load i32, i32* %9
%41 = load i32*, i32** %5
%42 = load i32, i32* %41
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %44
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %39
49: ; preds = %39
%50 = load i32*, i32** %5
%51 = load i32, i32* %50
store i32 %51, i32* %9
br label %52
52: ; preds = %59, %49
%53 = load i32, i32* %9
%54 = load i32, i32* %7
%55 = sub nsw i32 %54, 5
%56 = icmp slt i32 %53, %55
br i1 %56, label %57, label %62
57: ; preds = %52
%58 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %52
62: ; preds = %52
%63 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %62, %17
%65 = load i32, i32* @stdout
%66 = call i32 @fflush(i32 %65)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"\0D[\00"
@stdout = global i32 0
define void @print_bar(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = sdiv i32 %2, 77
%5 = load i32, i32* %0
%6 = icmp slt i32 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = add nsw i32 %5, 1
store i32 %8, i32* %0
br label %38
9: ; preds = %3
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
store i32 0, i32* %0
br label %12
12: ; preds = %9, %12
%13 = tail call i32 @putchar(i32 8)
%14 = load i32, i32* %0
%15 = add nsw i32 %14, 1
store i32 %15, i32* %0
%16 = icmp slt i32 %14, 99
br i1 %16, label %12, label %17
17: ; preds = %12
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %0
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, 0
br i1 %20, label %25, label %23
21: ; preds = %25
%22 = icmp slt i32 %29, 72
br i1 %22, label %23, label %36
23: ; preds = %17, %21
%24 = phi i32 [ %19, %17 ], [ %29, %21 ]
br label %31
25: ; preds = %17, %25
%26 = phi i32 [ %28, %25 ], [ 0, %17 ]
%27 = tail call i32 @putchar(i32 61)
%28 = add nuw nsw i32 %26, 1
%29 = load i32, i32* %1
%30 = icmp slt i32 %28, %29
br i1 %30, label %25, label %21
31: ; preds = %23, %31
%32 = phi i32 [ %34, %31 ], [ %24, %23 ]
%33 = tail call i32 @putchar(i32 32)
%34 = add i32 %32, 1
%35 = icmp eq i32 %34, 72
br i1 %35, label %36, label %31
36: ; preds = %31, %21
%37 = tail call i32 @putchar(i32 93)
br label %38
38: ; preds = %36, %7
%39 = load i32, i32* @stdout
%40 = tail call i32 @fflush(i32 %39)
ret void
}