#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*/ fatal_error_i(char *, int);
unsigned char *forecast_time_in_units_location(unsigned char **, int *);
int int4(unsigned char *);
int forecast_time_in_units(unsigned char **sec) {
  unsigned char *p;
  int size;
  if ((p = forecast_time_in_units_location(sec, &size)) == NULL)
    return 0;
  if (size == 4) {
    return int4(p);
  } else if (size == 2) {
    return int4(p);
  } else
    fatal_error_i("forecast_time_in_units size=%d?", size);
  return 0;
}


x86 assembly (clang, -O0):
<forecast_time_in_units>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <forecast_time_in_units_location@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1163 <forecast_time_in_units+0x33>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <forecast_time_in_units+0x84>
cmpl   $0x4,-0x1c(%rbp)
jne    117e <forecast_time_in_units+0x4e>
mov    -0x18(%rbp),%rdi
call   1040 <int4@plt>
mov    %eax,-0x4(%rbp)
jmp    11b4 <forecast_time_in_units+0x84>
cmpl   $0x2,-0x1c(%rbp)
jne    1199 <forecast_time_in_units+0x69>
mov    -0x18(%rbp),%rdi
call   1040 <int4@plt>
mov    %eax,-0x4(%rbp)
jmp    11b4 <forecast_time_in_units+0x84>
mov    -0x1c(%rbp),%esi
lea    0xe5d(%rip),%rdi
call   1030 <fatal_error_i@plt>
jmp    11ad <forecast_time_in_units+0x7d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forecast_time_in_units>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
call   1050 <forecast_time_in_units_location@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     116c <forecast_time_in_units+0x3c>
mov    0xc(%rsp),%esi
cmp    $0x2,%esi
je     1154 <forecast_time_in_units+0x24>
cmp    $0x4,%esi
jne    1160 <forecast_time_in_units+0x30>
mov    %rax,%rdi
call   1040 <int4@plt>
mov    %eax,%ebx
jmp    116c <forecast_time_in_units+0x3c>
lea    0xe99(%rip),%rdi
call   1030 <fatal_error_i@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"forecast_time_in_units size=%d?\00"
define i32 @forecast_time_in_units(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = call i8* @forecast_time_in_units_location(i8** %6, i32* %5)
store i8* %7, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %27
10: ; preds = %1
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 4
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = call i32 @int4(i8* %14)
store i32 %15, i32* %2
br label %27
16: ; preds = %10
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i8*, i8** %4
%21 = call i32 @int4(i8* %20)
store i32 %21, i32* %2
br label %27
22: ; preds = %16
%23 = load i32, i32* %5
%24 = call i32 @fatal_error_i(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22
br label %26
26: ; preds = %25
store i32 0, i32* %2
br label %27
27: ; preds = %26, %19, %13, %9
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@.str = [32 x i8] c"forecast_time_in_units size=%d?\00"
define i32 @forecast_time_in_units(i8** %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i8* @forecast_time_in_units_location(i8** %0, i32* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i32, i32* %2
switch i32 %7, label %12 [
i32 4, label %8
i32 2, label %10
]
8: ; preds = %6
%9 = call i32 @int4(i8* %4)
br label %14
10: ; preds = %6
%11 = call i32 @int4(i8* %4)
br label %14
12: ; preds = %6
%13 = call i32 @fatal_error_i(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %14
14: ; preds = %1, %12, %10, %8
%15 = phi i32 [ %9, %8 ], [ %11, %10 ], [ 0, %12 ], [ 0, %1 ]
ret i32 %15
}