#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*/ exit(int);
scalar_t__ get_seconds(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("Not enough arguments.\n");
    usage(argv[0]);
    exit(1);
  }
  unsigned long int total_seconds = 0;
  for (int i = 1; i < argc; i++)
    total_seconds += get_seconds(argv[i]);
  printf("Total time: %lu second(s).\nStarted at: %d\n", total_seconds,
         time(NULL));
  sleep(total_seconds);
  printf("Ended at: %d\n", time(NULL));
  while (1) {
    printf("Ring!\a\n");
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a4 <main+0x44>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e6 <main+0x86>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <get_seconds@plt>
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b3 <main+0x53>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1080 <sleep@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
jmp    122f <main+0xcf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x2,%edi
jl     1204 <main+0x94>
mov    %edi,%r15d
mov    $0x1,%ebx
xor    %r12d,%r12d
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <get_seconds@plt>
add    %rax,%r12
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1190 <main+0x20>
xor    %edi,%edi
call   1060 <time@plt>
lea    0xe4d(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12d,%edi
call   1090 <sleep@plt>
xor    %edi,%edi
call   1060 <time@plt>
lea    0xe56(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe54(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
jmp    11f0 <main+0x80>
lea    0xe35(%rip),%rdi
call   1040 <puts@plt>
mov    (%r14),%rdi
call   1070 <usage@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Not enough arguments.\0A\00"
@.str.1 = [43 x i8] c"Total time: %lu second(s).\0AStarted at: %d\0A\00"
@.str.2 = [14 x i8] c"Ended at: %d\0A\00"
@.str.3 = [8 x i8] c"Ring!\07\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @usage(i8* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
store i64 0, i64* %6
store i32 1, i32* %7
br label %18
18: ; preds = %31, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i64 @get_seconds(i8* %27)
%29 = load i64, i64* %6
%30 = add i64 %29, %28
store i64 %30, i64* %6
br label %31
31: ; preds = %22
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %18
34: ; preds = %18
%35 = load i64, i64* %6
%36 = call i32 @time(i32* null)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i64 %35, i32 %36)
%38 = load i64, i64* %6
%39 = trunc i64 %38 to i32
%40 = call i32 @sleep(i32 %39)
%41 = call i32 @time(i32* null)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %34, %43
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 @sleep(i32 1)
br label %43
}

LLVM IR (-O2):
@.str.1 = [43 x i8] c"Total time: %lu second(s).\0AStarted at: %d\0A\00"
@.str.2 = [14 x i8] c"Ended at: %d\0A\00"
@str = [7 x i8] c"Ring!\07\00"
@str.4 = [22 x i8] c"Not enough arguments.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %18
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%8 = load i8*, i8** %1
%9 = tail call i32 @usage(i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %18
%12 = tail call i32 @time(i32* null)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i64 %24, i32 %12)
%14 = trunc i64 %24 to i32
%15 = tail call i32 @sleep(i32 %14)
%16 = tail call i32 @time(i32* null)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %27
18: ; preds = %4, %18
%19 = phi i64 [ 1, %4 ], [ %25, %18 ]
%20 = phi i64 [ 0, %4 ], [ %24, %18 ]
%21 = getelementptr inbounds i8*, i8** %1, i64 %19
%22 = load i8*, i8** %21
%23 = tail call i64 @get_seconds(i8* %22)
%24 = add i64 %23, %20
%25 = add nuw nsw i64 %19, 1
%26 = icmp eq i64 %25, %5
br i1 %26, label %11, label %18
27: ; preds = %27, %11
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%29 = tail call i32 @sleep(i32 1)
br label %27
}