#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  typedef struct {
    int dd;
    int mm;
    int yy;
  } waktu;
  waktu m;
  waktu s;
  int hariM;
  int hariS;
  int hariSelisih;
  int tahun, bulan, hari;
  printf("Waktu mulai dalam format dd:mm:yy : ");
  scanf("%d:%d:%d", &m.dd, &m.mm, &m.yy);
  printf("Waktu selesai dalam format dd:mm:yy : ");
  scanf("%d:%d:%d", &s.dd, &s.mm, &s.yy);
  hariM = m.dd + (m.mm * 30) + (m.yy * 365);
  hariS = s.dd + (s.mm * 30) + (s.yy * 365);
  hariSelisih = hariS - hariM;
  tahun = hariSelisih / 365;
  bulan = (hariSelisih % 365) / 30;
  hari = hariSelisih - (tahun * 365 + bulan * 30);
  printf("Jarak antara dua waktu tersebut yaitu %d tahun, %d bulan, %d hari",
         tahun, bulan, hari);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    -0x10(%rbp),%rdx
add    $0x4,%rdx
lea    -0x10(%rbp),%rcx
add    $0x8,%rcx
lea    0xecd(%rip),%rdi
call   1040 <scanf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
lea    0xe9f(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
imul   $0x1e,-0xc(%rbp),%ecx
add    %ecx,%eax
imul   $0x16d,-0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
imul   $0x1e,-0x1c(%rbp),%ecx
add    %ecx,%eax
imul   $0x16d,-0x18(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x16d,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
imul   $0x16d,-0x30(%rbp),%ecx
imul   $0x1e,-0x34(%rbp),%edx
add    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0xee1(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
mov    0x8(%rsp),%edx
sub    0x18(%rsp),%edx
imul   $0x16d,%edx,%edx
sub    0x14(%rsp),%ecx
mov    %ecx,%esi
shl    $0x5,%esi
sub    %ecx,%esi
sub    %ecx,%esi
sub    0x10(%rsp),%eax
add    %esi,%eax
add    %edx,%eax
cltq
imul   $0xffffffffb38cf9b1,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x8,%esi
add    %ecx,%esi
imul   $0x16d,%esi,%edx
imul   $0xfffffe93,%esi,%ecx
add    %eax,%ecx
sub    %edx,%eax
movswl %ax,%edx
imul   $0xffff8889,%edx,%edx
shr    $0x10,%edx
add    %eax,%edx
movzwl %dx,%eax
movswl %ax,%edx
shr    $0xf,%eax
sar    $0x4,%edx
add    %eax,%edx
movswl %dx,%edx
imul   $0xffffffe2,%edx,%eax
add    %eax,%ecx
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.waktu = type { i32, i32, i32 }
@.str = [37 x i8] c"Waktu mulai dalam format dd:mm:yy : \00"
@.str.1 = [9 x i8] c"%d:%d:%d\00"
@.str.2 = [39 x i8] c"Waktu selesai dalam format dd:mm:yy : \00"
@.str.3 = [66 x i8] c"Jarak antara dua waktu tersebut yaitu %d tahun, %d bulan, %d hari\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.waktu
%3 = alloca %struct.waktu
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i32 0, i32 0
%12 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i32 0, i32 1
%13 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i32 0, i32 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %11, i32* %12, i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds %struct.waktu, %struct.waktu* %3, i32 0, i32 0
%17 = getelementptr inbounds %struct.waktu, %struct.waktu* %3, i32 0, i32 1
%18 = getelementptr inbounds %struct.waktu, %struct.waktu* %3, i32 0, i32 2
%19 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %16, i32* %17, i32* %18)
%20 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i32 0, i32 0
%21 = load i32, i32* %20
%22 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i32 0, i32 1
%23 = load i32, i32* %22
%24 = mul nsw i32 %23, 30
%25 = add nsw i32 %21, %24
%26 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i32 0, i32 2
%27 = load i32, i32* %26
%28 = mul nsw i32 %27, 365
%29 = add nsw i32 %25, %28
store i32 %29, i32* %4
%30 = getelementptr inbounds %struct.waktu, %struct.waktu* %3, i32 0, i32 0
%31 = load i32, i32* %30
%32 = getelementptr inbounds %struct.waktu, %struct.waktu* %3, i32 0, i32 1
%33 = load i32, i32* %32
%34 = mul nsw i32 %33, 30
%35 = add nsw i32 %31, %34
%36 = getelementptr inbounds %struct.waktu, %struct.waktu* %3, i32 0, i32 2
%37 = load i32, i32* %36
%38 = mul nsw i32 %37, 365
%39 = add nsw i32 %35, %38
store i32 %39, i32* %5
%40 = load i32, i32* %5
%41 = load i32, i32* %4
%42 = sub nsw i32 %40, %41
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = sdiv i32 %43, 365
store i32 %44, i32* %7
%45 = load i32, i32* %6
%46 = srem i32 %45, 365
%47 = sdiv i32 %46, 30
store i32 %47, i32* %8
%48 = load i32, i32* %6
%49 = load i32, i32* %7
%50 = mul nsw i32 %49, 365
%51 = load i32, i32* %8
%52 = mul nsw i32 %51, 30
%53 = add nsw i32 %50, %52
%54 = sub nsw i32 %48, %53
store i32 %54, i32* %9
%55 = load i32, i32* %7
%56 = load i32, i32* %8
%57 = load i32, i32* %9
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56, i32 %57)
ret i32 0
}

LLVM IR (-O2):
%struct.waktu = type { i32, i32, i32 }
@.str = [37 x i8] c"Waktu mulai dalam format dd:mm:yy : \00"
@.str.1 = [9 x i8] c"%d:%d:%d\00"
@.str.2 = [39 x i8] c"Waktu selesai dalam format dd:mm:yy : \00"
@.str.3 = [66 x i8] c"Jarak antara dua waktu tersebut yaitu %d tahun, %d bulan, %d hari\00"
define i32 @main() {
%1 = alloca %struct.waktu
%2 = alloca %struct.waktu
%3 = bitcast %struct.waktu* %1 to i8*
%4 = bitcast %struct.waktu* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds %struct.waktu, %struct.waktu* %1, i64 0, i32 0
%7 = getelementptr inbounds %struct.waktu, %struct.waktu* %1, i64 0, i32 1
%8 = getelementptr inbounds %struct.waktu, %struct.waktu* %1, i64 0, i32 2
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7, i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i64 0, i32 0
%12 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i64 0, i32 1
%13 = getelementptr inbounds %struct.waktu, %struct.waktu* %2, i64 0, i32 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %11, i32* %12, i32* %13)
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = load i32, i32* %11
%19 = load i32, i32* %12
%20 = load i32, i32* %13
%21 = sub i32 %20, %17
%22 = mul i32 %21, 365
%23 = sub i32 %19, %16
%24 = mul i32 %23, 30
%25 = sub i32 %18, %15
%26 = add i32 %25, %24
%27 = add i32 %26, %22
%28 = sdiv i32 %27, 365
%29 = srem i32 %27, 365
%30 = trunc i32 %29 to i16
%31 = sdiv i16 %30, 30
%32 = sext i16 %31 to i32
%33 = mul nsw i32 %28, -365
%34 = mul nsw i32 %32, -30
%35 = add i32 %33, %27
%36 = add i32 %35, %34
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %32, i32 %36)
ret i32 0
}