#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*/ assertTrue(char *, int);
int rand();
int /*<<< orphan*/ srand(int);
void test_seed() {
  int x[3];
  srand(40039);
  x[0] = rand();
  x[1] = rand();
  x[2] = rand();
  srand(40039);
  assertTrue("rand() == x[0]", rand() == x[0]);
  ;
  assertTrue("rand() == x[1]", rand() == x[1]);
  ;
  assertTrue("rand() == x[2]", rand() == x[2]);
  ;
}


x86 assembly (clang, -O0):
<test_seed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x9c67,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    %eax,-0x4(%rbp)
mov    $0x9c67,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe7d(%rip),%rdi
call   1030 <assertTrue@plt>
mov    $0x0,%al
call   1050 <rand@plt>
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe6e(%rip),%rdi
call   1030 <assertTrue@plt>
mov    $0x0,%al
call   1050 <rand@plt>
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe5f(%rip),%rdi
call   1030 <assertTrue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_seed>:
push   %rbp
push   %r14
push   %rbx
mov    $0x9c67,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%r14d
mov    $0x9c67,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
xor    %esi,%esi
cmp    %ebx,%eax
sete   %sil
lea    0xe86(%rip),%rdi
call   1030 <assertTrue@plt>
xor    %eax,%eax
call   1050 <rand@plt>
xor    %esi,%esi
cmp    %ebp,%eax
sete   %sil
lea    0xe7a(%rip),%rdi
call   1030 <assertTrue@plt>
xor    %eax,%eax
call   1050 <rand@plt>
xor    %esi,%esi
cmp    %r14d,%eax
sete   %sil
lea    0xe6d(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <assertTrue@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"rand() == x[0]\00"
@.str.1 = [15 x i8] c"rand() == x[1]\00"
@.str.2 = [15 x i8] c"rand() == x[2]\00"
define void @test_seed() {
%1 = alloca [3 x i32]
%2 = call i32 @srand(i32 40039)
%3 = call i32 (...) @rand()
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 %3, i32* %4
%5 = call i32 (...) @rand()
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 %5, i32* %6
%7 = call i32 (...) @rand()
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 %7, i32* %8
%9 = call i32 @srand(i32 40039)
%10 = call i32 (...) @rand()
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%12 = load i32, i32* %11
%13 = icmp eq i32 %10, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (...) @rand()
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%18 = load i32, i32* %17
%19 = icmp eq i32 %16, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 (...) @rand()
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%24 = load i32, i32* %23
%25 = icmp eq i32 %22, %24
%26 = zext i1 %25 to i32
%27 = call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %26)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"rand() == x[0]\00"
@.str.1 = [15 x i8] c"rand() == x[1]\00"
@.str.2 = [15 x i8] c"rand() == x[2]\00"
define void @test_seed() {
%1 = tail call i32 @srand(i32 40039)
%2 = tail call i32 (...) @rand()
%3 = tail call i32 (...) @rand()
%4 = tail call i32 (...) @rand()
%5 = tail call i32 @srand(i32 40039)
%6 = tail call i32 (...) @rand()
%7 = icmp eq i32 %6, %2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @rand()
%11 = icmp eq i32 %10, %3
%12 = zext i1 %11 to i32
%13 = tail call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @rand()
%15 = icmp eq i32 %14, %4
%16 = zext i1 %15 to i32
%17 = tail call i32 @assertTrue(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret void
}