#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 *, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int tempo_digitado, acumulador;
  int tempo_horas = 0;
  int tempo_minutos = 0;
  int tempo_segundos = 0;
  scanf("%d", &tempo_digitado);
  while (tempo_digitado >= 3600) {
    acumulador = tempo_digitado - 3600;
    tempo_digitado = acumulador;
    tempo_horas += 1;
  }
  while (tempo_digitado >= 60) {
    acumulador = tempo_digitado - 60;
    tempo_digitado = acumulador;
    tempo_minutos += 1;
  }
  tempo_segundos = tempo_digitado;
  printf("%d:%d:%d\n", tempo_horas, tempo_minutos, tempo_segundos);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xe10,-0x8(%rbp)
jl     1180 <main+0x60>
mov    -0x8(%rbp),%eax
sub    $0xe10,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <main+0x34>
jmp    1185 <main+0x65>
cmpl   $0x3c,-0x8(%rbp)
jl     11ac <main+0x8c>
mov    -0x8(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x65>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
xor    %edx,%edx
cmp    $0xe10,%ecx
jl     1180 <main+0x60>
cmp    $0x1c1f,%ecx
mov    $0x1c1f,%eax
cmovl  %ecx,%eax
neg    %eax
add    %ecx,%eax
add    $0xe0f,%eax
mov    $0x91a2b3c5,%esi
imul   %rax,%rsi
shr    $0x2b,%rsi
imul   $0xfffff1f0,%esi,%eax
add    %eax,%ecx
add    $0xfffff1f0,%ecx
add    $0x1,%esi
mov    %ecx,0x4(%rsp)
cmp    $0x3c,%ecx
jge    1187 <main+0x67>
jmp    11b5 <main+0x95>
xor    %esi,%esi
cmp    $0x3c,%ecx
jl     11b5 <main+0x95>
cmp    $0x77,%ecx
mov    $0x77,%eax
cmovl  %ecx,%eax
neg    %eax
add    %ecx,%eax
add    $0x3b,%eax
mov    $0x88888889,%edx
imul   %rax,%rdx
shr    $0x25,%rdx
imul   $0xffffffc4,%edx,%eax
add    %eax,%ecx
add    $0xffffffc4,%ecx
add    $0x1,%edx
mov    %ecx,0x4(%rsp)
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%d:%d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %11, %0
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 3600
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 3600
store i32 %13, i32* %3
%14 = load i32, i32* %3
store i32 %14, i32* %2
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %8
17: ; preds = %8
br label %18
18: ; preds = %21, %17
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, 60
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 60
store i32 %23, i32* %3
%24 = load i32, i32* %3
store i32 %24, i32* %2
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %18
27: ; preds = %18
%28 = load i32, i32* %2
store i32 %28, i32* %6
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"%d:%d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 3599
br i1 %5, label %6, label %15
6: ; preds = %0
%7 = add nsw i32 %4, -3600
%8 = add nuw i32 %4, 3599
%9 = call i32 @llvm.smin.i32(i32 %4, i32 7199)
%10 = sub nuw i32 %8, %9
%11 = udiv i32 %10, 3600
%12 = mul nsw i32 %11, -3600
%13 = add nsw i32 %12, %7
%14 = add nuw nsw i32 %11, 1
store i32 %13, i32* %1
br label %15
15: ; preds = %6, %0
%16 = phi i32 [ %13, %6 ], [ %4, %0 ]
%17 = phi i32 [ %14, %6 ], [ 0, %0 ]
%18 = icmp sgt i32 %16, 59
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = add nsw i32 %16, -60
%21 = add nuw nsw i32 %16, 59
%22 = call i32 @llvm.smin.i32(i32 %16, i32 119)
%23 = sub nuw nsw i32 %21, %22
%24 = udiv i32 %23, 60
%25 = mul nsw i32 %24, -60
%26 = add nsw i32 %25, %20
%27 = add nuw nsw i32 %24, 1
store i32 %26, i32* %1
br label %28
28: ; preds = %19, %15
%29 = phi i32 [ %26, %19 ], [ %16, %15 ]
%30 = phi i32 [ %27, %19 ], [ 0, %15 ]
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %30, i32 %29)
ret i32 0
}