void splitHeader(cPHeader, cPFront, cPName, cPTail) char *cPHeader;
char *cPFront;
char *cPName;
char *cPTail;
{
  int iFirst, iSecond;
  iFirst = strlen("!entry.") - 1;
  for (iSecond = iFirst + 1; iSecond < strlen(cPHeader); iSecond++) {
    if (cPHeader[iSecond] == '.')
      break;
  }
  if (iSecond == strlen(cPHeader)) {
    printf("Illegal header: %s\n", cPHeader);
    exit(1);
  }
  strncpy(cPFront, cPHeader, iFirst + 1);
  strncpy(cPName, &(cPHeader[iFirst + 1]), iSecond - iFirst - 1);
  strcpy(cPTail, &(cPHeader[iSecond]));
}


x86 assembly (clang, -O0):
<splitHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x6,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movslq -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jae    11c6 <splitHeader+0x76>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    11b3 <splitHeader+0x63>
jmp    11c6 <splitHeader+0x76>
jmp    11b8 <splitHeader+0x68>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1178 <splitHeader+0x28>
movslq -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jne    1203 <splitHeader+0xb3>
mov    -0x8(%rbp),%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
add    %rax,%rsi
mov    -0x28(%rbp),%eax
sub    -0x24(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x28(%rbp),%rax
add    %rax,%rsi
call   1040 <strcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitHeader>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
call   1050 <strlen@plt>
mov    $0x7,%ecx
cmp    $0x8,%rax
jb     1192 <splitHeader+0x42>
mov    $0x7,%ecx
nopw   0x0(%rax,%rax,1)
cmpb   $0x2e,(%rbx,%rcx,1)
je     1192 <splitHeader+0x42>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1180 <splitHeader+0x30>
mov    %rax,%rcx
mov    %ecx,%r13d
cmp    %r13,%rax
je     11d4 <splitHeader+0x84>
mov    $0x7,%edx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strncpy@plt>
lea    0x7(%rbx),%rsi
lea    -0x7(%r13),%eax
movslq %eax,%rdx
mov    %r15,%rdi
call   1030 <strncpy@plt>
add    %r13,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <strcpy@plt>
lea    0xe25(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Illegal header: %s\0A\00"
define void @splitHeader(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i32 6, i32* %9
%11 = load i32, i32* %9
%12 = add nsw i32 %11, 1
store i32 %12, i32* %10
br label %13
13: ; preds = %29, %4
%14 = load i32, i32* %10
%15 = sext i32 %14 to i64
%16 = load i8*, i8** %5
%17 = call i64 @strlen(i8* %16)
%18 = icmp ult i64 %15, %17
br i1 %18, label %19, label %32
19: ; preds = %13
%20 = load i8*, i8** %5
%21 = load i32, i32* %10
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 46
br i1 %26, label %27, label %28
27: ; preds = %19
br label %32
28: ; preds = %19
br label %29
29: ; preds = %28
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
br label %13
32: ; preds = %27, %13
%33 = load i32, i32* %10
%34 = sext i32 %33 to i64
%35 = load i8*, i8** %5
%36 = call i64 @strlen(i8* %35)
%37 = icmp eq i64 %34, %36
br i1 %37, label %38, label %41
38: ; preds = %32
%39 = load i8*, i8** %5
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %39)
unreachable
41: ; preds = %32
%42 = load i8*, i8** %6
%43 = load i8*, i8** %5
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = call i8* @strncpy(i8* %42, i8* %43, i64 %46)
%48 = load i8*, i8** %7
%49 = load i8*, i8** %5
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %49, i64 %52
%54 = load i32, i32* %10
%55 = load i32, i32* %9
%56 = sub nsw i32 %54, %55
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = call i8* @strncpy(i8* %48, i8* %53, i64 %58)
%60 = load i8*, i8** %8
%61 = load i8*, i8** %5
%62 = load i32, i32* %10
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %61, i64 %63
%65 = call i8* @strcpy(i8* %60, i8* %64)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Illegal header: %s\0A\00"
define void @splitHeader(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = icmp ugt i64 %5, 7
br i1 %6, label %7, label %18
7: ; preds = %4, %12
%8 = phi i64 [ %13, %12 ], [ 7, %4 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 46
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw i64 %8, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %7
15: ; preds = %7, %12
%16 = phi i64 [ %5, %12 ], [ %8, %7 ]
%17 = trunc i64 %16 to i32
br label %18
18: ; preds = %15, %4
%19 = phi i32 [ 7, %4 ], [ %17, %15 ]
%20 = zext i32 %19 to i64
%21 = icmp eq i64 %5, %20
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
tail call void @exit(i32 1)
unreachable
24: ; preds = %18
%25 = tail call i8* @strncpy(i8* dereferenceable(1) %1, i8* dereferenceable(1) %0, i64 7)
%26 = getelementptr inbounds i8, i8* %0, i64 7
%27 = add nsw i32 %19, -7
%28 = sext i32 %27 to i64
%29 = tail call i8* @strncpy(i8* dereferenceable(1) %2, i8* %26, i64 %28)
%30 = getelementptr inbounds i8, i8* %0, i64 %20
%31 = tail call i8* @strcpy(i8* dereferenceable(1) %3, i8* %30)
ret void
}