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

/* Variables and functions */
int bplus_tree_get(struct bplus_tree *, int);
int /*<<< orphan*/ bplus_tree_put(struct bplus_tree *, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
void _proc(struct bplus_tree *tree, char op, int n) {
  switch (op) {
  case 'i':
    bplus_tree_put(tree, n, n);
    break;
  case 'r':
    bplus_tree_put(tree, n, 0);
    break;
  case 'f':
    fprintf(stderr, "key:%d data:%d\n", n, bplus_tree_get(tree, n));
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<_proc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x66,%eax
je     11a3 <_proc+0x73>
jmp    115a <_proc+0x2a>
mov    -0x14(%rbp),%eax
sub    $0x69,%eax
je     117c <_proc+0x4c>
jmp    116b <_proc+0x3b>
mov    -0x14(%rbp),%eax
sub    $0x72,%eax
je     1190 <_proc+0x60>
jmp    11da <_proc+0xaa>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <bplus_tree_put@plt>
jmp    11df <_proc+0xaf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
xor    %edx,%edx
call   1030 <bplus_tree_put@plt>
jmp    11df <_proc+0xaf>
mov    0x2e36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1050 <bplus_tree_get@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
lea    0xe30(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11df <_proc+0xaf>
jmp    11df <_proc+0xaf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_proc>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
cmp    $0x66,%esi
je     114a <_proc+0x1a>
cmp    $0x72,%esi
je     1172 <_proc+0x42>
cmp    $0x69,%esi
jne    1181 <_proc+0x51>
mov    %ebx,%esi
mov    %ebx,%edx
jmp    1176 <_proc+0x46>
mov    0x2e8f(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%esi
call   1050 <bplus_tree_get@plt>
lea    0xe9f(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>
mov    %ebx,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <bplus_tree_put@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.bplus_tree = type { i32 }
@stderr = global i32 0
@.str = [16 x i8] c"key:%d data:%d\0A\00"
define void @_proc(%struct.bplus_tree* %0, i8 signext %1, i32 %2) {
%4 = alloca %struct.bplus_tree*
%5 = alloca i8
%6 = alloca i32
store %struct.bplus_tree* %0, %struct.bplus_tree** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
switch i32 %8, label %25 [
i32 105, label %9
i32 114, label %14
i32 102, label %18
]
9: ; preds = %3
%10 = load %struct.bplus_tree*, %struct.bplus_tree** %4
%11 = load i32, i32* %6
%12 = load i32, i32* %6
%13 = call i32 @bplus_tree_put(%struct.bplus_tree* %10, i32 %11, i32 %12)
br label %26
14: ; preds = %3
%15 = load %struct.bplus_tree*, %struct.bplus_tree** %4
%16 = load i32, i32* %6
%17 = call i32 @bplus_tree_put(%struct.bplus_tree* %15, i32 %16, i32 0)
br label %26
18: ; preds = %3
%19 = load i32, i32* @stderr
%20 = load i32, i32* %6
%21 = load %struct.bplus_tree*, %struct.bplus_tree** %4
%22 = load i32, i32* %6
%23 = call i32 @bplus_tree_get(%struct.bplus_tree* %21, i32 %22)
%24 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %23)
br label %26
25: ; preds = %3
br label %26
26: ; preds = %25, %18, %14, %9
ret void
}

LLVM IR (-O2):
%struct.bplus_tree = type { i32 }
@stderr = global i32 0
@.str = [16 x i8] c"key:%d data:%d\0A\00"
define void @_proc(%struct.bplus_tree* %0, i8 signext %1, i32 %2) {
%4 = sext i8 %1 to i32
switch i32 %4, label %13 [
i32 105, label %5
i32 114, label %7
i32 102, label %9
]
5: ; preds = %3
%6 = tail call i32 @bplus_tree_put(%struct.bplus_tree* %0, i32 %2, i32 %2)
br label %13
7: ; preds = %3
%8 = tail call i32 @bplus_tree_put(%struct.bplus_tree* %0, i32 %2, i32 0)
br label %13
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = tail call i32 @bplus_tree_get(%struct.bplus_tree* %0, i32 %2)
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %11)
br label %13
13: ; preds = %3, %9, %7, %5
ret void
}