#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
double convert_arg(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int pow(double, int);
int /*<<< orphan*/ printf(char *, double, ...);
double sqrt(double);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  double a, b, c = 0;
  double x1, x2 = 0;
  double delta, sum, product = 0;
  if (argc != 4) {
    fprintf(stderr, "Usage: %s <+/-num1><+/-num2><+/-num3>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  a = convert_arg(argv[1]);
  b = convert_arg(argv[2]);
  c = convert_arg(argv[3]);
  printf("Equation is:\n\t((%.0lfx²) + (%.0lfx) + (%.0lf) = 0)\n", a, b, c);
  delta = (pow(b, 2) - (4 * a * c));
  printf("Delta (discriminant):\n\t%.0lf\n", delta);
  if (delta > 0) {
    x1 = (-b + sqrt(delta)) / (2 * a);
    x2 = (-b - sqrt(delta)) / (2 * a);
  } else if (delta == 0)
    x1 = x2 = -b / (2 * a);
  else {
    fprintf(stderr, "(delta < 0) Equation is irrisolvible. Bye!\n");
    exit(EXIT_FAILURE);
  }
  printf("Solutions are:\n\tx1: %.0lf\n\tx2: %.0lf\n", x1, x2);
  sum = -b / a;
  product = c / a;
  printf("Sum (x1+x2):\n\t%.0lf\nProduct (x1*x2):\n\t%.0lf\n", sum, product);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11c4 <main+0x64>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <convert_arg@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <convert_arg@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <convert_arg@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xe27(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdce(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe00(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1324 <main+0x1c4>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xd44(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xcf7(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    13a2 <main+0x242>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1378 <main+0x218>
jp     1378 <main+0x218>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xca8(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm0,-0x30(%rbp)
jmp    139d <main+0x23d>
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
jmp    13a2 <main+0x242>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xd03(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    0xcdc(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2bc2(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
jne    1340 <main+0x1e0>
mov    0x8(%rbx),%rdi
call   1050 <convert_arg@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x10(%rbx),%rdi
call   1050 <convert_arg@plt>
movapd %xmm0,0x10(%rsp)
mov    0x18(%rbx),%rdi
call   1050 <convert_arg@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x28(%rsp)
lea    0xe9e(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
mov    $0x3,%al
call   1030 <printf@plt>
movaps 0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xe27(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  0x28(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x30(%rsp),%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    12bd <main+0x15d>
movapd 0xdf7(%rip),%xmm1
movapd 0x10(%rsp),%xmm2
xorpd  %xmm2,%xmm1
sqrtsd %xmm3,%xmm4
ucomisd %xmm0,%xmm3
movapd %xmm4,%xmm5
movapd %xmm1,0x40(%rsp)
jae    1262 <main+0x102>
movapd %xmm3,%xmm0
movapd %xmm4,0x50(%rsp)
call   1070 <sqrt@plt>
movapd 0x50(%rsp),%xmm4
movsd  0x30(%rsp),%xmm3
movapd 0x40(%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
movapd %xmm0,%xmm5
movsd  0x8(%rsp),%xmm6
addsd  %xmm6,%xmm6
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jae    12a7 <main+0x147>
movapd %xmm3,%xmm0
movapd %xmm5,0x30(%rsp)
movapd %xmm6,0x50(%rsp)
call   1070 <sqrt@plt>
movapd 0x50(%rsp),%xmm6
movapd 0x30(%rsp),%xmm5
movapd 0x40(%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
movapd %xmm0,%xmm4
unpcklpd %xmm5,%xmm1
unpcklpd %xmm2,%xmm4
subpd  %xmm4,%xmm1
unpcklpd %xmm6,%xmm6
divpd  %xmm6,%xmm1
jmp    12f3 <main+0x193>
movapd 0x10(%rsp),%xmm0
jne    135c <main+0x1fc>
jp     135c <main+0x1fc>
movapd 0xd39(%rip),%xmm1
xorpd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
movapd %xmm1,0x40(%rsp)
divsd  %xmm0,%xmm1
unpcklpd %xmm1,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
lea    0xdc4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movapd 0x40(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
divsd  %xmm2,%xmm0
movsd  0x28(%rsp),%xmm1
divsd  %xmm2,%xmm1
lea    0xdc2(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbx
ret
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xccd(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1373 <main+0x213>
mov    0x2c7d(%rip),%rax
mov    (%rax),%edi
lea    0xd2e(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2c5e(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Usage: %s <+/-num1><+/-num2><+/-num3>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [53 x i8] c"Equation is:\0A\09((%.0lfx\C2\B2) + (%.0lfx) + (%.0lf) = 0)\0A\00"
@.str.2 = [30 x i8] c"Delta (discriminant):\0A\09%.0lf\0A\00"
@.str.3 = [44 x i8] c"(delta < 0) Equation is irrisolvible. Bye!\0A\00"
@.str.4 = [38 x i8] c"Solutions are:\0A\09x1: %.0lf\0A\09x2: %.0lf\0A\00"
@.str.5 = [45 x i8] c"Sum (x1+x2):\0A\09%.0lf\0AProduct (x1*x2):\0A\09%.0lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %13
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 4
br i1 %15, label %16, label %24
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call double @convert_arg(i8* %27)
store double %28, double* %6
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call double @convert_arg(i8* %31)
store double %32, double* %7
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 3
%35 = load i8*, i8** %34
%36 = call double @convert_arg(i8* %35)
store double %36, double* %8
%37 = load double, double* %6
%38 = load double, double* %7
%39 = load double, double* %8
%40 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), double %37, double %38, double %39)
%41 = load double, double* %7
%42 = call i32 @pow(double %41, i32 2)
%43 = sitofp i32 %42 to double
%44 = load double, double* %6
%45 = fmul double 4.000000e+00, %44
%46 = load double, double* %8
%47 = fneg double %45
%48 = call double @llvm.fmuladd.f64(double %47, double %46, double %43)
store double %48, double* %11
%49 = load double, double* %11
%50 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %49)
%51 = load double, double* %11
%52 = fcmp ogt double %51, 0.000000e+00
br i1 %52, label %53, label %70
53: ; preds = %24
%54 = load double, double* %7
%55 = fneg double %54
%56 = load double, double* %11
%57 = call double @sqrt(double %56)
%58 = fadd double %55, %57
%59 = load double, double* %6
%60 = fmul double 2.000000e+00, %59
%61 = fdiv double %58, %60
store double %61, double* %9
%62 = load double, double* %7
%63 = fneg double %62
%64 = load double, double* %11
%65 = call double @sqrt(double %64)
%66 = fsub double %63, %65
%67 = load double, double* %6
%68 = fmul double 2.000000e+00, %67
%69 = fdiv double %66, %68
store double %69, double* %10
br label %85
70: ; preds = %24
%71 = load double, double* %11
%72 = fcmp oeq double %71, 0.000000e+00
br i1 %72, label %73, label %79
73: ; preds = %70
%74 = load double, double* %7
%75 = fneg double %74
%76 = load double, double* %6
%77 = fmul double 2.000000e+00, %76
%78 = fdiv double %75, %77
store double %78, double* %10
store double %78, double* %9
br label %84
79: ; preds = %70
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %73
br label %85
85: ; preds = %84, %53
%86 = load double, double* %9
%87 = load double, double* %10
%88 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), double %86, double %87)
%89 = load double, double* %7
%90 = fneg double %89
%91 = load double, double* %6
%92 = fdiv double %90, %91
store double %92, double* %12
%93 = load double, double* %8
%94 = load double, double* %6
%95 = fdiv double %93, %94
store double %95, double* %13
%96 = load double, double* %12
%97 = load double, double* %13
%98 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), double %96, double %97)
%99 = load i32, i32* @EXIT_SUCCESS
ret i32 %99
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Usage: %s <+/-num1><+/-num2><+/-num3>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [53 x i8] c"Equation is:\0A\09((%.0lfx\C2\B2) + (%.0lfx) + (%.0lf) = 0)\0A\00"
@.str.2 = [30 x i8] c"Delta (discriminant):\0A\09%.0lf\0A\00"
@.str.3 = [44 x i8] c"(delta < 0) Equation is irrisolvible. Bye!\0A\00"
@.str.4 = [38 x i8] c"Solutions are:\0A\09x1: %.0lf\0A\09x2: %.0lf\0A\00"
@.str.5 = [45 x i8] c"Sum (x1+x2):\0A\09%.0lf\0AProduct (x1*x2):\0A\09%.0lf\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call double @convert_arg(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call double @convert_arg(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call double @convert_arg(i8* %18)
%20 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), double %13, double %16, double %19)
%21 = tail call i32 @pow(double %16, i32 2)
%22 = sitofp i32 %21 to double
%23 = fmul double %13, -4.000000e+00
%24 = tail call double @llvm.fmuladd.f64(double %23, double %19, double %22)
%25 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), double %24)
%26 = fcmp ogt double %24, 0.000000e+00
br i1 %26, label %27, label %40
27: ; preds = %10
%28 = fneg double %16
%29 = tail call double @sqrt(double %24)
%30 = fmul double %13, 2.000000e+00
%31 = tail call double @sqrt(double %24)
%32 = insertelement <2 x double> poison, double %28, i64 0
%33 = insertelement <2 x double> %32, double %29, i64 1
%34 = insertelement <2 x double> poison, double %31, i64 0
%35 = insertelement <2 x double> %34, double %16, i64 1
%36 = fsub <2 x double> %33, %35
%37 = insertelement <2 x double> poison, double %30, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = fdiv <2 x double> %36, %38
br label %53
40: ; preds = %10
%41 = fcmp oeq double %24, 0.000000e+00
br i1 %41, label %42, label %48
42: ; preds = %40
%43 = fneg double %16
%44 = fmul double %13, 2.000000e+00
%45 = fdiv double %43, %44
%46 = insertelement <2 x double> poison, double %45, i64 0
%47 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> zeroinitializer
br label %53
48: ; preds = %40
%49 = load i32, i32* @stderr
%50 = tail call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%51 = load i32, i32* @EXIT_FAILURE
%52 = tail call i32 @exit(i32 %51)
unreachable
53: ; preds = %42, %27
%54 = phi double [ %43, %42 ], [ %28, %27 ]
%55 = phi <2 x double> [ %47, %42 ], [ %39, %27 ]
%56 = extractelement <2 x double> %55, i64 0
%57 = extractelement <2 x double> %55, i64 1
%58 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), double %57, double %56)
%59 = fdiv double %54, %13
%60 = fdiv double %19, %13
%61 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), double %59, double %60)
%62 = load i32, i32* @EXIT_SUCCESS
ret i32 %62
}