#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 */
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *stderr;
int fputtransform(FILE *file, int ntrans, float *trans, int binary) {
  register int i, n;
  register float *p;
  if (binary) {
    fprintf(stderr, "fputtransform: need code to handle binary writes for this "
                    "architecture.");
    return 0;
  }
  for (n = 0; n < ntrans; n++) {
    p = trans + n * 16;
    for (i = 0; i < 4; i++, p += 4) {
      fprintf(file, "  %12.8g  %12.8g  %12.8g  %12.8g\n", p[0], p[1], p[2],
              p[3]);
    }
    if (ferror(file))
      return n;
    fprintf(file, "\n");
  }
  return ntrans;
}


x86 assembly (clang, -O0):
<fputtransform>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1164 <fputtransform+0x44>
mov    0x2e99(%rip),%rax
mov    (%rax),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1243 <fputtransform+0x123>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123d <fputtransform+0x11d>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    11ff <fputtransform+0xdf>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x38(%rbp),%rax
movss  0x4(%rax),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x38(%rbp),%rax
movss  0x8(%rax),%xmm2
cvtss2sd %xmm2,%xmm2
mov    -0x38(%rbp),%rax
movss  0xc(%rax),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xe6a(%rip),%rsi
mov    $0x4,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x38(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x38(%rbp)
jmp    1196 <fputtransform+0x76>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     121d <fputtransform+0xfd>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1243 <fputtransform+0x123>
mov    -0x10(%rbp),%rdi
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116b <fputtransform+0x4b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputtransform>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %ecx,%ecx
je     117d <fputtransform+0x3d>
mov    0x2e8c(%rip),%rax
mov    (%rax),%rcx
lea    0xea2(%rip),%rdi
mov    $0x47,%esi
mov    $0x1,%edx
call   1060 <fwrite@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %esi,%r14d
test   %esi,%esi
jle    1170 <fputtransform+0x30>
mov    %rdx,%rbx
mov    %rdi,%r15
add    $0x3c,%rbx
xor    %r13d,%r13d
lea    0xeb0(%rip),%r12
nopl   0x0(%rax,%rax,1)
movss  -0x3c(%rbx),%xmm0
movss  -0x38(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x34(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x30(%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
movss  -0x2c(%rbx),%xmm0
movss  -0x28(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x24(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x20(%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
movss  -0x1c(%rbx),%xmm0
movss  -0x18(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x14(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x10(%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
movss  -0xc(%rbx),%xmm0
movss  -0x8(%rbx),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  -0x4(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
movss  (%rbx),%xmm3
cvtss2sd %xmm3,%xmm3
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
mov    %r15,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    1293 <fputtransform+0x153>
mov    $0xa,%edi
mov    %r15,%rsi
call   1040 <fputc@plt>
add    $0x1,%r13
add    $0x40,%rbx
cmp    %r13,%r14
jne    11a0 <fputtransform+0x60>
jmp    1170 <fputtransform+0x30>
mov    %r13d,%r14d
jmp    1170 <fputtransform+0x30>

LLVM IR (-O0):
@stderr = global i32* null
@.str = [72 x i8] c"fputtransform: need code to handle binary writes for this architecture.\00"
@.str.1 = [34 x i8] c" %12.8g %12.8g %12.8g %12.8g\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @fputtransform(i32* %0, i32 %1, float* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
store i32* %0, i32** %6
store i32 %1, i32* %7
store float* %2, float** %8
store i32 %3, i32* %9
%13 = load i32, i32* %9
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32*, i32** @stderr
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %70
18: ; preds = %4
store i32 0, i32* %11
br label %19
19: ; preds = %65, %18
%20 = load i32, i32* %11
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %68
23: ; preds = %19
%24 = load float*, float** %8
%25 = load i32, i32* %11
%26 = mul nsw i32 %25, 16
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float, float* %24, i64 %27
store float* %28, float** %12
store i32 0, i32* %10
br label %29
29: ; preds = %51, %23
%30 = load i32, i32* %10
%31 = icmp slt i32 %30, 4
br i1 %31, label %32, label %56
32: ; preds = %29
%33 = load i32*, i32** %6
%34 = load float*, float** %12
%35 = getelementptr inbounds float, float* %34, i64 0
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = load float*, float** %12
%39 = getelementptr inbounds float, float* %38, i64 1
%40 = load float, float* %39
%41 = fpext float %40 to double
%42 = load float*, float** %12
%43 = getelementptr inbounds float, float* %42, i64 2
%44 = load float, float* %43
%45 = fpext float %44 to double
%46 = load float*, float** %12
%47 = getelementptr inbounds float, float* %46, i64 3
%48 = load float, float* %47
%49 = fpext float %48 to double
%50 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %37, double %41, double %45, double %49)
br label %51
51: ; preds = %32
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
%54 = load float*, float** %12
%55 = getelementptr inbounds float, float* %54, i64 4
store float* %55, float** %12
br label %29
56: ; preds = %29
%57 = load i32*, i32** %6
%58 = call i64 @ferror(i32* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = load i32, i32* %11
store i32 %61, i32* %5
br label %70
62: ; preds = %56
%63 = load i32*, i32** %6
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %65
65: ; preds = %62
%66 = load i32, i32* %11
%67 = add nsw i32 %66, 1
store i32 %67, i32* %11
br label %19
68: ; preds = %19
%69 = load i32, i32* %7
store i32 %69, i32* %5
br label %70
70: ; preds = %68, %60, %15
%71 = load i32, i32* %5
ret i32 %71
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [72 x i8] c"fputtransform: need code to handle binary writes for this architecture.\00"
@.str.1 = [34 x i8] c" %12.8g %12.8g %12.8g %12.8g\0A\00"
define i32 @fputtransform(i32* nocapture %0, i32 %1, float* nocapture %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %76
8: ; preds = %6
%9 = zext i32 %1 to i64
br label %13
10: ; preds = %4
%11 = load i32*, i32** @stderr
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i64 71, i64 1, i32* %11)
br label %76
13: ; preds = %8, %70
%14 = phi i64 [ 0, %8 ], [ %72, %70 ]
%15 = shl nsw i64 %14, 4
%16 = getelementptr inbounds float, float* %2, i64 %15
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = getelementptr inbounds float, float* %16, i64 1
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = getelementptr inbounds float, float* %16, i64 2
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = getelementptr inbounds float, float* %16, i64 3
%26 = load float, float* %25
%27 = fpext float %26 to double
%28 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %18, double %21, double %24, double %27)
%29 = getelementptr inbounds float, float* %16, i64 4
%30 = load float, float* %29
%31 = fpext float %30 to double
%32 = getelementptr inbounds float, float* %29, i64 1
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = getelementptr inbounds float, float* %29, i64 2
%36 = load float, float* %35
%37 = fpext float %36 to double
%38 = getelementptr inbounds float, float* %29, i64 3
%39 = load float, float* %38
%40 = fpext float %39 to double
%41 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %31, double %34, double %37, double %40)
%42 = getelementptr inbounds float, float* %29, i64 4
%43 = load float, float* %42
%44 = fpext float %43 to double
%45 = getelementptr inbounds float, float* %42, i64 1
%46 = load float, float* %45
%47 = fpext float %46 to double
%48 = getelementptr inbounds float, float* %42, i64 2
%49 = load float, float* %48
%50 = fpext float %49 to double
%51 = getelementptr inbounds float, float* %42, i64 3
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %44, double %47, double %50, double %53)
%55 = getelementptr inbounds float, float* %42, i64 4
%56 = load float, float* %55
%57 = fpext float %56 to double
%58 = getelementptr inbounds float, float* %55, i64 1
%59 = load float, float* %58
%60 = fpext float %59 to double
%61 = getelementptr inbounds float, float* %55, i64 2
%62 = load float, float* %61
%63 = fpext float %62 to double
%64 = getelementptr inbounds float, float* %55, i64 3
%65 = load float, float* %64
%66 = fpext float %65 to double
%67 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %57, double %60, double %63, double %66)
%68 = tail call i64 @ferror(i32* %0)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %13
%71 = tail call i32 @fputc(i32 10, i32* %0)
%72 = add nuw nsw i64 %14, 1
%73 = icmp eq i64 %72, %9
br i1 %73, label %76, label %13
74: ; preds = %13
%75 = trunc i64 %14 to i32
br label %76
76: ; preds = %70, %74, %6, %10
%77 = phi i32 [ 0, %10 ], [ %1, %6 ], [ %75, %74 ], [ %1, %70 ]
ret i32 %77
}