#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 */
int /*<<< orphan*/ drand48();
int /*<<< orphan*/ erand48(unsigned short *);
int /*<<< orphan*/ jrand48(unsigned short *);
int /*<<< orphan*/ lcong48(unsigned short *);
int /*<<< orphan*/ lrand48();
int /*<<< orphan*/ mrand48();
int /*<<< orphan*/ nrand48(unsigned short *);
int /*<<< orphan*/ rand();
int /*<<< orphan*/ rand_r(unsigned int *);
int /*<<< orphan*/ random();
void test_rand() {
  unsigned short a[7];
  unsigned b;
  rand();
  drand48();
  erand48(a);
  jrand48(a);
  lcong48(a);
  lrand48();
  mrand48();
  nrand48(a);
  rand_r(&b);
  random();
}


x86 assembly (clang, -O0):
<test_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x0,%al
call   10c0 <drand48@plt>
lea    -0xe(%rbp),%rdi
call   1090 <erand48@plt>
lea    -0xe(%rbp),%rdi
call   10a0 <jrand48@plt>
lea    -0xe(%rbp),%rdi
call   1050 <lcong48@plt>
mov    $0x0,%al
call   1080 <lrand48@plt>
mov    $0x0,%al
call   1060 <mrand48@plt>
lea    -0xe(%rbp),%rdi
call   1030 <nrand48@plt>
lea    -0x14(%rbp),%rdi
call   1040 <rand_r@plt>
mov    $0x0,%al
call   1070 <random@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_rand>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   10b0 <rand@plt>
xor    %eax,%eax
call   10c0 <drand48@plt>
lea    0x12(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <erand48@plt>
mov    %rbx,%rdi
call   10a0 <jrand48@plt>
mov    %rbx,%rdi
call   1050 <lcong48@plt>
xor    %eax,%eax
call   1080 <lrand48@plt>
xor    %eax,%eax
call   1060 <mrand48@plt>
mov    %rbx,%rdi
call   1030 <nrand48@plt>
lea    0xc(%rsp),%rdi
call   1040 <rand_r@plt>
xor    %eax,%eax
call   1070 <random@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @test_rand() {
%1 = alloca [7 x i16]
%2 = alloca i32
%3 = call i32 (...) @rand()
%4 = call i32 (...) @drand48()
%5 = getelementptr inbounds [7 x i16], [7 x i16]* %1, i64 0, i64 0
%6 = call i32 @erand48(i16* %5)
%7 = getelementptr inbounds [7 x i16], [7 x i16]* %1, i64 0, i64 0
%8 = call i32 @jrand48(i16* %7)
%9 = getelementptr inbounds [7 x i16], [7 x i16]* %1, i64 0, i64 0
%10 = call i32 @lcong48(i16* %9)
%11 = call i32 (...) @lrand48()
%12 = call i32 (...) @mrand48()
%13 = getelementptr inbounds [7 x i16], [7 x i16]* %1, i64 0, i64 0
%14 = call i32 @nrand48(i16* %13)
%15 = call i32 @rand_r(i32* %2)
%16 = call i32 (...) @random()
ret void
}

LLVM IR (-O2):
define void @test_rand() {
%1 = alloca [7 x i16]
%2 = alloca i32
%3 = bitcast [7 x i16]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @rand()
%6 = tail call i32 (...) @drand48()
%7 = getelementptr inbounds [7 x i16], [7 x i16]* %1, i64 0, i64 0
%8 = call i32 @erand48(i16* %7)
%9 = call i32 @jrand48(i16* %7)
%10 = call i32 @lcong48(i16* %7)
%11 = call i32 (...) @lrand48()
%12 = call i32 (...) @mrand48()
%13 = call i32 @nrand48(i16* %7)
%14 = call i32 @rand_r(i32* %2)
%15 = call i32 (...) @random()
ret void
}