#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 *, long *);
int main() {
  long int date;
  printf("Enter birth date in format (ddmmYYYY):\n");
  scanf("%ld", &date);
  int day = date / 1000000;
  int month = (date / 10000) % 100;
  printf("The day and the month of birth are %02d.%02d\n", day, month);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x2710,%ecx
cqto
idiv   %rcx
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rcx
movabs $0x431bde82d7b634db,%rdx
de 1b 43
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
shr    $0x12,%rdx
add    %edx,%esi
movabs $0x346dc5d63886594b,%rdx
c5 6d 34
mov    %rcx,%rax
imul   %rdx
mov    %rdx,%rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xb,%rcx
add    %rax,%rcx
movabs $0xa3d70a3d70a3d70b,%rdx
0a d7 a3
mov    %rcx,%rax
imul   %rdx
add    %rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x6,%rdx
add    %eax,%edx
imul   $0x64,%edx,%eax
sub    %eax,%ecx
lea    0xe4a(%rip),%rdi
mov    %ecx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Enter birth date in format (ddmmYYYY):\0A\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [46 x i8] c"The day and the month of birth are %02d.%02d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%7 = load i64, i64* %2
%8 = sdiv i64 %7, 1000000
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
%10 = load i64, i64* %2
%11 = sdiv i64 %10, 10000
%12 = srem i64 %11, 100
%13 = trunc i64 %12 to i32
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [46 x i8] c"The day and the month of birth are %02d.%02d\0A\00"
@str = [39 x i8] c"Enter birth date in format (ddmmYYYY):\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = sdiv i64 %5, 1000000
%7 = trunc i64 %6 to i32
%8 = sdiv i64 %5, 10000
%9 = srem i64 %8, 100
%10 = trunc i64 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %10)
ret i32 0
}