#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 */
struct hashtableitem {
  int dummy;
};
struct hashtable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int hashtable_get_item(struct hashtable *, char *, size_t,
                       struct hashtableitem **);
char *hashtable_strerror(int);
int /*<<< orphan*/ stderr;
void hashtable_get_item_f(struct hashtable *ht, char *key, size_t keylen,
                          struct hashtableitem **item) {
  int r;
  r = hashtable_get_item(ht, key, keylen, item);
  if (r != 0 && r != 3) {
    fprintf(stderr, "Error while getting an item from a hashtable: %s\n",
            hashtable_strerror(r));
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<hashtable_get_item_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <hashtable_get_item@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11b8 <hashtable_get_item_f+0x78>
cmpl   $0x3,-0x24(%rbp)
je     11b8 <hashtable_get_item_f+0x78>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
call   1040 <hashtable_strerror@plt>
mov    -0x28(%rbp),%edi
mov    %rax,%rdx
lea    0xe5b(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashtable_get_item_f>:
push   %rbx
call   1030 <hashtable_get_item@plt>
test   %eax,%eax
je     114f <hashtable_get_item_f+0xf>
cmp    $0x3,%eax
jne    1151 <hashtable_get_item_f+0x11>
pop    %rbx
ret
mov    0x2e88(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1040 <hashtable_strerror@plt>
lea    0xe98(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.hashtable = type { i32 }
%struct.hashtableitem = type { i32 }
@stderr = global i32 0
@.str = [50 x i8] c"Error while getting an item from a hashtable: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @hashtable_get_item_f(%struct.hashtable* %0, i8* %1, i64 %2, %struct.hashtableitem** %3) {
%5 = alloca %struct.hashtable*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca %struct.hashtableitem**
%9 = alloca i32
store %struct.hashtable* %0, %struct.hashtable** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store %struct.hashtableitem** %3, %struct.hashtableitem*** %8
%10 = load %struct.hashtable*, %struct.hashtable** %5
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load %struct.hashtableitem**, %struct.hashtableitem*** %8
%14 = call i32 @hashtable_get_item(%struct.hashtable* %10, i8* %11, i64 %12, %struct.hashtableitem** %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %4
%18 = load i32, i32* %9
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = load i32, i32* %9
%23 = call i8* @hashtable_strerror(i32 %22)
%24 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %17, %4
ret void
}

LLVM IR (-O2):
%struct.hashtable = type { i32 }
%struct.hashtableitem = type { i32 }
@stderr = global i32 0
@.str = [50 x i8] c"Error while getting an item from a hashtable: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @hashtable_get_item_f(%struct.hashtable* %0, i8* %1, i64 %2, %struct.hashtableitem** %3) {
%5 = tail call i32 @hashtable_get_item(%struct.hashtable* %0, i8* %1, i64 %2, %struct.hashtableitem** %3)
switch i32 %5, label %6 [
i32 3, label %12
i32 0, label %12
]
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i8* @hashtable_strerror(i32 %5)
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %4, %4
ret void
}