#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 */
scalar_t__ minipack_is_pos_fixnum(void *);
scalar_t__ minipack_is_uint16(void *);
scalar_t__ minipack_is_uint32(void *);
scalar_t__ minipack_is_uint64(void *);
scalar_t__ minipack_is_uint8(void *);
size_t minipack_sizeof_uint_elem(void *ptr) {
  if (minipack_is_pos_fixnum(ptr)) {
    return 1;
  } else if (minipack_is_uint8(ptr)) {
    return 2;
  } else if (minipack_is_uint16(ptr)) {
    return 3;
  } else if (minipack_is_uint32(ptr)) {
    return 5;
  } else if (minipack_is_uint64(ptr)) {
    return 9;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<minipack_sizeof_uint_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <minipack_is_pos_fixnum@plt>
cmp    $0x0,%rax
je     117c <minipack_sizeof_uint_elem+0x2c>
movq   $0x1,-0x8(%rbp)
jmp    1204 <minipack_sizeof_uint_elem+0xb4>
mov    -0x10(%rbp),%rdi
call   1040 <minipack_is_uint8@plt>
cmp    $0x0,%rax
je     119c <minipack_sizeof_uint_elem+0x4c>
movq   $0x2,-0x8(%rbp)
jmp    1204 <minipack_sizeof_uint_elem+0xb4>
mov    -0x10(%rbp),%rdi
call   1070 <minipack_is_uint16@plt>
cmp    $0x0,%rax
je     11bc <minipack_sizeof_uint_elem+0x6c>
movq   $0x3,-0x8(%rbp)
jmp    1204 <minipack_sizeof_uint_elem+0xb4>
mov    -0x10(%rbp),%rdi
call   1050 <minipack_is_uint32@plt>
cmp    $0x0,%rax
je     11dc <minipack_sizeof_uint_elem+0x8c>
movq   $0x5,-0x8(%rbp)
jmp    1204 <minipack_sizeof_uint_elem+0xb4>
mov    -0x10(%rbp),%rdi
call   1030 <minipack_is_uint64@plt>
cmp    $0x0,%rax
je     11fc <minipack_sizeof_uint_elem+0xac>
movq   $0x9,-0x8(%rbp)
jmp    1204 <minipack_sizeof_uint_elem+0xb4>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_sizeof_uint_elem>:
push   %rbx
mov    %rdi,%rbx
call   1060 <minipack_is_pos_fixnum@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1168 <minipack_sizeof_uint_elem+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <minipack_is_uint8@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    1166 <minipack_sizeof_uint_elem+0x16>
mov    %rbx,%rdi
call   1070 <minipack_is_uint16@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    1166 <minipack_sizeof_uint_elem+0x16>
mov    %rbx,%rdi
call   1050 <minipack_is_uint32@plt>
mov    %rax,%rcx
mov    $0x5,%eax
test   %rcx,%rcx
jne    1166 <minipack_sizeof_uint_elem+0x16>
mov    %rbx,%rdi
call   1030 <minipack_is_uint64@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,8),%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @minipack_sizeof_uint_elem(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @minipack_is_pos_fixnum(i8* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i64 1, i64* %2
br label %29
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @minipack_is_uint8(i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i64 2, i64* %2
br label %29
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i64 @minipack_is_uint16(i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i64 3, i64* %2
br label %29
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = call i64 @minipack_is_uint32(i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i64 5, i64* %2
br label %29
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = call i64 @minipack_is_uint64(i8* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i64 9, i64* %2
br label %29
28: ; preds = %23
store i64 0, i64* %2
br label %29
29: ; preds = %28, %27, %22, %17, %12, %7
%30 = load i64, i64* %2
ret i64 %30
}

LLVM IR (-O2):
define i64 @minipack_sizeof_uint_elem(i8* %0) {
%2 = tail call i64 @minipack_is_pos_fixnum(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %17
4: ; preds = %1
%5 = tail call i64 @minipack_is_uint8(i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = tail call i64 @minipack_is_uint16(i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = tail call i64 @minipack_is_uint32(i8* %0)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = tail call i64 @minipack_is_uint64(i8* %0)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i64 0, i64 9
br label %17
17: ; preds = %13, %10, %7, %4, %1
%18 = phi i64 [ 1, %1 ], [ 2, %4 ], [ 3, %7 ], [ 5, %10 ], [ %16, %13 ]
ret i64 %18
}