#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 */
double libt_timetointerval4(double, double, double, int);
double libt_walltime();
int /*<<< orphan*/ printf(char *, ...);
double strtodelay(char const *, int /*<<< orphan*/ *);
int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
char *timetostr(double);
int main(int argc, char *argv[]) {
  const char *sinterval, *soffset;
  double interval, offset;
  double walltime = libt_walltime();
  ;
  double delay;
  int j, max = 10;
  sinterval = (argc >= 2) ? argv[1] : "1d";
  soffset = (argc >= 3) ? argv[2] : "4h";
  if (argc >= 4)
    max = strtoul(argv[3], NULL, 0);
  interval = strtodelay(sinterval, NULL);
  offset = strtodelay(soffset, NULL);
  printf("now %s\n", timetostr(walltime));
  printf("/%s +%s\n", sinterval, soffset);
  for (j = 0; j < max; ++j) {
    delay = libt_timetointerval4(walltime, interval, offset, 10);
    printf("%i %s (+%.0f)\n", j, timetostr(walltime + delay), delay);
    walltime += delay;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <libt_walltime@plt>
movsd  %xmm0,-0x38(%rbp)
movl   $0xa,-0x48(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11a4 <main+0x44>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    11b4 <main+0x54>
lea    0xe55(%rip),%rax
mov    %rax,-0x50(%rbp)
jmp    11b4 <main+0x54>
mov    -0x50(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     11d7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    11e7 <main+0x87>
lea    0xe25(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    11e7 <main+0x87>
mov    -0x58(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     120f <main+0xaf>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <strtoul@plt>
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtodelay@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtodelay@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <timetostr@plt>
mov    %rax,%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    12e0 <main+0x180>
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    $0xa,%edi
call   1080 <libt_timetointerval4@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
call   1050 <timetostr@plt>
mov    -0x5c(%rbp),%esi
mov    %rax,%rdx
movsd  -0x40(%rbp),%xmm0
lea    0xd5b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x40(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    126b <main+0x10b>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <libt_walltime@plt>
mov    $0xa,%r12d
lea    0xe7e(%rip),%r14
cmp    $0x2,%ebp
movsd  %xmm0,(%rsp)
jl     11b0 <main+0x50>
mov    0x8(%rbx),%r15
je     11b7 <main+0x57>
mov    0x10(%rbx),%r14
cmp    $0x4,%ebp
jb     11b7 <main+0x57>
mov    0x18(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <strtoul@plt>
mov    %eax,%r12d
jmp    11b7 <main+0x57>
lea    0xe49(%rip),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
xor    %esi,%esi
call   1030 <strtodelay@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <strtodelay@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1050 <timetostr@plt>
lea    0xe1c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe13(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    1275 <main+0x115>
lea    0xe03(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mov    $0xa,%edi
call   1080 <libt_timetointerval4@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1050 <timetostr@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    1220 <main+0xc0>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"1d\00"
@.str.1 = [3 x i8] c"4h\00"
@.str.2 = [8 x i8] c"now %s\0A\00"
@.str.3 = [9 x i8] c"/%s +%s\0A\00"
@.str.4 = [15 x i8] c"%i %s (+%.0f)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call double (...) @libt_walltime()
store double %14, double* %10
store i32 10, i32* %13
%15 = load i32, i32* %4
%16 = icmp sge i32 %15, 2
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
br label %22
21: ; preds = %2
br label %22
22: ; preds = %21, %17
%23 = phi i8* [ %20, %17 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %21 ]
store i8* %23, i8** %6
%24 = load i32, i32* %4
%25 = icmp sge i32 %24, 3
br i1 %25, label %26, label %30
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
br label %31
30: ; preds = %22
br label %31
31: ; preds = %30, %26
%32 = phi i8* [ %29, %26 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %30 ]
store i8* %32, i8** %7
%33 = load i32, i32* %4
%34 = icmp sge i32 %33, 4
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 3
%38 = load i8*, i8** %37
%39 = call i32 @strtoul(i8* %38, i32* null, i32 0)
store i32 %39, i32* %13
br label %40
40: ; preds = %35, %31
%41 = load i8*, i8** %6
%42 = call double @strtodelay(i8* %41, i32* null)
store double %42, double* %8
%43 = load i8*, i8** %7
%44 = call double @strtodelay(i8* %43, i32* null)
store double %44, double* %9
%45 = load double, double* %10
%46 = call i8* @timetostr(double %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %46)
%48 = load i8*, i8** %6
%49 = load i8*, i8** %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %48, i8* %49)
store i32 0, i32* %12
br label %51
51: ; preds = %70, %40
%52 = load i32, i32* %12
%53 = load i32, i32* %13
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %73
55: ; preds = %51
%56 = load double, double* %10
%57 = load double, double* %8
%58 = load double, double* %9
%59 = call double @libt_timetointerval4(double %56, double %57, double %58, i32 10)
store double %59, double* %11
%60 = load i32, i32* %12
%61 = load double, double* %10
%62 = load double, double* %11
%63 = fadd double %61, %62
%64 = call i8* @timetostr(double %63)
%65 = load double, double* %11
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %60, i8* %64, double %65)
%67 = load double, double* %11
%68 = load double, double* %10
%69 = fadd double %68, %67
store double %69, double* %10
br label %70
70: ; preds = %55
%71 = load i32, i32* %12
%72 = add nsw i32 %71, 1
store i32 %72, i32* %12
br label %51
73: ; preds = %51
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"1d\00"
@.str.1 = [3 x i8] c"4h\00"
@.str.2 = [8 x i8] c"now %s\0A\00"
@.str.3 = [9 x i8] c"/%s +%s\0A\00"
@.str.4 = [15 x i8] c"%i %s (+%.0f)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call double (...) @libt_walltime()
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = icmp eq i32 %0, 2
br i1 %8, label %17, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = icmp ugt i32 %0, 3
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @strtoul(i8* nocapture %15, i32* null, i32 0)
br label %17
17: ; preds = %2, %5, %13, %9
%18 = phi i8* [ %11, %13 ], [ %11, %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ]
%19 = phi i8* [ %7, %13 ], [ %7, %9 ], [ %7, %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %2 ]
%20 = phi i32 [ %16, %13 ], [ 10, %9 ], [ 10, %5 ], [ 10, %2 ]
%21 = tail call double @strtodelay(i8* %19, i32* null)
%22 = tail call double @strtodelay(i8* %18, i32* null)
%23 = tail call i8* @timetostr(double %3)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %19, i8* %18)
%26 = icmp sgt i32 %20, 0
br i1 %26, label %27, label %36
27: ; preds = %17, %27
%28 = phi i32 [ %34, %27 ], [ 0, %17 ]
%29 = phi double [ %31, %27 ], [ %3, %17 ]
%30 = tail call double @libt_timetointerval4(double %29, double %21, double %22, i32 10)
%31 = fadd double %29, %30
%32 = tail call i8* @timetostr(double %31)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %28, i8* %32, double %30)
%34 = add nuw nsw i32 %28, 1
%35 = icmp eq i32 %34, %20
br i1 %35, label %36, label %27
36: ; preds = %27, %17
ret i32 0
}