#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 /*<<< orphan*/ scanf(char *, ...);
int main() {
  char func;
  int zero1 = 0;
  int zero2 = 0;
  double x = 0.0;
  double y = 0.0;
  printf("\nBy what single letter would you like your function to be named? ");
  scanf("%c", &func);
  printf("Enter both zero values of the quadratic function %s: ", &func);
  scanf("%d %d", &zero1, &zero2);
  printf("Enter the x-value at which the function %s is to be evaluated: ",
         &func);
  scanf("%lf", &x);
  y = (x - zero1) * (x - zero2);
  printf("\nResult of function %c (%lf) = %lf \n\n", func, x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed1(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee5(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0x10(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsbl -0x5(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xed2(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x18(%rsp)
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    0xf(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xedc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeef(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1e(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x18(%rsp),%xmm0
cvtsi2sdl 0x14(%rsp),%xmm1
movapd %xmm0,%xmm2
cvtsi2sdl 0x10(%rsp),%xmm3
subsd  %xmm1,%xmm2
movapd %xmm0,%xmm1
subsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm1
movsbl 0xf(%rsp),%esi
lea    0xee4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [66 x i8] c"\0ABy what single letter would you like your function to be named? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [54 x i8] c"Enter both zero values of the quadratic function %s: \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [64 x i8] c"Enter the x-value at which the function %s is to be evaluated: \00"
@.str.5 = [4 x i8] c"%lf\00"
@.str.6 = [38 x i8] c"\0AResult of function %c (%lf) = %lf \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %5)
%13 = load double, double* %5
%14 = load i32, i32* %3
%15 = sitofp i32 %14 to double
%16 = fsub double %13, %15
%17 = load double, double* %5
%18 = load i32, i32* %4
%19 = sitofp i32 %18 to double
%20 = fsub double %17, %19
%21 = fmul double %16, %20
store double %21, double* %6
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = load double, double* %5
%25 = load double, double* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %23, double %24, double %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [66 x i8] c"\0ABy what single letter would you like your function to be named? \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [54 x i8] c"Enter both zero values of the quadratic function %s: \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [64 x i8] c"Enter the x-value at which the function %s is to be evaluated: \00"
@.str.5 = [4 x i8] c"%lf\00"
@.str.6 = [38 x i8] c"\0AResult of function %c (%lf) = %lf \0A\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), double* %4)
%14 = load double, double* %4
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to double
%17 = fsub double %14, %16
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to double
%20 = fsub double %14, %19
%21 = fmul double %17, %20
%22 = load i8, i8* %1
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i32 %23, double %14, double %21)
ret i32 0
}