#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int scanf(char *, int *);
int /*<<< orphan*/ stderr;
int main(void) {
  int input_sec, sec, min, hr, scanf_res;
  printf("Intast et antal sekunder der skal omregnes:\n");
  scanf_res = scanf(" %d", &input_sec);
  if (scanf_res != 1 || input_sec < 0) {
    fprintf(stderr, "Fejl ved indlæsning.\n");
    fprintf(stderr, "Check at du har indtastet et heltal støre end 0.\n");
    return 1;
  }
  hr = input_sec / 3600;
  min = (input_sec % 3600) / 60;
  sec = (input_sec % 3600) % 60;
  printf("\n%d sekund", input_sec);
  input_sec != 1 ? printf("er") : 0;
  printf(" svarer til ");
  if (hr > 0) {
    printf("%d time", hr);
    hr > 1 ? putchar('r') : 0;
    if (min > 0 && sec > 0) {
      printf(", ");
    } else if (min > 0 || sec > 0) {
      printf(" og ");
    } else {
      printf("\n");
      return 0;
    }
  }
  if (min > 0) {
    printf("%d minut", min);
    min > 1 ? printf("er") : 0;
    if (sec > 0) {
      printf(" og ");
    } else {
      printf("\n");
      return 0;
    }
  }
  printf("%d sekund", sec);
  sec != 1 ? printf("er") : 0;
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1184 <main+0x44>
cmpl   $0x0,-0x8(%rbp)
jge    11ba <main+0x7a>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13a5 <main+0x265>
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
je     1226 <main+0xe6>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122b <main+0xeb>
jmp    122b <main+0xeb>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jle    12e4 <main+0x1a4>
mov    -0x14(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jle    126d <main+0x12d>
mov    $0x72,%edi
call   1030 <putchar@plt>
jmp    1272 <main+0x132>
jmp    1272 <main+0x132>
cmpl   $0x0,-0x10(%rbp)
jle    1299 <main+0x159>
cmpl   $0x0,-0xc(%rbp)
jle    1299 <main+0x159>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12df <main+0x19f>
cmpl   $0x0,-0x10(%rbp)
jg     12ad <main+0x16d>
cmpl   $0x0,-0xc(%rbp)
jle    12c0 <main+0x180>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12da <main+0x19a>
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a5 <main+0x265>
jmp    12df <main+0x19f>
jmp    12e4 <main+0x1a4>
cmpl   $0x0,-0x10(%rbp)
jle    135d <main+0x21d>
mov    -0x10(%rbp),%esi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
jle    131c <main+0x1dc>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1321 <main+0x1e1>
jmp    1321 <main+0x1e1>
cmpl   $0x0,-0xc(%rbp)
jle    133e <main+0x1fe>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1358 <main+0x218>
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13a5 <main+0x265>
jmp    135d <main+0x21d>
mov    -0xc(%rbp),%esi
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
je     138b <main+0x24b>
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1390 <main+0x250>
jmp    1390 <main+0x250>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf20(%rip),%rdi
call   1040 <puts@plt>
lea    0xe92(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    123e <main+0xee>
mov    0x4(%rsp),%ebx
test   %ebx,%ebx
js     123e <main+0xee>
mov    %ebx,%eax
mov    $0x91a2b3c5,%ebp
imul   %rax,%rbp
shr    $0x2b,%rbp
imul   $0xe10,%ebp,%eax
mov    %ebx,%r13d
sub    %eax,%r13d
imul   $0x8889,%r13d,%r15d
shr    $0x15,%r15d
imul   $0x3c,%r15d,%eax
mov    %r13d,%r12d
sub    %eax,%r12d
lea    0xe8a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x1,0x4(%rsp)
je     11e2 <main+0x92>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzwl %r12w,%r14d
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xe10,%ebx
jb     1289 <main+0x139>
lea    0xe62(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1c20,%ebx
jb     1222 <main+0xd2>
mov    $0x72,%edi
call   1030 <putchar@plt>
cmp    $0x3c,%r13d
jb     126b <main+0x11b>
test   %r12w,%r12w
je     126b <main+0x11b>
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    128f <main+0x13f>
mov    0x2d9b(%rip),%rbx
mov    (%rbx),%edi
lea    0xdb6(%rip),%rsi
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdbf(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%ebx
jmp    1307 <main+0x1b7>
cmp    $0x3b,%r13d
ja     127b <main+0x12b>
test   %r12w,%r12w
je     12fb <main+0x1ab>
lea    0xdf2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x3c,%r13d
jb     12c7 <main+0x177>
lea    0xde3(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x78,%r13d
jb     12b4 <main+0x164>
lea    0xdac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
je     12fb <main+0x1ab>
lea    0xdb4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd81(%rip),%rdi
xor    %ebx,%ebx
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x1,%r12w
je     12ef <main+0x19f>
lea    0xd71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1307 <main+0x1b7>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Intast et antal sekunder der skal omregnes:\0A\00"
@.str.1 = [4 x i8] c" %d\00"
@stderr = global i32 0
@.str.2 = [23 x i8] c"Fejl ved indl\C3\A6sning.\0A\00"
@.str.3 = [51 x i8] c"Check at du har indtastet et heltal st\C3\B8re end 0.\0A\00"
@.str.4 = [11 x i8] c"\0A%d sekund\00"
@.str.5 = [3 x i8] c"er\00"
@.str.6 = [13 x i8] c" svarer til \00"
@.str.7 = [8 x i8] c"%d time\00"
@.str.8 = [3 x i8] c", \00"
@.str.9 = [5 x i8] c" og \00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [9 x i8] c"%d minut\00"
@.str.12 = [10 x i8] c"%d sekund\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 ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 1
br i1 %10, label %14, label %11
11: ; preds = %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11, %0
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %100
19: ; preds = %11
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 3600
store i32 %21, i32* %5
%22 = load i32, i32* %2
%23 = srem i32 %22, 3600
%24 = sdiv i32 %23, 60
store i32 %24, i32* %4
%25 = load i32, i32* %2
%26 = srem i32 %25, 3600
%27 = srem i32 %26, 60
store i32 %27, i32* %3
%28 = load i32, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %2
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %19
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %35
34: ; preds = %19
br label %35
35: ; preds = %34, %32
%36 = phi i32 [ %33, %32 ], [ 0, %34 ]
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%38 = load i32, i32* %5
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %69
40: ; preds = %35
%41 = load i32, i32* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %5
%44 = icmp sgt i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = call i32 @putchar(i8 signext 114)
br label %48
47: ; preds = %40
br label %48
48: ; preds = %47, %45
%49 = phi i32 [ %46, %45 ], [ 0, %47 ]
%50 = load i32, i32* %4
%51 = icmp sgt i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = load i32, i32* %3
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %68
57: ; preds = %52, %48
%58 = load i32, i32* %4
%59 = icmp sgt i32 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %57
%61 = load i32, i32* %3
%62 = icmp sgt i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60, %57
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %67
65: ; preds = %60
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %100
67: ; preds = %63
br label %68
68: ; preds = %67, %55
br label %69
69: ; preds = %68, %35
%70 = load i32, i32* %4
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %89
72: ; preds = %69
%73 = load i32, i32* %4
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %73)
%75 = load i32, i32* %4
%76 = icmp sgt i32 %75, 1
br i1 %76, label %77, label %79
77: ; preds = %72
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %80
79: ; preds = %72
br label %80
80: ; preds = %79, %77
%81 = phi i32 [ %78, %77 ], [ 0, %79 ]
%82 = load i32, i32* %3
%83 = icmp sgt i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %88
86: ; preds = %80
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %100
88: ; preds = %84
br label %89
89: ; preds = %88, %69
%90 = load i32, i32* %3
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 %90)
%92 = load i32, i32* %3
%93 = icmp ne i32 %92, 1
br i1 %93, label %94, label %96
94: ; preds = %89
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %97
96: ; preds = %89
br label %97
97: ; preds = %96, %94
%98 = phi i32 [ %95, %94 ], [ 0, %96 ]
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %100
100: ; preds = %97, %86, %65, %14
%101 = load i32, i32* %1
ret i32 %101
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c" %d\00"
@stderr = global i32 0
@.str.2 = [23 x i8] c"Fejl ved indl\C3\A6sning.\0A\00"
@.str.3 = [51 x i8] c"Check at du har indtastet et heltal st\C3\B8re end 0.\0A\00"
@.str.4 = [11 x i8] c"\0A%d sekund\00"
@.str.5 = [3 x i8] c"er\00"
@.str.6 = [13 x i8] c" svarer til \00"
@.str.7 = [8 x i8] c"%d time\00"
@.str.8 = [3 x i8] c", \00"
@.str.9 = [5 x i8] c" og \00"
@.str.11 = [9 x i8] c"%d minut\00"
@.str.12 = [10 x i8] c"%d sekund\00"
@str = [44 x i8] c"Intast et antal sekunder der skal omregnes:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp ne i32 %4, 1
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 0
%8 = select i1 %5, i1 true, i1 %7
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
br label %67
14: ; preds = %0
%15 = udiv i32 %6, 3600
%16 = urem i32 %6, 3600
%17 = trunc i32 %16 to i16
%18 = udiv i16 %17, 60
%19 = zext i16 %18 to i32
%20 = urem i16 %17, 60
%21 = zext i16 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %6)
%23 = load i32, i32* %1
%24 = icmp eq i32 %23, 1
br i1 %24, label %27, label %25
25: ; preds = %14
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %27
27: ; preds = %14, %25
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp ugt i32 %6, 3599
br i1 %29, label %30, label %47
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%32 = icmp ugt i32 %6, 7199
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @putchar(i8 signext 114)
br label %35
35: ; preds = %30, %33
%36 = icmp ugt i32 %16, 59
%37 = icmp ne i16 %20, 0
%38 = and i1 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %49
41: ; preds = %35
%42 = or i1 %36, %37
br i1 %42, label %43, label %45
43: ; preds = %41
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %47
45: ; preds = %41
%46 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %67
47: ; preds = %43, %27
%48 = icmp ugt i32 %16, 59
br i1 %48, label %49, label %60
49: ; preds = %39, %47
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %19)
%51 = icmp ugt i32 %16, 119
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %49, %52
%55 = icmp eq i16 %20, 0
br i1 %55, label %58, label %56
56: ; preds = %54
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %60
58: ; preds = %54
%59 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %67
60: ; preds = %56, %47
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 %21)
%62 = icmp eq i16 %20, 1
br i1 %62, label %65, label %63
63: ; preds = %60
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %65
65: ; preds = %60, %63
%66 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
br label %67
67: ; preds = %65, %58, %45, %9
%68 = phi i32 [ 1, %9 ], [ 0, %65 ], [ 0, %58 ], [ 0, %45 ]
ret i32 %68
}