#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void send_status(FILE *client, int code, const char *reason_phrase) {
  if (code == 200) {
    reason_phrase = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length:15 "
                    "\r\n\r\n200 Bienvenue\r\n";
  } else if (code == 404) {
    reason_phrase = "HTTP/1.1 404 not found\r\nConnection: "
                    "close\r\nContent-Length:15 \r\n\r\n404 not found\r\n";
  } else if (code == 400) {
    reason_phrase = "HTTP/1.1 400 Bad Request\r\nConnection: "
                    "close\r\nContent-Length:17 \r\n\r\n400 Bad request\r\n";
  }
  fprintf(client, "%s", reason_phrase);
  fflush(client);
}


x86 assembly (clang, -O0):
<send_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jne    1150 <send_status+0x30>
lea    0xeb9(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    118f <send_status+0x6f>
cmpl   $0x194,-0xc(%rbp)
jne    116d <send_status+0x4d>
lea    0xee6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    118a <send_status+0x6a>
cmpl   $0x190,-0xc(%rbp)
jne    1185 <send_status+0x65>
lea    0xf1a(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    118a <send_status+0x6a>
jmp    118f <send_status+0x6f>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xf52(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_status>:
push   %rbx
mov    %rdi,%rbx
cmp    $0xc8,%esi
je     1145 <send_status+0x25>
cmp    $0x190,%esi
je     114e <send_status+0x2e>
cmp    $0x194,%esi
jne    1155 <send_status+0x35>
lea    0xf07(%rip),%rdx
jmp    1155 <send_status+0x35>
lea    0xeb4(%rip),%rdx
jmp    1155 <send_status+0x35>
lea    0xf46(%rip),%rdx
mov    %rdx,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [74 x i8] c"HTTP/1.1 200 OK\0D\0AConnection: close\0D\0AContent-Length:15 \0D\0A\0D\0A200 Bienvenue\0D\0A\00"
@.str.1 = [81 x i8] c"HTTP/1.1 404 not found\0D\0AConnection: close\0D\0AContent-Length:15 \0D\0A\0D\0A404 not found\0D\0A\00"
@.str.2 = [85 x i8] c"HTTP/1.1 400 Bad Request\0D\0AConnection: close\0D\0AContent-Length:17 \0D\0A\0D\0A400 Bad request\0D\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define void @send_status(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 200
br i1 %8, label %9, label %10
9: ; preds = %3
store i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8** %6
br label %20
10: ; preds = %3
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 404
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %19
14: ; preds = %10
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 400
br i1 %16, label %17, label %18
17: ; preds = %14
store i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.2, i64 0, i64 0), i8** %6
br label %18
18: ; preds = %17, %14
br label %19
19: ; preds = %18, %13
br label %20
20: ; preds = %19, %9
%21 = load i32*, i32** %4
%22 = load i8*, i8** %6
%23 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load i32*, i32** %4
%25 = call i32 @fflush(i32* %24)
ret void
}

LLVM IR (-O2):
@.str = [74 x i8] c"HTTP/1.1 200 OK\0D\0AConnection: close\0D\0AContent-Length:15 \0D\0A\0D\0A200 Bienvenue\0D\0A\00"
@.str.1 = [81 x i8] c"HTTP/1.1 404 not found\0D\0AConnection: close\0D\0AContent-Length:15 \0D\0A\0D\0A404 not found\0D\0A\00"
@.str.2 = [85 x i8] c"HTTP/1.1 400 Bad Request\0D\0AConnection: close\0D\0AContent-Length:17 \0D\0A\0D\0A400 Bad request\0D\0A\00"
define void @send_status(i32* nocapture %0, i32 %1, i8* nocapture %2) {
switch i32 %1, label %6 [
i32 200, label %7
i32 404, label %4
i32 400, label %5
]
4: ; preds = %3
br label %7
5: ; preds = %3
br label %7
6: ; preds = %3
br label %7
7: ; preds = %3, %6, %4, %5
%8 = phi i8* [ getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([85 x i8], [85 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), %3 ], [ %2, %6 ]
%9 = tail call i32 @fputs(i8* %8, i32* %0)
%10 = tail call i32 @fflush(i32* %0)
ret void
}