#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *, float *, float *);
void thirteen() {
  struct complex {
    float x, y;
  } z1, z2;
  printf("enter real, imaginary coefficients of 2 complex numbers (float): ");
  scanf("%f%f%f%f", &z1.x, &z1.y, &z2.x, &z2.y);
  printf("\ngenerated sum\t\t= % 09.2f %+09.2f i\n", (z1.x + z2.x),
         (z1.y + z2.y));
  printf("generated difference\t= % 09.2f %+09.2f i\n", (z1.x - z2.x),
         (z1.y - z2.y));
  printf("generated product\t= % 09.2f %+09.2f i\n",
         (z1.x * z2.x - z1.y * z2.y), (z1.x * z2.y + z1.y * z2.x));
  printf("generated quotient\t= % 09.2f %+09.2f i\n",
         (z1.x * z2.x + z1.y * z2.y) / (z2.x * z2.x + z2.y * z2.y),
         (-z1.x * z2.y + z1.y * z2.x) / (z2.x * z2.x + z2.y * z2.y));
  getchar();
  printf("\nreturning to menu. press Enter...");
  getchar();
}


x86 assembly (clang, -O0):
<thirteen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rsi
lea    -0x8(%rbp),%rdx
add    $0x4,%rdx
lea    -0x10(%rbp),%rcx
lea    -0x10(%rbp),%r8
add    $0x4,%r8
lea    0xedd(%rip),%rdi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xebe(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeb9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm3
movss  -0x4(%rbp),%xmm2
mulss  -0x10(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe88(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm3
movss  -0xc(%rbp),%xmm2
mulss  -0xc(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0xc(%rbp),%xmm3
movss  -0x4(%rbp),%xmm2
mulss  -0x10(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x10(%rbp),%xmm4
movss  -0xc(%rbp),%xmm3
mulss  -0xc(%rbp),%xmm3
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe14(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thirteen>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rdx
lea    0xc(%rsp),%r8
lea    0xeef(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rcx
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
addss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xec2(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
subss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
subss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeb9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0x8(%rsp),%xmm3
movss  0xc(%rsp),%xmm0
movaps %xmm1,%xmm4
mulss  %xmm0,%xmm1
mulss  %xmm2,%xmm0
mulss  %xmm3,%xmm4
subss  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
mulss  %xmm2,%xmm3
addss  %xmm3,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe97(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm1
movss  0x14(%rsp),%xmm0
movss  0x8(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
movaps %xmm1,%xmm4
unpcklps %xmm2,%xmm4
movaps %xmm2,%xmm5
mulss  %xmm0,%xmm2
unpcklps %xmm3,%xmm0
mulss  %xmm3,%xmm1
shufps $0x0,%xmm3,%xmm3
mulps  %xmm0,%xmm3
shufps $0x0,%xmm5,%xmm5
mulps  %xmm4,%xmm5
addps  %xmm3,%xmm5
movaps %xmm5,%xmm3
shufps $0x55,%xmm5,%xmm3
divss  %xmm3,%xmm5
xorps  %xmm0,%xmm0
cvtss2sd %xmm5,%xmm0
subss  %xmm1,%xmm2
divss  %xmm3,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xe52(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.complex = type { float, float }
@.str = [66 x i8] c"enter real, imaginary coefficients of 2 complex numbers (float): \00"
@.str.1 = [9 x i8] c"%f%f%f%f\00"
@.str.2 = [37 x i8] c"\0Agenerated sum\09\09= % 09.2f %+09.2f i\0A\00"
@.str.3 = [42 x i8] c"generated difference\09= % 09.2f %+09.2f i\0A\00"
@.str.4 = [39 x i8] c"generated product\09= % 09.2f %+09.2f i\0A\00"
@.str.5 = [40 x i8] c"generated quotient\09= % 09.2f %+09.2f i\0A\00"
@.str.6 = [35 x i8] c"\0Areturning to menu. press Enter...\00"
define void @thirteen() {
%1 = alloca %struct.complex
%2 = alloca %struct.complex
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%5 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%6 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%7 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %4, float* %5, float* %6, float* %7)
%9 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%10 = load float, float* %9
%11 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%12 = load float, float* %11
%13 = fadd float %10, %12
%14 = fpext float %13 to double
%15 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%16 = load float, float* %15
%17 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%18 = load float, float* %17
%19 = fadd float %16, %18
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %14, double %20)
%22 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%23 = load float, float* %22
%24 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%25 = load float, float* %24
%26 = fsub float %23, %25
%27 = fpext float %26 to double
%28 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%29 = load float, float* %28
%30 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%31 = load float, float* %30
%32 = fsub float %29, %31
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), double %27, double %33)
%35 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%36 = load float, float* %35
%37 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%38 = load float, float* %37
%39 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%40 = load float, float* %39
%41 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%42 = load float, float* %41
%43 = fmul float %40, %42
%44 = fneg float %43
%45 = call float @llvm.fmuladd.f32(float %36, float %38, float %44)
%46 = fpext float %45 to double
%47 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%48 = load float, float* %47
%49 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%50 = load float, float* %49
%51 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%52 = load float, float* %51
%53 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%54 = load float, float* %53
%55 = fmul float %52, %54
%56 = call float @llvm.fmuladd.f32(float %48, float %50, float %55)
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), double %46, double %57)
%59 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%60 = load float, float* %59
%61 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%62 = load float, float* %61
%63 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%64 = load float, float* %63
%65 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%66 = load float, float* %65
%67 = fmul float %64, %66
%68 = call float @llvm.fmuladd.f32(float %60, float %62, float %67)
%69 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%70 = load float, float* %69
%71 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%72 = load float, float* %71
%73 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%74 = load float, float* %73
%75 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%76 = load float, float* %75
%77 = fmul float %74, %76
%78 = call float @llvm.fmuladd.f32(float %70, float %72, float %77)
%79 = fdiv float %68, %78
%80 = fpext float %79 to double
%81 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 0
%82 = load float, float* %81
%83 = fneg float %82
%84 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%85 = load float, float* %84
%86 = getelementptr inbounds %struct.complex, %struct.complex* %1, i32 0, i32 1
%87 = load float, float* %86
%88 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%89 = load float, float* %88
%90 = fmul float %87, %89
%91 = call float @llvm.fmuladd.f32(float %83, float %85, float %90)
%92 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%93 = load float, float* %92
%94 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 0
%95 = load float, float* %94
%96 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%97 = load float, float* %96
%98 = getelementptr inbounds %struct.complex, %struct.complex* %2, i32 0, i32 1
%99 = load float, float* %98
%100 = fmul float %97, %99
%101 = call float @llvm.fmuladd.f32(float %93, float %95, float %100)
%102 = fdiv float %91, %101
%103 = fpext float %102 to double
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %80, double %103)
%105 = call i32 (...) @getchar()
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%107 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
%struct.complex = type { float, float }
@.str = [66 x i8] c"enter real, imaginary coefficients of 2 complex numbers (float): \00"
@.str.1 = [9 x i8] c"%f%f%f%f\00"
@.str.2 = [37 x i8] c"\0Agenerated sum\09\09= % 09.2f %+09.2f i\0A\00"
@.str.3 = [42 x i8] c"generated difference\09= % 09.2f %+09.2f i\0A\00"
@.str.4 = [39 x i8] c"generated product\09= % 09.2f %+09.2f i\0A\00"
@.str.5 = [40 x i8] c"generated quotient\09= % 09.2f %+09.2f i\0A\00"
@.str.6 = [35 x i8] c"\0Areturning to menu. press Enter...\00"
define void @thirteen() {
%1 = alloca %struct.complex
%2 = alloca %struct.complex
%3 = bitcast %struct.complex* %1 to i8*
%4 = bitcast %struct.complex* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds %struct.complex, %struct.complex* %1, i64 0, i32 0
%7 = getelementptr inbounds %struct.complex, %struct.complex* %1, i64 0, i32 1
%8 = getelementptr inbounds %struct.complex, %struct.complex* %2, i64 0, i32 0
%9 = getelementptr inbounds %struct.complex, %struct.complex* %2, i64 0, i32 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %6, float* %7, float* %8, float* %9)
%11 = load float, float* %6
%12 = load float, float* %8
%13 = fadd float %11, %12
%14 = fpext float %13 to double
%15 = load float, float* %7
%16 = load float, float* %9
%17 = fadd float %15, %16
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %14, double %18)
%20 = load float, float* %6
%21 = load float, float* %8
%22 = fsub float %20, %21
%23 = fpext float %22 to double
%24 = load float, float* %7
%25 = load float, float* %9
%26 = fsub float %24, %25
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), double %23, double %27)
%29 = load float, float* %6
%30 = load float, float* %8
%31 = load float, float* %7
%32 = load float, float* %9
%33 = fneg float %31
%34 = fmul float %32, %33
%35 = call float @llvm.fmuladd.f32(float %29, float %30, float %34)
%36 = fpext float %35 to double
%37 = fmul float %30, %31
%38 = call float @llvm.fmuladd.f32(float %29, float %32, float %37)
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), double %36, double %39)
%41 = load float, float* %6
%42 = load float, float* %8
%43 = load float, float* %7
%44 = load float, float* %9
%45 = insertelement <2 x float> poison, float %43, i64 0
%46 = insertelement <2 x float> %45, float %44, i64 1
%47 = insertelement <2 x float> poison, float %44, i64 0
%48 = shufflevector <2 x float> %47, <2 x float> poison, <2 x i32> zeroinitializer
%49 = fmul <2 x float> %46, %48
%50 = insertelement <2 x float> poison, float %41, i64 0
%51 = insertelement <2 x float> %50, float %42, i64 1
%52 = insertelement <2 x float> poison, float %42, i64 0
%53 = shufflevector <2 x float> %52, <2 x float> poison, <2 x i32> zeroinitializer
%54 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %51, <2 x float> %53, <2 x float> %49)
%55 = extractelement <2 x float> %54, i64 0
%56 = extractelement <2 x float> %54, i64 1
%57 = fdiv float %55, %56
%58 = fpext float %57 to double
%59 = fneg float %41
%60 = fmul float %42, %43
%61 = call float @llvm.fmuladd.f32(float %59, float %44, float %60)
%62 = fdiv float %61, %56
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %58, double %63)
%65 = call i32 (...) @getchar()
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%67 = call i32 (...) @getchar()
ret void
}