#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*/ file_parse(char *, char ***, char *, float *, float *,
                              float *);
int /*<<< orphan*/ interactive_parse(char ***, char *, float *, float *,
                                     float *);
int /*<<< orphan*/ printf(char *, char, float);
float solve_rack_pinion(char *, float, float, float);
scalar_t__ strcmp(char *, char *);
void rack_pinion(char *input_file) {
  char parameters[3][2][64] = {{"N", "Number of Teeth"},
                               {"P", "Pitch Diameter of Pinion"},
                               {"S", "Surface Speed"}};
  char unknown_choice = '\0';
  float result;
  float nVal = 0;
  float pVal = 0;
  float sVal = 0;
  if (strcmp(input_file, "Does Not Exist") == 0)
    interactive_parse(parameters, &unknown_choice, &nVal, &pVal, &sVal);
  else
    file_parse(input_file, parameters, &unknown_choice, &nVal, &pVal, &sVal);
  result = solve_rack_pinion(&unknown_choice, nVal, pVal, sVal);
  printf("Computed value for %c is %f\n", unknown_choice, result);
}


x86 assembly (clang, -O0):
<rack_pinion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x190(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x180,%edx
call   1070 <memcpy@plt>
movb   $0x0,-0x191(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x19c(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1a0(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1a4(%rbp)
ff
mov    -0x8(%rbp),%rdi
lea    0xfc6(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11f6 <rack_pinion+0x96>
lea    -0x190(%rbp),%rdi
lea    -0x191(%rbp),%rsi
lea    -0x19c(%rbp),%rdx
lea    -0x1a0(%rbp),%rcx
lea    -0x1a4(%rbp),%r8
call   1030 <interactive_parse@plt>
jmp    1222 <rack_pinion+0xc2>
mov    -0x8(%rbp),%rdi
lea    -0x190(%rbp),%rsi
lea    -0x191(%rbp),%rdx
lea    -0x19c(%rbp),%rcx
lea    -0x1a0(%rbp),%r8
lea    -0x1a4(%rbp),%r9
call   1040 <file_parse@plt>
movss  -0x19c(%rbp),%xmm0
ff
movss  -0x1a0(%rbp),%xmm1
ff
movss  -0x1a4(%rbp),%xmm2
ff
lea    -0x191(%rbp),%rdi
call   1080 <solve_rack_pinion@plt>
movss  %xmm0,-0x198(%rbp)
ff
mov    -0x191(%rbp),%al
movss  -0x198(%rbp),%xmm0
ff
lea    0xf2c(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rack_pinion>:
push   %rbx
sub    $0x190,%rsp
mov    %rdi,%rbx
lea    0xe8e(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0x180,%edx
call   1070 <memcpy@plt>
movb   $0x0,0x3(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xfdb(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11d5 <rack_pinion+0x75>
lea    0x10(%rsp),%rsi
lea    0x3(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %rbx,%rdi
call   1040 <file_parse@plt>
jmp    11f3 <rack_pinion+0x93>
lea    0x10(%rsp),%rdi
lea    0x3(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1030 <interactive_parse@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0x4(%rsp),%xmm2
lea    0x3(%rsp),%rdi
call   1080 <solve_rack_pinion@plt>
movsbl 0x3(%rsp),%esi
lea    0xf74(%rip),%rdi
call   1050 <printf@plt>
add    $0x190,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.rack_pinion.parameters = [3 x [2 x [64 x i8]]] [[2 x [64 x i8]] [[64 x i8] c"N\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [64 x i8] c"Number of Teeth\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], [2 x [64 x i8]] [[64 x i8] c"P\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [64 x i8] c"Pitch Diameter of Pinion\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], [2 x [64 x i8]] [[64 x i8] c"S\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [64 x i8] c"Surface Speed\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]]
@.str = [15 x i8] c"Does Not Exist\00"
@.str.1 = [29 x i8] c"Computed value for %c is %f\0A\00"
define void @rack_pinion(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x [2 x [64 x i8]]]
%4 = alloca i8
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i8* %0, i8** %2
%9 = bitcast [3 x [2 x [64 x i8]]]* %3 to i8*
store i8 0, i8* %4
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
%10 = load i8*, i8** %2
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %1
%14 = getelementptr inbounds [3 x [2 x [64 x i8]]], [3 x [2 x [64 x i8]]]* %3, i64 0, i64 0
%15 = bitcast [2 x [64 x i8]]* %14 to i8***
%16 = call i32 @interactive_parse(i8*** %15, i8* %4, float* %6, float* %7, float* %8)
br label %22
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = getelementptr inbounds [3 x [2 x [64 x i8]]], [3 x [2 x [64 x i8]]]* %3, i64 0, i64 0
%20 = bitcast [2 x [64 x i8]]* %19 to i8***
%21 = call i32 @file_parse(i8* %18, i8*** %20, i8* %4, float* %6, float* %7, float* %8)
br label %22
22: ; preds = %17, %13
%23 = load float, float* %6
%24 = load float, float* %7
%25 = load float, float* %8
%26 = call float @solve_rack_pinion(i8* %4, float %23, float %24, float %25)
store float %26, float* %5
%27 = load i8, i8* %4
%28 = load float, float* %5
%29 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8 signext %27, float %28)
ret void
}

LLVM IR (-O2):
@__const.rack_pinion.parameters = [3 x [2 x [64 x i8]]] [[2 x [64 x i8]] [[64 x i8] c"N\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [64 x i8] c"Number of Teeth\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], [2 x [64 x i8]] [[64 x i8] c"P\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [64 x i8] c"Pitch Diameter of Pinion\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"], [2 x [64 x i8]] [[64 x i8] c"S\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [64 x i8] c"Surface Speed\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]]
@.str = [15 x i8] c"Does Not Exist\00"
@.str.1 = [29 x i8] c"Computed value for %c is %f\0A\00"
define void @rack_pinion(i8* %0) {
%2 = alloca [3 x [2 x [64 x i8]]]
%3 = alloca i8
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = getelementptr inbounds [3 x [2 x [64 x i8]]], [3 x [2 x [64 x i8]]]* %2, i64 0, i64 0, i64 0, i64 0
store i8 0, i8* %3
%8 = bitcast float* %4 to i8*
store float 0.000000e+00, float* %4
%9 = bitcast float* %5 to i8*
store float 0.000000e+00, float* %5
%10 = bitcast float* %6 to i8*
store float 0.000000e+00, float* %6
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = bitcast [3 x [2 x [64 x i8]]]* %2 to i8***
br i1 %12, label %14, label %16
14: ; preds = %1
%15 = call i32 @interactive_parse(i8*** %13, i8* %3, float* %4, float* %5, float* %6)
br label %18
16: ; preds = %1
%17 = call i32 @file_parse(i8* %0, i8*** %13, i8* %3, float* %4, float* %5, float* %6)
br label %18
18: ; preds = %16, %14
%19 = load float, float* %4
%20 = load float, float* %5
%21 = load float, float* %6
%22 = call float @solve_rack_pinion(i8* %3, float %19, float %20, float %21)
%23 = load i8, i8* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8 signext %23, float %22)
ret void
}