#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_mday;
  int tm_mon;
  int tm_year;
};

/* Variables and functions */
int /*<<< orphan*/ difftime(int /*<<< orphan*/, int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int rok, miesiac, dzien;
  struct tm *data_urodzenia;
  time_t czas_urodzenia, czas_teraz;
  data_urodzenia = localtime(&czas_urodzenia);
  printf("Podaj swoja date urodzeniaodzenia w formacie rrrr-mm-dd: ");
  scanf("%d-%d-%d", &rok, &miesiac, &dzien);
  data_urodzenia->tm_mday = dzien;
  data_urodzenia->tm_mon = miesiac - 1;
  data_urodzenia->tm_year = rok - 1900;
  czas_urodzenia = mktime(data_urodzenia);
  time(&czas_teraz);
  printf("Do momentu uruchomienia tego programu przezyles:\n");
  printf("\t%.0lf sekund\n", difftime(czas_teraz, czas_urodzenia));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1080 <scanf@plt>
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%ecx
sub    $0x76c,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rdi
call   1070 <mktime@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <time@plt>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <difftime@plt>
mov    %eax,%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1090 <scanf@plt>
mov    0x14(%rsp),%eax
mov    %eax,(%rbx)
mov    0x18(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x4(%rbx)
mov    $0xfffff894,%eax
add    0x1c(%rsp),%eax
mov    %eax,0x8(%rbx)
mov    %rbx,%rdi
call   1080 <mktime@plt>
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%rdi
call   1070 <time@plt>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
call   1060 <difftime@plt>
lea    0xe46(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [58 x i8] c"Podaj swoja date urodzeniaodzenia w formacie rrrr-mm-dd: \00"
@.str.1 = [9 x i8] c"%d-%d-%d\00"
@.str.2 = [50 x i8] c"Do momentu uruchomienia tego programu przezyles:\0A\00"
@.str.3 = [15 x i8] c"\09%.0lf sekund\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.tm*
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %8, %struct.tm** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%11 = load i32, i32* %4
%12 = load %struct.tm*, %struct.tm** %5
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 0
store i32 %11, i32* %13
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
%16 = load %struct.tm*, %struct.tm** %5
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 1
store i32 %15, i32* %17
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 1900
%20 = load %struct.tm*, %struct.tm** %5
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 2
store i32 %19, i32* %21
%22 = load %struct.tm*, %struct.tm** %5
%23 = call i32 @mktime(%struct.tm* %22)
store i32 %23, i32* %6
%24 = call i32 @time(i32* %7)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* %7
%27 = load i32, i32* %6
%28 = call i32 @difftime(i32 %26, i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [58 x i8] c"Podaj swoja date urodzeniaodzenia w formacie rrrr-mm-dd: \00"
@.str.1 = [9 x i8] c"%d-%d-%d\00"
@.str.3 = [15 x i8] c"\09%.0lf sekund\0A\00"
@str = [49 x i8] c"Do momentu uruchomienia tego programu przezyles:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = call %struct.tm* @localtime(i32* %4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%14 = load i32, i32* %3
%15 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 0
store i32 %14, i32* %15
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
%18 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 1
store i32 %17, i32* %18
%19 = load i32, i32* %1
%20 = add nsw i32 %19, -1900
%21 = getelementptr inbounds %struct.tm, %struct.tm* %11, i64 0, i32 2
store i32 %20, i32* %21
%22 = call i32 @mktime(%struct.tm* %11)
store i32 %22, i32* %4
%23 = call i32 @time(i32* %5)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%25 = load i32, i32* %5
%26 = load i32, i32* %4
%27 = call i32 @difftime(i32 %25, i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %27)
ret i32 0
}