#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*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int get_factor(int unit) {
  int factor;
  switch (unit) {
  case 0:
    factor = 60;
    break;
  case 1:
    factor = 60 * 60;
    break;
  case 2:
    factor = 60 * 60 * 24;
    break;
  case 10:
    factor = 60 * 60 * 3;
    break;
  case 11:
    factor = 60 * 60 * 3;
    break;
  case 12:
    factor = 60 * 60 * 12;
    break;
  case 50:
    factor = 5 * 60;
    break;
  case 254:
    factor = 1;
    break;
  default:
    fprintf(stderr, "Invalid unit for forecast time: %d\n", unit);
    factor = 0;
  }
  return factor;
}


x86 assembly (clang, -O0):
<get_factor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11a7 <get_factor+0x97>
jmp    112e <get_factor+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11b3 <get_factor+0xa3>
jmp    113f <get_factor+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11bf <get_factor+0xaf>
jmp    1150 <get_factor+0x40>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     11cb <get_factor+0xbb>
jmp    1161 <get_factor+0x51>
mov    -0xc(%rbp),%eax
sub    $0xb,%eax
je     11d7 <get_factor+0xc7>
jmp    1172 <get_factor+0x62>
mov    -0xc(%rbp),%eax
sub    $0xc,%eax
je     11e3 <get_factor+0xd3>
jmp    1183 <get_factor+0x73>
mov    -0xc(%rbp),%eax
sub    $0x32,%eax
je     11ef <get_factor+0xdf>
jmp    1194 <get_factor+0x84>
mov    -0xc(%rbp),%eax
sub    $0xfe,%eax
je     11fb <get_factor+0xeb>
jmp    1207 <get_factor+0xf7>
movl   $0x3c,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0xe10,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0x15180,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0x2a30,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0x2a30,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0xa8c0,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0x12c,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
movl   $0x1,-0x8(%rbp)
jmp    1226 <get_factor+0x116>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xde6(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_factor>:
push   %rax
mov    %edi,%edx
cmp    $0x32,%edi
ja     1136 <get_factor+0x26>
mov    $0x3c,%eax
mov    %edx,%ecx
lea    0xeda(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    $0x2a30,%eax
pop    %rcx
ret
cmp    $0xfe,%edx
jne    1145 <get_factor+0x35>
mov    $0x1,%eax
pop    %rcx
ret
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xf77(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0xe10,%eax
pop    %rcx
ret
mov    $0x15180,%eax
pop    %rcx
ret
mov    $0xa8c0,%eax
pop    %rcx
ret
mov    $0x12c,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"Invalid unit for forecast time: %d\0A\00"
define i32 @get_factor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %13 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 10, label %8
i32 11, label %9
i32 12, label %10
i32 50, label %11
i32 254, label %12
]
5: ; preds = %1
store i32 60, i32* %3
br label %17
6: ; preds = %1
store i32 3600, i32* %3
br label %17
7: ; preds = %1
store i32 86400, i32* %3
br label %17
8: ; preds = %1
store i32 10800, i32* %3
br label %17
9: ; preds = %1
store i32 10800, i32* %3
br label %17
10: ; preds = %1
store i32 43200, i32* %3
br label %17
11: ; preds = %1
store i32 300, i32* %3
br label %17
12: ; preds = %1
store i32 1, i32* %3
br label %17
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = load i32, i32* %2
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %15)
store i32 0, i32* %3
br label %17
17: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"Invalid unit for forecast time: %d\0A\00"
define i32 @get_factor(i32 %0) {
switch i32 %0, label %9 [
i32 0, label %12
i32 1, label %2
i32 2, label %3
i32 10, label %4
i32 11, label %5
i32 12, label %6
i32 50, label %7
i32 254, label %8
]
2: ; preds = %1
br label %12
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %12
12: ; preds = %1, %9, %8, %7, %6, %5, %4, %3, %2
%13 = phi i32 [ 0, %9 ], [ 1, %8 ], [ 300, %7 ], [ 43200, %6 ], [ 10800, %5 ], [ 10800, %4 ], [ 86400, %3 ], [ 3600, %2 ], [ 60, %1 ]
ret i32 %13
}