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

/* Variables and functions */
struct ic_decl_type *ic_kludge_get_decl_type(struct ic_kludge *, char *);
char *ic_symbol_contents(struct ic_symbol *);
int /*<<< orphan*/ puts(char *);
struct ic_decl_type *
ic_kludge_get_decl_type_from_symbol(struct ic_kludge *kludge,
                                    struct ic_symbol *type) {
  char *type_str = 0;
  struct ic_decl_type *tdecl = 0;
  if (!kludge) {
    puts("ic_kludge_get_decl_type_from_symbol: kludge was null");
    return 0;
  }
  if (!type) {
    puts("ic_kludge_get_decl_type_from_symbol: type was null");
    return 0;
  }
  type_str = ic_symbol_contents(type);
  if (!type_str) {
    puts("ic_kludge_get_decl_type_from_symbol: call to ic_symbol_contents "
         "failed");
    return 0;
  }
  tdecl = ic_kludge_get_decl_type(kludge, type_str);
  if (!tdecl) {
    return 0;
  }
  return tdecl;
}


x86 assembly (clang, -O0):
<ic_kludge_get_decl_type_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_decl_type_from_symbol+0x44>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11fa <ic_kludge_get_decl_type_from_symbol+0xca>
cmpq   $0x0,-0x18(%rbp)
jne    1198 <ic_kludge_get_decl_type_from_symbol+0x68>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11fa <ic_kludge_get_decl_type_from_symbol+0xca>
mov    -0x18(%rbp),%rdi
call   1050 <ic_symbol_contents@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c9 <ic_kludge_get_decl_type_from_symbol+0x99>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11fa <ic_kludge_get_decl_type_from_symbol+0xca>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <ic_kludge_get_decl_type@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11f2 <ic_kludge_get_decl_type_from_symbol+0xc2>
movq   $0x0,-0x8(%rbp)
jmp    11fa <ic_kludge_get_decl_type_from_symbol+0xca>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_kludge_get_decl_type_from_symbol>:
push   %rbx
test   %rdi,%rdi
je     1157 <ic_kludge_get_decl_type_from_symbol+0x27>
test   %rsi,%rsi
je     1160 <ic_kludge_get_decl_type_from_symbol+0x30>
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1050 <ic_symbol_contents@plt>
test   %rax,%rax
je     1169 <ic_kludge_get_decl_type_from_symbol+0x39>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <ic_kludge_get_decl_type@plt>
lea    0xea2(%rip),%rdi
jmp    1170 <ic_kludge_get_decl_type_from_symbol+0x40>
lea    0xece(%rip),%rdi
jmp    1170 <ic_kludge_get_decl_type_from_symbol+0x40>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ic_decl_type = type { i32 }
%struct.ic_kludge = type { i32 }
%struct.ic_symbol = type { i32 }
@.str = [53 x i8] c"ic_kludge_get_decl_type_from_symbol: kludge was null\00"
@.str.1 = [51 x i8] c"ic_kludge_get_decl_type_from_symbol: type was null\00"
@.str.2 = [71 x i8] c"ic_kludge_get_decl_type_from_symbol: call to ic_symbol_contents failed\00"
define %struct.ic_decl_type* @ic_kludge_get_decl_type_from_symbol(%struct.ic_kludge* %0, %struct.ic_symbol* %1) {
%3 = alloca %struct.ic_decl_type*
%4 = alloca %struct.ic_kludge*
%5 = alloca %struct.ic_symbol*
%6 = alloca i8*
%7 = alloca %struct.ic_decl_type*
store %struct.ic_kludge* %0, %struct.ic_kludge** %4
store %struct.ic_symbol* %1, %struct.ic_symbol** %5
store i8* null, i8** %6
store %struct.ic_decl_type* null, %struct.ic_decl_type** %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 ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
store %struct.ic_decl_type* null, %struct.ic_decl_type** %3
br label %33
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 ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
store %struct.ic_decl_type* null, %struct.ic_decl_type** %3
br label %33
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** %6
%20 = load i8*, i8** %6
%21 = icmp ne i8* %20, null
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = call i32 @puts(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
store %struct.ic_decl_type* null, %struct.ic_decl_type** %3
br label %33
24: ; preds = %17
%25 = load %struct.ic_kludge*, %struct.ic_kludge** %4
%26 = load i8*, i8** %6
%27 = call %struct.ic_decl_type* @ic_kludge_get_decl_type(%struct.ic_kludge* %25, i8* %26)
store %struct.ic_decl_type* %27, %struct.ic_decl_type** %7
%28 = load %struct.ic_decl_type*, %struct.ic_decl_type** %7
%29 = icmp ne %struct.ic_decl_type* %28, null
br i1 %29, label %31, label %30
30: ; preds = %24
store %struct.ic_decl_type* null, %struct.ic_decl_type** %3
br label %33
31: ; preds = %24
%32 = load %struct.ic_decl_type*, %struct.ic_decl_type** %7
store %struct.ic_decl_type* %32, %struct.ic_decl_type** %3
br label %33
33: ; preds = %31, %30, %22, %15, %10
%34 = load %struct.ic_decl_type*, %struct.ic_decl_type** %3
ret %struct.ic_decl_type* %34
}

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