#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 sendString(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int sendStatusLine(int statusCode) {
  char statusLine[16 + 1];
  switch (statusCode) {
  case 00:
    sprintf(statusLine, "%2d", 00);
    break;
  case 01:
    sprintf(statusLine, "%2d", 01);
    break;
  case -1:
    sprintf(statusLine, "%2d", -1);
    break;
  case -2:
    sprintf(statusLine, "%2d", -2);
    break;
  case -4:
    sprintf(statusLine, "%2d", -4);
    break;
  case -5:
    sprintf(statusLine, "%2d", -5);
    break;
  default:
    sprintf(statusLine, "%2d", -3);
    break;
  }
  statusLine[2] = ' ';
  switch (statusCode) {
  case 00:
    strcpy(&statusLine[3], "Ok");
    break;
  case 01:
    strcpy(&statusLine[3], "Created");
    break;
  case -1:
    strcpy(&statusLine[3], "Bad Request");
    break;
  case -2:
    strcpy(&statusLine[3], "Not Created");
    break;
  case -4:
    strcpy(&statusLine[3], "Conflict");
    break;
  case -5:
    strcpy(&statusLine[3], "Forbidden");
    break;
  default:
    strcpy(&statusLine[3], "Server Error");
    break;
  }
  statusLine[15] = '\n';
  statusLine[16] = '\0';
  return sendString(statusLine);
}


x86 assembly (clang, -O0):
<sendStatusLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x6,%eax
ja     11fd <sendStatusLine+0xcd>
mov    -0x28(%rbp),%rax
lea    0xea5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x20(%rbp),%rdi
lea    0xec9(%rip),%rsi
xor    %edx,%edx
call   1050 <sprintf@plt>
jmp    1212 <sendStatusLine+0xe2>
lea    -0x20(%rbp),%rdi
lea    0xeb2(%rip),%rsi
mov    $0x1,%edx
call   1050 <sprintf@plt>
jmp    1212 <sendStatusLine+0xe2>
lea    -0x20(%rbp),%rdi
lea    0xe98(%rip),%rsi
mov    $0xffffffff,%edx
call   1050 <sprintf@plt>
jmp    1212 <sendStatusLine+0xe2>
lea    -0x20(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0xfffffffe,%edx
call   1050 <sprintf@plt>
jmp    1212 <sendStatusLine+0xe2>
lea    -0x20(%rbp),%rdi
lea    0xe64(%rip),%rsi
mov    $0xfffffffc,%edx
call   1050 <sprintf@plt>
jmp    1212 <sendStatusLine+0xe2>
lea    -0x20(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0xfffffffb,%edx
call   1050 <sprintf@plt>
jmp    1212 <sendStatusLine+0xe2>
lea    -0x20(%rbp),%rdi
lea    0xe30(%rip),%rsi
mov    $0xfffffffd,%edx
call   1050 <sprintf@plt>
movb   $0x20,-0x1e(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x6,%eax
ja     12d5 <sendStatusLine+0x1a5>
mov    -0x30(%rbp),%rax
lea    0xde6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xdee(%rip),%rsi
call   1040 <strcpy@plt>
jmp    12e9 <sendStatusLine+0x1b9>
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xde8(%rip),%rsi
call   1040 <strcpy@plt>
jmp    12e9 <sendStatusLine+0x1b9>
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xdbf(%rip),%rsi
call   1040 <strcpy@plt>
jmp    12e9 <sendStatusLine+0x1b9>
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xdb2(%rip),%rsi
call   1040 <strcpy@plt>
jmp    12e9 <sendStatusLine+0x1b9>
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xda5(%rip),%rsi
call   1040 <strcpy@plt>
jmp    12e9 <sendStatusLine+0x1b9>
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xd95(%rip),%rsi
call   1040 <strcpy@plt>
jmp    12e9 <sendStatusLine+0x1b9>
lea    -0x20(%rbp),%rdi
add    $0x3,%rdi
lea    0xd86(%rip),%rsi
call   1040 <strcpy@plt>
movb   $0xa,-0x11(%rbp)
movb   $0x0,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <sendString@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendStatusLine>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%edx
lea    0x5(%rdx),%eax
cmp    $0x6,%eax
ja     1153 <sendStatusLine+0x23>
cltq
lea    0xef6(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    115f <sendStatusLine+0x2f>
lea    0xed8(%rip),%rbx
mov    $0xfffffffd,%edx
lea    0xe9a(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <sprintf@plt>
movb   $0x20,0x2(%rsp)
lea    0x3(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
movw   $0xa,0xf(%rsp)
mov    %r14,%rdi
call   1030 <sendString@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%2d\00"
@.str.1 = [3 x i8] c"Ok\00"
@.str.2 = [8 x i8] c"Created\00"
@.str.3 = [12 x i8] c"Bad Request\00"
@.str.4 = [12 x i8] c"Not Created\00"
@.str.5 = [9 x i8] c"Conflict\00"
@.str.6 = [10 x i8] c"Forbidden\00"
@.str.7 = [13 x i8] c"Server Error\00"
define i32 @sendStatusLine(i32 %0) {
%2 = alloca i32
%3 = alloca [17 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %23 [
i32 0, label %5
i32 1, label %8
i32 -1, label %11
i32 -2, label %14
i32 -4, label %17
i32 -5, label %20
]
5: ; preds = %1
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
br label %26
8: ; preds = %1
%9 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%10 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
br label %26
11: ; preds = %1
%12 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%13 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -1)
br label %26
14: ; preds = %1
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%16 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -2)
br label %26
17: ; preds = %1
%18 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%19 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -4)
br label %26
20: ; preds = %1
%21 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%22 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -5)
br label %26
23: ; preds = %1
%24 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%25 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 -3)
br label %26
26: ; preds = %23, %20, %17, %14, %11, %8, %5
%27 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 2
store i8 32, i8* %27
%28 = load i32, i32* %2
switch i32 %28, label %47 [
i32 0, label %29
i32 1, label %32
i32 -1, label %35
i32 -2, label %38
i32 -4, label %41
i32 -5, label %44
]
29: ; preds = %26
%30 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %50
32: ; preds = %26
%33 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%34 = call i32 @strcpy(i8* %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %50
35: ; preds = %26
%36 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%37 = call i32 @strcpy(i8* %36, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %50
38: ; preds = %26
%39 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%40 = call i32 @strcpy(i8* %39, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %50
41: ; preds = %26
%42 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%43 = call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %50
44: ; preds = %26
%45 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%46 = call i32 @strcpy(i8* %45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %50
47: ; preds = %26
%48 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 3
%49 = call i32 @strcpy(i8* %48, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %50
50: ; preds = %47, %44, %41, %38, %35, %32, %29
%51 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 15
store i8 10, i8* %51
%52 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 16
store i8 0, i8* %52
%53 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%54 = call i32 @sendString(i8* %53)
ret i32 %54
}

LLVM IR (-O2):
@.str = [4 x i8] c"%2d\00"
@.str.1 = [3 x i8] c"Ok\00"
@.str.2 = [8 x i8] c"Created\00"
@.str.3 = [12 x i8] c"Bad Request\00"
@.str.4 = [12 x i8] c"Not Created\00"
@.str.5 = [9 x i8] c"Conflict\00"
@.str.6 = [10 x i8] c"Forbidden\00"
@.str.7 = [13 x i8] c"Server Error\00"
@reltable.sendStatusLine = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.sendStatusLine to i64)) to i32)]
define i32 @sendStatusLine(i32 %0) {
%2 = alloca [17 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%4 = add i32 %0, 5
%5 = icmp ult i32 %4, 7
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.sendStatusLine to i8*), i64 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %0, %6 ], [ -3, %1 ]
%12 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), %1 ]
%13 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%14 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 2
store i8 32, i8* %14
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 3
%16 = call i32 @strcpy(i8* %15, i8* %12)
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 15
store i8 10, i8* %17
%18 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 16
store i8 0, i8* %18
%19 = call i32 @sendString(i8* %3)
ret i32 %19
}