int __jrand48_r(xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
long int *result;
{
  if (__drand48_iterate(xsubi, buffer) < 0)
    return -1;
  *result = ((xsubi[2] << 16) | xsubi[1]) & 0xffffffffl;
  return 0;
}


x86 assembly (clang, -O0):
<__jrand48_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <__drand48_iterate@plt>
cmp    $0x0,%eax
jge    1148 <__jrand48_r+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <__jrand48_r+0x6b>
mov    -0x10(%rbp),%rax
movzwl 0x4(%rax),%eax
shl    $0x10,%eax
mov    -0x10(%rbp),%rcx
movzwl 0x2(%rcx),%ecx
or     %ecx,%eax
movslq %eax,%rcx
movabs $0xffffffff,%rax
and    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__jrand48_r>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <__drand48_iterate@plt>
test   %eax,%eax
js     112f <__jrand48_r+0x1f>
mov    0x2(%rbx),%eax
mov    %rax,(%r14)
jmp    1134 <__jrand48_r+0x24>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.drand48_data = type opaque
define i32 @__jrand48_r(i16* %0, %struct.drand48_data* %1, i64* %2) {
%4 = alloca i32
%5 = alloca i16*
%6 = alloca %struct.drand48_data*
%7 = alloca i64*
store i16* %0, i16** %5
store %struct.drand48_data* %1, %struct.drand48_data** %6
store i64* %2, i64** %7
%8 = load i16*, i16** %5
%9 = load %struct.drand48_data*, %struct.drand48_data** %6
%10 = call i32 (i16*, %struct.drand48_data*, ...) bitcast (i32 (...)* @__drand48_iterate to i32 (i16*, %struct.drand48_data*, ...)*)(i16* %8, %struct.drand48_data* %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
store i32 -1, i32* %4
br label %27
13: ; preds = %3
%14 = load i16*, i16** %5
%15 = getelementptr inbounds i16, i16* %14, i64 2
%16 = load i16, i16* %15
%17 = zext i16 %16 to i32
%18 = shl i32 %17, 16
%19 = load i16*, i16** %5
%20 = getelementptr inbounds i16, i16* %19, i64 1
%21 = load i16, i16* %20
%22 = zext i16 %21 to i32
%23 = or i32 %18, %22
%24 = sext i32 %23 to i64
%25 = and i64 %24, 4294967295
%26 = load i64*, i64** %7
store i64 %25, i64* %26
store i32 0, i32* %4
br label %27
27: ; preds = %13, %12
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
%struct.drand48_data = type opaque
define i32 @__jrand48_r(i16* %0, %struct.drand48_data* %1, i64* nocapture writeonly %2) {
%4 = tail call i32 (i16*, %struct.drand48_data*, ...) bitcast (i32 (...)* @__drand48_iterate to i32 (i16*, %struct.drand48_data*, ...)*)(i16* %0, %struct.drand48_data* %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = getelementptr inbounds i16, i16* %0, i64 2
%8 = load i16, i16* %7
%9 = zext i16 %8 to i64
%10 = shl nuw nsw i64 %9, 16
%11 = getelementptr inbounds i16, i16* %0, i64 1
%12 = load i16, i16* %11
%13 = zext i16 %12 to i64
%14 = or i64 %10, %13
store i64 %14, i64* %2
br label %15
15: ; preds = %3, %6
%16 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %16
}