#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 */
float df1x(float, float);
float df1y(float, float);
float df2x(float, float);
float df2y(float, float);
float f1(float, float);
float f2(float, float);
float fabs(float);
float jacobian(float, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *);
int main(void) {
  float x, y, error, max;
  float a, b, dx, dy, jac;
  printf("Enter initial approximation for x and y:\n");
  scanf("%f %f", &x, &y);
  do {
    printf("x: %f;\t dx: %f;\ny: %f;\t dy: %f\n\n", x, dx, y, dy);
    a = f1(x, y);
    b = f2(x, y);
    jac = jacobian(x, y);
    dx = (b * df1y(x, y) - a * df2y(x, y)) / jac;
    dy = (a * df2x(x, y) - b * df1x(x, y)) / jac;
    x = x + dx;
    y = y + dy;
    printf("x: %f;\t dx: %f;\ny: %f;\t dy: %f;\n\n", x, dx, y, dy);
    max = (fabs(dx) > fabs(dy)) ? fabs(dx) : fabs(dy);
  } while (max > 0.000005);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe6e(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   10b0 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x24(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe3c(%rip),%rdi
mov    $0x4,%al
call   1060 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1080 <f1@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <f2@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   10c0 <jacobian@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   10a0 <df1y@plt>
movss  %xmm0,-0x40(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1040 <df2y@plt>
movss  -0x44(%rbp),%xmm1
movss  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x3c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1090 <df2x@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1050 <df1x@plt>
movss  -0x38(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x30(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
divss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x24(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xcf9(%rip),%rdi
mov    $0x4,%al
call   1060 <printf@plt>
movss  -0x20(%rbp),%xmm0
call   1070 <fabs@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
call   1070 <fabs@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    13a5 <main+0x205>
movss  -0x20(%rbp),%xmm0
call   1070 <fabs@plt>
movss  %xmm0,-0x48(%rbp)
jmp    13b4 <main+0x214>
movss  -0x24(%rbp),%xmm0
call   1070 <fabs@plt>
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc31(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11d1 <main+0x31>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xeb3(%rip),%rdi
call   1050 <puts@plt>
lea    0xe5e(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   10b0 <scanf@plt>
lea    0xe4e(%rip),%r14
lea    0xe68(%rip),%rbx
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm3,%xmm3
cvtss2sd %xmm2,%xmm3
shufps $0x55,%xmm2,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
movss  0x8(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    %r14,%rdi
mov    $0x4,%al
call   1070 <printf@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1080 <f1@plt>
movaps %xmm0,0x60(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1030 <f2@plt>
movaps %xmm0,0x40(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   10c0 <jacobian@plt>
movaps %xmm0,0x50(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   10a0 <df1y@plt>
movaps %xmm0,0x30(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1040 <df2y@plt>
movaps %xmm0,0x20(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1090 <df2x@plt>
movaps %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
call   1060 <df1x@plt>
movaps 0x40(%rsp),%xmm3
movaps %xmm3,%xmm1
movaps 0x60(%rsp),%xmm2
unpcklps %xmm2,%xmm1
unpcklps 0x20(%rsp),%xmm0
mulps  %xmm1,%xmm0
unpcklps %xmm3,%xmm2
movaps 0x10(%rsp),%xmm3
unpcklps 0x30(%rsp),%xmm3
mulps  %xmm2,%xmm3
subps  %xmm0,%xmm3
movaps 0x50(%rsp),%xmm0
shufps $0x0,%xmm0,%xmm0
divps  %xmm0,%xmm3
movaps %xmm3,%xmm1
movaps %xmm3,0x10(%rsp)
shufps $0x55,%xmm3,%xmm1
movss  0xc(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm2
addss  %xmm3,%xmm2
movss  %xmm2,0x8(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
cvtss2sd %xmm3,%xmm3
mov    %rbx,%rdi
mov    $0x4,%al
call   1070 <printf@plt>
movdqa 0x10(%rsp),%xmm2
movdqa %xmm2,%xmm0
pand   0xccc(%rip),%xmm0
pshufd $0x55,%xmm0,%xmm1
maxss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
ucomisd 0xcc4(%rip),%xmm0
ja     11e0 <main+0x40>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Enter initial approximation for x and y:\0A\00"
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [33 x i8] c"x: %f;\09 dx: %f;\0Ay: %f;\09 dy: %f\0A\0A\00"
@.str.3 = [34 x i8] c"x: %f;\09 dx: %f;\0Ay: %f;\09 dy: %f;\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3)
br label %13
13: ; preds = %86, %0
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = load float, float* %8
%17 = fpext float %16 to double
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = load float, float* %9
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %15, double %17, double %19, double %21)
%23 = load float, float* %2
%24 = load float, float* %3
%25 = call float @f1(float %23, float %24)
store float %25, float* %6
%26 = load float, float* %2
%27 = load float, float* %3
%28 = call float @f2(float %26, float %27)
store float %28, float* %7
%29 = load float, float* %2
%30 = load float, float* %3
%31 = call float @jacobian(float %29, float %30)
store float %31, float* %10
%32 = load float, float* %7
%33 = load float, float* %2
%34 = load float, float* %3
%35 = call float @df1y(float %33, float %34)
%36 = load float, float* %6
%37 = load float, float* %2
%38 = load float, float* %3
%39 = call float @df2y(float %37, float %38)
%40 = fmul float %36, %39
%41 = fneg float %40
%42 = call float @llvm.fmuladd.f32(float %32, float %35, float %41)
%43 = load float, float* %10
%44 = fdiv float %42, %43
store float %44, float* %8
%45 = load float, float* %6
%46 = load float, float* %2
%47 = load float, float* %3
%48 = call float @df2x(float %46, float %47)
%49 = load float, float* %7
%50 = load float, float* %2
%51 = load float, float* %3
%52 = call float @df1x(float %50, float %51)
%53 = fmul float %49, %52
%54 = fneg float %53
%55 = call float @llvm.fmuladd.f32(float %45, float %48, float %54)
%56 = load float, float* %10
%57 = fdiv float %55, %56
store float %57, float* %9
%58 = load float, float* %2
%59 = load float, float* %8
%60 = fadd float %58, %59
store float %60, float* %2
%61 = load float, float* %3
%62 = load float, float* %9
%63 = fadd float %61, %62
store float %63, float* %3
%64 = load float, float* %2
%65 = fpext float %64 to double
%66 = load float, float* %8
%67 = fpext float %66 to double
%68 = load float, float* %3
%69 = fpext float %68 to double
%70 = load float, float* %9
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %65, double %67, double %69, double %71)
%73 = load float, float* %8
%74 = call float @fabs(float %73)
%75 = load float, float* %9
%76 = call float @fabs(float %75)
%77 = fcmp ogt float %74, %76
br i1 %77, label %78, label %81
78: ; preds = %13
%79 = load float, float* %8
%80 = call float @fabs(float %79)
br label %84
81: ; preds = %13
%82 = load float, float* %9
%83 = call float @fabs(float %82)
br label %84
84: ; preds = %81, %78
%85 = phi float [ %80, %78 ], [ %83, %81 ]
store float %85, float* %5
br label %86
86: ; preds = %84
%87 = load float, float* %5
%88 = fpext float %87 to double
%89 = fcmp ogt double %88, 5.000000e-06
br i1 %89, label %13, label %90
90: ; preds = %86
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%f %f\00"
@.str.2 = [33 x i8] c"x: %f;\09 dx: %f;\0Ay: %f;\09 dy: %f\0A\0A\00"
@.str.3 = [34 x i8] c"x: %f;\09 dx: %f;\0Ay: %f;\09 dy: %f;\0A\0A\00"
@str = [41 x i8] c"Enter initial approximation for x and y:\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2)
br label %7
7: ; preds = %7, %0
%8 = phi <2 x float> [ undef, %0 ], [ %52, %7 ]
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = extractelement <2 x float> %8, i64 1
%12 = fpext float %11 to double
%13 = load float, float* %2
%14 = fpext float %13 to double
%15 = extractelement <2 x float> %8, i64 0
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %10, double %12, double %14, double %16)
%18 = load float, float* %1
%19 = load float, float* %2
%20 = call float @f1(float %18, float %19)
%21 = load float, float* %1
%22 = load float, float* %2
%23 = call float @f2(float %21, float %22)
%24 = load float, float* %1
%25 = load float, float* %2
%26 = call float @jacobian(float %24, float %25)
%27 = load float, float* %1
%28 = load float, float* %2
%29 = call float @df1y(float %27, float %28)
%30 = load float, float* %1
%31 = load float, float* %2
%32 = call float @df2y(float %30, float %31)
%33 = load float, float* %1
%34 = load float, float* %2
%35 = call float @df2x(float %33, float %34)
%36 = load float, float* %1
%37 = load float, float* %2
%38 = call float @df1x(float %36, float %37)
%39 = insertelement <2 x float> poison, float %23, i64 0
%40 = insertelement <2 x float> %39, float %20, i64 1
%41 = fneg <2 x float> %40
%42 = insertelement <2 x float> poison, float %38, i64 0
%43 = insertelement <2 x float> %42, float %32, i64 1
%44 = fmul <2 x float> %43, %41
%45 = insertelement <2 x float> poison, float %20, i64 0
%46 = insertelement <2 x float> %45, float %23, i64 1
%47 = insertelement <2 x float> poison, float %35, i64 0
%48 = insertelement <2 x float> %47, float %29, i64 1
%49 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %46, <2 x float> %48, <2 x float> %44)
%50 = insertelement <2 x float> poison, float %26, i64 0
%51 = shufflevector <2 x float> %50, <2 x float> poison, <2 x i32> zeroinitializer
%52 = fdiv <2 x float> %49, %51
%53 = load float, float* %1
%54 = extractelement <2 x float> %52, i64 1
%55 = fadd float %54, %53
store float %55, float* %1
%56 = load float, float* %2
%57 = extractelement <2 x float> %52, i64 0
%58 = fadd float %56, %57
store float %58, float* %2
%59 = fpext float %55 to double
%60 = fpext float %54 to double
%61 = fpext float %58 to double
%62 = fpext float %57 to double
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %59, double %60, double %61, double %62)
%64 = call <2 x float> @llvm.fabs.v2f32(<2 x float> %52)
%65 = extractelement <2 x float> %64, i64 0
%66 = extractelement <2 x float> %64, i64 1
%67 = fcmp ogt float %66, %65
%68 = select i1 %67, float %66, float %65
%69 = fpext float %68 to double
%70 = fcmp ogt double %69, 5.000000e-06
br i1 %70, label %7, label %71
71: ; preds = %7
ret i32 0
}