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

/* Variables and functions */
int /*<<< orphan*/ cbt_add(struct cbtree **, int /*<<< orphan*/, char);
struct cbtree *cbt_new(int);
char cbt_remove(struct cbtree **, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ stderr;
int main() {
  struct cbtree *root = cbt_new(4);
  cbt_add(&root, 0, 'a');
  char ret = cbt_remove(&root, 0);
  if (ret != 'a')
    fprintf(stderr, "Remove failed, expected a, got: %c", ret);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <cbt_new@plt>
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x61,%edx
call   1060 <cbt_add@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <cbt_remove@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x61,%eax
je     11a1 <main+0x61>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
movsbl -0x11(%rbp),%edx
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <cbt_new@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x61,%edx
call   1060 <cbt_add@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <cbt_remove@plt>
cmp    $0x61,%al
je     118e <main+0x4e>
mov    0x2e63(%rip),%rcx
mov    (%rcx),%edi
movsbl %al,%edx
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.cbtree = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"Remove failed, expected a, got: %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.cbtree*
%3 = alloca i8
store i32 0, i32* %1
%4 = call %struct.cbtree* @cbt_new(i32 4)
store %struct.cbtree* %4, %struct.cbtree** %2
%5 = call i32 @cbt_add(%struct.cbtree** %2, i32 0, i8 signext 97)
%6 = call signext i8 @cbt_remove(%struct.cbtree** %2, i32 0)
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 97
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = load i8, i8* %3
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext %12)
br label %14
14: ; preds = %10, %0
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
%struct.cbtree = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"Remove failed, expected a, got: %c\00"
define i32 @main() {
%1 = alloca %struct.cbtree*
%2 = bitcast %struct.cbtree** %1 to i8*
%3 = tail call %struct.cbtree* @cbt_new(i32 4)
store %struct.cbtree* %3, %struct.cbtree** %1
%4 = call i32 @cbt_add(%struct.cbtree** %1, i32 0, i8 signext 97)
%5 = call signext i8 @cbt_remove(%struct.cbtree** %1, i32 0)
%6 = icmp eq i8 %5, 97
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 signext %5)
br label %10
10: ; preds = %7, %0
ret i32 0
}