#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 timezone {
  int dummy;
};
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int,
                          int);
int main() {
  struct timeval tv;
  struct timezone tz;
  unsigned int s, m, h;
  gettimeofday(&tv, &tz);
  s = tv.tv_sec % 60;
  m = (tv.tv_sec / 60) % 60;
  h = (tv.tv_sec / 3600) % 24;
  printf("La hora UTC es: %02d:%02d:%02d.%05d\n", h, m, s, tv.tv_usec / 10);
  return h;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <gettimeofday@plt>
mov    -0x10(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    $0xa,%edi
cltd
idiv   %edi
mov    -0x28(%rbp),%edx
mov    %eax,%r8d
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1040 <gettimeofday@plt>
movslq (%rsp),%rax
imul   $0xffffffff88888889,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x5,%edx
add    %ecx,%edx
imul   $0x3c,%edx,%esi
imul   $0xffffffff91a2b3c5,%rax,%rdi
shr    $0x20,%rdi
add    %eax,%edi
mov    %eax,%ecx
sub    %esi,%ecx
movslq %edx,%rdx
imul   $0xffffffff88888889,%rdx,%rax
shr    $0x20,%rax
add    %edx,%eax
mov    %eax,%esi
shr    $0x1f,%esi
sar    $0x5,%eax
add    %esi,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%edx
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0xb,%edi
add    %eax,%edi
movslq %edi,%rbx
imul   $0x2aaaaaab,%rbx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x22,%rax
add    %esi,%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%ebx
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%r8
mov    %r8,%rax
shr    $0x3f,%rax
sar    $0x22,%r8
add    %eax,%r8d
lea    0xe36(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
@.str = [37 x i8] c"La hora UTC es: %02d:%02d:%02d.%05d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca %struct.timezone
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @gettimeofday(%struct.timeval* %2, %struct.timezone* %3)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%9 = load i32, i32* %8
%10 = srem i32 %9, 60
store i32 %10, i32* %4
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%12 = load i32, i32* %11
%13 = sdiv i32 %12, 60
%14 = srem i32 %13, 60
store i32 %14, i32* %5
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%16 = load i32, i32* %15
%17 = sdiv i32 %16, 3600
%18 = srem i32 %17, 24
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = load i32, i32* %4
%22 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%23 = load i32, i32* %22
%24 = sdiv i32 %23, 10
%25 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %21, i32 %24)
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
@.str = [37 x i8] c"La hora UTC es: %02d:%02d:%02d.%05d\0A\00"
define i32 @main() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = srem i32 %7, 60
%9 = sdiv i32 %7, 60
%10 = srem i32 %9, 60
%11 = sdiv i32 %7, 3600
%12 = srem i32 %11, 24
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%14 = load i32, i32* %13
%15 = sdiv i32 %14, 10
%16 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %10, i32 %8, i32 %15)
ret i32 %12
}