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

/* Variables and functions */
struct string_pool *string_pool_create();
int /*<<< orphan*/ string_pool_load(struct string_pool *, char const *);
struct string_pool *string_pool_create_and_load(const char *filename) {
  struct string_pool *sp;
  if (!(sp = string_pool_create()))
    return NULL;
  if (!string_pool_load(sp, filename))
    return NULL;
  return sp;
}


x86 assembly (clang, -O0):
<string_pool_create_and_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <string_pool_create@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    114e <string_pool_create_and_load+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    1179 <string_pool_create_and_load+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <string_pool_load@plt>
cmp    $0x0,%eax
jne    1171 <string_pool_create_and_load+0x51>
movq   $0x0,-0x8(%rbp)
jmp    1179 <string_pool_create_and_load+0x59>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_pool_create_and_load>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <string_pool_create@plt>
test   %rax,%rax
je     114c <string_pool_create_and_load+0x2c>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r15,%rsi
call   1040 <string_pool_load@plt>
xor    %ebx,%ebx
test   %eax,%eax
cmovne %r14,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.string_pool = type { i32 }
define %struct.string_pool* @string_pool_create_and_load(i8* %0) {
%2 = alloca %struct.string_pool*
%3 = alloca i8*
%4 = alloca %struct.string_pool*
store i8* %0, i8** %3
%5 = call %struct.string_pool* (...) @string_pool_create()
store %struct.string_pool* %5, %struct.string_pool** %4
%6 = icmp ne %struct.string_pool* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store %struct.string_pool* null, %struct.string_pool** %2
br label %16
8: ; preds = %1
%9 = load %struct.string_pool*, %struct.string_pool** %4
%10 = load i8*, i8** %3
%11 = call i32 @string_pool_load(%struct.string_pool* %9, i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %8
store %struct.string_pool* null, %struct.string_pool** %2
br label %16
14: ; preds = %8
%15 = load %struct.string_pool*, %struct.string_pool** %4
store %struct.string_pool* %15, %struct.string_pool** %2
br label %16
16: ; preds = %14, %13, %7
%17 = load %struct.string_pool*, %struct.string_pool** %2
ret %struct.string_pool* %17
}

LLVM IR (-O2):
%struct.string_pool = type { i32 }
define %struct.string_pool* @string_pool_create_and_load(i8* %0) {
%2 = tail call %struct.string_pool* (...) @string_pool_create()
%3 = icmp eq %struct.string_pool* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @string_pool_load(%struct.string_pool* %2, i8* %0)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, %struct.string_pool* null, %struct.string_pool* %2
br label %8
8: ; preds = %4, %1
%9 = phi %struct.string_pool* [ null, %1 ], [ %7, %4 ]
ret %struct.string_pool* %9
}