#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*/ printf(char *);
void get_range(int range[2], int size, int type) {
  switch (type) {
  case 0:
    range[0] = 0;
    range[1] = size;
    break;
  case 1:
    range[0] = size / 2;
    range[1] = 1;
    break;
  case 2:
    range[0] = 1;
    range[1] = size - 2;
    break;
  default:
    printf("invalid argument\n");
  }
}


x86 assembly (clang, -O0):
<get_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1157 <get_range+0x47>
jmp    1135 <get_range+0x25>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1170 <get_range+0x60>
jmp    1146 <get_range+0x36>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1193 <get_range+0x83>
jmp    11af <get_range+0x9f>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
jmp    11bb <get_range+0xab>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x4(%rax)
jmp    11bb <get_range+0xab>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
jmp    11bb <get_range+0xab>
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_range>:
cmp    $0x2,%edx
je     1128 <get_range+0x18>
cmp    $0x1,%edx
je     1135 <get_range+0x25>
test   %edx,%edx
jne    1148 <get_range+0x38>
movl   $0x0,(%rdi)
mov    %esi,0x4(%rdi)
ret
movl   $0x1,(%rdi)
add    $0xfffffffe,%esi
mov    %esi,0x4(%rdi)
ret
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
mov    %eax,(%rdi)
movl   $0x1,0x4(%rdi)
ret
lea    0xeb1(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"invalid argument\0A\00"
define void @get_range(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
switch i32 %7, label %28 [
i32 0, label %8
i32 1, label %14
i32 2, label %21
]
8: ; preds = %3
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 0
store i32 0, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
br label %30
14: ; preds = %3
%15 = load i32, i32* %5
%16 = sdiv i32 %15, 2
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 0
store i32 %16, i32* %18
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32 1, i32* %20
br label %30
21: ; preds = %3
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 0
store i32 1, i32* %23
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 2
%26 = load i32*, i32** %4
%27 = getelementptr inbounds i32, i32* %26, i64 1
store i32 %25, i32* %27
br label %30
28: ; preds = %3
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %21, %14, %8
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"invalid argument\00"
define void @get_range(i32* nocapture writeonly %0, i32 %1, i32 %2) {
switch i32 %2, label %12 [
i32 0, label %4
i32 1, label %6
i32 2, label %9
]
4: ; preds = %3
store i32 0, i32* %0
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %1, i32* %5
br label %14
6: ; preds = %3
%7 = sdiv i32 %1, 2
store i32 %7, i32* %0
%8 = getelementptr inbounds i32, i32* %0, i64 1
store i32 1, i32* %8
br label %14
9: ; preds = %3
store i32 1, i32* %0
%10 = add nsw i32 %1, -2
%11 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %10, i32* %11
br label %14
12: ; preds = %3
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9, %6, %4
ret void
}