#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 *, ...);
void print_eigenvectors(char *desc, int n, double *wi, double *v, int ldv) {
  int i, j;
  printf("\n %s\n", desc);
  for (i = 0; i < n; i++) {
    j = 0;
    while (j < n) {
      if (wi[j] == (double)0.0) {
        printf(" %6.2f", v[i + j * ldv]);
        j++;
      } else {
        printf(" (%6.2f,%6.2f)", v[i + j * ldv], v[i + (j + 1) * ldv]);
        printf(" (%6.2f,%6.2f)", v[i + j * ldv], -v[i + (j + 1) * ldv]);
        j += 2;
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<print_eigenvectors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    127a <print_eigenvectors+0x16a>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    125e <print_eigenvectors+0x14e>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b7 <print_eigenvectors+0xa7>
jp     11b7 <print_eigenvectors+0xa7>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1259 <print_eigenvectors+0x149>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe1c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
lea    0xdc4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x2c(%rbp)
jmp    1157 <print_eigenvectors+0x47>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1144 <print_eigenvectors+0x34>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_eigenvectors>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%ebx
mov    %rcx,%r12
mov    %rdx,%rbp
mov    %esi,%r15d
mov    %rdi,%rsi
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ecx,%ecx
test   %r15d,%r15d
jle    1238 <print_eigenvectors+0x118>
mov    %rbp,0x10(%rsp)
jmp    117a <print_eigenvectors+0x5a>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
cmp    %r15d,%ecx
je     1238 <print_eigenvectors+0x118>
xor    %r13d,%r13d
mov    %ecx,0xc(%rsp)
jmp    11f1 <print_eigenvectors+0xd1>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%r13),%eax
imul   %ebx,%eax
add    %ecx,%eax
mov    %r15d,%ebp
movslq %eax,%r15
movsd  (%r12,%r15,8),%xmm1
lea    0xe79(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  (%r12,%r14,8),%xmm0
movsd  (%r12,%r15,8),%xmm1
mov    %ebp,%r15d
mov    0x10(%rsp),%rbp
xorps  0xe32(%rip),%xmm1
lea    0xe50(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    0xc(%rsp),%ecx
mov    $0x2,%eax
add    %eax,%r13d
cmp    %r15d,%r13d
jge    1160 <print_eigenvectors+0x40>
mov    %r13d,%eax
movsd  0x0(%rbp,%rax,8),%xmm0
mov    %r13d,%eax
imul   %ebx,%eax
add    %ecx,%eax
ucomisd 0xe06(%rip),%xmm0
movslq %eax,%r14
movsd  (%r12,%r14,8),%xmm0
jne    1190 <print_eigenvectors+0x70>
jp     1190 <print_eigenvectors+0x70>
lea    0xdf8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    0xc(%rsp),%ecx
mov    $0x1,%eax
jmp    11e5 <print_eigenvectors+0xc5>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"\0A %s\0A\00"
@.str.1 = [7 x i8] c" %6.2f\00"
@.str.2 = [15 x i8] c" (%6.2f,%6.2f)\00"
define void @print_eigenvectors(i8* %0, i32 %1, double* nocapture %2, double* nocapture %3, i32 %4) {
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %43
8: ; preds = %5, %39
%9 = phi i32 [ %41, %39 ], [ 0, %5 ]
br label %10
10: ; preds = %8, %35
%11 = phi i32 [ %37, %35 ], [ 0, %8 ]
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds double, double* %2, i64 %12
%14 = load double, double* %13
%15 = fcmp oeq double %14, 0.000000e+00
%16 = mul nsw i32 %11, %4
%17 = add nsw i32 %16, %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %3, i64 %18
%20 = load double, double* %19
br i1 %15, label %21, label %23
21: ; preds = %10
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %20)
br label %35
23: ; preds = %10
%24 = add nuw nsw i32 %11, 1
%25 = mul nsw i32 %24, %4
%26 = add nsw i32 %25, %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %3, i64 %27
%29 = load double, double* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %20, double %29)
%31 = load double, double* %19
%32 = load double, double* %28
%33 = fneg double %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %31, double %33)
br label %35
35: ; preds = %23, %21
%36 = phi i32 [ 2, %23 ], [ 1, %21 ]
%37 = add nuw nsw i32 %11, %36
%38 = icmp slt i32 %37, %1
br i1 %38, label %10, label %39
39: ; preds = %35
%40 = tail call i32 @putchar(i32 10)
%41 = add nuw nsw i32 %9, 1
%42 = icmp eq i32 %41, %1
br i1 %42, label %43, label %8
43: ; preds = %39, %5
ret void
}