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


x86 assembly (clang, -O0):
<pointToIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x78,%eax
jne    1159 <pointToIndex+0x49>
movsd  -0x10(%rbp),%xmm0
movsd  0xedb(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    11e1 <pointToIndex+0xd1>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
jne    118f <pointToIndex+0x7f>
movsd  -0x10(%rbp),%xmm0
movsd  0xea5(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    11e1 <pointToIndex+0xd1>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jne    11c5 <pointToIndex+0xb5>
movsd  -0x10(%rbp),%xmm0
movsd  0xe5f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    11e1 <pointToIndex+0xd1>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe4b(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointToIndex>:
push   %rax
cmp    $0x7a,%dil
je     1135 <pointToIndex+0x25>
cmp    $0x79,%dil
je     1123 <pointToIndex+0x13>
cmp    $0x78,%dil
jne    1143 <pointToIndex+0x33>
addsd  0xedd(%rip),%xmm0
mulsd  0xedd(%rip),%xmm0
jmp    113d <pointToIndex+0x2d>
addsd  0xec3(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

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