#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 */
double NAN;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
double indexToPoint(char axis, int index) {
  if (axis == 'x')
    return -7.00 + 2.00 * index;
  else if (axis == 'y')
    return -7.00 + 2.00 * index;
  else if (axis == 'z')
    return -14.00 + 1.00 * index;
  else {
    fprintf(stderr, "'axis' must be 'x', 'y', or 'z'.");
    return NAN;
  }
}


x86 assembly (clang, -O0):
<indexToPoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    %esi,-0x10(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x78,%eax
jne    114d <indexToPoint+0x3d>
cvtsi2sdl -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xec9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c6 <indexToPoint+0xb6>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
jne    1179 <indexToPoint+0x69>
cvtsi2sdl -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c6 <indexToPoint+0xb6>
movsbl -0x9(%rbp),%eax
cmp    $0x7a,%eax
jne    11a1 <indexToPoint+0x91>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c6 <indexToPoint+0xb6>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e3b(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indexToPoint>:
push   %rax
cmp    $0x7a,%dil
je     1135 <indexToPoint+0x25>
cmp    $0x79,%dil
je     1123 <indexToPoint+0x13>
cmp    $0x78,%dil
jne    1143 <indexToPoint+0x33>
cvtsi2sd %esi,%xmm0
addsd  %xmm0,%xmm0
addsd  0xed5(%rip),%xmm0
pop    %rax
ret
cvtsi2sd %esi,%xmm0
addsd  0xebf(%rip),%xmm0
pop    %rax
ret
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e99(%rip),%rax
movsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"'axis' must be 'x', 'y', or 'z'.\00"
@NAN = global double 0.000000e+00
define double @indexToPoint(i8 signext %0, i32 %1) {
%3 = alloca double
%4 = alloca i8
%5 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 120
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %5
%11 = sitofp i32 %10 to double
%12 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %11, double -7.000000e+00)
store double %12, double* %3
br label %33
13: ; preds = %2
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 121
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to double
%20 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %19, double -7.000000e+00)
store double %20, double* %3
br label %33
21: ; preds = %13
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 122
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = call double @llvm.fmuladd.f64(double 1.000000e+00, double %27, double -1.400000e+01)
store double %28, double* %3
br label %33
29: ; preds = %21
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%32 = load double, double* @NAN
store double %32, double* %3
br label %33
33: ; preds = %29, %25, %17, %9
%34 = load double, double* %3
ret double %34
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"'axis' must be 'x', 'y', or 'z'.\00"
@NAN = global double 0.000000e+00
define double @indexToPoint(i8 signext %0, i32 %1) {
switch i8 %0, label %12 [
i8 120, label %3
i8 121, label %6
i8 122, label %9
]
3: ; preds = %2
%4 = sitofp i32 %1 to double
%5 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double -7.000000e+00)
br label %16
6: ; preds = %2
%7 = sitofp i32 %1 to double
%8 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double -7.000000e+00)
br label %16
9: ; preds = %2
%10 = sitofp i32 %1 to double
%11 = fadd double %10, -1.400000e+01
br label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%15 = load double, double* @NAN
br label %16
16: ; preds = %12, %9, %6, %3
%17 = phi double [ %5, %3 ], [ %8, %6 ], [ %11, %9 ], [ %15, %12 ]
ret double %17
}