#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();
  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)
mov    -0x4(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <srandom@plt>
mov    -0x4(%rbp),%edi
call   1030 <srandom@plt>
lea    0xe9b(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe8f(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xe8b(%rip),%rdi
lea    0xe71(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe75(%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   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <get_time@plt>
mov    %eax,%ebp
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %ebp,%edi
call   1030 <srandom@plt>
mov    %ebp,%edi
call   1030 <srandom@plt>
lea    0xea3(%rip),%rdi
lea    0xeac(%rip),%r14
mov    %r14,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe9c(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe94(%rip),%rdi
mov    %r14,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1070 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
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
%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 %1)
%3 = tail call i32 @srandom(i32 %1)
%4 = tail call i32 @srandom(i32 %1)
%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 %1)
%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 %1)
%10 = tail call i32 @fclose(i32* %8)
ret void
}