#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 total_seconds, hours, secs_reminder, mins, secs;
  printf("Indtast antal af sekunder: ");
  scanf("%d", &total_seconds);
  hours = total_seconds / 3600;
  secs_reminder = total_seconds % 3600;
  mins = secs_reminder / 60;
  secs = secs_reminder % 60;
  printf("%d svarer til ", total_seconds);
  if (hours > 0)
    printf(hours == 1 ? "%d time, " : "%d timer, ", hours);
  if (mins > 0)
    printf(mins == 1 ? "%d minut og " : "%d minutter og ", mins);
  if (secs > 0)
    printf(secs == 1 ? "%d sekund " : "%d sekunder", secs);
  printf("\n");
  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    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    11c2 <main+0xa2>
mov    -0xc(%rbp),%ecx
lea    0xe8e(%rip),%rdi
lea    0xe7d(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    11ee <main+0xce>
mov    -0x14(%rbp),%ecx
lea    0xe7a(%rip),%rdi
lea    0xe66(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdi
mov    -0x14(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jle    121a <main+0xfa>
mov    -0x18(%rbp),%ecx
lea    0xe69(%rip),%rdi
lea    0xe57(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdi
mov    -0x18(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x4(%rsp),%r15
imul   $0xffffffff91a2b3c5,%r15,%rax
shr    $0x20,%rax
add    %r15d,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0xb,%eax
add    %ecx,%eax
imul   $0xe10,%eax,%eax
mov    %r15d,%ebp
sub    %eax,%ebp
movswl %bp,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %ebp,%eax
movzwl %ax,%eax
movswl %ax,%ebx
shr    $0xf,%eax
sar    $0x5,%ebx
add    %eax,%ebx
imul   $0x3c,%ebx,%eax
mov    %ebp,%r14d
sub    %eax,%r14d
lea    0xe75(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xe10,%r15
jge    1201 <main+0xd1>
cmp    $0x3c,%ebp
jge    123b <main+0x10b>
test   %r14w,%r14w
jle    11ea <main+0xba>
movswl %r14w,%esi
cmp    $0x1,%r14w
lea    0xe88(%rip),%rax
lea    0xe8c(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15d,%eax
mov    $0x91a2b3c5,%esi
imul   %rax,%rsi
shr    $0x2b,%rsi
lea    -0xe10(%r15),%eax
cmp    $0xe10,%eax
lea    0xe0a(%rip),%rax
lea    0xe0d(%rip),%rdi
cmovb  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x3c,%ebp
jl     11c2 <main+0x92>
movswl %bx,%esi
add    $0xffffffc4,%ebp
cmp    $0x3c,%ebp
lea    0xdf8(%rip),%rax
lea    0xdfe(%rip),%rdi
cmovb  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14w,%r14w
jg     11c8 <main+0x98>
jmp    11ea <main+0xba>

LLVM IR (-O0):
@.str = [28 x i8] c"Indtast antal af sekunder: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"%d svarer til \00"
@.str.3 = [10 x i8] c"%d time, \00"
@.str.4 = [11 x i8] c"%d timer, \00"
@.str.5 = [13 x i8] c"%d minut og \00"
@.str.6 = [16 x i8] c"%d minutter og \00"
@.str.7 = [11 x i8] c"%d sekund \00"
@.str.8 = [12 x i8] c"%d sekunder\00"
@.str.9 = [2 x i8] c"\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
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 3600
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = srem i32 %11, 3600
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = sdiv i32 %13, 60
store i32 %14, i32* %5
%15 = load i32, i32* %4
%16 = srem i32 %15, 60
store i32 %16, i32* %6
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %0
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0)
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* %25, i32 %26)
br label %28
28: ; preds = %21, %0
%29 = load i32, i32* %5
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 1
%34 = zext i1 %33 to i64
%35 = select i1 %33, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0)
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* %35, i32 %36)
br label %38
38: ; preds = %31, %28
%39 = load i32, i32* %6
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %38
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 1
%44 = zext i1 %43 to i64
%45 = select i1 %43, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0)
%46 = load i32, i32* %6
%47 = call i32 (i8*, ...) @printf(i8* %45, i32 %46)
br label %48
48: ; preds = %41, %38
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Indtast antal af sekunder: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"%d svarer til \00"
@.str.3 = [10 x i8] c"%d time, \00"
@.str.4 = [11 x i8] c"%d timer, \00"
@.str.5 = [13 x i8] c"%d minut og \00"
@.str.6 = [16 x i8] c"%d minutter og \00"
@.str.7 = [11 x i8] c"%d sekund \00"
@.str.8 = [12 x i8] c"%d sekunder\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 = srem i32 %5, 3600
%7 = trunc i32 %6 to i16
%8 = sdiv i16 %7, 60
%9 = sext i16 %8 to i32
%10 = srem i16 %7, 60
%11 = sext i16 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%13 = icmp sgt i32 %5, 3599
br i1 %13, label %14, label %20
14: ; preds = %0
%15 = udiv i32 %5, 3600
%16 = add nsw i32 %5, -3600
%17 = icmp ult i32 %16, 3600
%18 = select i1 %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %18, i32 %15)
br label %20
20: ; preds = %14, %0
%21 = icmp sgt i32 %6, 59
br i1 %21, label %22, label %27
22: ; preds = %20
%23 = add nsw i32 %6, -60
%24 = icmp ult i32 %23, 60
%25 = select i1 %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %25, i32 %9)
br label %27
27: ; preds = %22, %20
%28 = icmp sgt i16 %10, 0
br i1 %28, label %29, label %33
29: ; preds = %27
%30 = icmp eq i16 %10, 1
%31 = select i1 %30, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %31, i32 %11)
br label %33
33: ; preds = %29, %27
%34 = call i32 @putchar(i32 10)
ret i32 0
}