#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*/ Log(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *strstr(char *, char *);
void handleHttpRetcode(char *rbuf) {
  if ((strstr(rbuf, "HTTP/1.1 416")) != NULL) {
    Log("Server returned HTTP/1.1 416 - Requested Range Not Satisfiable\n");
    exit(1);
  } else if ((strstr(rbuf, "HTTP/1.1 403")) != NULL) {
    Log("<Server returned HTTP/1.1 403 - Permission Denied\n");
    exit(1);
  } else if ((strstr(rbuf, "HTTP/1.1 404")) != NULL) {
    Log("<Server returned HTTP/1.1 404 - File Not Found\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<handleHttpRetcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     116c <handleHttpRetcode+0x3c>
lea    0xeb0(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     119c <handleHttpRetcode+0x6c>
lea    0xecd(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xee6(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11cc <handleHttpRetcode+0x9c>
lea    0xedd(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    11d1 <handleHttpRetcode+0xa1>
jmp    11d6 <handleHttpRetcode+0xa6>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleHttpRetcode>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
jne    116f <handleHttpRetcode+0x3f>
lea    0xf01(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
jne    1178 <handleHttpRetcode+0x48>
lea    0xf2d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %rax,%rax
jne    1181 <handleHttpRetcode+0x51>
pop    %rbx
ret
lea    0xe97(%rip),%rdi
jmp    1188 <handleHttpRetcode+0x58>
lea    0xedb(%rip),%rdi
jmp    1188 <handleHttpRetcode+0x58>
lea    0xf12(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"HTTP/1.1 416\00"
@.str.1 = [64 x i8] c"Server returned HTTP/1.1 416 - Requested Range Not Satisfiable\0A\00"
@.str.2 = [13 x i8] c"HTTP/1.1 403\00"
@.str.3 = [51 x i8] c"<Server returned HTTP/1.1 403 - Permission Denied\0A\00"
@.str.4 = [13 x i8] c"HTTP/1.1 404\00"
@.str.5 = [48 x i8] c"<Server returned HTTP/1.1 404 - File Not Found\0A\00"
define void @handleHttpRetcode(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @strstr(i8* %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @Log(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32* @strstr(i8* %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 @Log(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = call i32* @strstr(i8* %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = call i32 @Log(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %16
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"HTTP/1.1 416\00"
@.str.1 = [64 x i8] c"Server returned HTTP/1.1 416 - Requested Range Not Satisfiable\0A\00"
@.str.2 = [13 x i8] c"HTTP/1.1 403\00"
@.str.3 = [51 x i8] c"<Server returned HTTP/1.1 403 - Permission Denied\0A\00"
@.str.4 = [13 x i8] c"HTTP/1.1 404\00"
@.str.5 = [48 x i8] c"<Server returned HTTP/1.1 404 - File Not Found\0A\00"
define void @handleHttpRetcode(i8* %0) {
%2 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @Log(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 @Log(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %7
%14 = tail call i32* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i32 @Log(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %13
ret void
}