#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 hashtable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *hashtable_strerror(int);
int hashtable_update(struct hashtable *, char *, size_t, void *);
int /*<<< orphan*/ stderr;
void hashtable_update_f(struct hashtable *ht, char *key, size_t keylen,
                        void *data) {
  int r;
  r = hashtable_update(ht, key, keylen, data);
  if (r != 0) {
    fprintf(stderr, "Error while updating a key in a hashtable: %s\n",
            hashtable_strerror(r));
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<hashtable_update_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   1040 <hashtable_update@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11ae <hashtable_update_f+0x6e>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
call   1030 <hashtable_strerror@plt>
mov    -0x28(%rbp),%edi
mov    %rax,%rdx
lea    0xe65(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashtable_update_f>:
push   %rbx
call   1040 <hashtable_update@plt>
test   %eax,%eax
jne    114c <hashtable_update_f+0xc>
pop    %rbx
ret
mov    0x2e8d(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1030 <hashtable_strerror@plt>
lea    0xe9d(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

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

LLVM IR (-O2):
%struct.hashtable = type { i32 }
@stderr = global i32 0
@.str = [47 x i8] c"Error while updating a key in a hashtable: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @hashtable_update_f(%struct.hashtable* %0, i8* %1, i64 %2, i8* %3) {
%5 = tail call i32 @hashtable_update(%struct.hashtable* %0, i8* %1, i64 %2, i8* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i8* @hashtable_strerror(i32 %5)
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %4
ret void
}