#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 */
float RAND_MAX;
scalar_t__ rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int randomSequence(int *sequence, int size, int a, int b) {
  srand(time(0));
  if (b < a)
    return (1);
  else {
    int i;
    for (i = 0; i < size; i++) {
      float num = (float)rand() / RAND_MAX;
      sequence[i] = a + (int)(num * (b - a));
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<randomSequence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    116b <randomSequence+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    11d6 <randomSequence+0xa6>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11cf <randomSequence+0x9f>
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2e57(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x18(%rbp),%edx
movss  -0x24(%rbp),%xmm0
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1172 <randomSequence+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomSequence>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %edx,%r13d
mov    %esi,%r12d
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x1,%r15d
sub    %r13d,%ebp
jl     11bf <randomSequence+0x8f>
mov    $0x0,%r15d
test   %r12d,%r12d
jle    11bf <randomSequence+0x8f>
cvtsi2ss %ebp,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %r12d,%ebp
xor    %r15d,%r15d
mov    0x2e67(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  (%r12),%xmm0
mulss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%eax
add    %r13d,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <randomSequence+0x60>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global float 0.000000e+00
define i32 @randomSequence(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca float
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%12 = call i32 @time(i32 0)
%13 = call i32 @srand(i32 %12)
%14 = load i32, i32* %9
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %4
store i32 1, i32* %5
br label %45
18: ; preds = %4
store i32 0, i32* %10
br label %19
19: ; preds = %41, %18
%20 = load i32, i32* %10
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %44
23: ; preds = %19
%24 = call i64 (...) @rand()
%25 = sitofp i64 %24 to float
%26 = load float, float* @RAND_MAX
%27 = fdiv float %25, %26
store float %27, float* %11
%28 = load i32, i32* %8
%29 = load float, float* %11
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = sub nsw i32 %30, %31
%33 = sitofp i32 %32 to float
%34 = fmul float %29, %33
%35 = fptosi float %34 to i32
%36 = add nsw i32 %28, %35
%37 = load i32*, i32** %6
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
store i32 %36, i32* %40
br label %41
41: ; preds = %23
%42 = load i32, i32* %10
%43 = add nsw i32 %42, 1
store i32 %43, i32* %10
br label %19
44: ; preds = %19
store i32 0, i32* %5
br label %45
45: ; preds = %44, %17
%46 = load i32, i32* %5
ret i32 %46
}

LLVM IR (-O2):
@RAND_MAX = global float 0.000000e+00
define i32 @randomSequence(i32* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @time(i32 0)
%6 = tail call i32 @srand(i32 %5)
%7 = icmp slt i32 %3, %2
br i1 %7, label %26, label %8
8: ; preds = %4
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %26
10: ; preds = %8
%11 = sub nsw i32 %3, %2
%12 = sitofp i32 %11 to float
%13 = zext i32 %1 to i64
br label %14
14: ; preds = %10, %14
%15 = phi i64 [ 0, %10 ], [ %24, %14 ]
%16 = tail call i64 (...) @rand()
%17 = sitofp i64 %16 to float
%18 = load float, float* @RAND_MAX
%19 = fdiv float %17, %18
%20 = fmul float %19, %12
%21 = fptosi float %20 to i32
%22 = add nsw i32 %21, %2
%23 = getelementptr inbounds i32, i32* %0, i64 %15
store i32 %22, i32* %23
%24 = add nuw nsw i64 %15, 1
%25 = icmp eq i64 %24, %13
br i1 %25, label %26, label %14
26: ; preds = %14, %8, %4
%27 = phi i32 [ 1, %4 ], [ 0, %8 ], [ 0, %14 ]
ret i32 %27
}