#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 randlc(double *, double *);
void create_seq(double seed, double a, int q, int *arr) {
  double x;
  register int i, k;
  k = (1 << 19) / 4;
  for (i = 0; i < q; i++) {
    x = randlc(&seed, &a);
    x += randlc(&seed, &a);
    x += randlc(&seed, &a);
    x += randlc(&seed, &a);
    arr[i] = (int)(k * x);
  }
}


x86 assembly (clang, -O0):
<create_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
movl   $0x20000,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c1 <create_seq+0xb1>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <randlc@plt>
movsd  %xmm0,-0x28(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <randlc@plt>
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <randlc@plt>
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <randlc@plt>
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x30(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1137 <create_seq+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_seq>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
test   %edi,%edi
jle    11a9 <create_seq+0x99>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r13
nop
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <randlc@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <randlc@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <randlc@plt>
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
mov    %r13,%rsi
call   1030 <randlc@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xe68(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <create_seq+0x30>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @create_seq(double %0, double %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca double
%6 = alloca double
store double %0, double* %5
store double %1, double* %6
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %24
8: ; preds = %4
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %22, %10 ]
%12 = call double @randlc(double* %5, double* %6)
%13 = call double @randlc(double* %5, double* %6)
%14 = fadd double %12, %13
%15 = call double @randlc(double* %5, double* %6)
%16 = fadd double %14, %15
%17 = call double @randlc(double* %5, double* %6)
%18 = fadd double %16, %17
%19 = fmul double %18, 1.310720e+05
%20 = fptosi double %19 to i32
%21 = getelementptr inbounds i32, i32* %3, i64 %11
store i32 %20, i32* %21
%22 = add nuw nsw i64 %11, 1
%23 = icmp eq i64 %22, %9
br i1 %23, label %24, label %10
24: ; preds = %10, %4
ret void
}