#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 *, long, int, int, int);
int sscanf(char *, char *, long *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ sun_mjulianday2date(long, int *, int *, int *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <daynum>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  long daynum;
  if (sscanf(argv[1], "%ld", &daynum) != 1) {
    fprintf(stderr, "Cannot parse daynum: %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  int year;
  int month;
  int day;
  sun_mjulianday2date(daynum, &year, &month, &day);
  printf("%ld (Modified Julian Day) is %02d.%02d.%04d (dd.mm.yyyy)\n", daynum,
         day, month, year);
  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   1050 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6b(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     11e6 <main+0x96>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe45(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1030 <sun_mjulianday2date@plt>
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
mov    0x2db4(%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    11bc <main+0x6c>
mov    0x8(%rbx),%rdi
lea    0xeac(%rip),%rsi
lea    0x18(%rsp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    11d1 <main+0x81>
mov    0x18(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <sun_mjulianday2date@plt>
mov    0x18(%rsp),%rsi
mov    0xc(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0x14(%rsp),%r8d
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe31(%rip),%rsi
jmp    11e5 <main+0x95>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe33(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <daynum>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [25 x i8] c"Cannot parse daynum: %s\0A\00"
@.str.3 = [58 x i8] c"%ld (Modified Julian Day) is %02d.%02d.%04d (dd.mm.yyyy)\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 i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %6)
%25 = icmp ne i32 %24, 1
br i1 %25, label %26, label %34
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %20
%35 = load i64, i64* %6
%36 = call i32 @sun_mjulianday2date(i64 %35, i32* %7, i32* %8, i32* %9)
%37 = load i64, i64* %6
%38 = load i32, i32* %9
%39 = load i32, i32* %8
%40 = load i32, i32* %7
%41 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i64 %37, i32 %38, i32 %39, i32 %40)
%42 = load i32, i32* @EXIT_SUCCESS
%43 = call i32 @exit(i32 %42)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Usage: %s <daynum>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [25 x i8] c"Cannot parse daynum: %s\0A\00"
@.str.3 = [58 x i8] c"%ld (Modified Julian Day) is %02d.%02d.%04d (dd.mm.yyyy)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = icmp eq i32 %0, 2
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = bitcast i64* %3 to i8*
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%19 = icmp eq i32 %18, 1
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %16
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %14
%27 = bitcast i32* %4 to i8*
%28 = bitcast i32* %5 to i8*
%29 = bitcast i32* %6 to i8*
%30 = load i64, i64* %3
%31 = call i32 @sun_mjulianday2date(i64 %30, i32* %4, i32* %5, i32* %6)
%32 = load i64, i64* %3
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = load i32, i32* %4
%36 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i64 %32, i32 %33, i32 %34, i32 %35)
%37 = load i32, i32* @EXIT_SUCCESS
%38 = call i32 @exit(i32 %37)
unreachable
}