#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 worker_info {
  int dummy;
};
struct benchmark_args {
  int dummy;
};
struct benchmark {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ map_common_free_worker(struct benchmark *,
                                          struct benchmark_args *,
                                          struct worker_info *);
int map_common_init_worker(struct benchmark *, struct benchmark_args *,
                           struct worker_info *);
int map_global_rand_keys_init(struct benchmark *, struct benchmark_args *,
                              struct worker_info *);
int map_bench_get_init_worker(struct benchmark *bench,
                              struct benchmark_args *args,
                              struct worker_info *worker) {
  int ret = map_common_init_worker(bench, args, worker);
  if (ret)
    return ret;
  ret = map_global_rand_keys_init(bench, args, worker);
  if (ret)
    goto err_common_free_worker;
  return 0;
err_common_free_worker:
  map_common_free_worker(bench, args, worker);
  return -1;
}


x86 assembly (clang, -O0):
<map_bench_get_init_worker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <map_common_init_worker@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     116d <map_bench_get_init_worker+0x3d>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b4 <map_bench_get_init_worker+0x84>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <map_global_rand_keys_init@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1190 <map_bench_get_init_worker+0x60>
jmp    119c <map_bench_get_init_worker+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <map_bench_get_init_worker+0x84>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <map_common_free_worker@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_bench_get_init_worker>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <map_common_init_worker@plt>
test   %eax,%eax
jne    1170 <map_bench_get_init_worker+0x40>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <map_global_rand_keys_init@plt>
test   %eax,%eax
je     116e <map_bench_get_init_worker+0x3e>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <map_common_free_worker@plt>
mov    $0xffffffff,%eax
jmp    1170 <map_bench_get_init_worker+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.benchmark = type { i32 }
%struct.benchmark_args = type { i32 }
%struct.worker_info = type { i32 }
define i32 @map_bench_get_init_worker(%struct.benchmark* %0, %struct.benchmark_args* %1, %struct.worker_info* %2) {
%4 = alloca i32
%5 = alloca %struct.benchmark*
%6 = alloca %struct.benchmark_args*
%7 = alloca %struct.worker_info*
%8 = alloca i32
store %struct.benchmark* %0, %struct.benchmark** %5
store %struct.benchmark_args* %1, %struct.benchmark_args** %6
store %struct.worker_info* %2, %struct.worker_info** %7
%9 = load %struct.benchmark*, %struct.benchmark** %5
%10 = load %struct.benchmark_args*, %struct.benchmark_args** %6
%11 = load %struct.worker_info*, %struct.worker_info** %7
%12 = call i32 @map_common_init_worker(%struct.benchmark* %9, %struct.benchmark_args* %10, %struct.worker_info* %11)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %3
%16 = load i32, i32* %8
store i32 %16, i32* %4
br label %31
17: ; preds = %3
%18 = load %struct.benchmark*, %struct.benchmark** %5
%19 = load %struct.benchmark_args*, %struct.benchmark_args** %6
%20 = load %struct.worker_info*, %struct.worker_info** %7
%21 = call i32 @map_global_rand_keys_init(%struct.benchmark* %18, %struct.benchmark_args* %19, %struct.worker_info* %20)
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %17
br label %26
25: ; preds = %17
store i32 0, i32* %4
br label %31
26: ; preds = %24
%27 = load %struct.benchmark*, %struct.benchmark** %5
%28 = load %struct.benchmark_args*, %struct.benchmark_args** %6
%29 = load %struct.worker_info*, %struct.worker_info** %7
%30 = call i32 @map_common_free_worker(%struct.benchmark* %27, %struct.benchmark_args* %28, %struct.worker_info* %29)
store i32 -1, i32* %4
br label %31
31: ; preds = %26, %25, %15
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
%struct.benchmark = type { i32 }
%struct.benchmark_args = type { i32 }
%struct.worker_info = type { i32 }
define i32 @map_bench_get_init_worker(%struct.benchmark* %0, %struct.benchmark_args* %1, %struct.worker_info* %2) {
%4 = tail call i32 @map_common_init_worker(%struct.benchmark* %0, %struct.benchmark_args* %1, %struct.worker_info* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = tail call i32 @map_global_rand_keys_init(%struct.benchmark* %0, %struct.benchmark_args* %1, %struct.worker_info* %2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @map_common_free_worker(%struct.benchmark* %0, %struct.benchmark_args* %1, %struct.worker_info* %2)
br label %11
11: ; preds = %6, %3, %9
%12 = phi i32 [ -1, %9 ], [ %4, %3 ], [ 0, %6 ]
ret i32 %12
}