#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 *, ...);
void printMeter100Needle(int value) {
  int i;
  if (value < 0) {
    value = 0;
  } else if (value > 100) {
    value = 100;
  }
  printf("\x1b[0K");
  printf("\x1b[%dm", 33);
  for (i = 0; i < (value / 2); i++) {
    printf("=");
  }
  printf("^");
  printf("\x1b[39m");
  printf("\n");
  printf("\n");
  return;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1131 <printMeter100Needle+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1147 <printMeter100Needle+0x37>
cmpl   $0x64,-0x4(%rbp)
jle    1142 <printMeter100Needle+0x32>
movl   $0x64,-0x4(%rbp)
jmp    1147 <printMeter100Needle+0x37>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x21,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jge    11a9 <printMeter100Needle+0x99>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116f <printMeter100Needle+0x5f>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x64,%edi
mov    $0x64,%ebp
cmovb  %edi,%ebp
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x21,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
js     116f <printMeter100Needle+0x4f>
cmp    $0x2,%ebp
jb     116f <printMeter100Needle+0x4f>
shr    %ebp
nopl   0x0(%rax)
mov    $0x3d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1160 <printMeter100Needle+0x40>
mov    $0x5e,%edi
call   1030 <putchar@plt>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[0K\00"
@.str.1 = [6 x i8] c"\1B[%dm\00"
@.str.2 = [2 x i8] c"=\00"
@.str.3 = [2 x i8] c"^\00"
@.str.4 = [6 x i8] c"\1B[39m\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @printMeter100Needle(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %12
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 100
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 100, i32* %2
br label %11
11: ; preds = %10, %7
br label %12
12: ; preds = %11, %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 33)
store i32 0, i32* %3
br label %15
15: ; preds = %22, %12
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = sdiv i32 %17, 2
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %25
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %15
25: ; preds = %15
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[0K\00"
@.str.1 = [6 x i8] c"\1B[%dm\00"
@.str.4 = [6 x i8] c"\1B[39m\00"
define void @printMeter100Needle(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = icmp ult i32 %0, 100
%4 = select i1 %3, i32 %0, i32 100
%5 = lshr i32 %4, 1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 33)
%8 = icmp ult i32 %4, 2
%9 = or i1 %2, %8
br i1 %9, label %15, label %10
10: ; preds = %1, %10
%11 = phi i32 [ %13, %10 ], [ 0, %1 ]
%12 = tail call i32 @putchar(i32 61)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %5
br i1 %14, label %15, label %10
15: ; preds = %10, %1
%16 = tail call i32 @putchar(i32 94)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 @putchar(i32 10)
ret void
}