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

/* Variables and functions */
int /*<<< orphan*/ indexDump(struct index *);
int /*<<< orphan*/ indexFree(struct index *);
struct index *indexNew(char *);
int /*<<< orphan*/ printf(char *, char *);
int db__hash_idx_craete(char *name) {
  struct index *hash_idx;
  hash_idx = indexNew(name);
  if (hash_idx) {
    indexDump(hash_idx);
    indexFree(hash_idx);
    printf("create hash index %s:succeed\n", name);
    return 87;
  } else {
    printf("create hash index %s:failed\n", name);
    return -1;
  }
}


x86 assembly (clang, -O0):
<db__hash_idx_craete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <indexNew@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1192 <db__hash_idx_craete+0x52>
mov    -0x18(%rbp),%rdi
call   1030 <indexDump@plt>
mov    -0x18(%rbp),%rdi
call   1050 <indexFree@plt>
mov    -0x10(%rbp),%rsi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
movl   $0x57,-0x4(%rbp)
jmp    11a9 <db__hash_idx_craete+0x69>
mov    -0x10(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db__hash_idx_craete>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1060 <indexNew@plt>
test   %rax,%rax
je     1171 <db__hash_idx_craete+0x31>
mov    %rax,%rbp
mov    %rax,%rdi
call   1030 <indexDump@plt>
mov    %rbp,%rdi
call   1050 <indexFree@plt>
mov    $0x57,%ebp
lea    0xe91(%rip),%rdi
jmp    117d <db__hash_idx_craete+0x3d>
mov    $0xffffffff,%ebp
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.index = type { i32 }
@.str = [30 x i8] c"create hash index %s:succeed\0A\00"
@.str.1 = [29 x i8] c"create hash index %s:failed\0A\00"
define i32 @db__hash_idx_craete(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.index*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call %struct.index* @indexNew(i8* %5)
store %struct.index* %6, %struct.index** %4
%7 = load %struct.index*, %struct.index** %4
%8 = icmp ne %struct.index* %7, null
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load %struct.index*, %struct.index** %4
%11 = call i32 @indexDump(%struct.index* %10)
%12 = load %struct.index*, %struct.index** %4
%13 = call i32 @indexFree(%struct.index* %12)
%14 = load i8*, i8** %3
%15 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 87, i32* %2
br label %19
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %17)
store i32 -1, i32* %2
br label %19
19: ; preds = %16, %9
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
%struct.index = type { i32 }
@.str = [30 x i8] c"create hash index %s:succeed\0A\00"
@.str.1 = [29 x i8] c"create hash index %s:failed\0A\00"
define i32 @db__hash_idx_craete(i8* %0) {
%2 = tail call %struct.index* @indexNew(i8* %0)
%3 = icmp eq %struct.index* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @indexDump(%struct.index* %2)
%6 = tail call i32 @indexFree(%struct.index* %2)
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), %1 ]
%9 = phi i32 [ 87, %4 ], [ -1, %1 ]
%10 = tail call i32 @printf(i8* %8, i8* %0)
ret i32 %9
}