#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*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int splitStatusLine(char *statusLine, int *statusCode, char *statusMessage) {
  printf("%s\n", statusLine);
  sscanf(statusLine, "%d ", statusCode);
  switch (*statusCode) {
  case 00:
    strncpy(statusMessage, "Ok", 12);
    break;
  case 01:
    strncpy(statusMessage, "Created", 12);
    break;
  case -1:
    strncpy(statusMessage, "Bad Request", 12);
    break;
  case -2:
    strncpy(statusMessage, "Not Created", 12);
    break;
  case -3:
    strncpy(statusMessage, "Server Error", 12);
    break;
  case -4:
    strncpy(statusMessage, "Conflict", 12);
    break;
  case -5:
    strncpy(statusMessage, "Forbidden", 12);
    break;
  default:
    return 0;
    break;
  }
  printf("%s\n", statusLine);
  return 1;
}


x86 assembly (clang, -O0):
<splitStatusLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1050 <sscanf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x5,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x6,%eax
ja     124a <splitStatusLine+0x11a>
mov    -0x28(%rbp),%rax
lea    0xe75(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rdi
lea    0xe85(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
mov    -0x20(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
mov    -0x20(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
mov    -0x20(%rbp),%rdi
lea    0xe46(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
mov    -0x20(%rbp),%rdi
lea    0xe38(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
mov    -0x20(%rbp),%rdi
lea    0xe2b(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
mov    -0x20(%rbp),%rdi
lea    0xe1a(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
jmp    1256 <splitStatusLine+0x126>
movl   $0x0,-0x4(%rbp)
jmp    126d <splitStatusLine+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xdbb(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitStatusLine>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xebb(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1050 <sscanf@plt>
mov    (%rbx),%ecx
add    $0x5,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
ja     119d <splitStatusLine+0x6d>
movslq %ecx,%rax
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    %r14,%rdi
mov    $0xc,%edx
call   1030 <strncpy@plt>
lea    0xe70(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"Ok\00"
@.str.3 = [8 x i8] c"Created\00"
@.str.4 = [12 x i8] c"Bad Request\00"
@.str.5 = [12 x i8] c"Not Created\00"
@.str.6 = [13 x i8] c"Server Error\00"
@.str.7 = [9 x i8] c"Conflict\00"
@.str.8 = [10 x i8] c"Forbidden\00"
define i32 @splitStatusLine(i8* %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %5
%11 = load i32*, i32** %6
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
switch i32 %14, label %36 [
i32 0, label %15
i32 1, label %18
i32 -1, label %21
i32 -2, label %24
i32 -3, label %27
i32 -4, label %30
i32 -5, label %33
]
15: ; preds = %3
%16 = load i8*, i8** %7
%17 = call i32 @strncpy(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 12)
br label %37
18: ; preds = %3
%19 = load i8*, i8** %7
%20 = call i32 @strncpy(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 12)
br label %37
21: ; preds = %3
%22 = load i8*, i8** %7
%23 = call i32 @strncpy(i8* %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 12)
br label %37
24: ; preds = %3
%25 = load i8*, i8** %7
%26 = call i32 @strncpy(i8* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 12)
br label %37
27: ; preds = %3
%28 = load i8*, i8** %7
%29 = call i32 @strncpy(i8* %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 12)
br label %37
30: ; preds = %3
%31 = load i8*, i8** %7
%32 = call i32 @strncpy(i8* %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 12)
br label %37
33: ; preds = %3
%34 = load i8*, i8** %7
%35 = call i32 @strncpy(i8* %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i32 12)
br label %37
36: ; preds = %3
store i32 0, i32* %4
br label %40
37: ; preds = %33, %30, %27, %24, %21, %18, %15
%38 = load i8*, i8** %5
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %38)
store i32 1, i32* %4
br label %40
40: ; preds = %37, %36
%41 = load i32, i32* %4
ret i32 %41
}

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