#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*/ bio_write(int, int);
void t2_putnumpasses(int n) {
  if (n == 1) {
    bio_write(0, 1);
  } else if (n == 2) {
    bio_write(2, 2);
  } else if (n <= 5) {
    bio_write(0xc | (n - 3), 4);
  } else if (n <= 36) {
    bio_write(0x1e0 | (n - 6), 9);
  } else if (n <= 164) {
    bio_write(0xff80 | (n - 37), 16);
  }
}


x86 assembly (clang, -O0):
<t2_putnumpasses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1136 <t2_putnumpasses+0x26>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <bio_write@plt>
jmp    11cf <t2_putnumpasses+0xbf>
cmpl   $0x2,-0x4(%rbp)
jne    1151 <t2_putnumpasses+0x41>
mov    $0x2,%esi
mov    %esi,%edi
call   1030 <bio_write@plt>
jmp    11ca <t2_putnumpasses+0xba>
cmpl   $0x5,-0x4(%rbp)
jg     1173 <t2_putnumpasses+0x63>
mov    -0x4(%rbp),%edi
sub    $0x3,%edi
or     $0xc,%edi
mov    $0x4,%esi
call   1030 <bio_write@plt>
jmp    11c5 <t2_putnumpasses+0xb5>
cmpl   $0x24,-0x4(%rbp)
jg     1198 <t2_putnumpasses+0x88>
mov    -0x4(%rbp),%edi
sub    $0x6,%edi
or     $0x1e0,%edi
mov    $0x9,%esi
call   1030 <bio_write@plt>
jmp    11c0 <t2_putnumpasses+0xb0>
cmpl   $0xa4,-0x4(%rbp)
jg     11bb <t2_putnumpasses+0xab>
mov    -0x4(%rbp),%edi
sub    $0x25,%edi
or     $0xff80,%edi
mov    $0x10,%esi
call   1030 <bio_write@plt>
jmp    11c0 <t2_putnumpasses+0xb0>
jmp    11c5 <t2_putnumpasses+0xb5>
jmp    11ca <t2_putnumpasses+0xba>
jmp    11cf <t2_putnumpasses+0xbf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2_putnumpasses>:
cmp    $0x2,%edi
je     1126 <t2_putnumpasses+0x16>
cmp    $0x1,%edi
jne    1135 <t2_putnumpasses+0x25>
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <bio_write@plt>
mov    $0x2,%edi
mov    $0x2,%esi
jmp    1030 <bio_write@plt>
cmp    $0x5,%edi
jg     114a <t2_putnumpasses+0x3a>
add    $0xfffffffd,%edi
or     $0xc,%edi
mov    $0x4,%esi
jmp    1030 <bio_write@plt>
cmp    $0x24,%edi
ja     1162 <t2_putnumpasses+0x52>
add    $0xfffffffa,%edi
or     $0x1e0,%edi
mov    $0x9,%esi
jmp    1030 <bio_write@plt>
cmp    $0xa4,%edi
ja     117d <t2_putnumpasses+0x6d>
add    $0xffffffdb,%edi
or     $0xff80,%edi
mov    $0x10,%esi
jmp    1030 <bio_write@plt>
ret

LLVM IR (-O0):
define void @t2_putnumpasses(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @bio_write(i32 0, i32 1)
br label %40
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @bio_write(i32 2, i32 2)
br label %39
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp sle i32 %13, 5
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 3
%18 = or i32 12, %17
%19 = call i32 @bio_write(i32 %18, i32 4)
br label %38
20: ; preds = %12
%21 = load i32, i32* %2
%22 = icmp sle i32 %21, 36
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 6
%26 = or i32 480, %25
%27 = call i32 @bio_write(i32 %26, i32 9)
br label %37
28: ; preds = %20
%29 = load i32, i32* %2
%30 = icmp sle i32 %29, 164
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %2
%33 = sub nsw i32 %32, 37
%34 = or i32 65408, %33
%35 = call i32 @bio_write(i32 %34, i32 16)
br label %36
36: ; preds = %31, %28
br label %37
37: ; preds = %36, %23
br label %38
38: ; preds = %37, %15
br label %39
39: ; preds = %38, %10
br label %40
40: ; preds = %39, %5
ret void
}

LLVM IR (-O2):
define void @t2_putnumpasses(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %2
i32 2, label %4
]
2: ; preds = %1
%3 = tail call i32 @bio_write(i32 0, i32 1)
br label %24
4: ; preds = %1
%5 = tail call i32 @bio_write(i32 2, i32 2)
br label %24
6: ; preds = %1
%7 = icmp slt i32 %0, 6
br i1 %7, label %8, label %12
8: ; preds = %6
%9 = add nsw i32 %0, -3
%10 = or i32 %9, 12
%11 = tail call i32 @bio_write(i32 %10, i32 4)
br label %24
12: ; preds = %6
%13 = icmp ult i32 %0, 37
br i1 %13, label %14, label %18
14: ; preds = %12
%15 = add nsw i32 %0, -6
%16 = or i32 %15, 480
%17 = tail call i32 @bio_write(i32 %16, i32 9)
br label %24
18: ; preds = %12
%19 = icmp ult i32 %0, 165
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = add nsw i32 %0, -37
%22 = or i32 %21, 65408
%23 = tail call i32 @bio_write(i32 %22, i32 16)
br label %24
24: ; preds = %4, %14, %20, %18, %8, %2
ret void
}