#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_fixmap(void *);
scalar_t__ minipack_is_map16(void *);
scalar_t__ minipack_is_map32(void *);
size_t minipack_sizeof_map_elem(void *ptr) {
  if (minipack_is_fixmap(ptr)) {
    return 1;
  } else if (minipack_is_map16(ptr)) {
    return 3;
  } else if (minipack_is_map32(ptr)) {
    return 5;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<minipack_sizeof_map_elem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <minipack_is_fixmap@plt>
cmp    $0x0,%rax
je     115c <minipack_sizeof_map_elem+0x2c>
movq   $0x1,-0x8(%rbp)
jmp    11a4 <minipack_sizeof_map_elem+0x74>
mov    -0x10(%rbp),%rdi
call   1030 <minipack_is_map16@plt>
cmp    $0x0,%rax
je     117c <minipack_sizeof_map_elem+0x4c>
movq   $0x3,-0x8(%rbp)
jmp    11a4 <minipack_sizeof_map_elem+0x74>
mov    -0x10(%rbp),%rdi
call   1050 <minipack_is_map32@plt>
cmp    $0x0,%rax
je     119c <minipack_sizeof_map_elem+0x6c>
movq   $0x5,-0x8(%rbp)
jmp    11a4 <minipack_sizeof_map_elem+0x74>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_sizeof_map_elem>:
push   %rbx
mov    %rdi,%rbx
call   1040 <minipack_is_fixmap@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1148 <minipack_sizeof_map_elem+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <minipack_is_map16@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    1146 <minipack_sizeof_map_elem+0x16>
mov    %rbx,%rdi
call   1050 <minipack_is_map32@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,4),%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @minipack_sizeof_map_elem(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @minipack_is_fixmap(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 %19
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @minipack_is_map16(i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i64 3, i64* %2
br label %19
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i64 @minipack_is_map32(i8* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i64 5, i64* %2
br label %19
18: ; preds = %13
store i64 0, i64* %2
br label %19
19: ; preds = %18, %17, %12, %7
%20 = load i64, i64* %2
ret i64 %20
}

LLVM IR (-O2):
define i64 @minipack_sizeof_map_elem(i8* %0) {
%2 = tail call i64 @minipack_is_fixmap(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i64 @minipack_is_map16(i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i64 @minipack_is_map32(i8* %0)
%9 = icmp eq i64 %8, 0
%10 = select i1 %9, i64 0, i64 5
br label %11
11: ; preds = %7, %4, %1
%12 = phi i64 [ 1, %1 ], [ 3, %4 ], [ %10, %7 ]
ret i64 %12
}