#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fabs(double const);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char const *, double const);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
int cd_mat_vec_fprintf(FILE *stream, const char *prefix, const double *a, int n,
                       const char *start, const char *dblfmt, const char *sep,
                       const char *end, const char *suffix) {
  int j;
  FILE *x_stream = stream ? stream : stdout;
  const char *x_prefix = prefix ? prefix : "";
  const char *x_start = start ? start : "  ";
  const char *x_dblfmt = dblfmt ? dblfmt : "%7.3f";
  const char *x_sep = sep ? sep : "  ";
  const char *x_end = end ? end : "  ";
  const char *x_suffix = suffix ? suffix : "\n";
  fputs(x_prefix, x_stream);
  fputs(x_start, x_stream);
  for (j = 0; j < n; j++) {
    if (j > 0)
      fputs(x_sep, x_stream);
    if (fabs(a[j]) < 1e-8) {
      fprintf(x_stream, "%7.0f", a[j]);
    } else {
      fprintf(x_stream, x_dblfmt, a[j]);
    }
  }
  fputs(x_end, x_stream);
  fputs(x_suffix, x_stream);
  return 0;
}


x86 assembly (clang, -O0):
<cd_mat_vec_fprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1176 <cd_mat_vec_fprintf+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,-0x78(%rbp)
jmp    1184 <cd_mat_vec_fprintf+0x54>
mov    0x2e63(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a4 <cd_mat_vec_fprintf+0x74>
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
jmp    11b4 <cd_mat_vec_fprintf+0x84>
lea    0xe67(%rip),%rax
mov    %rax,-0x80(%rbp)
jmp    11b4 <cd_mat_vec_fprintf+0x84>
mov    -0x80(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11d7 <cd_mat_vec_fprintf+0xa7>
mov    -0x28(%rbp),%rax
mov    %rax,-0x88(%rbp)
jmp    11ea <cd_mat_vec_fprintf+0xba>
lea    0xe2a(%rip),%rax
mov    %rax,-0x88(%rbp)
jmp    11ea <cd_mat_vec_fprintf+0xba>
mov    -0x88(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1210 <cd_mat_vec_fprintf+0xe0>
mov    -0x30(%rbp),%rax
mov    %rax,-0x90(%rbp)
jmp    1223 <cd_mat_vec_fprintf+0xf3>
lea    0xdf4(%rip),%rax
mov    %rax,-0x90(%rbp)
jmp    1223 <cd_mat_vec_fprintf+0xf3>
mov    -0x90(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,0x10(%rbp)
je     1249 <cd_mat_vec_fprintf+0x119>
mov    0x10(%rbp),%rax
mov    %rax,-0x98(%rbp)
jmp    125c <cd_mat_vec_fprintf+0x12c>
lea    0xdb8(%rip),%rax
mov    %rax,-0x98(%rbp)
jmp    125c <cd_mat_vec_fprintf+0x12c>
mov    -0x98(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,0x18(%rbp)
je     1282 <cd_mat_vec_fprintf+0x152>
mov    0x18(%rbp),%rax
mov    %rax,-0xa0(%rbp)
jmp    1295 <cd_mat_vec_fprintf+0x165>
lea    0xd7f(%rip),%rax
mov    %rax,-0xa0(%rbp)
jmp    1295 <cd_mat_vec_fprintf+0x165>
mov    -0xa0(%rbp),%rax
mov    %rax,-0x68(%rbp)
cmpq   $0x0,0x20(%rbp)
je     12bb <cd_mat_vec_fprintf+0x18b>
mov    0x20(%rbp),%rax
mov    %rax,-0xa8(%rbp)
jmp    12ce <cd_mat_vec_fprintf+0x19e>
lea    0xd4f(%rip),%rax
mov    %rax,-0xa8(%rbp)
jmp    12ce <cd_mat_vec_fprintf+0x19e>
mov    -0xa8(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x50(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <fputs@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1394 <cd_mat_vec_fprintf+0x264>
cmpl   $0x0,-0x34(%rbp)
jle    131d <cd_mat_vec_fprintf+0x1ed>
mov    -0x60(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xcc5(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1367 <cd_mat_vec_fprintf+0x237>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xcb6(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1381 <cd_mat_vec_fprintf+0x251>
mov    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <fprintf@plt>
jmp    1386 <cd_mat_vec_fprintf+0x256>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12fa <cd_mat_vec_fprintf+0x1ca>
mov    -0x68(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x70(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cd_mat_vec_fprintf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%rbp
mov    %ecx,%r12d
mov    %rdx,%r14
mov    %rdi,%rbx
mov    0x40(%rsp),%r15
test   %rdi,%rdi
jne    115b <cd_mat_vec_fprintf+0x2b>
mov    0x2e88(%rip),%rax
mov    (%rax),%rbx
test   %rsi,%rsi
lea    0xea5(%rip),%rdi
cmovne %rsi,%rdi
test   %rbp,%rbp
lea    0xe8d(%rip),%rax
cmove  %rax,%rbp
test   %r9,%r9
lea    0xe82(%rip),%r13
cmovne %r9,%r13
test   %r15,%r15
cmove  %rax,%r15
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
test   %r12d,%r12d
jle    121d <cd_mat_vec_fprintf+0xed>
movsd  (%r14),%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
movsd  (%r14),%xmm0
lea    0xe4f(%rip),%rax
mov    %r13,%rsi
cmovle %rax,%rsi
mov    %rbx,%rdi
call   1050 <fprintf@plt>
cmp    $0x1,%r12d
je     121d <cd_mat_vec_fprintf+0xed>
mov    %r12d,%r12d
mov    $0x1,%ebp
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
movsd  (%r14,%rbp,8),%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
movsd  (%r14,%rbp,8),%xmm0
mov    %r13,%rsi
lea    0xe03(%rip),%rax
cmovle %rax,%rsi
mov    %rbx,%rdi
call   1050 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11e0 <cd_mat_vec_fprintf+0xb0>
mov    0x50(%rsp),%rax
test   %rax,%rax
lea    0xddd(%rip),%rbp
cmovne %rax,%rbp
mov    0x48(%rsp),%rax
test   %rax,%rax
lea    0xdc1(%rip),%rdi
cmovne %rax,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32* null
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c" \00"
@.str.2 = [6 x i8] c"%7.3f\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"%7.0f\00"
define i32 @cd_mat_vec_fprintf(i32* %0, i8* %1, double* %2, i32 %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8) {
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32*
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca i8*
store i32* %0, i32** %10
store i8* %1, i8** %11
store double* %2, double** %12
store i32 %3, i32* %13
store i8* %4, i8** %14
store i8* %5, i8** %15
store i8* %6, i8** %16
store i8* %7, i8** %17
store i8* %8, i8** %18
%27 = load i32*, i32** %10
%28 = icmp ne i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %9
%30 = load i32*, i32** %10
br label %33
31: ; preds = %9
%32 = load i32*, i32** @stdout
br label %33
33: ; preds = %31, %29
%34 = phi i32* [ %30, %29 ], [ %32, %31 ]
store i32* %34, i32** %20
%35 = load i8*, i8** %11
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load i8*, i8** %11
br label %40
39: ; preds = %33
br label %40
40: ; preds = %39, %37
%41 = phi i8* [ %38, %37 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %39 ]
store i8* %41, i8** %21
%42 = load i8*, i8** %14
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load i8*, i8** %14
br label %47
46: ; preds = %40
br label %47
47: ; preds = %46, %44
%48 = phi i8* [ %45, %44 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %46 ]
store i8* %48, i8** %22
%49 = load i8*, i8** %15
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = load i8*, i8** %15
br label %54
53: ; preds = %47
br label %54
54: ; preds = %53, %51
%55 = phi i8* [ %52, %51 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %53 ]
store i8* %55, i8** %23
%56 = load i8*, i8** %16
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = load i8*, i8** %16
br label %61
60: ; preds = %54
br label %61
61: ; preds = %60, %58
%62 = phi i8* [ %59, %58 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %60 ]
store i8* %62, i8** %24
%63 = load i8*, i8** %17
%64 = icmp ne i8* %63, null
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = load i8*, i8** %17
br label %68
67: ; preds = %61
br label %68
68: ; preds = %67, %65
%69 = phi i8* [ %66, %65 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %67 ]
store i8* %69, i8** %25
%70 = load i8*, i8** %18
%71 = icmp ne i8* %70, null
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = load i8*, i8** %18
br label %75
74: ; preds = %68
br label %75
75: ; preds = %74, %72
%76 = phi i8* [ %73, %72 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %74 ]
store i8* %76, i8** %26
%77 = load i8*, i8** %21
%78 = load i32*, i32** %20
%79 = call i32 @fputs(i8* %77, i32* %78)
%80 = load i8*, i8** %22
%81 = load i32*, i32** %20
%82 = call i32 @fputs(i8* %80, i32* %81)
store i32 0, i32* %19
br label %83
83: ; preds = %121, %75
%84 = load i32, i32* %19
%85 = load i32, i32* %13
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %124
87: ; preds = %83
%88 = load i32, i32* %19
%89 = icmp sgt i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %87
%91 = load i8*, i8** %24
%92 = load i32*, i32** %20
%93 = call i32 @fputs(i8* %91, i32* %92)
br label %94
94: ; preds = %90, %87
%95 = load double*, double** %12
%96 = load i32, i32* %19
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %95, i64 %97
%99 = load double, double* %98
%100 = call i32 @fabs(double %99)
%101 = sitofp i32 %100 to double
%102 = fcmp olt double %101, 1.000000e-08
br i1 %102, label %103, label %111
103: ; preds = %94
%104 = load i32*, i32** %20
%105 = load double*, double** %12
%106 = load i32, i32* %19
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
%109 = load double, double* %108
%110 = call i32 @fprintf(i32* %104, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %109)
br label %120
111: ; preds = %94
%112 = load i32*, i32** %20
%113 = load i8*, i8** %23
%114 = load double*, double** %12
%115 = load i32, i32* %19
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
%118 = load double, double* %117
%119 = call i32 @fprintf(i32* %112, i8* %113, double %118)
br label %120
120: ; preds = %111, %103
br label %121
121: ; preds = %120
%122 = load i32, i32* %19
%123 = add nsw i32 %122, 1
store i32 %123, i32* %19
br label %83
124: ; preds = %83
%125 = load i8*, i8** %25
%126 = load i32*, i32** %20
%127 = call i32 @fputs(i8* %125, i32* %126)
%128 = load i8*, i8** %26
%129 = load i32*, i32** %20
%130 = call i32 @fputs(i8* %128, i32* %129)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32* null
@.str = [1 x i8] zeroinitializer
@.str.1 = [3 x i8] c" \00"
@.str.2 = [6 x i8] c"%7.3f\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"%7.0f\00"
define i32 @cd_mat_vec_fprintf(i32* %0, i8* %1, double* nocapture %2, i32 %3, i8* %4, i8* %5, i8* %6, i8* %7, i8* %8) {
%10 = icmp eq i32* %0, null
%11 = load i32*, i32** @stdout
%12 = select i1 %10, i32* %11, i32* %0
%13 = icmp eq i8* %1, null
%14 = select i1 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %1
%15 = icmp eq i8* %4, null
%16 = select i1 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4
%17 = icmp eq i8* %5, null
%18 = select i1 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %5
%19 = icmp eq i8* %6, null
%20 = select i1 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6
%21 = tail call i32 @fputs(i8* %14, i32* %12)
%22 = tail call i32 @fputs(i8* %16, i32* %12)
%23 = icmp sgt i32 %3, 0
br i1 %23, label %24, label %45
24: ; preds = %9
%25 = zext i32 %3 to i64
%26 = load double, double* %2
%27 = tail call i32 @fabs(double %26)
%28 = icmp slt i32 %27, 1
%29 = load double, double* %2
%30 = select i1 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %18
%31 = tail call i32 @fprintf(i32* %12, i8* %30, double %29)
%32 = icmp eq i32 %3, 1
br i1 %32, label %45, label %33
33: ; preds = %24, %33
%34 = phi i64 [ %43, %33 ], [ 1, %24 ]
%35 = tail call i32 @fputs(i8* %20, i32* %12)
%36 = getelementptr inbounds double, double* %2, i64 %34
%37 = load double, double* %36
%38 = tail call i32 @fabs(double %37)
%39 = icmp slt i32 %38, 1
%40 = load double, double* %36
%41 = select i1 %39, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %18
%42 = tail call i32 @fprintf(i32* %12, i8* %41, double %40)
%43 = add nuw nsw i64 %34, 1
%44 = icmp eq i64 %43, %25
br i1 %44, label %45, label %33
45: ; preds = %33, %24, %9
%46 = icmp eq i8* %8, null
%47 = select i1 %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %8
%48 = icmp eq i8* %7, null
%49 = select i1 %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7
%50 = tail call i32 @fputs(i8* %49, i32* %12)
%51 = tail call i32 @fputs(i8* %47, i32* %12)
ret i32 0
}