#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 time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int rand();
int /*<<< orphan*/ srand(unsigned int);
int time(int /*<<< orphan*/ *);
int main(void) {
  time_t clk = time(0);
  unsigned int tempo1 = 0, tempo2 = 0, tempo3 = 0, tempo4 = 0;
  tempo1 = clk / 256;
  tempo2 = clk % 256;
  tempo3 = (tempo1 * tempo2) % 256;
  tempo4 = (tempo3 + tempo2) % 256;
  printf("\nTempo coletado: %i", (int)clk);
  printf("\nPrimeiro VALOR: %i", tempo1);
  printf("\nSegundo VALOR:  %i", tempo2);
  printf("\nTerceiro VALOR: %i", tempo3);
  printf("\nQuarto VALOR: %i", tempo4);
  unsigned int x_randomico = 0, y_randomico = 0;
  srand((unsigned)time(NULL));
  x_randomico = rand() % 256;
  srand((unsigned)time(NULL) + tempo3 * tempo4);
  y_randomico = rand() % 256;
  printf("\n\n Primeiro Rand: %i", x_randomico);
  printf("\n Segundo Rand: %i", y_randomico);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
add    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
lea    0xff(%rax),%ebx
test   %eax,%eax
cmovns %eax,%ebx
mov    %ebx,%ecx
and    $0xffffff00,%ecx
mov    %eax,%ebp
sub    %ecx,%ebp
sar    $0x8,%ebx
mov    %ebx,%ecx
imul   %ebp,%ecx
movzbl %cl,%r14d
add    %ebp,%ecx
movzbl %cl,%r15d
lea    0xe82(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
lea    0xff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffffff00,%eax
sub    %eax,%ebx
xor    %edi,%edi
call   1050 <time@plt>
imul   %r14d,%r15d
add    %eax,%r15d
mov    %r15d,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebp
lea    0xff(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xffffff00,%eax
sub    %eax,%ebp
lea    0xe42(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"\0ATempo coletado: %i\00"
@.str.1 = [20 x i8] c"\0APrimeiro VALOR: %i\00"
@.str.2 = [20 x i8] c"\0ASegundo VALOR: %i\00"
@.str.3 = [20 x i8] c"\0ATerceiro VALOR: %i\00"
@.str.4 = [18 x i8] c"\0AQuarto VALOR: %i\00"
@.str.5 = [21 x i8] c"\0A\0A Primeiro Rand: %i\00"
@.str.6 = [19 x i8] c"\0A Segundo Rand: %i\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @time(i32* null)
store i32 %9, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 256
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = srem i32 %12, 256
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = mul i32 %14, %15
%17 = urem i32 %16, 256
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = add i32 %18, %19
%21 = urem i32 %20, 256
store i32 %21, i32* %6
%22 = load i32, i32* %2
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %5
%29 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %6
%31 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %30)
store i32 0, i32* %7
store i32 0, i32* %8
%32 = call i32 @time(i32* null)
%33 = call i32 @srand(i32 %32)
%34 = call i32 (...) @rand()
%35 = srem i32 %34, 256
store i32 %35, i32* %7
%36 = call i32 @time(i32* null)
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = mul i32 %37, %38
%40 = add i32 %36, %39
%41 = call i32 @srand(i32 %40)
%42 = call i32 (...) @rand()
%43 = srem i32 %42, 256
store i32 %43, i32* %8
%44 = load i32, i32* %7
%45 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %8
%47 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0ATempo coletado: %i\00"
@.str.1 = [20 x i8] c"\0APrimeiro VALOR: %i\00"
@.str.2 = [20 x i8] c"\0ASegundo VALOR: %i\00"
@.str.3 = [20 x i8] c"\0ATerceiro VALOR: %i\00"
@.str.4 = [18 x i8] c"\0AQuarto VALOR: %i\00"
@.str.5 = [21 x i8] c"\0A\0A Primeiro Rand: %i\00"
@.str.6 = [19 x i8] c"\0A Segundo Rand: %i\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = sdiv i32 %1, 256
%3 = srem i32 %1, 256
%4 = mul nsw i32 %2, %3
%5 = and i32 %4, 255
%6 = add nsw i32 %4, %3
%7 = and i32 %6, 255
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %7)
%13 = tail call i32 @time(i32* null)
%14 = tail call i32 @srand(i32 %13)
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 256
%17 = tail call i32 @time(i32* null)
%18 = mul nuw nsw i32 %7, %5
%19 = add i32 %17, %18
%20 = tail call i32 @srand(i32 %19)
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 256
%23 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %22)
ret i32 0
}