#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 */

/* Variables and functions */
unsigned long random();
void random_wordstring(unsigned long *a, long n) {
  long i;
  for (i = 0; i < n; i++) {
    a[i] = random() | (random() << 31);
    if (sizeof(long) > sizeof(int))
      a[i] = (a[1] << 31) | random();
  }
}


x86 assembly (clang, -O0):
<random_wordstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    119a <random_wordstring+0x8a>
mov    $0x0,%al
call   1030 <random@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    -0x28(%rbp),%rdx
shl    $0x1f,%rax
or     %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
shl    $0x1f,%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    -0x20(%rbp),%rdx
or     %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <random_wordstring+0x18>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_wordstring>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
jle    116b <random_wordstring+0x5b>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <random@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1030 <random@plt>
shl    $0x1f,%rax
or     %r12,%rax
mov    %rax,(%r15,%rbx,8)
mov    0x8(%r15),%r12
shl    $0x1f,%r12
xor    %eax,%eax
call   1030 <random@plt>
or     %r12,%rax
mov    %rax,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <random_wordstring+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @random_wordstring(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %27, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp slt i64 %7, %8
br i1 %9, label %10, label %30
10: ; preds = %6
%11 = call i64 (...) @random()
%12 = call i64 (...) @random()
%13 = shl i64 %12, 31
%14 = or i64 %11, %13
%15 = load i64*, i64** %3
%16 = load i64, i64* %5
%17 = getelementptr inbounds i64, i64* %15, i64 %16
store i64 %14, i64* %17
%18 = load i64*, i64** %3
%19 = getelementptr inbounds i64, i64* %18, i64 1
%20 = load i64, i64* %19
%21 = shl i64 %20, 31
%22 = call i64 (...) @random()
%23 = or i64 %21, %22
%24 = load i64*, i64** %3
%25 = load i64, i64* %5
%26 = getelementptr inbounds i64, i64* %24, i64 %25
store i64 %23, i64* %26
br label %27
27: ; preds = %10
%28 = load i64, i64* %5
%29 = add nsw i64 %28, 1
store i64 %29, i64* %5
br label %6
30: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @random_wordstring(i64* nocapture %0, i64 %1) {
%3 = icmp sgt i64 %1, 0
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = getelementptr inbounds i64, i64* %0, i64 1
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %17, %6 ]
%8 = tail call i64 (...) @random()
%9 = tail call i64 (...) @random()
%10 = shl i64 %9, 31
%11 = or i64 %10, %8
%12 = getelementptr inbounds i64, i64* %0, i64 %7
store i64 %11, i64* %12
%13 = load i64, i64* %5
%14 = shl i64 %13, 31
%15 = tail call i64 (...) @random()
%16 = or i64 %14, %15
store i64 %16, i64* %12
%17 = add nuw nsw i64 %7, 1
%18 = icmp eq i64 %17, %1
br i1 %18, label %19, label %6
19: ; preds = %6, %2
ret void
}