pputrast(fn, hd, bf, sx, sy, r) char *fn;
unsigned char hd[32];
float bf[316 * 316];
int sx, sy, r;
{
  int fd, i, j;
  unsigned char c;
  if ((fd = creat(fn, 0600)) > 0) {
    ;
    if (write(fd, hd, 32) == 32) {
      for (i = 0; i < sy; i++) {
        for (j = 0; j < sx; j++) {
          c = (unsigned char)bf[r * i + j];
          if (write(fd, &c, sizeof(c)) != 1) {
            error(7);
          }
        }
      }
    } else {
      error(8);
    }
  } else {
    error(9);
  }
  close(fd);
}


x86 assembly (clang, -O0):
<pputrast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x180,%esi
mov    $0x0,%al
call   1060 <creat@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
jle    123e <pputrast+0xfe>
mov    -0x30(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x20,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x20,%eax
jne    122d <pputrast+0xed>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1228 <pputrast+0xe8>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1215 <pputrast+0xd5>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x34(%rbp),%edx
imul   %edx,%ecx
mov    -0x38(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
cvttss2si (%rax,%rcx,4),%eax
mov    %al,-0x39(%rbp)
mov    -0x30(%rbp),%edi
lea    -0x39(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x1,%eax
je     1202 <pputrast+0xc2>
mov    $0x7,%edi
mov    $0x0,%al
call   1050 <error@plt>
jmp    1207 <pputrast+0xc7>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11b1 <pputrast+0x71>
jmp    121a <pputrast+0xda>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119e <pputrast+0x5e>
jmp    1239 <pputrast+0xf9>
mov    $0x8,%edi
mov    $0x0,%al
call   1050 <error@plt>
jmp    124a <pputrast+0x10a>
mov    $0x9,%edi
mov    $0x0,%al
call   1050 <error@plt>
mov    -0x30(%rbp),%edi
mov    $0x0,%al
call   1040 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pputrast>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r12d
mov    %r8d,%r15d
mov    %ecx,0x4(%rsp)
mov    %rdx,%rbp
mov    %rsi,%r13
mov    $0x180,%esi
xor    %eax,%eax
call   1060 <creat@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1218 <pputrast+0xd8>
mov    %ebx,%edi
mov    %r13,%rsi
mov    $0x20,%edx
xor    %eax,%eax
call   1030 <write@plt>
mov    $0x8,%edi
cmp    $0x20,%eax
jne    121d <pputrast+0xdd>
test   %r15d,%r15d
jle    1224 <pputrast+0xe4>
movslq %r12d,%rax
mov    %r15d,%ecx
mov    %rcx,0x8(%rsp)
mov    0x4(%rsp),%r14d
shl    $0x2,%rax
mov    %rax,0x10(%rsp)
lea    0x3(%rsp),%r15
xor    %r13d,%r13d
jmp    11d0 <pputrast+0x90>
nop
add    $0x1,%r13
add    0x10(%rsp),%rbp
cmp    0x8(%rsp),%r13
je     1224 <pputrast+0xe4>
cmpl   $0x0,0x4(%rsp)
jle    11c0 <pputrast+0x80>
xor    %r12d,%r12d
jmp    11e9 <pputrast+0xa9>
nopl   0x0(%rax)
add    $0x1,%r12
cmp    %r12,%r14
je     11c0 <pputrast+0x80>
cvttss2si 0x0(%rbp,%r12,4),%eax
mov    %al,0x3(%rsp)
mov    $0x1,%edx
mov    %ebx,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <write@plt>
cmp    $0x1,%eax
je     11e0 <pputrast+0xa0>
mov    $0x7,%edi
xor    %eax,%eax
call   1050 <error@plt>
jmp    11e0 <pputrast+0xa0>
mov    $0x9,%edi
xor    %eax,%eax
call   1050 <error@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <close@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @pputrast(i8* %0, i8* %1, float* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca float*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8
store i8* %0, i8** %8
store i8* %1, i8** %9
store float* %2, float** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%18 = load i8*, i8** %8
%19 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @creat to i32 (i8*, i32, ...)*)(i8* %18, i32 384)
store i32 %19, i32* %14
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %64
21: ; preds = %6
%22 = load i32, i32* %14
%23 = load i8*, i8** %9
%24 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %22, i8* %23, i32 32)
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %61
26: ; preds = %21
store i32 0, i32* %15
br label %27
27: ; preds = %57, %26
%28 = load i32, i32* %15
%29 = load i32, i32* %12
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %60
31: ; preds = %27
store i32 0, i32* %16
br label %32
32: ; preds = %53, %31
%33 = load i32, i32* %16
%34 = load i32, i32* %11
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %56
36: ; preds = %32
%37 = load float*, float** %10
%38 = load i32, i32* %13
%39 = load i32, i32* %15
%40 = mul nsw i32 %38, %39
%41 = load i32, i32* %16
%42 = add nsw i32 %40, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds float, float* %37, i64 %43
%45 = load float, float* %44
%46 = fptoui float %45 to i8
store i8 %46, i8* %17
%47 = load i32, i32* %14
%48 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %47, i8* %17, i64 1)
%49 = icmp ne i32 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %36
%51 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 7)
br label %52
52: ; preds = %50, %36
br label %53
53: ; preds = %52
%54 = load i32, i32* %16
%55 = add nsw i32 %54, 1
store i32 %55, i32* %16
br label %32
56: ; preds = %32
br label %57
57: ; preds = %56
%58 = load i32, i32* %15
%59 = add nsw i32 %58, 1
store i32 %59, i32* %15
br label %27
60: ; preds = %27
br label %63
61: ; preds = %21
%62 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 8)
br label %63
63: ; preds = %61, %60
br label %66
64: ; preds = %6
%65 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 9)
br label %66
66: ; preds = %64, %63
%67 = load i32, i32* %14
%68 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %67)
%69 = load i32, i32* %7
ret i32 %69
}

LLVM IR (-O2):
define i32 @pputrast(i8* %0, i8* %1, float* nocapture %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8
%8 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @creat to i32 (i8*, i32, ...)*)(i8* %0, i32 384)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %40
10: ; preds = %6
%11 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %8, i8* %1, i32 32)
%12 = icmp eq i32 %11, 32
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = icmp sgt i32 %4, 0
br i1 %14, label %15, label %43
15: ; preds = %13
%16 = icmp sgt i32 %3, 0
%17 = sext i32 %5 to i64
%18 = zext i32 %4 to i64
%19 = zext i32 %3 to i64
br label %20
20: ; preds = %15, %37
%21 = phi i64 [ 0, %15 ], [ %38, %37 ]
br i1 %16, label %22, label %37
22: ; preds = %20
%23 = mul nsw i64 %21, %17
br label %24
24: ; preds = %22, %34
%25 = phi i64 [ 0, %22 ], [ %35, %34 ]
%26 = add nsw i64 %25, %23
%27 = getelementptr inbounds float, float* %2, i64 %26
%28 = load float, float* %27
%29 = fptoui float %28 to i8
store i8 %29, i8* %7
%30 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %8, i8* %7, i64 1)
%31 = icmp eq i32 %30, 1
br i1 %31, label %34, label %32
32: ; preds = %24
%33 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 7)
br label %34
34: ; preds = %24, %32
%35 = add nuw nsw i64 %25, 1
%36 = icmp eq i64 %35, %19
br i1 %36, label %37, label %24
37: ; preds = %34, %20
%38 = add nuw nsw i64 %21, 1
%39 = icmp eq i64 %38, %18
br i1 %39, label %43, label %20
40: ; preds = %6, %10
%41 = phi i32 [ 8, %10 ], [ 9, %6 ]
%42 = tail call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 %41)
br label %43
43: ; preds = %37, %40, %13
%44 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %8)
ret i32 undef
}