#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 t_hdata {
  int dummy;
};
struct t_hashtable {
  int dummy;
};

/* Variables and functions */
char *hashtable_get(struct t_hashtable *, char *);
scalar_t__ hashtable_has_key(struct t_hashtable *, char *);
int /*<<< orphan*/ hdata_set(struct t_hdata *, void *, char *, char const *);
int gui_bar_window_update_cb(void *data, struct t_hdata *hdata, void *pointer,
                             struct t_hashtable *hashtable) {
  const char *value;
  int rc;
  (void)data;
  rc = 0;
  if (hashtable_has_key(hashtable, "scroll_x")) {
    value = hashtable_get(hashtable, "scroll_x");
    if (value) {
      hdata_set(hdata, pointer, "scroll_x", value);
      rc++;
    }
  }
  if (hashtable_has_key(hashtable, "scroll_y")) {
    value = hashtable_get(hashtable, "scroll_y");
    if (value) {
      hdata_set(hdata, pointer, "scroll_y", value);
      rc++;
    }
  }
  return rc;
}


x86 assembly (clang, -O0):
<gui_bar_window_update_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1030 <hashtable_has_key@plt>
cmp    $0x0,%rax
je     11ae <gui_bar_window_update_cb+0x7e>
mov    -0x20(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1040 <hashtable_get@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11a9 <gui_bar_window_update_cb+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rcx
lea    0xe65(%rip),%rdx
call   1050 <hdata_set@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ae <gui_bar_window_update_cb+0x7e>
mov    -0x20(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1030 <hashtable_has_key@plt>
cmp    $0x0,%rax
je     120d <gui_bar_window_update_cb+0xdd>
mov    -0x20(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1040 <hashtable_get@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1208 <gui_bar_window_update_cb+0xd8>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rcx
lea    0xe0f(%rip),%rdx
call   1050 <hdata_set@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    120d <gui_bar_window_update_cb+0xdd>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_bar_window_update_cb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xeb9(%rip),%rsi
mov    %rcx,%rdi
call   1030 <hashtable_has_key@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1184 <gui_bar_window_update_cb+0x54>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <hashtable_get@plt>
test   %rax,%rax
je     1184 <gui_bar_window_update_cb+0x54>
lea    0xe8f(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rcx
call   1050 <hdata_set@plt>
mov    $0x1,%ebp
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <hashtable_has_key@plt>
test   %rax,%rax
je     11c4 <gui_bar_window_update_cb+0x94>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <hashtable_get@plt>
test   %rax,%rax
je     11c4 <gui_bar_window_update_cb+0x94>
lea    0xe56(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rcx
call   1050 <hdata_set@plt>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.t_hdata = type { i32 }
%struct.t_hashtable = type { i32 }
@.str = [9 x i8] c"scroll_x\00"
@.str.1 = [9 x i8] c"scroll_y\00"
define i32 @gui_bar_window_update_cb(i8* %0, %struct.t_hdata* %1, i8* %2, %struct.t_hashtable* %3) {
%5 = alloca i8*
%6 = alloca %struct.t_hdata*
%7 = alloca i8*
%8 = alloca %struct.t_hashtable*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %5
store %struct.t_hdata* %1, %struct.t_hdata** %6
store i8* %2, i8** %7
store %struct.t_hashtable* %3, %struct.t_hashtable** %8
%11 = load i8*, i8** %5
store i32 0, i32* %10
%12 = load %struct.t_hashtable*, %struct.t_hashtable** %8
%13 = call i64 @hashtable_has_key(%struct.t_hashtable* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %4
%16 = load %struct.t_hashtable*, %struct.t_hashtable** %8
%17 = call i8* @hashtable_get(%struct.t_hashtable* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %9
%18 = load i8*, i8** %9
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load %struct.t_hdata*, %struct.t_hdata** %6
%22 = load i8*, i8** %7
%23 = load i8*, i8** %9
%24 = call i32 @hdata_set(%struct.t_hdata* %21, i8* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %10
%26 = add nsw i32 %25, 1
store i32 %26, i32* %10
br label %27
27: ; preds = %20, %15
br label %28
28: ; preds = %27, %4
%29 = load %struct.t_hashtable*, %struct.t_hashtable** %8
%30 = call i64 @hashtable_has_key(%struct.t_hashtable* %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %45
32: ; preds = %28
%33 = load %struct.t_hashtable*, %struct.t_hashtable** %8
%34 = call i8* @hashtable_get(%struct.t_hashtable* %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i8* %34, i8** %9
%35 = load i8*, i8** %9
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %44
37: ; preds = %32
%38 = load %struct.t_hdata*, %struct.t_hdata** %6
%39 = load i8*, i8** %7
%40 = load i8*, i8** %9
%41 = call i32 @hdata_set(%struct.t_hdata* %38, i8* %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %40)
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %44
44: ; preds = %37, %32
br label %45
45: ; preds = %44, %28
%46 = load i32, i32* %10
ret i32 %46
}

LLVM IR (-O2):
%struct.t_hdata = type { i32 }
%struct.t_hashtable = type { i32 }
@.str = [9 x i8] c"scroll_x\00"
@.str.1 = [9 x i8] c"scroll_y\00"
define i32 @gui_bar_window_update_cb(i8* nocapture readnone %0, %struct.t_hdata* %1, i8* %2, %struct.t_hashtable* %3) {
%5 = tail call i64 @hashtable_has_key(%struct.t_hashtable* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = tail call i8* @hashtable_get(%struct.t_hashtable* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @hdata_set(%struct.t_hdata* %1, i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %12
12: ; preds = %7, %10, %4
%13 = phi i32 [ 1, %10 ], [ 0, %7 ], [ 0, %4 ]
%14 = tail call i64 @hashtable_has_key(%struct.t_hashtable* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %12
%17 = tail call i8* @hashtable_get(%struct.t_hashtable* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i8* %17, null
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = tail call i32 @hdata_set(%struct.t_hdata* %1, i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%21 = add nuw nsw i32 %13, 1
br label %22
22: ; preds = %16, %19, %12
%23 = phi i32 [ %21, %19 ], [ %13, %16 ], [ %13, %12 ]
ret i32 %23
}