#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*/ assert(int);
int /*<<< orphan*/ file_parse(char *, char *, double *, double *);
int /*<<< orphan*/ interactive_parse(char ***, char *, double *, double *);
int /*<<< orphan*/ printf(char *, double);
scalar_t__ strcmp(char *, char *);
void metric_US(char *input_file) {
  int i;
  char parameters[2][2][64] = {{"M", "Module (Metric)"},
                               {"P", "Diametral Pitch (US)"}};
  char unknown_choice = '\0';
  char toss_char;
  double dia_pitch = 0;
  double met_module = 0;
  if (strcmp(input_file, "Does Not Exist") == 0)
    interactive_parse(parameters, &unknown_choice, &dia_pitch, &met_module);
  else
    file_parse(input_file, &unknown_choice, &dia_pitch, &met_module);
  switch (unknown_choice) {
  case 'M':
    met_module = 25.4 / dia_pitch;
    assert(dia_pitch > 0);
    printf("Module is %f\n", met_module);
    break;
  case 'P':
    dia_pitch = 25.4 / met_module;
    assert(met_module > 0);
    printf("Diametral pitch is %f\n", dia_pitch);
    break;
  }
}


x86 assembly (clang, -O0):
<metric_US>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x100,%edx
call   1080 <memcpy@plt>
movb   $0x0,-0x111(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
mov    -0x8(%rbp),%rdi
lea    0xf61(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11e4 <metric_US+0x84>
lea    -0x110(%rbp),%rdi
lea    -0x111(%rbp),%rsi
lea    -0x120(%rbp),%rdx
lea    -0x128(%rbp),%rcx
call   1030 <interactive_parse@plt>
jmp    1202 <metric_US+0xa2>
mov    -0x8(%rbp),%rdi
lea    -0x111(%rbp),%rsi
lea    -0x120(%rbp),%rdx
lea    -0x128(%rbp),%rcx
call   1040 <file_parse@plt>
movsbl -0x111(%rbp),%eax
mov    %eax,-0x12c(%rbp)
sub    $0x4d,%eax
je     1231 <metric_US+0xd1>
jmp    121d <metric_US+0xbd>
mov    -0x12c(%rbp),%eax
sub    $0x50,%eax
je     127e <metric_US+0x11e>
jmp    12c6 <metric_US+0x166>
movsd  0xdc7(%rip),%xmm0
divsd  -0x120(%rbp),%xmm0
ff
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x120(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x128(%rbp),%xmm0
ff
lea    0xeab(%rip),%rdi
call   1050 <printf@plt>
jmp    12c6 <metric_US+0x166>
movsd  0xd7a(%rip),%xmm0
divsd  -0x128(%rbp),%xmm0
ff
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x128(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsd  -0x120(%rbp),%xmm0
ff
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<metric_US>:
push   %rbx
sub    $0x120,%rsp
mov    %rdi,%rbx
lea    0xe9e(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    $0x100,%edx
call   1080 <memcpy@plt>
movb   $0x0,0xf(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xf71(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11c5 <metric_US+0x65>
lea    0xf(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
call   1040 <file_parse@plt>
jmp    11de <metric_US+0x7e>
lea    0x20(%rsp),%rdi
lea    0xf(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <interactive_parse@plt>
movsbl 0xf(%rsp),%eax
cmp    $0x50,%eax
je     1227 <metric_US+0xc7>
cmp    $0x4d,%eax
jne    1264 <metric_US+0x104>
movsd  0x18(%rsp),%xmm0
movsd  0xe05(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
xorpd  %xmm1,%xmm1
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1070 <assert@plt>
movsd  0x10(%rsp),%xmm0
lea    0xefa(%rip),%rdi
jmp    125f <metric_US+0xff>
movsd  0x10(%rsp),%xmm0
movsd  0xdcb(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
xorpd  %xmm1,%xmm1
xor    %edi,%edi
ucomisd %xmm1,%xmm0
seta   %dil
call   1070 <assert@plt>
movsd  0x18(%rsp),%xmm0
lea    0xece(%rip),%rdi
call   1050 <printf@plt>
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.metric_US.parameters = [2 x [2 x [64 x i8]]] [[2 x [64 x i8]] [[64 x i8] c"M\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\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"Module (Metric)\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\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"Diametral Pitch (US)\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\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 = [14 x i8] c"Module is %f\0A\00"
@.str.2 = [23 x i8] c"Diametral pitch is %f\0A\00"
define void @metric_US(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [2 x [2 x [64 x i8]]]
%5 = alloca i8
%6 = alloca i8
%7 = alloca double
%8 = alloca double
store i8* %0, i8** %2
%9 = bitcast [2 x [2 x [64 x i8]]]* %4 to i8*
store i8 0, i8* %5
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %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 [2 x [2 x [64 x i8]]], [2 x [2 x [64 x i8]]]* %4, i64 0, i64 0
%15 = bitcast [2 x [64 x i8]]* %14 to i8***
%16 = call i32 @interactive_parse(i8*** %15, i8* %5, double* %7, double* %8)
br label %20
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = call i32 @file_parse(i8* %18, i8* %5, double* %7, double* %8)
br label %20
20: ; preds = %17, %13
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
switch i32 %22, label %41 [
i32 77, label %23
i32 80, label %32
]
23: ; preds = %20
%24 = load double, double* %7
%25 = fdiv double 2.540000e+01, %24
store double %25, double* %8
%26 = load double, double* %7
%27 = fcmp ogt double %26, 0.000000e+00
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load double, double* %8
%31 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %30)
br label %41
32: ; preds = %20
%33 = load double, double* %8
%34 = fdiv double 2.540000e+01, %33
store double %34, double* %7
%35 = load double, double* %8
%36 = fcmp ogt double %35, 0.000000e+00
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = load double, double* %7
%40 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %39)
br label %41
41: ; preds = %20, %32, %23
ret void
}

LLVM IR (-O2):
@__const.metric_US.parameters = [2 x [2 x [64 x i8]]] [[2 x [64 x i8]] [[64 x i8] c"M\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\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"Module (Metric)\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\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"Diametral Pitch (US)\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\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 = [14 x i8] c"Module is %f\0A\00"
@.str.2 = [23 x i8] c"Diametral pitch is %f\0A\00"
define void @metric_US(i8* %0) {
%2 = alloca [2 x [2 x [64 x i8]]]
%3 = alloca i8
%4 = alloca double
%5 = alloca double
%6 = getelementptr inbounds [2 x [2 x [64 x i8]]], [2 x [2 x [64 x i8]]]* %2, i64 0, i64 0, i64 0, i64 0
store i8 0, i8* %3
%7 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%8 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = bitcast [2 x [2 x [64 x i8]]]* %2 to i8***
%13 = call i32 @interactive_parse(i8*** %12, i8* %3, double* %4, double* %5)
br label %16
14: ; preds = %1
%15 = call i32 @file_parse(i8* %0, i8* %3, double* %4, double* %5)
br label %16
16: ; preds = %14, %11
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
switch i32 %18, label %35 [
i32 77, label %19
i32 80, label %27
]
19: ; preds = %16
%20 = load double, double* %4
%21 = fdiv double 2.540000e+01, %20
store double %21, double* %5
%22 = fcmp ogt double %20, 0.000000e+00
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load double, double* %5
%26 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %25)
br label %35
27: ; preds = %16
%28 = load double, double* %5
%29 = fdiv double 2.540000e+01, %28
store double %29, double* %4
%30 = fcmp ogt double %28, 0.000000e+00
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load double, double* %4
%34 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %33)
br label %35
35: ; preds = %16, %27, %19
ret void
}