#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_date(char *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, int, int, int, int, double);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ sun_date2gpstime(int, int, int, int *, double *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <date>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  int year;
  int month;
  int day;
  if (!parse_date(argv[1], &year, &month, &day)) {
    fprintf(stderr, "Cannot parse date: %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  int week;
  double tow;
  sun_date2gpstime(year, month, day, &week, &tow);
  printf("%02d.%02d.%04d begins on week %d tow %f s (GPS Time)\n", day, month,
         year, week, tow);
  exit(EXIT_SUCCESS);
}


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)
je     119a <main+0x4a>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1030 <parse_date@plt>
cmp    $0x0,%eax
jne    11e7 <main+0x97>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe3e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1040 <sun_date2gpstime@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8d
movsd  -0x28(%rbp),%xmm0
lea    0xe13(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    118f <main+0x3f>
mov    0x8(%rbx),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <parse_date@plt>
test   %eax,%eax
jne    11b5 <main+0x65>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe85(%rip),%rsi
jmp    11a2 <main+0x52>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe5e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0x14(%rsp),%rcx
lea    0x18(%rsp),%r8
call   1040 <sun_date2gpstime@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0x14(%rsp),%r8d
movsd  0x18(%rsp),%xmm0
lea    0xe3b(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <date>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [23 x i8] c"Cannot parse date: %s\0A\00"
@.str.2 = [54 x i8] c"%02d.%02d.%04d begins on week %d tow %f s (GPS Time)\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 i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @parse_date(i8* %24, i32* %6, i32* %7, i32* %8)
%26 = icmp ne i32 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %21
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = call i32 @sun_date2gpstime(i32 %36, i32 %37, i32 %38, i32* %9, double* %10)
%40 = load i32, i32* %8
%41 = load i32, i32* %7
%42 = load i32, i32* %6
%43 = load i32, i32* %9
%44 = load double, double* %10
%45 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %40, i32 %41, i32 %42, i32 %43, double %44)
%46 = load i32, i32* @EXIT_SUCCESS
%47 = call i32 @exit(i32 %46)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <date>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [23 x i8] c"Cannot parse date: %s\0A\00"
@.str.2 = [54 x i8] c"%02d.%02d.%04d begins on week %d tow %f s (GPS Time)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = icmp eq i32 %0, 2
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 ([18 x i8], [18 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 i32* %3 to i8*
%17 = bitcast i32* %4 to i8*
%18 = bitcast i32* %5 to i8*
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @parse_date(i8* %20, i32* %3, i32* %4, i32* %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 = bitcast i32* %6 to i8*
%31 = bitcast double* %7 to i8*
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 @sun_date2gpstime(i32 %32, i32 %33, i32 %34, i32* %6, double* %7)
%36 = load i32, i32* %5
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = load i32, i32* %6
%40 = load double, double* %7
%41 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i32 %36, i32 %37, i32 %38, i32 %39, double %40)
%42 = load i32, i32* @EXIT_SUCCESS
%43 = call i32 @exit(i32 %42)
unreachable
}