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


x86 assembly (clang, -O0):
<handleHttpRetcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    $0x0,%eax
je     1173 <handleHttpRetcode+0x43>
lea    0xea9(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    $0x0,%eax
je     11aa <handleHttpRetcode+0x7a>
lea    0xebf(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rdi
lea    0xed8(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    $0x0,%eax
je     11e1 <handleHttpRetcode+0xb1>
lea    0xec8(%rip),%rdi
call   1030 <Log@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    11e6 <handleHttpRetcode+0xb6>
jmp    11eb <handleHttpRetcode+0xbb>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleHttpRetcode>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1050 <strstr@plt>
test   %eax,%eax
jne    116c <handleHttpRetcode+0x3c>
lea    0xf02(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %eax,%eax
jne    1175 <handleHttpRetcode+0x45>
lea    0xf2f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strstr@plt>
test   %eax,%eax
jne    117e <handleHttpRetcode+0x4e>
pop    %rbx
ret
lea    0xe9a(%rip),%rdi
jmp    1185 <handleHttpRetcode+0x55>
lea    0xede(%rip),%rdi
jmp    1185 <handleHttpRetcode+0x55>
lea    0xf15(%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*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strstr(i8* %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = ptrtoint i8* %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = call i32 @Log(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i8* @strstr(i8* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = ptrtoint i8* %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = call i32 @Log(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %14
%24 = load i8*, i8** %2
%25 = call i8* @strstr(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i8* %25, i8** %3
%26 = load i8*, i8** %3
%27 = ptrtoint i8* %26 to i32
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = call i32 @Log(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %23
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
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 i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = ptrtoint i8* %2 to i64
%4 = trunc i64 %3 to i32
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call i32 @Log(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
%10 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%11 = ptrtoint i8* %10 to i64
%12 = trunc i64 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %9
%15 = tail call i32 @Log(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %9
%18 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = tail call i32 @Log(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %17
ret void
}