#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 atoi(char *);
int ExtractYear(const char *RawDate) {
  char RawYear[5];
  int Temp;
  RawYear[0] = RawDate[20];
  RawYear[1] = RawDate[21];
  RawYear[2] = RawDate[22];
  RawYear[3] = RawDate[23];
  RawYear[4] = 0;
  Temp = atoi(RawYear);
  return Temp;
}


x86 assembly (clang, -O0):
<ExtractYear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    0x15(%rax),%al
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x16(%rax),%al
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rax
mov    0x17(%rax),%al
mov    %al,-0xa(%rbp)
movb   $0x0,-0x9(%rbp)
lea    -0xd(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExtractYear>:
push   %rax
mov    0x14(%rdi),%al
mov    %al,0x3(%rsp)
mov    0x15(%rdi),%al
mov    %al,0x4(%rsp)
mov    0x16(%rdi),%al
mov    %al,0x5(%rsp)
mov    0x17(%rdi),%al
mov    %al,0x6(%rsp)
movb   $0x0,0x7(%rsp)
lea    0x3(%rsp),%rdi
call   1030 <atoi@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ExtractYear(i8* %0) {
%2 = alloca i8*
%3 = alloca [5 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 20
%7 = load i8, i8* %6
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
store i8 %7, i8* %8
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 21
%11 = load i8, i8* %10
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
store i8 %11, i8* %12
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 22
%15 = load i8, i8* %14
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
store i8 %15, i8* %16
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 23
%19 = load i8, i8* %18
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
store i8 %19, i8* %20
%21 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 0, i8* %21
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %4
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @ExtractYear(i8* nocapture %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8, i8* %0, i64 20
%5 = load i8, i8* %4
store i8 %5, i8* %3
%6 = getelementptr inbounds i8, i8* %0, i64 21
%7 = load i8, i8* %6
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
store i8 %7, i8* %8
%9 = getelementptr inbounds i8, i8* %0, i64 22
%10 = load i8, i8* %9
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
store i8 %10, i8* %11
%12 = getelementptr inbounds i8, i8* %0, i64 23
%13 = load i8, i8* %12
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
store i8 %13, i8* %14
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
store i8 0, i8* %15
%16 = call i32 @atoi(i8* %3)
ret i32 %16
}