#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*/ power_method(double *, double *, double *, double *, int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  double a[3 * 3] = {4, -4, 0, -4, 8, -4, 0, -4, 4};
  double x[3] = {0.0};
  double ix[3] = {0.2, 0.3, 0.6};
  double n[1];
  power_method(a, n, x, ix, 3);
  printf("largest eigenvalue: %10.5lf\n", n[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x48,%edx
call   1060 <memcpy@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    0xecb(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x90(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0xa8(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0xa0(%rbp),%rcx
mov    $0x3,%r8d
call   1050 <power_method@plt>
movsd  -0xa8(%rbp),%xmm0
ff
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x98,%rsp
mov    0xf12(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe9c(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movq   $0x0,0x40(%rsp)
mov    0xedf(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x50(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x30(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    $0x3,%r8d
call   1040 <power_method@plt>
movsd  0x8(%rsp),%xmm0
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [9 x double] [double 4.000000e+00, double -4.000000e+00, double 0.000000e+00, double -4.000000e+00, double 8.000000e+00, double -4.000000e+00, double 0.000000e+00, double -4.000000e+00, double 4.000000e+00]
@__const.main.ix = [3 x double] [double 2.000000e-01, double 3.000000e-01, double 6.000000e-01]
@.str = [29 x i8] c"largest eigenvalue: %10.5lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x double]
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca [1 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [9 x double]* %6 to i8*
%11 = bitcast [3 x double]* %7 to i8*
%12 = bitcast [3 x double]* %8 to i8*
%13 = getelementptr inbounds [9 x double], [9 x double]* %6, i64 0, i64 0
%14 = getelementptr inbounds [1 x double], [1 x double]* %9, i64 0, i64 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%17 = call i32 @power_method(double* %13, double* %14, double* %15, double* %16, i32 3)
%18 = getelementptr inbounds [1 x double], [1 x double]* %9, i64 0, i64 0
%19 = load double, double* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [9 x double] [double 4.000000e+00, double -4.000000e+00, double 0.000000e+00, double -4.000000e+00, double 8.000000e+00, double -4.000000e+00, double 0.000000e+00, double -4.000000e+00, double 4.000000e+00]
@__const.main.ix = [3 x double] [double 2.000000e-01, double 3.000000e-01, double 6.000000e-01]
@.str = [29 x i8] c"largest eigenvalue: %10.5lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x double]
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [1 x double]
%7 = bitcast [9 x double]* %3 to i8*
%8 = bitcast [3 x double]* %4 to i8*
%9 = bitcast [3 x double]* %5 to i8*
%10 = bitcast [1 x double]* %6 to i8*
%11 = getelementptr inbounds [9 x double], [9 x double]* %3, i64 0, i64 0
%12 = getelementptr inbounds [1 x double], [1 x double]* %6, i64 0, i64 0
%13 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%15 = call i32 @power_method(double* %11, double* %12, double* %13, double* %14, i32 3)
%16 = load double, double* %12
%17 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double %16)
ret i32 0
}