#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 */

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
void rp_write_retval(int ret, char *b) {
  switch (ret) {
  case (0x345):
    strcpy(b, "OK");
    break;
  case (0x678):
    strcpy(b, "E00");
    break;
  case (0x9ab):
    *b = '\0';
    break;
  default:
    assert(0);
    break;
  }
}


x86 assembly (clang, -O0):
<rp_write_retval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x345,%eax
je     116b <rp_write_retval+0x4b>
jmp    1145 <rp_write_retval+0x25>
mov    -0x14(%rbp),%eax
sub    $0x678,%eax
je     1180 <rp_write_retval+0x60>
jmp    1158 <rp_write_retval+0x38>
mov    -0x14(%rbp),%eax
sub    $0x9ab,%eax
je     1195 <rp_write_retval+0x75>
jmp    11a1 <rp_write_retval+0x81>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11a8 <rp_write_retval+0x88>
mov    -0x10(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11a8 <rp_write_retval+0x88>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11a8 <rp_write_retval+0x88>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rp_write_retval>:
cmp    $0x9ab,%edi
je     1141 <rp_write_retval+0x21>
cmp    $0x678,%edi
je     1145 <rp_write_retval+0x25>
cmp    $0x345,%edi
jne    1157 <rp_write_retval+0x37>
lea    0xec1(%rip),%rax
jmp    114c <rp_write_retval+0x2c>
movb   $0x0,(%rsi)
ret
lea    0xeb7(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <strcpy@plt>
xor    %edi,%edi
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"OK\00"
@.str.1 = [4 x i8] c"E00\00"
define void @rp_write_retval(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %14 [
i32 837, label %6
i32 1656, label %9
i32 2475, label %12
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %16
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %16
12: ; preds = %2
%13 = load i8*, i8** %4
store i8 0, i8* %13
br label %16
14: ; preds = %2
%15 = call i32 @assert(i32 0)
br label %16
16: ; preds = %14, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
@.str.1 = [4 x i8] c"E00\00"
define void @rp_write_retval(i32 %0, i8* %1) {
switch i32 %0, label %8 [
i32 837, label %3
i32 1656, label %5
i32 2475, label %7
]
3: ; preds = %2
%4 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %10
5: ; preds = %2
%6 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %10
7: ; preds = %2
store i8 0, i8* %1
br label %10
8: ; preds = %2
%9 = tail call i32 @assert(i32 0)
br label %10
10: ; preds = %8, %7, %5, %3
ret void
}