#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 ECONNREFUSED;
int EDQUOT;
int EINVAL;
int EIO;
int ENOENT;
int ENOSPC;
int ENOSYS;
int EPERM;
int EPIPE;
int errno;
int ftp_lite_error(int r) {
  if (r <= 0) {
    return errno;
  } else if (r < 100 || r > 599) {
    return EINVAL;
  } else if (r < 400) {
    return 0;
  } else
    switch (r) {
    case 421:
      return EPERM;
    case 425:
      return ECONNREFUSED;
    case 426:
      return EPIPE;
    case 450:
      return EBUSY;
    case 451:
      return EIO;
    case 452:
      return ENOSPC;
    case 500:
    case 501:
      return EINVAL;
    case 502:
      return ENOSYS;
    case 503:
      return EINVAL;
    case 504:
      return ENOSYS;
    case 530:
    case 532:
      return EACCES;
    case 550:
      return ENOENT;
    case 551:
      return EINVAL;
    case 552:
      return EDQUOT;
    case 553:
      return EACCES;
    default:
      return EINVAL;
    }
}


x86 assembly (clang, -O0):
<ftp_lite_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1122 <ftp_lite_error+0x22>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
cmpl   $0x64,-0x8(%rbp)
jl     1139 <ftp_lite_error+0x39>
cmpl   $0x257,-0x8(%rbp)
jle    114a <ftp_lite_error+0x4a>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
cmpl   $0x190,-0x8(%rbp)
jge    1163 <ftp_lite_error+0x63>
movl   $0x0,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    -0x8(%rbp),%eax
add    $0xfffffe5b,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x84,%eax
ja     128f <ftp_lite_error+0x18f>
mov    -0x10(%rbp),%rax
lea    0xe79(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2de9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2dff(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2dce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129b <ftp_lite_error+0x19b>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftp_lite_error>:
test   %edi,%edi
jle    111a <ftp_lite_error+0x1a>
lea    -0x258(%rdi),%eax
cmp    $0xfffffe0b,%eax
ja     1124 <ftp_lite_error+0x24>
mov    0x2e90(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
ret
xor    %eax,%eax
cmp    $0x190,%edi
jb     1123 <ftp_lite_error+0x23>
add    $0xfffffe5b,%edi
cmp    $0x84,%edi
ja     1111 <ftp_lite_error+0x11>
lea    0xebd(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    0x2e7d(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e8c(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e1b(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e72(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e41(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e18(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e37(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e0e(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2ded(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>
mov    0x2e34(%rip),%rax
jmp    1121 <ftp_lite_error+0x21>

LLVM IR (-O0):
@errno = global i32 0
@EINVAL = global i32 0
@EPERM = global i32 0
@ECONNREFUSED = global i32 0
@EPIPE = global i32 0
@EBUSY = global i32 0
@EIO = global i32 0
@ENOSPC = global i32 0
@ENOSYS = global i32 0
@EACCES = global i32 0
@ENOENT = global i32 0
@EDQUOT = global i32 0
define i32 @ftp_lite_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @errno
store i32 %7, i32* %2
br label %54
8: ; preds = %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 100
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 599
br i1 %13, label %14, label %16
14: ; preds = %11, %8
%15 = load i32, i32* @EINVAL
store i32 %15, i32* %2
br label %54
16: ; preds = %11
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 400
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 0, i32* %2
br label %54
20: ; preds = %16
%21 = load i32, i32* %3
switch i32 %21, label %52 [
i32 421, label %22
i32 425, label %24
i32 426, label %26
i32 450, label %28
i32 451, label %30
i32 452, label %32
i32 500, label %34
i32 501, label %34
i32 502, label %36
i32 503, label %38
i32 504, label %40
i32 530, label %42
i32 532, label %42
i32 550, label %44
i32 551, label %46
i32 552, label %48
i32 553, label %50
]
22: ; preds = %20
%23 = load i32, i32* @EPERM
store i32 %23, i32* %2
br label %54
24: ; preds = %20
%25 = load i32, i32* @ECONNREFUSED
store i32 %25, i32* %2
br label %54
26: ; preds = %20
%27 = load i32, i32* @EPIPE
store i32 %27, i32* %2
br label %54
28: ; preds = %20
%29 = load i32, i32* @EBUSY
store i32 %29, i32* %2
br label %54
30: ; preds = %20
%31 = load i32, i32* @EIO
store i32 %31, i32* %2
br label %54
32: ; preds = %20
%33 = load i32, i32* @ENOSPC
store i32 %33, i32* %2
br label %54
34: ; preds = %20, %20
%35 = load i32, i32* @EINVAL
store i32 %35, i32* %2
br label %54
36: ; preds = %20
%37 = load i32, i32* @ENOSYS
store i32 %37, i32* %2
br label %54
38: ; preds = %20
%39 = load i32, i32* @EINVAL
store i32 %39, i32* %2
br label %54
40: ; preds = %20
%41 = load i32, i32* @ENOSYS
store i32 %41, i32* %2
br label %54
42: ; preds = %20, %20
%43 = load i32, i32* @EACCES
store i32 %43, i32* %2
br label %54
44: ; preds = %20
%45 = load i32, i32* @ENOENT
store i32 %45, i32* %2
br label %54
46: ; preds = %20
%47 = load i32, i32* @EINVAL
store i32 %47, i32* %2
br label %54
48: ; preds = %20
%49 = load i32, i32* @EDQUOT
store i32 %49, i32* %2
br label %54
50: ; preds = %20
%51 = load i32, i32* @EACCES
store i32 %51, i32* %2
br label %54
52: ; preds = %20
%53 = load i32, i32* @EINVAL
store i32 %53, i32* %2
br label %54
54: ; preds = %52, %50, %48, %46, %44, %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %19, %14, %6
%55 = load i32, i32* %2
ret i32 %55
}

LLVM IR (-O2):
@errno = global i32 0
@EINVAL = global i32 0
@EPERM = global i32 0
@ECONNREFUSED = global i32 0
@EPIPE = global i32 0
@EBUSY = global i32 0
@EIO = global i32 0
@ENOSPC = global i32 0
@ENOSYS = global i32 0
@EACCES = global i32 0
@ENOENT = global i32 0
@EDQUOT = global i32 0
define i32 @ftp_lite_error(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @errno
br label %45
5: ; preds = %1
%6 = add nsw i32 %0, -600
%7 = icmp ult i32 %6, -500
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = load i32, i32* @EINVAL
br label %45
10: ; preds = %5
%11 = icmp ult i32 %0, 400
br i1 %11, label %45, label %12
12: ; preds = %10
switch i32 %0, label %43 [
i32 421, label %13
i32 425, label %15
i32 426, label %17
i32 450, label %19
i32 451, label %21
i32 452, label %23
i32 500, label %25
i32 501, label %25
i32 502, label %27
i32 503, label %29
i32 504, label %31
i32 530, label %33
i32 532, label %33
i32 550, label %35
i32 551, label %37
i32 552, label %39
i32 553, label %41
]
13: ; preds = %12
%14 = load i32, i32* @EPERM
br label %45
15: ; preds = %12
%16 = load i32, i32* @ECONNREFUSED
br label %45
17: ; preds = %12
%18 = load i32, i32* @EPIPE
br label %45
19: ; preds = %12
%20 = load i32, i32* @EBUSY
br label %45
21: ; preds = %12
%22 = load i32, i32* @EIO
br label %45
23: ; preds = %12
%24 = load i32, i32* @ENOSPC
br label %45
25: ; preds = %12, %12
%26 = load i32, i32* @EINVAL
br label %45
27: ; preds = %12
%28 = load i32, i32* @ENOSYS
br label %45
29: ; preds = %12
%30 = load i32, i32* @EINVAL
br label %45
31: ; preds = %12
%32 = load i32, i32* @ENOSYS
br label %45
33: ; preds = %12, %12
%34 = load i32, i32* @EACCES
br label %45
35: ; preds = %12
%36 = load i32, i32* @ENOENT
br label %45
37: ; preds = %12
%38 = load i32, i32* @EINVAL
br label %45
39: ; preds = %12
%40 = load i32, i32* @EDQUOT
br label %45
41: ; preds = %12
%42 = load i32, i32* @EACCES
br label %45
43: ; preds = %12
%44 = load i32, i32* @EINVAL
br label %45
45: ; preds = %10, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %8, %3
%46 = phi i32 [ %4, %3 ], [ %9, %8 ], [ %44, %43 ], [ %42, %41 ], [ %40, %39 ], [ %38, %37 ], [ %36, %35 ], [ %34, %33 ], [ %32, %31 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ], [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ 0, %10 ]
ret i32 %46
}