#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
float sqrt(float);
int /*<<< orphan*/ sscanf(char *, char *, float *, float *, float *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  float a, b, c, r1, r2, d;
  char str[128];
  printf("Emaizkidazu ax^2+bx+c=0 erako bigarren mailako ekuazio baten a,b,c "
         "konstanteak: ");
  fgets(str, 128, stdin);
  sscanf(str, "%f %f %f", &a, &b, &c);
  if ((a == 0) && (b == 0))
    printf("Hori ez da ekuazio bat\n");
  else if (a == 0) {
    r1 = -c / b;
    printf(
        "Emandako ekuazio 1go mailakoa de eta bere erro bakarra hauxe da: %f\n",
        r1);
  } else {
    d = b * b - 4 * a * c;
    if (d < 0)
      printf("Ez du erro errealik\n");
    else if (d == 0) {
      r1 = -b / (2 * a);
      printf("erro bikoitza du: %f\n", r1);
    } else {
      r1 = (-b + sqrt(d)) / (2 * a);
      r2 = (-b - sqrt(d)) / (2 * a);
      printf("honakoak dira bere bi erroak: %f eta %f.\n", r1, r2);
    }
  }
  printf("Sakatu \"return\" amaitzeko .....");
  fgets(str, 128, stdin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    -0xb0(%rbp),%rdi
lea    0xeca(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1050 <sscanf@plt>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11e1 <main+0xa1>
jp     11e1 <main+0xa1>
movss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11e1 <main+0xa1>
jp     11e1 <main+0xa1>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13a2 <main+0x262>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1230 <main+0xf0>
jp     1230 <main+0xf0>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    139d <main+0x25d>
movss  -0x18(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  0xdbe(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
mulss  -0x1c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x28(%rbp),%xmm0
jbe    1286 <main+0x146>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1398 <main+0x258>
movss  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12e1 <main+0x1a1>
jp     12e1 <main+0x1a1>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd4d(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdff(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1393 <main+0x253>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xb8(%rbp)
ff
movss  -0x28(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0xb8(%rbp),%xmm0
ff
addss  %xmm1,%xmm0
movss  0xce8(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xb4(%rbp)
ff
movss  -0x28(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0xb4(%rbp),%xmm0
ff
subss  %xmm1,%xmm0
movss  0xc9f(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd5e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1398 <main+0x258>
jmp    139d <main+0x25d>
jmp    13a2 <main+0x262>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    0x2c2a(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xb8,%rsp
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e79(%rip),%r14
mov    (%r14),%edx
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1050 <fgets@plt>
lea    0xee6(%rip),%rsi
mov    %rsp,%rdx
lea    0x4(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %rbx,%rdi
call   1060 <sscanf@plt>
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
movss  0x4(%rsp),%xmm3
jne    11cd <main+0x7d>
jp     11cd <main+0x7d>
ucomiss %xmm1,%xmm3
jne    11cd <main+0x7d>
jp     11cd <main+0x7d>
lea    0xf70(%rip),%rdi
call   1030 <puts@plt>
jmp    130a <main+0x1ba>
ucomiss %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
jne    11ff <main+0xaf>
jp     11ff <main+0xaf>
xorps  0xe2f(%rip),%xmm1
divss  %xmm3,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe87(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    130a <main+0x1ba>
movss  0xdf9(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm1,%xmm2
movaps %xmm3,%xmm4
mulss  %xmm3,%xmm4
addss  %xmm2,%xmm4
xorps  %xmm1,%xmm1
ucomiss %xmm4,%xmm1
jbe    1233 <main+0xe3>
lea    0xef6(%rip),%rdi
call   1030 <puts@plt>
jmp    130a <main+0x1ba>
ucomiss %xmm1,%xmm4
jne    1259 <main+0x109>
jp     1259 <main+0x109>
xorps  0xdcf(%rip),%xmm3
addss  %xmm0,%xmm0
divss  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
lea    0xe68(%rip),%rdi
jmp    11f3 <main+0xa3>
xorps  %xmm2,%xmm2
sqrtss %xmm4,%xmm2
xorps  %xmm5,%xmm5
ucomiss %xmm5,%xmm4
movaps %xmm2,%xmm1
jae    1299 <main+0x149>
movaps %xmm4,%xmm0
movaps %xmm3,0x20(%rsp)
movaps %xmm4,0x10(%rsp)
movss  %xmm2,0x8(%rsp)
call   1070 <sqrt@plt>
xorps  %xmm5,%xmm5
movss  0x8(%rsp),%xmm2
movaps 0x10(%rsp),%xmm4
movaps 0x20(%rsp),%xmm3
movaps %xmm0,%xmm1
subss  %xmm3,%xmm1
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  0x4(%rsp),%xmm3
xorps  0xd59(%rip),%xmm3
ucomiss %xmm5,%xmm4
jae    12dd <main+0x18d>
movaps %xmm4,%xmm0
movss  %xmm1,0x20(%rsp)
movaps %xmm3,0x10(%rsp)
call   1070 <sqrt@plt>
movaps 0x10(%rsp),%xmm3
movss  0x20(%rsp),%xmm1
movaps %xmm0,%xmm2
subss  %xmm2,%xmm3
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
lea    0xdd2(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14),%edx
lea    0x30(%rsp),%rdi
mov    $0x80,%esi
call   1050 <fgets@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [81 x i8] c"Emaizkidazu ax^2+bx+c=0 erako bigarren mailako ekuazio baten a,b,c konstanteak: \00"
@stdin = global i32 0
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [24 x i8] c"Hori ez da ekuazio bat\0A\00"
@.str.3 = [69 x i8] c"Emandako ekuazio 1go mailakoa de eta bere erro bakarra hauxe da: %f\0A\00"
@.str.4 = [21 x i8] c"Ez du erro errealik\0A\00"
@.str.5 = [22 x i8] c"erro bikoitza du: %f\0A\00"
@.str.6 = [42 x i8] c"honakoak dira bere bi erroak: %f eta %f.\0A\00"
@.str.7 = [32 x i8] c"Sakatu \22return\22 amaitzeko .....\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 128, i32 %15)
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %6, float* %7, float* %8)
%19 = load float, float* %6
%20 = fcmp oeq float %19, 0.000000e+00
br i1 %20, label %21, label %26
21: ; preds = %2
%22 = load float, float* %7
%23 = fcmp oeq float %22, 0.000000e+00
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
br label %87
26: ; preds = %21, %2
%27 = load float, float* %6
%28 = fcmp oeq float %27, 0.000000e+00
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load float, float* %8
%31 = fneg float %30
%32 = load float, float* %7
%33 = fdiv float %31, %32
store float %33, float* %9
%34 = load float, float* %9
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0), double %35)
br label %86
37: ; preds = %26
%38 = load float, float* %7
%39 = load float, float* %7
%40 = load float, float* %6
%41 = fmul float 4.000000e+00, %40
%42 = load float, float* %8
%43 = fmul float %41, %42
%44 = fneg float %43
%45 = call float @llvm.fmuladd.f32(float %38, float %39, float %44)
store float %45, float* %11
%46 = load float, float* %11
%47 = fcmp olt float %46, 0.000000e+00
br i1 %47, label %48, label %50
48: ; preds = %37
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %85
50: ; preds = %37
%51 = load float, float* %11
%52 = fcmp oeq float %51, 0.000000e+00
br i1 %52, label %53, label %62
53: ; preds = %50
%54 = load float, float* %7
%55 = fneg float %54
%56 = load float, float* %6
%57 = fmul float 2.000000e+00, %56
%58 = fdiv float %55, %57
store float %58, float* %9
%59 = load float, float* %9
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %60)
br label %84
62: ; preds = %50
%63 = load float, float* %7
%64 = fneg float %63
%65 = load float, float* %11
%66 = call float @sqrt(float %65)
%67 = fadd float %64, %66
%68 = load float, float* %6
%69 = fmul float 2.000000e+00, %68
%70 = fdiv float %67, %69
store float %70, float* %9
%71 = load float, float* %7
%72 = fneg float %71
%73 = load float, float* %11
%74 = call float @sqrt(float %73)
%75 = fsub float %72, %74
%76 = load float, float* %6
%77 = fmul float 2.000000e+00, %76
%78 = fdiv float %75, %77
store float %78, float* %10
%79 = load float, float* %9
%80 = fpext float %79 to double
%81 = load float, float* %10
%82 = fpext float %81 to double
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), double %80, double %82)
br label %84
84: ; preds = %62, %53
br label %85
85: ; preds = %84, %48
br label %86
86: ; preds = %85, %29
br label %87
87: ; preds = %86, %24
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%89 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%90 = load i32, i32* @stdin
%91 = call i32 @fgets(i8* %89, i32 128, i32 %90)
ret i32 0
}

LLVM IR (-O2):
@.str = [81 x i8] c"Emaizkidazu ax^2+bx+c=0 erako bigarren mailako ekuazio baten a,b,c konstanteak: \00"
@stdin = global i32 0
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.3 = [69 x i8] c"Emandako ekuazio 1go mailakoa de eta bere erro bakarra hauxe da: %f\0A\00"
@.str.5 = [22 x i8] c"erro bikoitza du: %f\0A\00"
@.str.6 = [42 x i8] c"honakoak dira bere bi erroak: %f eta %f.\0A\00"
@.str.7 = [32 x i8] c"Sakatu \22return\22 amaitzeko .....\00"
@str = [20 x i8] c"Ez du erro errealik\00"
@str.8 = [23 x i8] c"Hori ez da ekuazio bat\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca [128 x i8]
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = bitcast float* %5 to i8*
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %10, i32 128, i32 %12)
%14 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %3, float* %4, float* %5)
%15 = load float, float* %3
%16 = fcmp oeq float %15, 0.000000e+00
%17 = load float, float* %4
%18 = fcmp oeq float %17, 0.000000e+00
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
br label %60
22: ; preds = %2
%23 = load float, float* %5
br i1 %16, label %24, label %29
24: ; preds = %22
%25 = fneg float %23
%26 = fdiv float %25, %17
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0), double %27)
br label %60
29: ; preds = %22
%30 = fmul float %15, -4.000000e+00
%31 = fmul float %30, %23
%32 = call float @llvm.fmuladd.f32(float %17, float %17, float %31)
%33 = fcmp olt float %32, 0.000000e+00
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %60
36: ; preds = %29
%37 = fcmp oeq float %32, 0.000000e+00
br i1 %37, label %38, label %44
38: ; preds = %36
%39 = fneg float %17
%40 = fmul float %15, 2.000000e+00
%41 = fdiv float %39, %40
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), double %42)
br label %60
44: ; preds = %36
%45 = call float @sqrt(float %32)
%46 = fsub float %45, %17
%47 = load float, float* %3
%48 = fmul float %47, 2.000000e+00
%49 = fdiv float %46, %48
%50 = load float, float* %4
%51 = fneg float %50
%52 = call float @sqrt(float %32)
%53 = fsub float %51, %52
%54 = load float, float* %3
%55 = fmul float %54, 2.000000e+00
%56 = fdiv float %53, %55
%57 = fpext float %49 to double
%58 = fpext float %56 to double
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), double %57, double %58)
br label %60
60: ; preds = %24, %38, %44, %34, %20
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%62 = load i32, i32* @stdin
%63 = call i32 @fgets(i8* %10, i32 128, i32 %62)
ret i32 0
}