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

/* Variables and functions */
scalar_t__ ic_kludge_get_decl_type(struct ic_kludge *, char *);
scalar_t__ ic_kludge_get_fdecl(struct ic_kludge *, char *);
scalar_t__ ic_scope_get(struct ic_scope *, char *);
int /*<<< orphan*/ puts(char *);
int ic_kludge_identifier_exists(struct ic_kludge *kludge,
                                struct ic_scope *scope, char *identifier) {
  if (!kludge) {
    puts("ic_kludge_identifier_exists: kludge was null");
    return -1;
  }
  if (!identifier) {
    puts("ic_kludge_identifier_exists: identifier was null");
    return -1;
  }
  if (scope) {
    if (ic_scope_get(scope, identifier)) {
      return 1;
    }
  }
  if (ic_kludge_get_decl_type(kludge, identifier)) {
    return 1;
  }
  if (ic_kludge_get_fdecl(kludge, identifier)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ic_kludge_identifier_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <ic_kludge_identifier_exists+0x37>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121a <ic_kludge_identifier_exists+0xda>
cmpq   $0x0,-0x20(%rbp)
jne    119a <ic_kludge_identifier_exists+0x5a>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121a <ic_kludge_identifier_exists+0xda>
cmpq   $0x0,-0x18(%rbp)
je     11cd <ic_kludge_identifier_exists+0x8d>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <ic_scope_get@plt>
cmp    $0x0,%rax
je     11c8 <ic_kludge_identifier_exists+0x88>
movl   $0x1,-0x4(%rbp)
jmp    121a <ic_kludge_identifier_exists+0xda>
jmp    11cd <ic_kludge_identifier_exists+0x8d>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <ic_kludge_get_decl_type@plt>
cmp    $0x0,%rax
je     11f0 <ic_kludge_identifier_exists+0xb0>
movl   $0x1,-0x4(%rbp)
jmp    121a <ic_kludge_identifier_exists+0xda>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <ic_kludge_get_fdecl@plt>
cmp    $0x0,%rax
je     1213 <ic_kludge_identifier_exists+0xd3>
movl   $0x1,-0x4(%rbp)
jmp    121a <ic_kludge_identifier_exists+0xda>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_kludge_identifier_exists>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11a1 <ic_kludge_identifier_exists+0x61>
mov    %rdx,%r14
test   %rdx,%rdx
je     11aa <ic_kludge_identifier_exists+0x6a>
mov    %rdi,%rbx
test   %rsi,%rsi
je     1171 <ic_kludge_identifier_exists+0x31>
mov    %rsi,%rdi
mov    %r14,%rsi
call   1050 <ic_scope_get@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11bb <ic_kludge_identifier_exists+0x7b>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <ic_kludge_get_decl_type@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    11bb <ic_kludge_identifier_exists+0x7b>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <ic_kludge_get_fdecl@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
jmp    11bb <ic_kludge_identifier_exists+0x7b>
lea    0xe58(%rip),%rdi
jmp    11b1 <ic_kludge_identifier_exists+0x71>
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ic_kludge = type { i32 }
%struct.ic_scope = type { i32 }
@.str = [45 x i8] c"ic_kludge_identifier_exists: kludge was null\00"
@.str.1 = [49 x i8] c"ic_kludge_identifier_exists: identifier was null\00"
define i32 @ic_kludge_identifier_exists(%struct.ic_kludge* %0, %struct.ic_scope* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.ic_kludge*
%6 = alloca %struct.ic_scope*
%7 = alloca i8*
store %struct.ic_kludge* %0, %struct.ic_kludge** %5
store %struct.ic_scope* %1, %struct.ic_scope** %6
store i8* %2, i8** %7
%8 = load %struct.ic_kludge*, %struct.ic_kludge** %5
%9 = icmp ne %struct.ic_kludge* %8, null
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = call i32 @puts(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %40
12: ; preds = %3
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %4
br label %40
17: ; preds = %12
%18 = load %struct.ic_scope*, %struct.ic_scope** %6
%19 = icmp ne %struct.ic_scope* %18, null
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load %struct.ic_scope*, %struct.ic_scope** %6
%22 = load i8*, i8** %7
%23 = call i64 @ic_scope_get(%struct.ic_scope* %21, i8* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 1, i32* %4
br label %40
26: ; preds = %20
br label %27
27: ; preds = %26, %17
%28 = load %struct.ic_kludge*, %struct.ic_kludge** %5
%29 = load i8*, i8** %7
%30 = call i64 @ic_kludge_get_decl_type(%struct.ic_kludge* %28, i8* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %27
store i32 1, i32* %4
br label %40
33: ; preds = %27
%34 = load %struct.ic_kludge*, %struct.ic_kludge** %5
%35 = load i8*, i8** %7
%36 = call i64 @ic_kludge_get_fdecl(%struct.ic_kludge* %34, i8* %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 1, i32* %4
br label %40
39: ; preds = %33
store i32 0, i32* %4
br label %40
40: ; preds = %39, %38, %32, %25, %15, %10
%41 = load i32, i32* %4
ret i32 %41
}

LLVM IR (-O2):
%struct.ic_kludge = type { i32 }
%struct.ic_scope = type { i32 }
@.str = [45 x i8] c"ic_kludge_identifier_exists: kludge was null\00"
@.str.1 = [49 x i8] c"ic_kludge_identifier_exists: identifier was null\00"
define i32 @ic_kludge_identifier_exists(%struct.ic_kludge* %0, %struct.ic_scope* %1, i8* %2) {
%4 = icmp eq %struct.ic_kludge* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %23
7: ; preds = %3
%8 = icmp eq i8* %2, null
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %23
11: ; preds = %7
%12 = icmp eq %struct.ic_scope* %1, null
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = tail call i64 @ic_scope_get(%struct.ic_scope* %1, i8* %2)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %13, %11
%17 = tail call i64 @ic_kludge_get_decl_type(%struct.ic_kludge* %0, i8* %2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = tail call i64 @ic_kludge_get_fdecl(%struct.ic_kludge* %0, i8* %2)
%21 = icmp ne i64 %20, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %19, %16, %13, %9, %5
%24 = phi i32 [ -1, %9 ], [ -1, %5 ], [ 1, %13 ], [ 1, %16 ], [ %22, %19 ]
ret i32 %24
}