#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*/ strncpy(char *, char *, int);
int splitResponseHeader(char *responseHeaderField, int *contentLength,
                        char *contentType) {
  int i = 0;
  int multiplicator = 1;
  for (i = 0; i < 15; i++)
    multiplicator *= 10;
  *contentLength = 0;
  for (i = 16; i < 16 + 15; i++) {
    *contentLength += multiplicator * (responseHeaderField[i] - '0');
    multiplicator /= 10;
  }
  strncpy(contentType, &responseHeaderField[46], 16);
  return 0;
}


x86 assembly (clang, -O0):
<splitResponseHeader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xf,-0x1c(%rbp)
jge    1158 <splitResponseHeader+0x48>
imul   $0xa,-0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <splitResponseHeader+0x29>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x10,-0x1c(%rbp)
cmpl   $0x1f,-0x1c(%rbp)
jge    11ac <splitResponseHeader+0x9c>
mov    -0x20(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
sub    $0x30,%eax
imul   %eax,%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <splitResponseHeader+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x2e,%rsi
mov    $0x10,%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitResponseHeader>:
push   %rax
mov    %rdx,%r8
mov    %rdi,%r9
movl   $0x0,(%rsi)
mov    $0xa4c68000,%edi
xor    %r10d,%r10d
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movsbl 0x10(%r9,%r10,1),%eax
add    $0xffffffd0,%eax
imul   %edi,%eax
add    %edx,%eax
mov    %eax,(%rsi)
cmp    $0xe,%r10
je     1187 <splitResponseHeader+0x77>
movslq %edi,%rdi
imul   $0x66666667,%rdi,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
movsbl 0x11(%r9,%r10,1),%edx
add    $0xffffffd0,%edx
imul   %ecx,%edx
add    %eax,%edx
mov    %edx,(%rsi)
imul   $0x51eb851f,%rdi,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x25,%rdi
add    %eax,%edi
add    $0x2,%r10
jmp    1130 <splitResponseHeader+0x20>
add    $0x2e,%r9
mov    %r8,%rdi
mov    %r9,%rsi
mov    $0x10,%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @splitResponseHeader(i8* %0, i32* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %7
br label %9
9: ; preds = %15, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 15
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %8
%14 = mul nsw i32 %13, 10
store i32 %14, i32* %8
br label %15
15: ; preds = %12
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %9
18: ; preds = %9
%19 = load i32*, i32** %5
store i32 0, i32* %19
store i32 16, i32* %7
br label %20
20: ; preds = %38, %18
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 31
br i1 %22, label %23, label %41
23: ; preds = %20
%24 = load i32, i32* %8
%25 = load i8*, i8** %4
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 48
%32 = mul nsw i32 %24, %31
%33 = load i32*, i32** %5
%34 = load i32, i32* %33
%35 = add nsw i32 %34, %32
store i32 %35, i32* %33
%36 = load i32, i32* %8
%37 = sdiv i32 %36, 10
store i32 %37, i32* %8
br label %38
38: ; preds = %23
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %20
41: ; preds = %20
%42 = load i8*, i8** %6
%43 = load i8*, i8** %4
%44 = getelementptr inbounds i8, i8* %43, i64 46
%45 = call i32 @strncpy(i8* %42, i8* %44, i32 16)
ret i32 0
}

LLVM IR (-O2):
define i32 @splitResponseHeader(i8* %0, i32* nocapture %1, i8* %2) {
store i32 0, i32* %1
br label %4
4: ; preds = %16, %3
%5 = phi i32 [ 0, %3 ], [ %23, %16 ]
%6 = phi i64 [ 16, %3 ], [ %25, %16 ]
%7 = phi i32 [ -1530494976, %3 ], [ %24, %16 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, -48
%12 = mul nsw i32 %11, %7
%13 = add nsw i32 %12, %5
store i32 %13, i32* %1
%14 = or i64 %6, 1
%15 = icmp eq i64 %14, 31
br i1 %15, label %26, label %16
16: ; preds = %4
%17 = sdiv i32 %7, 10
%18 = getelementptr inbounds i8, i8* %0, i64 %14
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = add nsw i32 %20, -48
%22 = mul nsw i32 %21, %17
%23 = add nsw i32 %22, %13
store i32 %23, i32* %1
%24 = sdiv i32 %7, 100
%25 = add nuw nsw i64 %6, 2
br label %4
26: ; preds = %4
%27 = getelementptr inbounds i8, i8* %0, i64 46
%28 = tail call i32 @strncpy(i8* %2, i8* %27, i32 16)
ret i32 0
}