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

/* Variables and functions */
struct ic_symbol *ic_kludge_get_operator(struct ic_kludge *, char *);
char *ic_symbol_contents(struct ic_symbol *);
int /*<<< orphan*/ puts(char *);
struct ic_symbol *ic_kludge_get_operator_from_symbol(struct ic_kludge *kludge,
                                                     struct ic_symbol *symbol) {
  struct ic_symbol *result = 0;
  char *str = 0;
  if (!kludge) {
    puts("ic_kludge_get_operator: kludge was null");
    return 0;
  }
  if (!symbol) {
    puts("ic_kludge_get_operator: symbol was null");
    return 0;
  }
  str = ic_symbol_contents(symbol);
  if (!str) {
    puts("ic_kludge_get_operator: call to ic_symbol_contents failed");
    return 0;
  }
  result = ic_kludge_get_operator(kludge, str);
  if (!result) {
    puts("ic_kludge_get_operator: call to ic_kludge_get_operator failed");
    return 0;
  }
  return result;
}


x86 assembly (clang, -O0):
<ic_kludge_get_operator_from_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1174 <ic_kludge_get_operator_from_symbol+0x44>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    1206 <ic_kludge_get_operator_from_symbol+0xd6>
cmpq   $0x0,-0x18(%rbp)
jne    1198 <ic_kludge_get_operator_from_symbol+0x68>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    1206 <ic_kludge_get_operator_from_symbol+0xd6>
mov    -0x18(%rbp),%rdi
call   1050 <ic_symbol_contents@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11c9 <ic_kludge_get_operator_from_symbol+0x99>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    1206 <ic_kludge_get_operator_from_symbol+0xd6>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <ic_kludge_get_operator@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11fe <ic_kludge_get_operator_from_symbol+0xce>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    1206 <ic_kludge_get_operator_from_symbol+0xd6>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_kludge_get_operator_from_symbol>:
push   %rbx
test   %rdi,%rdi
je     115d <ic_kludge_get_operator_from_symbol+0x2d>
test   %rsi,%rsi
je     1166 <ic_kludge_get_operator_from_symbol+0x36>
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1050 <ic_symbol_contents@plt>
test   %rax,%rax
je     116f <ic_kludge_get_operator_from_symbol+0x3f>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <ic_kludge_get_operator@plt>
test   %rax,%rax
je     1178 <ic_kludge_get_operator_from_symbol+0x48>
pop    %rbx
ret
lea    0xe9c(%rip),%rdi
jmp    117f <ic_kludge_get_operator_from_symbol+0x4f>
lea    0xebb(%rip),%rdi
jmp    117f <ic_kludge_get_operator_from_symbol+0x4f>
lea    0xeda(%rip),%rdi
jmp    117f <ic_kludge_get_operator_from_symbol+0x4f>
lea    0xf0b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

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

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