#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(void) {
  int inputseconds, minutes, hours, days, weeks, seconds;
  printf("This programme calculates seconds to weeks, days, hours and "
         "minutes.\nNow input seconds:");
  scanf("%d", &inputseconds);
  minutes = inputseconds / 60;
  hours = minutes / 60;
  days = hours / 24;
  weeks = days / 7;
  seconds = inputseconds % 60;
  minutes = minutes % 60;
  hours = hours % 24;
  days = days % 7;
  printf("From the amount of input seconds, the programme has calculated that "
         "there are:\n%d weeks, %d days, %d hours, %d minutes, and %d seconds "
         "in all\n",
         weeks, days, hours, minutes, seconds);
  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    0xf14(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf22(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%r9
imul   $0xffffffff91a2b3c5,%r9,%rcx
shr    $0x20,%rcx
add    %r9d,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0xb,%ecx
add    %eax,%ecx
imul   $0xffffffffc22e4507,%r9,%rax
shr    $0x20,%rax
add    %r9d,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x10,%eax
add    %edx,%eax
imul   $0x6ef5de4d,%r9,%rsi
mov    %rsi,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rsi
sar    $0x12,%esi
add    %edx,%esi
imul   $0xffffffff88888889,%r9,%rdx
shr    $0x20,%rdx
add    %r9d,%edx
mov    %edx,%edi
shr    $0x1f,%edi
sar    $0x5,%edx
add    %edi,%edx
imul   $0x3c,%edx,%edi
sub    %edi,%r9d
movslq %edx,%r8
imul   $0xffffffff88888889,%r8,%rdx
shr    $0x20,%rdx
add    %r8d,%edx
mov    %edx,%edi
shr    $0x1f,%edi
sar    $0x5,%edx
add    %edi,%edx
imul   $0x3c,%edx,%edx
sub    %edx,%r8d
movslq %ecx,%rcx
imul   $0x2aaaaaab,%rcx,%rdx
mov    %rdx,%rdi
shr    $0x3f,%rdi
shr    $0x22,%rdx
add    %edi,%edx
shl    $0x3,%edx
lea    (%rdx,%rdx,2),%edx
sub    %edx,%ecx
movswl %ax,%edx
imul   $0x4925,%edx,%edx
mov    %edx,%edi
shr    $0x1f,%edi
sar    $0x11,%edx
add    %edi,%edx
lea    0x0(,%rdx,8),%edi
sub    %edi,%edx
add    %eax,%edx
movswl %dx,%edx
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [88 x i8] c"This programme calculates seconds to weeks, days, hours and minutes.\0ANow input seconds:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [143 x i8] c"From the amount of input seconds, the programme has calculated that there are:\0A%d weeks, %d days, %d hours, %d minutes, and %d seconds in all\0A\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 ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 60
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = sdiv i32 %12, 60
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 24
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = sdiv i32 %16, 7
store i32 %17, i32* %6
%18 = load i32, i32* %2
%19 = srem i32 %18, 60
store i32 %19, i32* %7
%20 = load i32, i32* %3
%21 = srem i32 %20, 60
store i32 %21, i32* %3
%22 = load i32, i32* %4
%23 = srem i32 %22, 24
store i32 %23, i32* %4
%24 = load i32, i32* %5
%25 = srem i32 %24, 7
store i32 %25, i32* %5
%26 = load i32, i32* %6
%27 = load i32, i32* %5
%28 = load i32, i32* %4
%29 = load i32, i32* %3
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %27, i32 %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [88 x i8] c"This programme calculates seconds to weeks, days, hours and minutes.\0ANow input seconds:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [143 x i8] c"From the amount of input seconds, the programme has calculated that there are:\0A%d weeks, %d days, %d hours, %d minutes, and %d seconds in all\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = sdiv i32 %5, 60
%7 = sdiv i32 %5, 3600
%8 = sdiv i32 %5, 86400
%9 = sdiv i32 %5, 604800
%10 = srem i32 %5, 60
%11 = srem i32 %6, 60
%12 = srem i32 %7, 24
%13 = trunc i32 %8 to i16
%14 = srem i16 %13, 7
%15 = sext i16 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([143 x i8], [143 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %15, i32 %12, i32 %11, i32 %10)
ret i32 0
}