#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_string {
  int dummy;
};
struct ic_kludge {
  int dummy;
};
struct ic_decl_func {
  int dummy;
};

/* Variables and functions */
struct ic_decl_func *ic_kludge_get_fdecl(struct ic_kludge *, char *);
char *ic_string_contents(struct ic_string *);
int /*<<< orphan*/ puts(char *);
struct ic_decl_func *ic_kludge_get_fdecl_from_string(struct ic_kludge *kludge,
                                                     struct ic_string *fdecl) {
  char *fdecl_str = 0;
  if (!kludge) {
    puts("ic_kludge_get_fdecl_from_string: kludge was null");
    return 0;
  }
  if (!fdecl) {
    puts("ic_kludge_get_fdecl_from_string: fdecl was null");
    return 0;
  }
  fdecl_str = ic_string_contents(fdecl);
  if (!fdecl_str) {
    puts("ic_kludge_get_fdecl_from_string: call to ic_string_contents failed");
    return 0;
  }
  return ic_kludge_get_fdecl(kludge, fdecl_str);
}


x86 assembly (clang, -O0):
<ic_kludge_get_fdecl_from_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116c <ic_kludge_get_fdecl_from_string+0x3c>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d2 <ic_kludge_get_fdecl_from_string+0xa2>
cmpq   $0x0,-0x18(%rbp)
jne    1190 <ic_kludge_get_fdecl_from_string+0x60>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d2 <ic_kludge_get_fdecl_from_string+0xa2>
mov    -0x18(%rbp),%rdi
call   1040 <ic_string_contents@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11c1 <ic_kludge_get_fdecl_from_string+0x91>
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    11d2 <ic_kludge_get_fdecl_from_string+0xa2>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <ic_kludge_get_fdecl@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ic_decl_func = type { i32 }
%struct.ic_kludge = type { i32 }
%struct.ic_string = type { i32 }
@.str = [49 x i8] c"ic_kludge_get_fdecl_from_string: kludge was null\00"
@.str.1 = [48 x i8] c"ic_kludge_get_fdecl_from_string: fdecl was null\00"
@.str.2 = [67 x i8] c"ic_kludge_get_fdecl_from_string: call to ic_string_contents failed\00"
define %struct.ic_decl_func* @ic_kludge_get_fdecl_from_string(%struct.ic_kludge* %0, %struct.ic_string* %1) {
%3 = alloca %struct.ic_decl_func*
%4 = alloca %struct.ic_kludge*
%5 = alloca %struct.ic_string*
%6 = alloca i8*
store %struct.ic_kludge* %0, %struct.ic_kludge** %4
store %struct.ic_string* %1, %struct.ic_string** %5
store i8* null, i8** %6
%7 = load %struct.ic_kludge*, %struct.ic_kludge** %4
%8 = icmp ne %struct.ic_kludge* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store %struct.ic_decl_func* null, %struct.ic_decl_func** %3
br label %27
11: ; preds = %2
%12 = load %struct.ic_string*, %struct.ic_string** %5
%13 = icmp ne %struct.ic_string* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
store %struct.ic_decl_func* null, %struct.ic_decl_func** %3
br label %27
16: ; preds = %11
%17 = load %struct.ic_string*, %struct.ic_string** %5
%18 = call i8* @ic_string_contents(%struct.ic_string* %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = call i32 @puts(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
store %struct.ic_decl_func* null, %struct.ic_decl_func** %3
br label %27
23: ; preds = %16
%24 = load %struct.ic_kludge*, %struct.ic_kludge** %4
%25 = load i8*, i8** %6
%26 = call %struct.ic_decl_func* @ic_kludge_get_fdecl(%struct.ic_kludge* %24, i8* %25)
store %struct.ic_decl_func* %26, %struct.ic_decl_func** %3
br label %27
27: ; preds = %23, %21, %14, %9
%28 = load %struct.ic_decl_func*, %struct.ic_decl_func** %3
ret %struct.ic_decl_func* %28
}

LLVM IR (-O2):
%struct.ic_decl_func = type { i32 }
%struct.ic_kludge = type { i32 }
%struct.ic_string = type { i32 }
@.str = [49 x i8] c"ic_kludge_get_fdecl_from_string: kludge was null\00"
@.str.1 = [48 x i8] c"ic_kludge_get_fdecl_from_string: fdecl was null\00"
@.str.2 = [67 x i8] c"ic_kludge_get_fdecl_from_string: call to ic_string_contents failed\00"
define %struct.ic_decl_func* @ic_kludge_get_fdecl_from_string(%struct.ic_kludge* %0, %struct.ic_string* %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 ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %17
6: ; preds = %2
%7 = icmp eq %struct.ic_string* %1, null
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
br label %17
10: ; preds = %6
%11 = tail call i8* @ic_string_contents(%struct.ic_string* %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 ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %17
15: ; preds = %10
%16 = tail call %struct.ic_decl_func* @ic_kludge_get_fdecl(%struct.ic_kludge* %0, i8* %11)
br label %17
17: ; preds = %15, %13, %8, %4
%18 = phi %struct.ic_decl_func* [ %16, %15 ], [ null, %13 ], [ null, %8 ], [ null, %4 ]
ret %struct.ic_decl_func* %18
}