#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 ic_symbol {
  int dummy;
};
struct ic_scope {
  int dummy;
};

/* Variables and functions */
unsigned int ic_scope_insert(struct ic_scope *, char *, void *);
char *ic_symbol_contents(struct ic_symbol *);
int /*<<< orphan*/ puts(char *);
unsigned int ic_scope_insert_symbol(struct ic_scope *scope,
                                    struct ic_symbol *key, void *data) {
  char *key_chars = 0;
  if (!scope) {
    puts("ic_scope_insert_symbol: scope was null");
    return 0;
  }
  if (!key) {
    puts("ic_scope_insert_symbol: key was null");
    return 0;
  }
  key_chars = ic_symbol_contents(key);
  if (!key_chars) {
    puts("ic_scope_insert_symbol: call to ic_symbol_contents failed");
    return 0;
  }
  return ic_scope_insert(scope, key_chars, data);
}


x86 assembly (clang, -O0):
<ic_scope_insert_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <ic_scope_insert_symbol+0x3f>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <ic_scope_insert_symbol+0xa6>
cmpq   $0x0,-0x18(%rbp)
jne    1192 <ic_scope_insert_symbol+0x62>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <ic_scope_insert_symbol+0xa6>
mov    -0x18(%rbp),%rdi
call   1040 <ic_symbol_contents@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11c2 <ic_scope_insert_symbol+0x92>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <ic_scope_insert_symbol+0xa6>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <ic_scope_insert@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_scope_insert_symbol>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1166 <ic_scope_insert_symbol+0x36>
test   %rsi,%rsi
je     116f <ic_scope_insert_symbol+0x3f>
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <ic_symbol_contents@plt>
test   %rax,%rax
je     1178 <ic_scope_insert_symbol+0x48>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ic_scope_insert@plt>
lea    0xe93(%rip),%rdi
jmp    117f <ic_scope_insert_symbol+0x4f>
lea    0xeb1(%rip),%rdi
jmp    117f <ic_scope_insert_symbol+0x4f>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ic_scope = type { i32 }
%struct.ic_symbol = type { i32 }
@.str = [39 x i8] c"ic_scope_insert_symbol: scope was null\00"
@.str.1 = [37 x i8] c"ic_scope_insert_symbol: key was null\00"
@.str.2 = [58 x i8] c"ic_scope_insert_symbol: call to ic_symbol_contents failed\00"
define i32 @ic_scope_insert_symbol(%struct.ic_scope* %0, %struct.ic_symbol* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.ic_scope*
%6 = alloca %struct.ic_symbol*
%7 = alloca i8*
%8 = alloca i8*
store %struct.ic_scope* %0, %struct.ic_scope** %5
store %struct.ic_symbol* %1, %struct.ic_symbol** %6
store i8* %2, i8** %7
store i8* null, i8** %8
%9 = load %struct.ic_scope*, %struct.ic_scope** %5
%10 = icmp ne %struct.ic_scope* %9, null
br i1 %10, label %13, label %11
11: ; preds = %3
%12 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %30
13: ; preds = %3
%14 = load %struct.ic_symbol*, %struct.ic_symbol** %6
%15 = icmp ne %struct.ic_symbol* %14, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %30
18: ; preds = %13
%19 = load %struct.ic_symbol*, %struct.ic_symbol** %6
%20 = call i8* @ic_symbol_contents(%struct.ic_symbol* %19)
store i8* %20, i8** %8
%21 = load i8*, i8** %8
%22 = icmp ne i8* %21, null
br i1 %22, label %25, label %23
23: ; preds = %18
%24 = call i32 @puts(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %30
25: ; preds = %18
%26 = load %struct.ic_scope*, %struct.ic_scope** %5
%27 = load i8*, i8** %8
%28 = load i8*, i8** %7
%29 = call i32 @ic_scope_insert(%struct.ic_scope* %26, i8* %27, i8* %28)
store i32 %29, i32* %4
br label %30
30: ; preds = %25, %23, %16, %11
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
%struct.ic_scope = type { i32 }
%struct.ic_symbol = type { i32 }
@.str = [39 x i8] c"ic_scope_insert_symbol: scope was null\00"
@.str.1 = [37 x i8] c"ic_scope_insert_symbol: key was null\00"
@.str.2 = [58 x i8] c"ic_scope_insert_symbol: call to ic_symbol_contents failed\00"
define i32 @ic_scope_insert_symbol(%struct.ic_scope* %0, %struct.ic_symbol* %1, i8* %2) {
%4 = icmp eq %struct.ic_scope* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %18
7: ; preds = %3
%8 = icmp eq %struct.ic_symbol* %1, null
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %18
11: ; preds = %7
%12 = tail call i8* @ic_symbol_contents(%struct.ic_symbol* %1)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = tail call i32 @ic_scope_insert(%struct.ic_scope* %0, i8* %12, i8* %2)
br label %18
18: ; preds = %16, %14, %9, %5
%19 = phi i32 [ %17, %16 ], [ 0, %14 ], [ 0, %9 ], [ 0, %5 ]
ret i32 %19
}