void pputrast(fn, hd, bf, sx, sy, r) char *fn;
unsigned char hd[32];
float bf[512 * 512];
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(8);
          }
        }
      }
    } else {
      error(9);
    }
  } else {
    error(10);
  }
  close(fd);
}


x86 assembly (clang, -O0):
<pputrast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x180,%esi
mov    $0x0,%al
call   1060 <creat@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jle    123e <pputrast+0xfe>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x20,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x20,%eax
jne    122d <pputrast+0xed>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1228 <pputrast+0xe8>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1215 <pputrast+0xd5>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    -0x2c(%rbp),%edx
imul   %edx,%ecx
mov    -0x30(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
cvttss2si (%rax,%rcx,4),%eax
mov    %al,-0x31(%rbp)
mov    -0x28(%rbp),%edi
lea    -0x31(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x1,%eax
je     1202 <pputrast+0xc2>
mov    $0x8,%edi
mov    $0x0,%al
call   1050 <error@plt>
jmp    1207 <pputrast+0xc7>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b1 <pputrast+0x71>
jmp    121a <pputrast+0xda>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    119e <pputrast+0x5e>
jmp    1239 <pputrast+0xf9>
mov    $0x9,%edi
mov    $0x0,%al
call   1050 <error@plt>
jmp    124a <pputrast+0x10a>
mov    $0xa,%edi
mov    $0x0,%al
call   1050 <error@plt>
mov    -0x28(%rbp),%edi
mov    $0x0,%al
call   1040 <close@plt>
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    $0x9,%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    $0x8,%edi
xor    %eax,%eax
call   1050 <error@plt>
jmp    11e0 <pputrast+0xa0>
mov    $0xa,%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 void @pputrast(i8* %0, i8* %1, float* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca float*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
store i8* %0, i8** %7
store i8* %1, i8** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%17 = load i8*, i8** %7
%18 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @creat to i32 (i8*, i32, ...)*)(i8* %17, i32 384)
store i32 %18, i32* %13
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %63
20: ; preds = %6
%21 = load i32, i32* %13
%22 = load i8*, i8** %8
%23 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %21, i8* %22, i32 32)
%24 = icmp eq i32 %23, 32
br i1 %24, label %25, label %60
25: ; preds = %20
store i32 0, i32* %14
br label %26
26: ; preds = %56, %25
%27 = load i32, i32* %14
%28 = load i32, i32* %11
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %59
30: ; preds = %26
store i32 0, i32* %15
br label %31
31: ; preds = %52, %30
%32 = load i32, i32* %15
%33 = load i32, i32* %10
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %55
35: ; preds = %31
%36 = load float*, float** %9
%37 = load i32, i32* %12
%38 = load i32, i32* %14
%39 = mul nsw i32 %37, %38
%40 = load i32, i32* %15
%41 = add nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds float, float* %36, i64 %42
%44 = load float, float* %43
%45 = fptoui float %44 to i8
store i8 %45, i8* %16
%46 = load i32, i32* %13
%47 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %46, i8* %16, i64 1)
%48 = icmp ne i32 %47, 1
br i1 %48, label %49, label %51
49: ; preds = %35
%50 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 8)
br label %51
51: ; preds = %49, %35
br label %52
52: ; preds = %51
%53 = load i32, i32* %15
%54 = add nsw i32 %53, 1
store i32 %54, i32* %15
br label %31
55: ; preds = %31
br label %56
56: ; preds = %55
%57 = load i32, i32* %14
%58 = add nsw i32 %57, 1
store i32 %58, i32* %14
br label %26
59: ; preds = %26
br label %62
60: ; preds = %20
%61 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 9)
br label %62
62: ; preds = %60, %59
br label %65
63: ; preds = %6
%64 = call i32 (i32, ...) bitcast (i32 (...)* @error to i32 (i32, ...)*)(i32 10)
br label %65
65: ; preds = %63, %62
%66 = load i32, i32* %13
%67 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %66)
ret void
}

LLVM IR (-O2):
define void @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 8)
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 [ 9, %10 ], [ 10, %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 void
}