#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;
};

/* Variables and functions */
char *ic_string_contents(struct ic_string *);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char *, char *);
unsigned int ic_string_equal_char(struct ic_string *a, char *b) {
  char *a_ch = 0;
  if (!a) {
    puts("ic_string_equal_char: a was null");
    return 0;
  }
  if (!b) {
    puts("ic_string_equal_char: b was null");
    return 0;
  }
  a_ch = ic_string_contents(a);
  if (!a_ch) {
    puts("ic_string_equal_char: call to ic_string_contents failed");
    return 0;
  }
  if (0 == strcmp(a_ch, b)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<ic_string_equal_char>:
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    116b <ic_string_equal_char+0x3b>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ec <ic_string_equal_char+0xbc>
cmpq   $0x0,-0x18(%rbp)
jne    118e <ic_string_equal_char+0x5e>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ec <ic_string_equal_char+0xbc>
mov    -0x10(%rbp),%rdi
call   1050 <ic_string_contents@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11be <ic_string_equal_char+0x8e>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ec <ic_string_equal_char+0xbc>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11e5 <ic_string_equal_char+0xb5>
movl   $0x1,-0x4(%rbp)
jmp    11ec <ic_string_equal_char+0xbc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_string_equal_char>:
push   %rbx
test   %rdi,%rdi
je     1160 <ic_string_equal_char+0x30>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1169 <ic_string_equal_char+0x39>
call   1050 <ic_string_contents@plt>
test   %rax,%rax
je     1172 <ic_string_equal_char+0x42>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
lea    0xe99(%rip),%rdi
jmp    1179 <ic_string_equal_char+0x49>
lea    0xeb1(%rip),%rdi
jmp    1179 <ic_string_equal_char+0x49>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ic_string = type { i32 }
@.str = [33 x i8] c"ic_string_equal_char: a was null\00"
@.str.1 = [33 x i8] c"ic_string_equal_char: b was null\00"
@.str.2 = [56 x i8] c"ic_string_equal_char: call to ic_string_contents failed\00"
define i32 @ic_string_equal_char(%struct.ic_string* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.ic_string*
%5 = alloca i8*
%6 = alloca i8*
store %struct.ic_string* %0, %struct.ic_string** %4
store i8* %1, i8** %5
store i8* null, i8** %6
%7 = load %struct.ic_string*, %struct.ic_string** %4
%8 = icmp ne %struct.ic_string* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %30
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %30
16: ; preds = %11
%17 = load %struct.ic_string*, %struct.ic_string** %4
%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 ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %30
23: ; preds = %16
%24 = load i8*, i8** %6
%25 = load i8*, i8** %5
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp eq i64 0, %26
br i1 %27, label %28, label %29
28: ; preds = %23
store i32 1, i32* %3
br label %30
29: ; preds = %23
store i32 0, i32* %3
br label %30
30: ; preds = %29, %28, %21, %14, %9
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.ic_string = type { i32 }
@.str = [33 x i8] c"ic_string_equal_char: a was null\00"
@.str.1 = [33 x i8] c"ic_string_equal_char: b was null\00"
@.str.2 = [56 x i8] c"ic_string_equal_char: call to ic_string_contents failed\00"
define i32 @ic_string_equal_char(%struct.ic_string* %0, i8* %1) {
%3 = icmp eq %struct.ic_string* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %19
6: ; preds = %2
%7 = icmp eq i8* %1, null
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %19
10: ; preds = %6
%11 = tail call i8* @ic_string_contents(%struct.ic_string* %0)
%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 ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
br label %19
15: ; preds = %10
%16 = tail call i64 @strcmp(i8* %11, i8* %1)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %15, %13, %8, %4
%20 = phi i32 [ 0, %13 ], [ 0, %8 ], [ 0, %4 ], [ %18, %15 ]
ret i32 %20
}