#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 DMY2Jul(int, int, int);
char Int2Mime(unsigned long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int Year, Month, Day, Count;
  unsigned long Jul, InvJul;
  char Buffer[255];
  printf("Year:");
  scanf("%i", &Year);
  printf("Month:");
  scanf("%i", &Month);
  printf("Date of month:");
  scanf("%i", &Day);
  Day = DMY2Jul(Day, Month, Year);
  printf("Julian day: %i\n", Day);
  Year -= 1900;
  Jul = 1000 * (long)Year + (long)Day;
  InvJul = ~Jul;
  printf("\n%li\n", Jul);
  for (Count = 0; Count <= 5; Count++) {
    Buffer[Count] = Int2Mime(Jul >> ((5 - Count) * 5));
    Buffer[Count + 6] = Int2Mime(InvJul >> ((5 - Count) * 5));
  }
  Buffer[Count << 1] = 0;
  printf("\n%s\n", Buffer);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1050 <DMY2Jul@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
imul   $0x3e8,%rax,%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jg     1280 <main+0x140>
mov    -0x20(%rbp),%rdi
mov    $0x5,%eax
sub    -0x14(%rbp),%eax
imul   $0x5,%eax,%eax
mov    %eax,%eax
mov    %eax,%ecx
shr    %cl,%rdi
call   1030 <Int2Mime@plt>
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x130(%rbp,%rax,1)
mov    -0x28(%rbp),%rdi
mov    $0x5,%eax
sub    -0x14(%rbp),%eax
imul   $0x5,%eax,%eax
mov    %eax,%eax
mov    %eax,%ecx
shr    %cl,%rdi
call   1030 <Int2Mime@plt>
mov    %al,%cl
mov    -0x14(%rbp),%eax
add    $0x6,%eax
cltq
mov    %cl,-0x130(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1214 <main+0xd4>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cltq
movb   $0x0,-0x130(%rbp,%rax,1)
lea    -0x130(%rbp),%rsi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x118,%rsp
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea7(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe82(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
call   1050 <DMY2Jul@plt>
mov    %eax,0x4(%rsp)
lea    0xe61(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0x8(%rsp),%rax
add    $0xfffffffffffff894,%rax
mov    %eax,0x8(%rsp)
imul   $0x3e8,%rax,%rax
movslq 0x4(%rsp),%rbx
add    %rax,%rbx
mov    %rbx,%r14
not    %r14
lea    0xe3d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
shr    $0x19,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x10(%rsp)
mov    %r14,%rdi
shr    $0x19,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x16(%rsp)
mov    %rbx,%rdi
shr    $0x14,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x11(%rsp)
mov    %r14,%rdi
shr    $0x14,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x17(%rsp)
mov    %rbx,%rdi
shr    $0xf,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x12(%rsp)
mov    %r14,%rdi
shr    $0xf,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x18(%rsp)
mov    %rbx,%rdi
shr    $0xa,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x13(%rsp)
mov    %r14,%rdi
shr    $0xa,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x19(%rsp)
mov    %rbx,%rdi
shr    $0x5,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x14(%rsp)
mov    %r14,%rdi
shr    $0x5,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x1a(%rsp)
mov    %rbx,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x15(%rsp)
mov    %r14,%rdi
call   1030 <Int2Mime@plt>
mov    %al,0x1b(%rsp)
movb   $0x0,0x1c(%rsp)
lea    0xd75(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Year:\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [7 x i8] c"Month:\00"
@.str.3 = [15 x i8] c"Date of month:\00"
@.str.4 = [16 x i8] c"Julian day: %i\0A\00"
@.str.5 = [6 x i8] c"\0A%li\0A\00"
@.str.6 = [5 x i8] c"\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca [255 x i8]
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 @DMY2Jul(i32 %15, i32 %16, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %2
%22 = sub nsw i32 %21, 1900
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = mul nsw i64 1000, %24
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = add nsw i64 %25, %27
store i64 %28, i64* %6
%29 = load i64, i64* %6
%30 = xor i64 %29, -1
store i64 %30, i64* %7
%31 = load i64, i64* %6
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %31)
store i32 0, i32* %5
br label %33
33: ; preds = %58, %0
%34 = load i32, i32* %5
%35 = icmp sle i32 %34, 5
br i1 %35, label %36, label %61
36: ; preds = %33
%37 = load i64, i64* %6
%38 = load i32, i32* %5
%39 = sub nsw i32 5, %38
%40 = mul nsw i32 %39, 5
%41 = zext i32 %40 to i64
%42 = lshr i64 %37, %41
%43 = call signext i8 @Int2Mime(i64 %42)
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %45
store i8 %43, i8* %46
%47 = load i64, i64* %7
%48 = load i32, i32* %5
%49 = sub nsw i32 5, %48
%50 = mul nsw i32 %49, 5
%51 = zext i32 %50 to i64
%52 = lshr i64 %47, %51
%53 = call signext i8 @Int2Mime(i64 %52)
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 6
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %56
store i8 %53, i8* %57
br label %58
58: ; preds = %36
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
br label %33
61: ; preds = %33
%62 = load i32, i32* %5
%63 = shl i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 %64
store i8 0, i8* %65
%66 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [6 x i8] c"Year:\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [7 x i8] c"Month:\00"
@.str.3 = [15 x i8] c"Date of month:\00"
@.str.4 = [16 x i8] c"Julian day: %i\0A\00"
@.str.5 = [6 x i8] c"\0A%li\0A\00"
@.str.6 = [5 x i8] c"\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [255 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = load i32, i32* %1
%18 = call i32 @DMY2Jul(i32 %15, i32 %16, i32 %17)
store i32 %18, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %1
%21 = add nsw i32 %20, -1900
store i32 %21, i32* %1
%22 = sext i32 %21 to i64
%23 = mul nsw i64 %22, 1000
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = add nsw i64 %23, %25
%27 = xor i64 %26, -1
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 %26)
%29 = lshr i64 %26, 25
%30 = call signext i8 @Int2Mime(i64 %29)
store i8 %30, i8* %8
%31 = lshr i64 %27, 25
%32 = call signext i8 @Int2Mime(i64 %31)
%33 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 6
store i8 %32, i8* %33
%34 = lshr i64 %26, 20
%35 = call signext i8 @Int2Mime(i64 %34)
%36 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 1
store i8 %35, i8* %36
%37 = lshr i64 %27, 20
%38 = call signext i8 @Int2Mime(i64 %37)
%39 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 7
store i8 %38, i8* %39
%40 = lshr i64 %26, 15
%41 = call signext i8 @Int2Mime(i64 %40)
%42 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 2
store i8 %41, i8* %42
%43 = lshr i64 %27, 15
%44 = call signext i8 @Int2Mime(i64 %43)
%45 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 8
store i8 %44, i8* %45
%46 = lshr i64 %26, 10
%47 = call signext i8 @Int2Mime(i64 %46)
%48 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 3
store i8 %47, i8* %48
%49 = lshr i64 %27, 10
%50 = call signext i8 @Int2Mime(i64 %49)
%51 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 9
store i8 %50, i8* %51
%52 = lshr i64 %26, 5
%53 = call signext i8 @Int2Mime(i64 %52)
%54 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 4
store i8 %53, i8* %54
%55 = lshr i64 %27, 5
%56 = call signext i8 @Int2Mime(i64 %55)
%57 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 10
store i8 %56, i8* %57
%58 = call signext i8 @Int2Mime(i64 %26)
%59 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 5
store i8 %58, i8* %59
%60 = call signext i8 @Int2Mime(i64 %27)
%61 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 11
store i8 %60, i8* %61
%62 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 12
store i8 0, i8* %62
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %8)
ret i32 0
}