#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*/ adjust_pdb_field_string(char *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
void get_pdb_header(const char *record, char *pdbcode, char *date,
                    char *classification) {
  if (date != NULL) {
    strncpy(date, record + 50, 9);
    date[9] = '\0';
  }
  if (classification != NULL) {
    strncpy(classification, record + 10, 40);
    classification[40] = '\0';
  }
  if (pdbcode != NULL) {
    strncpy(pdbcode, record + 62, 4);
    pdbcode[4] = '\0';
    adjust_pdb_field_string(pdbcode);
  }
}


x86 assembly (clang, -O0):
<get_pdb_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <get_pdb_header+0x41>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x32,%rsi
mov    $0x9,%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,0x9(%rax)
cmpq   $0x0,-0x20(%rbp)
je     118a <get_pdb_header+0x6a>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0xa,%rsi
mov    $0x28,%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,0x28(%rax)
cmpq   $0x0,-0x10(%rbp)
je     11bc <get_pdb_header+0x9c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x3e,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <adjust_pdb_field_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pdb_header>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
test   %rdx,%rdx
je     114f <get_pdb_header+0x2f>
mov    %rdx,%rbx
lea    0x32(%r12),%rsi
mov    %rdx,%rdi
mov    $0x9,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x9(%rbx)
test   %r15,%r15
je     116b <get_pdb_header+0x4b>
lea    0xa(%r12),%rsi
mov    %r15,%rdi
mov    $0x28,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x28(%r15)
test   %r14,%r14
je     119c <get_pdb_header+0x7c>
add    $0x3e,%r12
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x4(%r14)
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <adjust_pdb_field_string@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @get_pdb_header(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %7
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %18
11: ; preds = %4
%12 = load i8*, i8** %7
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 50
%15 = call i32 @strncpy(i8* %12, i8* %14, i32 9)
%16 = load i8*, i8** %7
%17 = getelementptr inbounds i8, i8* %16, i64 9
store i8 0, i8* %17
br label %18
18: ; preds = %11, %4
%19 = load i8*, i8** %8
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i8*, i8** %8
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 10
%25 = call i32 @strncpy(i8* %22, i8* %24, i32 40)
%26 = load i8*, i8** %8
%27 = getelementptr inbounds i8, i8* %26, i64 40
store i8 0, i8* %27
br label %28
28: ; preds = %21, %18
%29 = load i8*, i8** %6
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %40
31: ; preds = %28
%32 = load i8*, i8** %6
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 62
%35 = call i32 @strncpy(i8* %32, i8* %34, i32 4)
%36 = load i8*, i8** %6
%37 = getelementptr inbounds i8, i8* %36, i64 4
store i8 0, i8* %37
%38 = load i8*, i8** %6
%39 = call i32 @adjust_pdb_field_string(i8* %38)
br label %40
40: ; preds = %31, %28
ret void
}

LLVM IR (-O2):
define void @get_pdb_header(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %2, null
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = getelementptr inbounds i8, i8* %0, i64 50
%8 = tail call i32 @strncpy(i8* %2, i8* %7, i32 9)
%9 = getelementptr inbounds i8, i8* %2, i64 9
store i8 0, i8* %9
br label %10
10: ; preds = %6, %4
%11 = icmp eq i8* %3, null
br i1 %11, label %16, label %12
12: ; preds = %10
%13 = getelementptr inbounds i8, i8* %0, i64 10
%14 = tail call i32 @strncpy(i8* %3, i8* %13, i32 40)
%15 = getelementptr inbounds i8, i8* %3, i64 40
store i8 0, i8* %15
br label %16
16: ; preds = %12, %10
%17 = icmp eq i8* %1, null
br i1 %17, label %23, label %18
18: ; preds = %16
%19 = getelementptr inbounds i8, i8* %0, i64 62
%20 = tail call i32 @strncpy(i8* %1, i8* %19, i32 4)
%21 = getelementptr inbounds i8, i8* %1, i64 4
store i8 0, i8* %21
%22 = tail call i32 @adjust_pdb_field_string(i8* %1)
br label %23
23: ; preds = %18, %16
ret void
}