#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 */
double float_uniform(int *);
void smp_random(int nvar, int npoint, int *seed, double x[]) {
  int i, j, k;
  for (k = i = 0; i < nvar; i++)
    for (j = 0; j < npoint; j++)
      x[k++] = float_uniform(seed);
}


x86 assembly (clang, -O0):
<smp_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1194 <smp_random+0x84>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1181 <smp_random+0x71>
mov    -0x10(%rbp),%rdi
call   1030 <float_uniform@plt>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1147 <smp_random+0x37>
jmp    1186 <smp_random+0x76>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <smp_random+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smp_random>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %esi,0x8(%rsp)
mov    %edi,0xc(%rsp)
test   %edi,%edi
jle    118c <smp_random+0x7c>
mov    %rdx,%rbx
mov    0x8(%rsp),%ebp
xor    %r13d,%r13d
xor    %r14d,%r14d
jmp    114b <smp_random+0x3b>
xchg   %ax,%ax
add    $0x1,%r14d
cmp    0xc(%rsp),%r14d
je     118c <smp_random+0x7c>
cmpl   $0x0,0x8(%rsp)
jle    1140 <smp_random+0x30>
movslq %r13d,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%r12
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <float_uniform@plt>
movsd  %xmm0,(%r12,%r15,8)
add    $0x1,%r15
cmp    %r15d,%ebp
jne    1170 <smp_random+0x60>
add    %r15d,%r13d
jmp    1140 <smp_random+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @smp_random(i32 %0, i32 %1, i32* %2, double* nocapture writeonly %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %27
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br label %8
8: ; preds = %6, %23
%9 = phi i32 [ 0, %6 ], [ %24, %23 ]
%10 = phi i32 [ 0, %6 ], [ %25, %23 ]
br i1 %7, label %11, label %23
11: ; preds = %8
%12 = sext i32 %9 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ %12, %11 ], [ %17, %13 ]
%15 = phi i32 [ 0, %11 ], [ %19, %13 ]
%16 = tail call double @float_uniform(i32* %2)
%17 = add nsw i64 %14, 1
%18 = getelementptr inbounds double, double* %3, i64 %14
store double %16, double* %18
%19 = add nuw nsw i32 %15, 1
%20 = icmp eq i32 %19, %1
br i1 %20, label %21, label %13
21: ; preds = %13
%22 = trunc i64 %17 to i32
br label %23
23: ; preds = %21, %8
%24 = phi i32 [ %9, %8 ], [ %22, %21 ]
%25 = add nuw nsw i32 %10, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %27, label %8
27: ; preds = %23, %4
ret void
}