#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 EACCES;
int EBUSY;
int EINVAL;
int EIO;
int ENOENT;
int ETIMEDOUT;
int errno;
int http_response_to_errno(int response) {
  if (response <= 299) {
    return 0;
  } else if (response <= 399) {
    return EBUSY;
  } else if (response == 400) {
    return EINVAL;
  } else if (response <= 403) {
    return EACCES;
  } else if (response == 404) {
    return ENOENT;
  } else if (response <= 406) {
    return EINVAL;
  } else if (response == 407) {
    return EACCES;
  } else if (response == 408) {
    return ETIMEDOUT;
  } else if (response <= 410) {
    return ENOENT;
  } else if (errno <= 499) {
    return EINVAL;
  } else {
    return EIO;
  }
}


x86 assembly (clang, -O0):
<http_response_to_errno>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x12b,-0x8(%rbp)
jg     1120 <http_response_to_errno+0x20>
movl   $0x0,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x18f,-0x8(%rbp)
jg     113e <http_response_to_errno+0x3e>
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x190,-0x8(%rbp)
jne    115c <http_response_to_errno+0x5c>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x193,-0x8(%rbp)
jg     117a <http_response_to_errno+0x7a>
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x194,-0x8(%rbp)
jne    1198 <http_response_to_errno+0x98>
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x196,-0x8(%rbp)
jg     11b6 <http_response_to_errno+0xb6>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x197,-0x8(%rbp)
jne    11d4 <http_response_to_errno+0xd4>
mov    0x2e1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x198,-0x8(%rbp)
jne    11f2 <http_response_to_errno+0xf2>
mov    0x2de0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
cmpl   $0x19a,-0x8(%rbp)
jg     1210 <http_response_to_errno+0x110>
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
mov    0x2db9(%rip),%rax
cmpl   $0x1f3,(%rax)
jg     1234 <http_response_to_errno+0x134>
mov    0x2d96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1240 <http_response_to_errno+0x140>
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_response_to_errno>:
xor    %eax,%eax
cmp    $0x12c,%edi
jl     114e <http_response_to_errno+0x4e>
cmp    $0x18f,%edi
ja     111b <http_response_to_errno+0x1b>
mov    0x2e9f(%rip),%rax
jmp    114c <http_response_to_errno+0x4c>
cmp    $0x190,%edi
jne    112c <http_response_to_errno+0x2c>
mov    0x2e96(%rip),%rax
jmp    114c <http_response_to_errno+0x4c>
cmp    $0x193,%edi
ja     113d <http_response_to_errno+0x3d>
mov    0x2ead(%rip),%rax
jmp    114c <http_response_to_errno+0x4c>
cmp    $0x194,%edi
jne    114f <http_response_to_errno+0x4f>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x196,%edi
jbe    1123 <http_response_to_errno+0x23>
cmp    $0x198,%edi
je     1187 <http_response_to_errno+0x87>
cmp    $0x197,%edi
je     1134 <http_response_to_errno+0x34>
cmp    $0x19a,%edi
jbe    1145 <http_response_to_errno+0x45>
mov    0x2e5a(%rip),%rax
cmpl   $0x1f3,(%rax)
jle    1123 <http_response_to_errno+0x23>
mov    0x2e53(%rip),%rax
jmp    114c <http_response_to_errno+0x4c>
mov    0x2e3a(%rip),%rax
jmp    114c <http_response_to_errno+0x4c>

LLVM IR (-O0):
@EBUSY = global i32 0
@EINVAL = global i32 0
@EACCES = global i32 0
@ENOENT = global i32 0
@ETIMEDOUT = global i32 0
@errno = global i32 0
@EIO = global i32 0
define i32 @http_response_to_errno(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 299
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %54
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 399
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = load i32, i32* @EBUSY
store i32 %11, i32* %2
br label %54
12: ; preds = %7
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 400
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = load i32, i32* @EINVAL
store i32 %16, i32* %2
br label %54
17: ; preds = %12
%18 = load i32, i32* %3
%19 = icmp sle i32 %18, 403
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = load i32, i32* @EACCES
store i32 %21, i32* %2
br label %54
22: ; preds = %17
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 404
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = load i32, i32* @ENOENT
store i32 %26, i32* %2
br label %54
27: ; preds = %22
%28 = load i32, i32* %3
%29 = icmp sle i32 %28, 406
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = load i32, i32* @EINVAL
store i32 %31, i32* %2
br label %54
32: ; preds = %27
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 407
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i32, i32* @EACCES
store i32 %36, i32* %2
br label %54
37: ; preds = %32
%38 = load i32, i32* %3
%39 = icmp eq i32 %38, 408
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = load i32, i32* @ETIMEDOUT
store i32 %41, i32* %2
br label %54
42: ; preds = %37
%43 = load i32, i32* %3
%44 = icmp sle i32 %43, 410
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = load i32, i32* @ENOENT
store i32 %46, i32* %2
br label %54
47: ; preds = %42
%48 = load i32, i32* @errno
%49 = icmp sle i32 %48, 499
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = load i32, i32* @EINVAL
store i32 %51, i32* %2
br label %54
52: ; preds = %47
%53 = load i32, i32* @EIO
store i32 %53, i32* %2
br label %54
54: ; preds = %52, %50, %45, %40, %35, %30, %25, %20, %15, %10, %6
%55 = load i32, i32* %2
ret i32 %55
}

LLVM IR (-O2):
@EBUSY = global i32 0
@EINVAL = global i32 0
@EACCES = global i32 0
@ENOENT = global i32 0
@ETIMEDOUT = global i32 0
@errno = global i32 0
@EIO = global i32 0
define i32 @http_response_to_errno(i32 %0) {
%2 = icmp slt i32 %0, 300
br i1 %2, label %39, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 400
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = load i32, i32* @EBUSY
br label %39
7: ; preds = %3
%8 = icmp eq i32 %0, 400
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = load i32, i32* @EINVAL
br label %39
11: ; preds = %7
%12 = icmp ult i32 %0, 404
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = load i32, i32* @EACCES
br label %39
15: ; preds = %11
%16 = icmp eq i32 %0, 404
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = load i32, i32* @ENOENT
br label %39
19: ; preds = %15
%20 = icmp ult i32 %0, 407
br i1 %20, label %21, label %23
21: ; preds = %19
%22 = load i32, i32* @EINVAL
br label %39
23: ; preds = %19
switch i32 %0, label %28 [
i32 407, label %24
i32 408, label %26
]
24: ; preds = %23
%25 = load i32, i32* @EACCES
br label %39
26: ; preds = %23
%27 = load i32, i32* @ETIMEDOUT
br label %39
28: ; preds = %23
%29 = icmp ult i32 %0, 411
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = load i32, i32* @ENOENT
br label %39
32: ; preds = %28
%33 = load i32, i32* @errno
%34 = icmp slt i32 %33, 500
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i32, i32* @EINVAL
br label %39
37: ; preds = %32
%38 = load i32, i32* @EIO
br label %39
39: ; preds = %1, %37, %35, %30, %26, %24, %21, %17, %13, %9, %5
%40 = phi i32 [ %6, %5 ], [ %10, %9 ], [ %14, %13 ], [ %18, %17 ], [ %22, %21 ], [ %25, %24 ], [ %27, %26 ], [ %31, %30 ], [ %36, %35 ], [ %38, %37 ], [ 0, %1 ]
ret i32 %40
}