#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 *);
int lulc_code2libcrop_code(double lulc_code) {
  if (lulc_code == 0) {
    printf("Undefined Crop\n");
    return (0);
  }
  if (lulc_code == 1) {
    printf("CIA Corn 2008-2010 (unpublished)\n");
    return (1);
  }
  if (lulc_code == 2) {
    printf("CIA Rice 2008-2010 (unpublished)\n");
    return (2);
  }
  if (lulc_code == 3) {
    printf("CIA Canola 2008-2010 (unpublished)\n");
    return (3);
  }
  if (lulc_code == 4) {
    printf("CIA Wheat 2008-2010 (unpublished)\n");
    return (4);
  }
}


x86 assembly (clang, -O0):
<lulc_code2libcrop_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114d <lulc_code2libcrop_code+0x3d>
jp     114d <lulc_code2libcrop_code+0x3d>
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    121c <lulc_code2libcrop_code+0x10c>
movsd  -0x10(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1182 <lulc_code2libcrop_code+0x72>
jp     1182 <lulc_code2libcrop_code+0x72>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    121c <lulc_code2libcrop_code+0x10c>
movsd  -0x10(%rbp),%xmm0
movsd  0xe79(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11b7 <lulc_code2libcrop_code+0xa7>
jp     11b7 <lulc_code2libcrop_code+0xa7>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    121c <lulc_code2libcrop_code+0x10c>
movsd  -0x10(%rbp),%xmm0
movsd  0xe4c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11ec <lulc_code2libcrop_code+0xdc>
jp     11ec <lulc_code2libcrop_code+0xdc>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x4(%rbp)
jmp    121c <lulc_code2libcrop_code+0x10c>
movsd  -0x10(%rbp),%xmm0
movsd  0xe1f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    121c <lulc_code2libcrop_code+0x10c>
jp     121c <lulc_code2libcrop_code+0x10c>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lulc_code2libcrop_code>:
push   %rbx
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1128 <lulc_code2libcrop_code+0x18>
jp     1128 <lulc_code2libcrop_code+0x18>
xor    %ebx,%ebx
lea    0xf81(%rip),%rdi
jmp    118e <lulc_code2libcrop_code+0x7e>
ucomisd 0xed0(%rip),%xmm0
jne    1142 <lulc_code2libcrop_code+0x32>
jp     1142 <lulc_code2libcrop_code+0x32>
mov    $0x1,%ebx
lea    0xf46(%rip),%rdi
jmp    118e <lulc_code2libcrop_code+0x7e>
ucomisd 0xebe(%rip),%xmm0
jne    115c <lulc_code2libcrop_code+0x4c>
jp     115c <lulc_code2libcrop_code+0x4c>
mov    $0x2,%ebx
lea    0xf0b(%rip),%rdi
jmp    118e <lulc_code2libcrop_code+0x7e>
ucomisd 0xeac(%rip),%xmm0
jne    1176 <lulc_code2libcrop_code+0x66>
jp     1176 <lulc_code2libcrop_code+0x66>
mov    $0x3,%ebx
lea    0xece(%rip),%rdi
jmp    118e <lulc_code2libcrop_code+0x7e>
ucomisd 0xe9a(%rip),%xmm0
jne    1197 <lulc_code2libcrop_code+0x87>
jp     1197 <lulc_code2libcrop_code+0x87>
mov    $0x4,%ebx
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret
jmp    1193 <lulc_code2libcrop_code+0x83>

LLVM IR (-O0):
@.str = [16 x i8] c"Undefined Crop\0A\00"
@.str.1 = [34 x i8] c"CIA Corn 2008-2010 (unpublished)\0A\00"
@.str.2 = [34 x i8] c"CIA Rice 2008-2010 (unpublished)\0A\00"
@.str.3 = [36 x i8] c"CIA Canola 2008-2010 (unpublished)\0A\00"
@.str.4 = [35 x i8] c"CIA Wheat 2008-2010 (unpublished)\0A\00"
define i32 @lulc_code2libcrop_code(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oeq double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %28
8: ; preds = %1
%9 = load double, double* %3
%10 = fcmp oeq double %9, 1.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %28
13: ; preds = %8
%14 = load double, double* %3
%15 = fcmp oeq double %14, 2.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %2
br label %28
18: ; preds = %13
%19 = load double, double* %3
%20 = fcmp oeq double %19, 3.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
store i32 3, i32* %2
br label %28
23: ; preds = %18
%24 = load double, double* %3
%25 = fcmp oeq double %24, 4.000000e+00
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
store i32 4, i32* %2
br label %28
28: ; preds = %6, %11, %16, %21, %26, %23
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@str = [34 x i8] c"CIA Wheat 2008-2010 (unpublished)\00"
@str.5 = [35 x i8] c"CIA Canola 2008-2010 (unpublished)\00"
@str.6 = [33 x i8] c"CIA Rice 2008-2010 (unpublished)\00"
@str.7 = [33 x i8] c"CIA Corn 2008-2010 (unpublished)\00"
@str.8 = [15 x i8] c"Undefined Crop\00"
define i32 @lulc_code2libcrop_code(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = fcmp oeq double %0, 1.000000e+00
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = fcmp oeq double %0, 2.000000e+00
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = fcmp oeq double %0, 3.000000e+00
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = fcmp oeq double %0, 4.000000e+00
br i1 %10, label %11, label %15
11: ; preds = %9, %7, %5, %3, %1
%12 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.8, i64 0, i64 0), %1 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0), %3 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0), %5 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0), %9 ]
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %12)
br label %15
15: ; preds = %11, %9
%16 = phi i32 [ undef, %9 ], [ %13, %11 ]
ret i32 %16
}