#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int h_inicio, min_inicio, seg_inicio, seg_duracao, converte_h_inicio,
      horario_termino;
  printf("---------- Experimento -----------\n");
  printf("Digite a(s) hora(s) de inicio: ");
  scanf("%d", &h_inicio);
  printf("Digite o(s) minuto(s) de inicio: ");
  scanf("%d", &min_inicio);
  printf("Digite o(s) segundo(s) de inicio: ");
  scanf("%d", &seg_inicio);
  printf("Duracao em segundos: ");
  scanf("%d", &seg_duracao);
  converte_h_inicio = h_inicio * 60 * 60 + min_inicio * 60 + seg_inicio;
  horario_termino = converte_h_inicio + seg_duracao;
  printf("Horario de término: %dh:%dmin:%ds", horario_termino / 3600,
         (horario_termino % 3600) / 60, (horario_termino % 3600) % 60);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
imul   $0x3c,-0x8(%rbp),%eax
imul   $0x3c,%eax,%eax
imul   $0x3c,-0xc(%rbp),%ecx
add    %ecx,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x1c(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x20(%rbp),%edx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf65(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
imul   $0xe10,0xc(%rsp),%eax
imul   $0x3c,0x8(%rsp),%ecx
add    %eax,%ecx
add    0x4(%rsp),%ecx
add    (%rsp),%ecx
movslq %ecx,%rax
imul   $0xffffffff91a2b3c5,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0xb,%esi
add    %ecx,%esi
imul   $0xe10,%esi,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8889,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%ecx
movswl %cx,%edi
shr    $0xf,%ecx
sar    $0x5,%edi
add    %ecx,%edi
movswl %di,%edx
imul   $0x3c,%edi,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"---------- Experimento -----------\0A\00"
@.str.1 = [32 x i8] c"Digite a(s) hora(s) de inicio: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [34 x i8] c"Digite o(s) minuto(s) de inicio: \00"
@.str.4 = [35 x i8] c"Digite o(s) segundo(s) de inicio: \00"
@.str.5 = [22 x i8] c"Duracao em segundos: \00"
@.str.6 = [35 x i8] c"Horario de t\C3\A9rmino: %dh:%dmin:%ds\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
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, 60
%19 = mul nsw i32 %18, 60
%20 = load i32, i32* %3
%21 = mul nsw i32 %20, 60
%22 = add nsw i32 %19, %21
%23 = load i32, i32* %4
%24 = add nsw i32 %22, %23
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = load i32, i32* %5
%27 = add nsw i32 %25, %26
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = sdiv i32 %28, 3600
%30 = load i32, i32* %7
%31 = srem i32 %30, 3600
%32 = sdiv i32 %31, 60
%33 = load i32, i32* %7
%34 = srem i32 %33, 3600
%35 = srem i32 %34, 60
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %29, i32 %32, i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"Digite a(s) hora(s) de inicio: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [34 x i8] c"Digite o(s) minuto(s) de inicio: \00"
@.str.4 = [35 x i8] c"Digite o(s) segundo(s) de inicio: \00"
@.str.5 = [22 x i8] c"Duracao em segundos: \00"
@.str.6 = [35 x i8] c"Horario de t\C3\A9rmino: %dh:%dmin:%ds\00"
@str = [35 x i8] c"---------- Experimento -----------\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %1
%19 = mul i32 %18, 3600
%20 = load i32, i32* %2
%21 = mul nsw i32 %20, 60
%22 = add nsw i32 %21, %19
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %4
%26 = add nsw i32 %24, %25
%27 = sdiv i32 %26, 3600
%28 = srem i32 %26, 3600
%29 = trunc i32 %28 to i16
%30 = sdiv i16 %29, 60
%31 = sext i16 %30 to i32
%32 = srem i16 %29, 60
%33 = sext i16 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i32 %27, i32 %31, i32 %33)
ret i32 0
}