#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int get_time();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ srandom(int);
void setseed() {
  int seconds;
  FILE *fptr;
  seconds = get_time();
  seconds = 796934483;
  printf("\nSetting seed for random number generator to %d.\n\n", seconds);
  srandom(seconds);
  srandom(seconds);
  fptr = fopen("output/seed.out", "a");
  fprintf(fptr, "The seed is %d\n\n", seconds);
  fclose(fptr);
  fptr = fopen("results", "a");
  fprintf(fptr, "\nThe seed is %d\n", seconds);
  fclose(fptr);
}


x86 assembly (clang, -O0):
<setseed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <get_time@plt>
mov    %eax,-0x4(%rbp)
movl   $0x2f804153,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <srandom@plt>
mov    -0x4(%rbp),%edi
call   1030 <srandom@plt>
lea    0xe94(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe88(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe84(%rip),%rdi
lea    0xe6a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe6e(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setseed>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <get_time@plt>
lea    0xe8e(%rip),%rdi
mov    $0x2f804153,%esi
call   1050 <printf@plt>
mov    $0x2f804153,%edi
call   1030 <srandom@plt>
mov    $0x2f804153,%edi
call   1030 <srandom@plt>
lea    0xe9c(%rip),%rdi
lea    0xea5(%rip),%r14
mov    %r14,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%rsi
mov    %rax,%rdi
mov    $0x2f804153,%edx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe8a(%rip),%rdi
mov    %r14,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe80(%rip),%rsi
mov    %rax,%rdi
mov    $0x2f804153,%edx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"\0ASetting seed for random number generator to %d.\0A\0A\00"
@.str.1 = [16 x i8] c"output/seed.out\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [17 x i8] c"The seed is %d\0A\0A\00"
@.str.4 = [8 x i8] c"results\00"
@.str.5 = [17 x i8] c"\0AThe seed is %d\0A\00"
define void @setseed() {
%1 = alloca i32
%2 = alloca i32*
%3 = call i32 (...) @get_time()
store i32 %3, i32* %1
store i32 796934483, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @srandom(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @srandom(i32 %8)
%10 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = load i32, i32* %1
%13 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %2
%15 = call i32 @fclose(i32* %14)
%16 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %16, i32** %2
%17 = load i32*, i32** %2
%18 = load i32, i32* %1
%19 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = load i32*, i32** %2
%21 = call i32 @fclose(i32* %20)
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"\0ASetting seed for random number generator to %d.\0A\0A\00"
@.str.1 = [16 x i8] c"output/seed.out\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [17 x i8] c"The seed is %d\0A\0A\00"
@.str.4 = [8 x i8] c"results\00"
@.str.5 = [17 x i8] c"\0AThe seed is %d\0A\00"
define void @setseed() {
%1 = tail call i32 (...) @get_time()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 796934483)
%3 = tail call i32 @srandom(i32 796934483)
%4 = tail call i32 @srandom(i32 796934483)
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 796934483)
%7 = tail call i32 @fclose(i32* %5)
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 796934483)
%10 = tail call i32 @fclose(i32* %8)
ret void
}