#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 ext3level2pct(unsigned char);
unsigned char pct2ext3level(int percent) {
  unsigned char level;
  if (percent <= 0)
    return 0u;
  if (percent > 100)
    return 63u;
  for (level = 0u; level < 63u; level++) {
    if (ext3level2pct(level) >= percent)
      return level;
  }
  return 63u;
}


x86 assembly (clang, -O0):
<pct2ext3level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     112e <pct2ext3level+0x1e>
movb   $0x0,-0x1(%rbp)
jmp    1185 <pct2ext3level+0x75>
cmpl   $0x64,-0x8(%rbp)
jle    1141 <pct2ext3level+0x31>
movb   $0x3f,-0x1(%rbp)
jmp    1185 <pct2ext3level+0x75>
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x3f,%eax
jae    1181 <pct2ext3level+0x71>
movzbl -0x9(%rbp),%edi
call   1030 <ext3level2pct@plt>
cmp    -0x8(%rbp),%eax
jl     116f <pct2ext3level+0x5f>
mov    -0x9(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1185 <pct2ext3level+0x75>
jmp    1174 <pct2ext3level+0x64>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1145 <pct2ext3level+0x35>
movb   $0x3f,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pct2ext3level>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1146 <pct2ext3level+0x36>
mov    %edi,%ebp
mov    $0x3f,%r14b
cmp    $0x64,%edi
ja     114e <pct2ext3level+0x3e>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl %bl,%edi
call   1030 <ext3level2pct@plt>
cmp    %ebp,%eax
jge    114b <pct2ext3level+0x3b>
add    $0x1,%bl
cmp    $0x3f,%bl
jne    1130 <pct2ext3level+0x20>
jmp    114e <pct2ext3level+0x3e>
xor    %r14d,%r14d
jmp    114e <pct2ext3level+0x3e>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @pct2ext3level(i32 %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 0, i8* %2
br label %29
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 100
br i1 %10, label %11, label %12
11: ; preds = %8
store i8 63, i8* %2
br label %29
12: ; preds = %8
store i8 0, i8* %4
br label %13
13: ; preds = %25, %12
%14 = load i8, i8* %4
%15 = zext i8 %14 to i32
%16 = icmp ult i32 %15, 63
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i8, i8* %4
%19 = call i32 @ext3level2pct(i8 zeroext %18)
%20 = load i32, i32* %3
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = load i8, i8* %4
store i8 %23, i8* %2
br label %29
24: ; preds = %17
br label %25
25: ; preds = %24
%26 = load i8, i8* %4
%27 = add i8 %26, 1
store i8 %27, i8* %4
br label %13
28: ; preds = %13
store i8 63, i8* %2
br label %29
29: ; preds = %28, %22, %11, %7
%30 = load i8, i8* %2
ret i8 %30
}

LLVM IR (-O2):
define zeroext i8 @pct2ext3level(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 100
br i1 %4, label %12, label %5
5: ; preds = %3, %9
%6 = phi i8 [ %10, %9 ], [ 0, %3 ]
%7 = tail call i32 @ext3level2pct(i8 zeroext %6)
%8 = icmp slt i32 %7, %0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = add nuw nsw i8 %6, 1
%11 = icmp eq i8 %10, 63
br i1 %11, label %12, label %5
12: ; preds = %9, %5, %3, %1
%13 = phi i8 [ 0, %1 ], [ 63, %3 ], [ 63, %9 ], [ %6, %5 ]
ret i8 %13
}