#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 */
#define INT_MAX 129
#define INT_MIN 128
int /*<<< orphan*/ printf(char *);
limit() {
  int i;
  for (i = INT_MIN; i <= INT_MIN + 5; i++)
    switch (i) {
    case INT_MIN:
      printf("0\n");
      break;
    case INT_MIN + 1:
      printf("1\n");
      break;
    case INT_MIN + 2:
      printf("2\n");
      break;
    case INT_MIN + 3:
      printf("3\n");
      break;
    case INT_MIN + 4:
      printf("4\n");
      break;
    default:
      printf("5\n");
      break;
    }
  for (i = INT_MAX; i >= INT_MAX - 5; i--)
    switch (i) {
    case INT_MAX:
      printf("0\n");
      break;
    case INT_MAX - 1:
      printf("1\n");
      break;
    case INT_MAX - 2:
      printf("2\n");
      break;
    case INT_MAX - 3:
      printf("3\n");
      break;
    case INT_MAX - 4:
      printf("4\n");
      break;
    default:
      printf("5\n");
      break;
    }
}


x86 assembly (clang, -O0):
<limit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x80,-0x8(%rbp)
cmpl   $0x85,-0x8(%rbp)
jg     11c9 <limit+0xb9>
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     11aa <limit+0x9a>
mov    -0x10(%rbp),%rax
lea    0xec8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    11b6 <limit+0xa6>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    11b6 <limit+0xa6>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    11b6 <limit+0xa6>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    11b6 <limit+0xa6>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    11b6 <limit+0xa6>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    11bb <limit+0xab>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <limit+0xf>
movl   $0x81,-0x8(%rbp)
cmpl   $0x7c,-0x8(%rbp)
jl     1277 <limit+0x167>
mov    -0x8(%rbp),%eax
add    $0xffffff83,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     1258 <limit+0x148>
mov    -0x18(%rbp),%rax
lea    0xe06(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <limit+0x154>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <limit+0x154>
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <limit+0x154>
lea    0xdf4(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <limit+0x154>
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
jmp    1264 <limit+0x154>
lea    0xdd8(%rip),%rdi
call   1030 <printf@plt>
jmp    1269 <limit+0x159>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    11d0 <limit+0xc0>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xee6(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%r12
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xeb3(%rip),%r13
mov    %r13,%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"0\0A\00"
@.str.1 = [3 x i8] c"1\0A\00"
@.str.2 = [3 x i8] c"2\0A\00"
@.str.3 = [3 x i8] c"3\0A\00"
@.str.4 = [3 x i8] c"4\0A\00"
@.str.5 = [3 x i8] c"5\0A\00"
define i32 @limit() {
%1 = alloca i32
%2 = alloca i32
store i32 128, i32* %2
br label %3
3: ; preds = %21, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 133
br i1 %5, label %6, label %24
6: ; preds = %3
%7 = load i32, i32* %2
switch i32 %7, label %18 [
i32 128, label %8
i32 129, label %10
i32 130, label %12
i32 131, label %14
i32 132, label %16
]
8: ; preds = %6
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %20
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %20
12: ; preds = %6
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %20
14: ; preds = %6
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %20
16: ; preds = %6
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %20
18: ; preds = %6
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %14, %12, %10, %8
br label %21
21: ; preds = %20
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %3
24: ; preds = %3
store i32 129, i32* %2
br label %25
25: ; preds = %43, %24
%26 = load i32, i32* %2
%27 = icmp sge i32 %26, 124
br i1 %27, label %28, label %46
28: ; preds = %25
%29 = load i32, i32* %2
switch i32 %29, label %40 [
i32 129, label %30
i32 128, label %32
i32 127, label %34
i32 126, label %36
i32 125, label %38
]
30: ; preds = %28
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %42
32: ; preds = %28
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %42
34: ; preds = %28
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %42
36: ; preds = %28
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %42
38: ; preds = %28
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %42
40: ; preds = %28
%41 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %38, %36, %34, %32, %30
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = add nsw i32 %44, -1
store i32 %45, i32* %2
br label %25
46: ; preds = %25
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@str.11 = [2 x i8] c"4\00"
@str.12 = [2 x i8] c"3\00"
@str.13 = [2 x i8] c"2\00"
@str.14 = [2 x i8] c"1\00"
@str.15 = [2 x i8] c"0\00"
@str.16 = [2 x i8] c"5\00"
define i32 @limit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.14, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.16, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.14, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.12, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.16, i64 0, i64 0))
ret i32 undef
}