main(argc, argv) int argc;
char **argv;
{
  long jd;
  double mjd, fd;
  int mm, dd, yyyy;
  void caldat(long julian, int *mm, int *dd, int *yyyy);
  if (argc != 2) {
    printf("args: mjd\n");
    exit(-1);
  }
  sscanf(argv[1], "%lf", &mjd);
  fd = mjd - (int)mjd;
  jd = (long)floor(mjd + 2400001.0);
  caldat(jd, &mm, &dd, &yyyy);
  fd += (double)dd;
  printf("%4d ", yyyy);
  if (mm < 10) {
    printf("0%1d ", mm);
  } else {
    printf("%2d ", mm);
  }
  if (fd < 10) {
    printf("0%6.5lf", fd);
  } else {
    printf("%7.5lf", fd);
  }
}


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     1188 <main+0x38>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe84(%rip),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
movsd  -0x20(%rbp),%xmm0
cvttsd2si -0x20(%rbp),%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe3f(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
call   1060 <floor@plt>
cvttsd2si %xmm0,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x34(%rbp),%rcx
call   1070 <caldat@plt>
cvtsi2sdl -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x34(%rbp),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0x2c(%rbp)
jge    1229 <main+0xd9>
mov    -0x2c(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0xea>
mov    -0x2c(%rbp),%esi
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xdc6(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1265 <main+0x115>
movsd  -0x28(%rbp),%xmm0
lea    0xdd6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1278 <main+0x128>
movsd  -0x28(%rbp),%xmm0
lea    0xdc6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
cmp    $0x2,%edi
jne    123f <main+0xdf>
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
movsd  0x20(%rsp),%xmm0
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
addsd  0xe58(%rip),%xmm0
call   1070 <floor@plt>
cvttsd2si %xmm0,%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
call   1080 <caldat@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x4(%rsp),%esi
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
cmp    $0xa,%esi
lea    0xe1e(%rip),%rax
lea    0xe1d(%rip),%rdi
cmovl  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0xdf3(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm1
lea    0xdfe(%rip),%rax
lea    0xdff(%rip),%rdi
cmova  %rax,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret
lea    0xded(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"args: mjd\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [5 x i8] c"%4d \00"
@.str.3 = [6 x i8] c"0%1d \00"
@.str.4 = [5 x i8] c"%2d \00"
@.str.5 = [8 x i8] c"0%6.5lf\00"
@.str.6 = [7 x i8] c"%7.5lf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
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, 2
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 (i8*, i8*, ...) @sscanf(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %7)
%21 = load double, double* %7
%22 = load double, double* %7
%23 = fptosi double %22 to i32
%24 = sitofp i32 %23 to double
%25 = fsub double %21, %24
store double %25, double* %8
%26 = load double, double* %7
%27 = fadd double %26, 0x41424F8080000000
%28 = call double @llvm.floor.f64(double %27)
%29 = fptosi double %28 to i64
store i64 %29, i64* %6
%30 = load i64, i64* %6
%31 = load i32, i32* %10
%32 = sitofp i32 %31 to double
%33 = load double, double* %8
%34 = fadd double %33, %32
store double %34, double* %8
%35 = load i32, i32* %11
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %9
%38 = icmp slt i32 %37, 10
br i1 %38, label %39, label %42
39: ; preds = %16
%40 = load i32, i32* %9
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %45
42: ; preds = %16
%43 = load i32, i32* %9
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %39
%46 = load double, double* %8
%47 = fcmp olt double %46, 1.000000e+01
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load double, double* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %49)
br label %54
51: ; preds = %45
%52 = load double, double* %8
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double %52)
br label %54
54: ; preds = %51, %48
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [5 x i8] c"%4d \00"
@.str.3 = [6 x i8] c"0%1d \00"
@.str.4 = [5 x i8] c"%2d \00"
@.str.5 = [8 x i8] c"0%6.5lf\00"
@.str.6 = [7 x i8] c"%7.5lf\00"
@str = [10 x i8] c"args: mjd\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast double* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
tail call void @exit(i32 -1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%18 = load double, double* %3
%19 = fptosi double %18 to i32
%20 = sitofp i32 %19 to double
%21 = fsub double %18, %20
%22 = fadd double %18, 0x41424F8080000000
%23 = call double @llvm.floor.f64(double %22)
%24 = fptosi double %23 to i64
%25 = load i32, i32* %5
%26 = sitofp i32 %25 to double
%27 = fadd double %21, %26
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 10
%32 = select i1 %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %32, i32 %30)
%34 = fcmp olt double %27, 1.000000e+01
%35 = select i1 %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %35, double %27)
ret i32 0
}