#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int,
                          unsigned int, unsigned int);
void transformar(unsigned int seg) {
  unsigned int d, h, m, s;
  d = seg / 86400;
  seg -= (d * 86400);
  h = seg / 3600;
  seg -= (h * 3600);
  m = seg / 60;
  seg -= (m * 60);
  s = seg % 60;
  printf("\n%u segundos correspondem a %u dia(s), %u hora(s), %u minuto(s) e "
         "%u segundo(s)\n\n",
         seg, d, h, m, s);
}


x86 assembly (clang, -O0):
<transformar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x15180,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
imul   $0x15180,-0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
imul   $0xe10,-0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
imul   $0x3c,-0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transformar>:
mov    %edi,%eax
mov    $0xc22e4507,%edx
imul   %rax,%rdx
shr    $0x30,%rdx
imul   $0xfffeae80,%edx,%eax
add    %edi,%eax
mov    $0x91a2b3c5,%ecx
imul   %rax,%rcx
shr    $0x2b,%rcx
imul   $0xfffff1f0,%ecx,%edi
add    %eax,%edi
mov    $0x88888889,%eax
mov    %rdi,%r8
imul   %rax,%r8
shr    $0x25,%r8
imul   $0xffffffc4,%r8d,%esi
add    %edi,%esi
imul   %rsi,%rax
shr    $0x25,%rax
imul   $0x3c,%eax,%eax
mov    %esi,%r9d
sub    %eax,%r9d
lea    0xe96(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [82 x i8] c"\0A%u segundos correspondem a %u dia(s), %u hora(s), %u minuto(s) e %u segundo(s)\0A\0A\00"
define void @transformar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = udiv i32 %7, 86400
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = mul i32 %9, 86400
%11 = load i32, i32* %2
%12 = sub i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = udiv i32 %13, 3600
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = mul i32 %15, 3600
%17 = load i32, i32* %2
%18 = sub i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = udiv i32 %19, 60
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = mul i32 %21, 60
%23 = load i32, i32* %2
%24 = sub i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = urem i32 %25, 60
store i32 %26, i32* %6
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %30, i32 %31)
ret void
}

LLVM IR (-O2):
@.str = [82 x i8] c"\0A%u segundos correspondem a %u dia(s), %u hora(s), %u minuto(s) e %u segundo(s)\0A\0A\00"
define void @transformar(i32 %0) {
%2 = udiv i32 %0, 86400
%3 = mul i32 %2, -86400
%4 = add i32 %3, %0
%5 = udiv i32 %4, 3600
%6 = mul i32 %5, -3600
%7 = add i32 %6, %4
%8 = udiv i32 %7, 60
%9 = mul i32 %8, -60
%10 = add i32 %9, %7
%11 = urem i32 %10, 60
%12 = tail call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %2, i32 %5, i32 %8, i32 %11)
ret void
}