#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 */
struct timeval {
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void SleepC(int timev) {
  struct timeval ts, tf, tr;
  gettimeofday(&ts, NULL);
  tf.tv_sec = 0;
  printf("Inicio...!!\n");
  printf("sistema time ---> %d\n", tf.tv_sec);
  while (1) {
    if (tf.tv_sec == (ts.tv_sec - (100000000 * timev))) {
      gettimeofday(&ts, NULL);
      tf.tv_sec = 0;
      printf("-----------------------------------> genial\n");
    } else {
      tf.tv_sec++;
    }
  }
}


x86 assembly (clang, -O0):
<SleepC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
movl   $0x0,-0x10(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   $0x5f5e100,-0x4(%rbp),%edx
sub    %edx,%ecx
cmp    %ecx,%eax
jne    119c <SleepC+0x7c>
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
movl   $0x0,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a5 <SleepC+0x85>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115e <SleepC+0x3e>

x86 assembly (clang, -O2):
<SleepC>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xea5(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0xfa0a1f00,%ebp,%ebp
lea    0xeb1(%rip),%r15
jmp    1183 <SleepC+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
mov    (%rsp),%eax
add    %ebp,%eax
cmp    %eax,%ebx
jne    1180 <SleepC+0x50>
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1183 <SleepC+0x53>

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [13 x i8] c"Inicio...!!\0A\00"
@.str.1 = [22 x i8] c"sistema time ---> %d\0A\00"
@.str.2 = [45 x i8] c"-----------------------------------> genial\0A\00"
define void @SleepC(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
store i32 %0, i32* %2
%6 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %1, %29
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%16 = load i32, i32* %15
%17 = load i32, i32* %2
%18 = mul nsw i32 100000000, %17
%19 = sub nsw i32 %16, %18
%20 = icmp eq i32 %14, %19
br i1 %20, label %21, label %25
21: ; preds = %12
%22 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
store i32 0, i32* %23
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
br label %29
25: ; preds = %12
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %29
29: ; preds = %25, %21
br label %12
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str.1 = [22 x i8] c"sistema time ---> %d\0A\00"
@str = [12 x i8] c"Inicio...!!\00"
@str.3 = [44 x i8] c"-----------------------------------> genial\00"
define void @SleepC(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 0)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%8 = mul i32 %0, -100000000
br label %9
9: ; preds = %19, %1
%10 = phi i32 [ 0, %1 ], [ %20, %19 ]
%11 = load i32, i32* %7
%12 = add i32 %11, %8
%13 = icmp eq i32 %10, %12
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.3, i64 0, i64 0))
br label %19
17: ; preds = %9
%18 = add nsw i32 %10, 1
br label %19
19: ; preds = %17, %14
%20 = phi i32 [ 0, %14 ], [ %18, %17 ]
br label %9
}