#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int atoi(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, double);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  unsigned int a = 1;
  double pc = 0;
  int items = 100;
  int i, j = 0;
  char *str = malloc(256);
  char tmp[100];
  if (argc == 2)
    items = atoi(argv[1]);
  if (str == NULL)
    return EXIT_FAILURE;
  for (i = 0; i <= items; i++) {
    memset(str, 0, 256);
    strcpy(str, "[");
    pc = (((double)i) / items) * 100;
    while ((int)pc--) {
      strcat(str, "=");
    }
    strcat(str, ">");
    pc = 100 - (((double)i) / items) * 100;
    while ((int)pc--) {
      strcat(str, " ");
    }
    sprintf(tmp, "] %g%%", (((double)i) / items) * 100);
    strcat(str, tmp);
    printf("\r%s", str);
    fflush(stdout);
  }
  printf("\n");
  free(str);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x64,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11ee <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    120a <main+0x7a>
mov    0x2de0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13aa <main+0x21a>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1387 <main+0x1f7>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
mov    -0x38(%rbp),%rdi
lea    0xdd8(%rip),%rsi
call   1040 <strcpy@plt>
cvtsi2sdl -0x28(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdad(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xd9f(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x20(%rbp)
cvttsd2si %xmm0,%eax
cmp    $0x0,%eax
je     1297 <main+0x107>
mov    -0x38(%rbp),%rdi
lea    0xd85(%rip),%rsi
call   10a0 <strcat@plt>
jmp    125c <main+0xcc>
mov    -0x38(%rbp),%rdi
lea    0xd72(%rip),%rsi
call   10a0 <strcat@plt>
cvtsi2sdl -0x28(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xd1a(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x20(%rbp)
cvttsd2si %xmm0,%eax
cmp    $0x0,%eax
je     131c <main+0x18c>
mov    -0x38(%rbp),%rdi
lea    0xd04(%rip),%rsi
call   10a0 <strcat@plt>
jmp    12e1 <main+0x151>
lea    -0xa0(%rbp),%rdi
cvtsi2sdl -0x28(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcc7(%rip),%xmm1
mulsd  %xmm1,%xmm0
lea    0xcd4(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x38(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x38(%rbp),%rsi
lea    0xcbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1211 <main+0x81>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    0x2c2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
cmp    $0x2,%ebp
jne    11ff <main+0x5f>
mov    0x8(%r14),%rdi
call   10a0 <atoi@plt>
test   %rbx,%rbx
je     135b <main+0x1bb>
mov    %eax,%r13d
test   %eax,%eax
jns    120e <main+0x6e>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2dd6(%rip),%rax
jmp    1362 <main+0x1c2>
mov    $0x64,%r13d
test   %rbx,%rbx
je     135b <main+0x1bb>
cvtsi2sd %r13d,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x20(%rsp),%rbp
lea    0xdf1(%rip),%r15
lea    0xde6(%rip),%r12
xor    %r14d,%r14d
jmp    128f <main+0xef>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
lea    0xdce(%rip),%rsi
movsd  0x8(%rsp),%xmm0
call   10c0 <sprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
lea    0xdb8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
lea    0x1(%r14),%eax
cmp    %r13d,%r14d
mov    %eax,%r14d
je     11e1 <main+0x41>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
mov    %rbx,%rdi
lea    0xd68(%rip),%rsi
call   1050 <strcpy@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
divsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  0xd37(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
cvttsd2si %xmm0,%eax
test   %eax,%eax
je     1305 <main+0x165>
movsd  0x8(%rsp),%xmm0
nopl   (%rax)
addsd  0xd20(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <strcat@plt>
movsd  (%rsp),%xmm0
cvttsd2si %xmm0,%eax
test   %eax,%eax
jne    12e0 <main+0x140>
mov    %rbx,%rdi
lea    0xd05(%rip),%rsi
call   10b0 <strcat@plt>
movsd  0xce4(%rip),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
subsd  %xmm1,%xmm0
nopw   0x0(%rax,%rax,1)
cvttsd2si %xmm0,%eax
test   %eax,%eax
je     1240 <main+0xa0>
addsd  0xcc4(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <strcat@plt>
movsd  (%rsp),%xmm0
jmp    1330 <main+0x190>
mov    0x2c7e(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"[\00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [2 x i8] c">\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [7 x i8] c"] %g%%\00"
@.str.5 = [4 x i8] c"\0D%s\00"
@stdout = global i32 0
@.str.6 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store double 0.000000e+00, double* %7
store i32 100, i32* %8
store i32 0, i32* %10
%13 = call i8* @malloc(i32 256)
store i8* %13, i8** %11
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %8
br label %21
21: ; preds = %16, %2
%22 = load i8*, i8** %11
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %92
26: ; preds = %21
store i32 0, i32* %9
br label %27
27: ; preds = %84, %26
%28 = load i32, i32* %9
%29 = load i32, i32* %8
%30 = icmp sle i32 %28, %29
br i1 %30, label %31, label %87
31: ; preds = %27
%32 = load i8*, i8** %11
%33 = call i32 @memset(i8* %32, i32 0, i32 256)
%34 = load i8*, i8** %11
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%36 = load i32, i32* %9
%37 = sitofp i32 %36 to double
%38 = load i32, i32* %8
%39 = sitofp i32 %38 to double
%40 = fdiv double %37, %39
%41 = fmul double %40, 1.000000e+02
store double %41, double* %7
br label %42
42: ; preds = %47, %31
%43 = load double, double* %7
%44 = fadd double %43, -1.000000e+00
store double %44, double* %7
%45 = fptosi double %43 to i32
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8*, i8** %11
%49 = call i32 @strcat(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %42
50: ; preds = %42
%51 = load i8*, i8** %11
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32, i32* %9
%54 = sitofp i32 %53 to double
%55 = load i32, i32* %8
%56 = sitofp i32 %55 to double
%57 = fdiv double %54, %56
%58 = fneg double %57
%59 = call double @llvm.fmuladd.f64(double %58, double 1.000000e+02, double 1.000000e+02)
store double %59, double* %7
br label %60
60: ; preds = %65, %50
%61 = load double, double* %7
%62 = fadd double %61, -1.000000e+00
store double %62, double* %7
%63 = fptosi double %61 to i32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = load i8*, i8** %11
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %60
68: ; preds = %60
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%70 = load i32, i32* %9
%71 = sitofp i32 %70 to double
%72 = load i32, i32* %8
%73 = sitofp i32 %72 to double
%74 = fdiv double %71, %73
%75 = fmul double %74, 1.000000e+02
%76 = call i32 @sprintf(i8* %69, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %75)
%77 = load i8*, i8** %11
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%79 = call i32 @strcat(i8* %77, i8* %78)
%80 = load i8*, i8** %11
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %80)
%82 = load i32, i32* @stdout
%83 = call i32 @fflush(i32 %82)
br label %84
84: ; preds = %68
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %27
87: ; preds = %27
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%89 = load i8*, i8** %11
%90 = call i32 @free(i8* %89)
%91 = load i32, i32* @EXIT_SUCCESS
store i32 %91, i32* %3
br label %92
92: ; preds = %87, %24
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"[\00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [2 x i8] c">\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [7 x i8] c"] %g%%\00"
@.str.5 = [4 x i8] c"\0D%s\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = icmp eq i32 %0, 2
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = icmp eq i8* %4, null
br i1 %11, label %57, label %14
12: ; preds = %2
%13 = icmp eq i8* %4, null
br i1 %13, label %57, label %16
14: ; preds = %7
%15 = icmp slt i32 %10, 0
br i1 %15, label %54, label %16
16: ; preds = %12, %14
%17 = phi i32 [ %10, %14 ], [ 100, %12 ]
%18 = sitofp i32 %17 to double
br label %19
19: ; preds = %16, %46
%20 = phi i32 [ 0, %16 ], [ %52, %46 ]
%21 = call i32 @memset(i8* %4, i32 0, i32 256)
%22 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = sitofp i32 %20 to double
%24 = fdiv double %23, %18
%25 = fmul double %24, 1.000000e+02
%26 = fptosi double %25 to i32
%27 = icmp eq i32 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %19, %28
%29 = phi double [ %30, %28 ], [ %25, %19 ]
%30 = fadd double %29, -1.000000e+00
%31 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = fptosi double %30 to i32
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %28
34: ; preds = %28, %19
%35 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%36 = fneg double %24
%37 = call double @llvm.fmuladd.f64(double %36, double 1.000000e+02, double 1.000000e+02)
%38 = fptosi double %37 to i32
%39 = icmp eq i32 %38, 0
br i1 %39, label %46, label %40
40: ; preds = %34, %40
%41 = phi double [ %42, %40 ], [ %37, %34 ]
%42 = fadd double %41, -1.000000e+00
%43 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%44 = fptosi double %42 to i32
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %40
46: ; preds = %40, %34
%47 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %25)
%48 = call i32 @strcat(i8* %4, i8* %5)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%50 = load i32, i32* @stdout
%51 = call i32 @fflush(i32 %50)
%52 = add nuw i32 %20, 1
%53 = icmp eq i32 %20, %17
br i1 %53, label %54, label %19
54: ; preds = %46, %14
%55 = call i32 @putchar(i32 10)
%56 = call i32 @free(i8* %4)
br label %57
57: ; preds = %12, %7, %54
%58 = phi i32* [ @EXIT_SUCCESS, %54 ], [ @EXIT_FAILURE, %7 ], [ @EXIT_FAILURE, %12 ]
%59 = load i32, i32* %58
ret i32 %59
}