#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 int csql_rand_get();
int /*<<< orphan*/ memcpy(char *, unsigned int *, int);
void csql_rand_fill(char *buf) {
  unsigned int randint, i, times;
  times = 20 / sizeof(unsigned int);
  for (i = 0; i < times; i++) {
    randint = csql_rand_get();
    memcpy(buf + (i * sizeof(unsigned int)), &randint, sizeof(unsigned int));
  }
}


x86 assembly (clang, -O0):
<csql_rand_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x5,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    117a <csql_rand_fill+0x5a>
mov    $0x0,%al
call   1030 <csql_rand_get@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113a <csql_rand_fill+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csql_rand_fill>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <csql_rand_get@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
call   1030 <csql_rand_get@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rbx),%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
call   1030 <csql_rand_get@plt>
mov    %eax,0x4(%rsp)
lea    0x8(%rbx),%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
call   1030 <csql_rand_get@plt>
mov    %eax,0x4(%rsp)
lea    0xc(%rbx),%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
call   1030 <csql_rand_get@plt>
mov    %eax,0x4(%rsp)
add    $0x10,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @csql_rand_fill(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 5, i32* %5
store i32 0, i32* %4
br label %6
6: ; preds = %18, %1
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = call i32 (...) @csql_rand_get()
store i32 %11, i32* %3
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = getelementptr inbounds i8, i8* %12, i64 %15
%17 = call i32 @memcpy(i8* %16, i32* %3, i32 4)
br label %18
18: ; preds = %10
%19 = load i32, i32* %4
%20 = add i32 %19, 1
store i32 %20, i32* %4
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @csql_rand_fill(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 (...) @csql_rand_get()
store i32 %4, i32* %2
%5 = call i32 @memcpy(i8* %0, i32* %2, i32 4)
%6 = call i32 (...) @csql_rand_get()
store i32 %6, i32* %2
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = call i32 @memcpy(i8* %7, i32* %2, i32 4)
%9 = call i32 (...) @csql_rand_get()
store i32 %9, i32* %2
%10 = getelementptr inbounds i8, i8* %0, i64 8
%11 = call i32 @memcpy(i8* %10, i32* %2, i32 4)
%12 = call i32 (...) @csql_rand_get()
store i32 %12, i32* %2
%13 = getelementptr inbounds i8, i8* %0, i64 12
%14 = call i32 @memcpy(i8* %13, i32* %2, i32 4)
%15 = call i32 (...) @csql_rand_get()
store i32 %15, i32* %2
%16 = getelementptr inbounds i8, i8* %0, i64 16
%17 = call i32 @memcpy(i8* %16, i32* %2, i32 4)
ret void
}