SSWRITE(pds, sds, words) long *pds, *sds, *words;
{
  long n, count;
  char *ermsg = "Error: The number of words to be written by SSWRITE must be a "
                "multiple of 512\n";
  if (*words == 0)
    return (0);
  count = *words / 512;
  if (count * 512 != *words) {
    write(2, ermsg, strlen(ermsg));
    return (-1L);
  }
  n = sswrite((char *)pds, (char *)*sds, count);
  return (n);
}


x86 assembly (clang, -O0):
<SSWRITE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1169 <SSWRITE+0x39>
movl   $0x0,-0x4(%rbp)
jmp    11e6 <SSWRITE+0xb6>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    $0x200,%ecx
cqto
idiv   %rcx
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
shl    $0x9,%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
je     11c3 <SSWRITE+0x93>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x40(%rbp),%rsi
mov    %rax,%rdx
mov    $0x2,%edi
mov    $0x0,%al
call   1040 <write@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e6 <SSWRITE+0xb6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1030 <sswrite@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSWRITE>:
push   %rax
mov    (%rdx),%rax
test   %rax,%rax
je     1155 <SSWRITE+0x35>
lea    0x1ff(%rax),%rdx
test   %rax,%rax
cmovns %rax,%rdx
mov    %rdx,%rcx
and    $0xfffffffffffffe00,%rcx
cmp    %rax,%rcx
jne    1159 <SSWRITE+0x39>
sar    $0x9,%rdx
mov    (%rsi),%rsi
xor    %eax,%eax
pop    %rcx
jmp    1030 <sswrite@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea0(%rip),%rsi
mov    $0x4e,%edx
mov    $0x2,%edi
xor    %eax,%eax
call   1040 <write@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [79 x i8] c"Error: The number of words to be written by SSWRITE must be a multiple of 512\0A\00"
define i32 @SSWRITE(i64* %0, i64* %1, i64* %2) {
%4 = alloca i32
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
store i64* %0, i64** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
store i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = load i64*, i64** %7
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 0, i32* %4
br label %40
15: ; preds = %3
%16 = load i64*, i64** %7
%17 = load i64, i64* %16
%18 = sdiv i64 %17, 512
store i64 %18, i64* %9
%19 = load i64, i64* %9
%20 = mul nsw i64 %19, 512
%21 = load i64*, i64** %7
%22 = load i64, i64* %21
%23 = icmp ne i64 %20, %22
br i1 %23, label %24, label %29
24: ; preds = %15
%25 = load i8*, i8** %10
%26 = load i8*, i8** %10
%27 = call i64 @strlen(i8* %26)
%28 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %25, i64 %27)
store i32 -1, i32* %4
br label %40
29: ; preds = %15
%30 = load i64*, i64** %5
%31 = bitcast i64* %30 to i8*
%32 = load i64*, i64** %6
%33 = load i64, i64* %32
%34 = inttoptr i64 %33 to i8*
%35 = load i64, i64* %9
%36 = call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @sswrite to i32 (i8*, i8*, i64, ...)*)(i8* %31, i8* %34, i64 %35)
%37 = sext i32 %36 to i64
store i64 %37, i64* %8
%38 = load i64, i64* %8
%39 = trunc i64 %38 to i32
store i32 %39, i32* %4
br label %40
40: ; preds = %29, %24, %14
%41 = load i32, i32* %4
ret i32 %41
}

LLVM IR (-O2):
@.str = [79 x i8] c"Error: The number of words to be written by SSWRITE must be a multiple of 512\0A\00"
define i32 @SSWRITE(i64* %0, i64* nocapture %1, i64* nocapture %2) {
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3
%7 = sdiv i64 %4, 512
%8 = shl nsw i64 %7, 9
%9 = icmp eq i64 %8, %4
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i64 78)
br label %17
12: ; preds = %6
%13 = bitcast i64* %0 to i8*
%14 = load i64, i64* %1
%15 = inttoptr i64 %14 to i8*
%16 = tail call i32 (i8*, i8*, i64, ...) bitcast (i32 (...)* @sswrite to i32 (i8*, i8*, i64, ...)*)(i8* %13, i8* %15, i64 %7)
br label %17
17: ; preds = %3, %12, %10
%18 = phi i32 [ -1, %10 ], [ %16, %12 ], [ 0, %3 ]
ret i32 %18
}