#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, int, double);
void convert(double a[], double b[], int n) {
  int i, j;
  a[0] = b[0];
  for (i = 1; i < n; i++) {
    for (int k = 0; k < 4; k++)
      printf("%d %d %g\n", i, k, a[k]);
    a[i] = a[i - 1];
    for (j = i - 1; j > 1; j--) {
      a[j] = (a[j] * b[i] * (-1)) + a[i];
    }
    a[0] *= b[i] * (-1);
  }
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    122b <convert+0x11b>
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jge    1184 <convert+0x74>
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114d <convert+0x3d>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jle    11fc <convert+0xec>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ac <convert+0x9c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  0xdf4(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <convert+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
cmp    $0x2,%edx
jl     128b <convert+0x17b>
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
add    $0xffffffff,%r14d
mov    $0x1,%ebx
xor    %ebp,%ebp
lea    0xec9(%rip),%r13
jmp    117b <convert+0x6b>
nopl   0x0(%rax)
movsd  (%r15,%rbx,8),%xmm0
xorpd  0xea2(%rip),%xmm0
mulsd  (%r12),%xmm0
movsd  %xmm0,(%r12)
add    $0x1,%rbx
add    $0x1,%rbp
cmp    %r14,%rbp
je     128b <convert+0x17b>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %edx,%edx
call   1030 <printf@plt>
movsd  0x8(%r12),%xmm0
mov    %r13,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
movsd  0x10(%r12),%xmm0
mov    %r13,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   1030 <printf@plt>
movsd  0x18(%r12),%xmm0
mov    %r13,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
call   1030 <printf@plt>
movsd  -0x8(%r12,%rbx,8),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
cmp    $0x3,%rbx
jb     1150 <convert+0x40>
movsd  (%r12,%rbp,8),%xmm1
mulsd  (%r15,%rbx,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%r12,%rbp,8)
cmp    $0x3,%rbp
jb     1150 <convert+0x40>
mov    %rbp,%rax
test   $0x1,%bpl
je     122b <convert+0x11b>
lea    -0x1(%rbp),%rax
movsd  (%r12,%rbx,8),%xmm0
movsd  -0x8(%r12,%rbp,8),%xmm1
mulsd  (%r15,%rbx,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%r12,%rbp,8)
cmp    $0x3,%rbp
je     1150 <convert+0x40>
add    $0x2,%rax
nopl   0x0(%rax)
movsd  (%r12,%rbx,8),%xmm0
movsd  -0x20(%r12,%rax,8),%xmm1
movsd  -0x18(%r12,%rax,8),%xmm2
mulsd  (%r15,%rbx,8),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,-0x18(%r12,%rax,8)
movsd  (%r12,%rbx,8),%xmm0
mulsd  (%r15,%rbx,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%r12,%rax,8)
add    $0xfffffffffffffffe,%rax
cmp    $0x4,%rax
jg     1240 <convert+0x130>
jmp    1150 <convert+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %g\0A\00"
define void @convert(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
store double %12, double* %14
store i32 1, i32* %7
br label %15
15: ; preds = %87, %3
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %90
19: ; preds = %15
store i32 0, i32* %9
br label %20
20: ; preds = %32, %19
%21 = load i32, i32* %9
%22 = icmp slt i32 %21, 4
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = load i32, i32* %7
%25 = load i32, i32* %9
%26 = load double*, double** %4
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25, double %30)
br label %32
32: ; preds = %23
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %20
35: ; preds = %20
%36 = load double*, double** %4
%37 = load i32, i32* %7
%38 = sub nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %36, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %4
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
store double %41, double* %45
%46 = load i32, i32* %7
%47 = sub nsw i32 %46, 1
store i32 %47, i32* %8
br label %48
48: ; preds = %73, %35
%49 = load i32, i32* %8
%50 = icmp sgt i32 %49, 1
br i1 %50, label %51, label %76
51: ; preds = %48
%52 = load double*, double** %4
%53 = load i32, i32* %8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = load double*, double** %5
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
%61 = load double, double* %60
%62 = fmul double %56, %61
%63 = load double*, double** %4
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = call double @llvm.fmuladd.f64(double %62, double -1.000000e+00, double %67)
%69 = load double*, double** %4
%70 = load i32, i32* %8
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double %68, double* %72
br label %73
73: ; preds = %51
%74 = load i32, i32* %8
%75 = add nsw i32 %74, -1
store i32 %75, i32* %8
br label %48
76: ; preds = %48
%77 = load double*, double** %5
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
%81 = load double, double* %80
%82 = fmul double %81, -1.000000e+00
%83 = load double*, double** %4
%84 = getelementptr inbounds double, double* %83, i64 0
%85 = load double, double* %84
%86 = fmul double %85, %82
store double %86, double* %84
br label %87
87: ; preds = %76
%88 = load i32, i32* %7
%89 = add nsw i32 %88, 1
store i32 %89, i32* %7
br label %15
90: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %g\0A\00"
define void @convert(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = load double, double* %1
store double %4, double* %0
%5 = icmp sgt i32 %2, 1
br i1 %5, label %6, label %77
6: ; preds = %3
%7 = add nsw i32 %2, -1
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = getelementptr inbounds double, double* %0, i64 2
%11 = getelementptr inbounds double, double* %0, i64 3
br label %12
12: ; preds = %6, %68
%13 = phi double [ %4, %6 ], [ %73, %68 ]
%14 = phi i64 [ 1, %6 ], [ %74, %68 ]
%15 = phi i64 [ 0, %6 ], [ %75, %68 ]
%16 = trunc i64 %14 to i32
%17 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16, i32 0, double %13)
%18 = load double, double* %9
%19 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16, i32 1, double %18)
%20 = load double, double* %10
%21 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16, i32 2, double %20)
%22 = load double, double* %11
%23 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16, i32 3, double %22)
%24 = add nsw i64 %14, -1
%25 = getelementptr inbounds double, double* %0, i64 %24
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %0, i64 %14
store double %26, double* %27
%28 = icmp ugt i64 %14, 2
br i1 %28, label %29, label %68
29: ; preds = %12
%30 = getelementptr inbounds double, double* %1, i64 %14
%31 = getelementptr inbounds double, double* %0, i64 %15
%32 = load double, double* %31
%33 = load double, double* %30
%34 = fmul double %32, %33
%35 = tail call double @llvm.fmuladd.f64(double %34, double -1.000000e+00, double %26)
store double %35, double* %31
%36 = icmp ugt i64 %15, 2
br i1 %36, label %37, label %68
37: ; preds = %29
%38 = and i64 %15, 1
%39 = icmp eq i64 %38, 0
br i1 %39, label %48, label %40
40: ; preds = %37
%41 = add nsw i64 %15, -1
%42 = load double, double* %27
%43 = getelementptr inbounds double, double* %0, i64 %41
%44 = load double, double* %43
%45 = load double, double* %30
%46 = fmul double %44, %45
%47 = tail call double @llvm.fmuladd.f64(double %46, double -1.000000e+00, double %42)
store double %47, double* %43
br label %48
48: ; preds = %40, %37
%49 = phi i64 [ %15, %37 ], [ %41, %40 ]
%50 = icmp eq i64 %15, 3
br i1 %50, label %68, label %51
51: ; preds = %48, %51
%52 = phi i64 [ %60, %51 ], [ %49, %48 ]
%53 = add nsw i64 %52, -1
%54 = load double, double* %27
%55 = getelementptr inbounds double, double* %0, i64 %53
%56 = load double, double* %55
%57 = load double, double* %30
%58 = fmul double %56, %57
%59 = tail call double @llvm.fmuladd.f64(double %58, double -1.000000e+00, double %54)
store double %59, double* %55
%60 = add nsw i64 %52, -2
%61 = load double, double* %27
%62 = getelementptr inbounds double, double* %0, i64 %60
%63 = load double, double* %62
%64 = load double, double* %30
%65 = fmul double %63, %64
%66 = tail call double @llvm.fmuladd.f64(double %65, double -1.000000e+00, double %61)
store double %66, double* %62
%67 = icmp sgt i64 %52, 4
br i1 %67, label %51, label %68
68: ; preds = %48, %51, %29, %12
%69 = getelementptr inbounds double, double* %1, i64 %14
%70 = load double, double* %69
%71 = fneg double %70
%72 = load double, double* %0
%73 = fmul double %72, %71
store double %73, double* %0
%74 = add nuw nsw i64 %14, 1
%75 = add nuw nsw i64 %15, 1
%76 = icmp eq i64 %75, %8
br i1 %76, label %77, label %12
77: ; preds = %68, %3
ret void
}