#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*/ parse_double(char *, double *);
int /*<<< orphan*/ parse_long(char *, long *);
int /*<<< orphan*/ printf(char *, int, double, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ sun_translate_gpstime(int *, double *, int /*<<< orphan*/,
                                         int /*<<< orphan*/, double);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "Usage: %s <week> <tow> <delta>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  int week1;
  double tow1;
  double delta;
  long tmp;
  if (!parse_long(argv[1], &tmp)) {
    fprintf(stderr, "Cannot parse week: %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  week1 = (int)tmp;
  if (!parse_double(argv[2], &tow1)) {
    fprintf(stderr, "Cannot parse tow: %s\n", argv[2]);
    exit(EXIT_FAILURE);
  }
  if (!parse_double(argv[3], &delta)) {
    fprintf(stderr, "Cannot parse delta: %s\n", argv[3]);
    exit(EXIT_FAILURE);
  }
  int week2 = week1;
  double tow2 = tow1;
  sun_translate_gpstime(&week2, &tow2, 0, 0, delta);
  printf("Week %d tow %.3f   +   %.3f s    =\n", week1, tow1, delta);
  printf("Week %d tow %.3f\n", week2, tow2);
  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   $0x3,-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   1050 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <parse_long@plt>
cmp    $0x0,%eax
jne    11ef <main+0x8f>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe44(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x30(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <parse_double@plt>
cmp    $0x0,%eax
jne    123b <main+0xdb>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe0f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <parse_double@plt>
cmp    $0x0,%eax
jne    1280 <main+0x120>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xde0(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    -0x34(%rbp),%rdi
lea    -0x40(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1040 <sun_translate_gpstime@plt>
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xdab(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
movsd  -0x40(%rbp),%xmm0
lea    0xdb9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1196 <main+0x36>
mov    0x8(%rbx),%rdi
lea    0x20(%rsp),%rsi
call   1060 <parse_long@plt>
test   %eax,%eax
jne    11bc <main+0x5c>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe8c(%rip),%rsi
jmp    11a9 <main+0x49>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe57(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x20(%rsp),%ebp
mov    0x10(%rbx),%rdi
lea    0x18(%rsp),%rsi
call   1070 <parse_double@plt>
test   %eax,%eax
jne    11e8 <main+0x88>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe51(%rip),%rsi
jmp    11a9 <main+0x49>
mov    0x18(%rbx),%rdi
lea    0x10(%rsp),%rsi
call   1070 <parse_double@plt>
test   %eax,%eax
jne    1210 <main+0xb0>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rbx),%rdx
lea    0xe3f(%rip),%rsi
jmp    11a9 <main+0x49>
mov    %ebp,0x4(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <sun_translate_gpstime@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
lea    0xe19(%rip),%rdi
mov    %ebp,%esi
mov    $0x2,%al
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
movsd  0x8(%rsp),%xmm0
lea    0xe23(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: %s <week> <tow> <delta>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [23 x i8] c"Cannot parse week: %s\0A\00"
@.str.2 = [22 x i8] c"Cannot parse tow: %s\0A\00"
@.str.3 = [24 x i8] c"Cannot parse delta: %s\0A\00"
@.str.4 = [36 x i8] c"Week %d tow %.3f + %.3f s =\0A\00"
@.str.5 = [18 x i8] c"Week %d tow %.3f\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 i32
%7 = alloca double
%8 = alloca double
%9 = alloca i64
%10 = alloca i32
%11 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %22
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @parse_long(i8* %25, i64* %9)
%27 = icmp ne i32 %26, 0
br i1 %27, label %36, label %28
28: ; preds = %22
%29 = load i32, i32* @stderr
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %22
%37 = load i64, i64* %9
%38 = trunc i64 %37 to i32
store i32 %38, i32* %6
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @parse_double(i8* %41, double* %7)
%43 = icmp ne i32 %42, 0
br i1 %43, label %52, label %44
44: ; preds = %36
%45 = load i32, i32* @stderr
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %48)
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %36
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
%56 = call i32 @parse_double(i8* %55, double* %8)
%57 = icmp ne i32 %56, 0
br i1 %57, label %66, label %58
58: ; preds = %52
%59 = load i32, i32* @stderr
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 3
%62 = load i8*, i8** %61
%63 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %62)
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %52
%67 = load i32, i32* %6
store i32 %67, i32* %10
%68 = load double, double* %7
store double %68, double* %11
%69 = load double, double* %8
%70 = call i32 @sun_translate_gpstime(i32* %10, double* %11, i32 0, i32 0, double %69)
%71 = load i32, i32* %6
%72 = load double, double* %7
%73 = load double, double* %8
%74 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %71, double %72, double %73)
%75 = load i32, i32* %10
%76 = load double, double* %11
%77 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %75, double %76)
%78 = load i32, i32* @EXIT_SUCCESS
%79 = call i32 @exit(i32 %78)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: %s <week> <tow> <delta>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [23 x i8] c"Cannot parse week: %s\0A\00"
@.str.2 = [22 x i8] c"Cannot parse tow: %s\0A\00"
@.str.3 = [24 x i8] c"Cannot parse delta: %s\0A\00"
@.str.4 = [36 x i8] c"Week %d tow %.3f + %.3f s =\0A\00"
@.str.5 = [18 x i8] c"Week %d tow %.3f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i64
%6 = alloca i32
%7 = alloca double
%8 = icmp eq i32 %0, 3
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = bitcast double* %3 to i8*
%17 = bitcast double* %4 to i8*
%18 = bitcast i64* %5 to i8*
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @parse_long(i8* %20, i64* %5)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %15
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %19
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %15
%30 = load i64, i64* %5
%31 = trunc i64 %30 to i32
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @parse_double(i8* %33, double* %3)
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %42
36: ; preds = %29
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %32
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %29
%43 = getelementptr inbounds i8*, i8** %1, i64 3
%44 = load i8*, i8** %43
%45 = call i32 @parse_double(i8* %44, double* %4)
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %42
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %43
%50 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %42
%54 = bitcast i32* %6 to i8*
store i32 %31, i32* %6
%55 = bitcast double* %7 to i8*
%56 = load double, double* %3
store double %56, double* %7
%57 = load double, double* %4
%58 = call i32 @sun_translate_gpstime(i32* %6, double* %7, i32 0, i32 0, double %57)
%59 = load double, double* %3
%60 = load double, double* %4
%61 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %31, double %59, double %60)
%62 = load i32, i32* %6
%63 = load double, double* %7
%64 = call i32 (i8*, i32, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %62, double %63)
%65 = load i32, i32* @EXIT_SUCCESS
%66 = call i32 @exit(i32 %65)
unreachable
}