#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 dims2pct(unsigned char);
unsigned char pct2dims(int percent) {
  unsigned char dims;
  if (percent <= 0)
    return 0;
  if (percent > 100)
    return 210;
  for (dims = 0u; dims < 211u; dims++) {
    if (dims2pct(dims) >= percent)
      return dims;
  }
  return 210;
}


x86 assembly (clang, -O0):
<pct2dims>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     112e <pct2dims+0x1e>
movb   $0x0,-0x1(%rbp)
jmp    1187 <pct2dims+0x77>
cmpl   $0x64,-0x8(%rbp)
jle    1141 <pct2dims+0x31>
movb   $0xd2,-0x1(%rbp)
jmp    1187 <pct2dims+0x77>
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0xd3,%eax
jae    1183 <pct2dims+0x73>
movzbl -0x9(%rbp),%edi
call   1030 <dims2pct@plt>
cmp    -0x8(%rbp),%eax
jl     1171 <pct2dims+0x61>
mov    -0x9(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1187 <pct2dims+0x77>
jmp    1176 <pct2dims+0x66>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1145 <pct2dims+0x35>
movb   $0xd2,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @pct2dims(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 -46, 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, 211
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i8, i8* %4
%19 = call i32 @dims2pct(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 -46, 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 @pct2dims(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 @dims2pct(i8 zeroext %6)
%8 = icmp slt i32 %7, %0
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = add nuw i8 %6, 1
%11 = icmp eq i8 %10, -45
br i1 %11, label %12, label %5
12: ; preds = %9, %5, %3, %1
%13 = phi i8 [ 0, %1 ], [ -46, %3 ], [ -46, %9 ], [ %6, %5 ]
ret i8 %13
}