#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_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, double, long, int, int, int, double);
int sscanf(char *, char *, double *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ sun_normalize_delta(long *, long *, double *);
int /*<<< orphan*/ sun_timeofday2time(long, int *, int *, int *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <delta>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  double delta;
  if (sscanf(argv[1], "%lf", &delta) != 1) {
    fprintf(stderr, "Cannot parse delta: %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  long delta_day;
  long delta_timeofday;
  double delta_subsec;
  delta_timeofday = 0;
  delta_day = 0;
  delta_subsec = delta;
  sun_normalize_delta(&delta_day, &delta_timeofday, &delta_subsec);
  int delta_hour;
  int delta_min;
  int delta_sec;
  sun_timeofday2time(delta_timeofday, &delta_hour, &delta_min, &delta_sec);
  printf("%f seconds is %ld days %d hours %d minutes %d seconds and %.3f "
         "sub-seconds\n",
         delta, delta_day, delta_hour, delta_min, delta_sec, delta_subsec);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11aa <main+0x4a>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5a(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
je     11f6 <main+0x96>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe34(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <sun_normalize_delta@plt>
mov    -0x28(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
call   1030 <sun_timeofday2time@plt>
movsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
movsd  -0x30(%rbp),%xmm1
lea    0xdda(%rip),%rdi
call   1040 <printf@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1212 <main+0xb2>
mov    0x8(%rbx),%rdi
lea    0xe97(%rip),%rsi
lea    0x28(%rsp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    1227 <main+0xc7>
movq   $0x0,0x18(%rsp)
movq   $0x0,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <sun_normalize_delta@plt>
mov    0x18(%rsp),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1030 <sun_timeofday2time@plt>
movsd  0x28(%rsp),%xmm0
mov    0x20(%rsp),%rsi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
movsd  0x10(%rsp),%xmm1
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xddb(%rip),%rsi
jmp    123b <main+0xdb>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xddc(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s <delta>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [24 x i8] c"Cannot parse delta: %s\0A\00"
@.str.3 = [76 x i8] c"%f seconds is %ld days %d hours %d minutes %d seconds and %.3f sub-seconds\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %23
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %6)
%28 = icmp ne i32 %27, 1
br i1 %28, label %29, label %37
29: ; preds = %23
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %23
store i64 0, i64* %8
store i64 0, i64* %7
%38 = load double, double* %6
store double %38, double* %9
%39 = call i32 @sun_normalize_delta(i64* %7, i64* %8, double* %9)
%40 = load i64, i64* %8
%41 = call i32 @sun_timeofday2time(i64 %40, i32* %10, i32* %11, i32* %12)
%42 = load double, double* %6
%43 = load i64, i64* %7
%44 = load i32, i32* %10
%45 = load i32, i32* %11
%46 = load i32, i32* %12
%47 = load double, double* %9
%48 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), double %42, i64 %43, i32 %44, i32 %45, i32 %46, double %47)
%49 = load i32, i32* @EXIT_SUCCESS
%50 = call i32 @exit(i32 %49)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Usage: %s <delta>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [24 x i8] c"Cannot parse delta: %s\0A\00"
@.str.3 = [76 x i8] c"%f seconds is %ld days %d hours %d minutes %d seconds and %.3f sub-seconds\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca i64
%5 = alloca i64
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = icmp eq i32 %0, 2
br i1 %10, label %17, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = bitcast double* %3 to i8*
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%22 = icmp eq i32 %21, 1
br i1 %22, label %29, label %23
23: ; preds = %17
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %19
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %17
%30 = bitcast i64* %4 to i8*
%31 = bitcast i64* %5 to i8*
%32 = bitcast double* %6 to i8*
store i64 0, i64* %5
store i64 0, i64* %4
%33 = load double, double* %3
store double %33, double* %6
%34 = call i32 @sun_normalize_delta(i64* %4, i64* %5, double* %6)
%35 = bitcast i32* %7 to i8*
%36 = bitcast i32* %8 to i8*
%37 = bitcast i32* %9 to i8*
%38 = load i64, i64* %5
%39 = call i32 @sun_timeofday2time(i64 %38, i32* %7, i32* %8, i32* %9)
%40 = load double, double* %3
%41 = load i64, i64* %4
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = load i32, i32* %9
%45 = load double, double* %6
%46 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), double %40, i64 %41, i32 %42, i32 %43, i32 %44, double %45)
%47 = load i32, i32* @EXIT_SUCCESS
%48 = call i32 @exit(i32 %47)
unreachable
}