#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*/ bcopy(char *, ...);
int int_get_ti_header_c_(char *hdrbuf, int *hdrbufsize, int *n, int *itypesize,
                         int *typesize, int *DataHandle, char *Data, int *Count,
                         int *code) {
  int i;
  char *p;
  p = hdrbuf;
  bcopy(p, hdrbufsize, sizeof(int));
  p += sizeof(int);
  bcopy(p, code, sizeof(int));
  p += sizeof(int);
  bcopy(p, DataHandle, sizeof(int));
  p += sizeof(int);
  bcopy(p, typesize, sizeof(int));
  p += sizeof(int);
  bcopy(p, Count, sizeof(int));
  p += sizeof(int);
  if (*Count * *typesize > 0) {
    bcopy(p, Data, *Count * *typesize);
    p += *Count * *typesize;
  }
  *n = (int)(p - hdrbuf);
  return (0);
}


x86 assembly (clang, -O0):
<int_get_ti_header_c_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <bcopy@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x20(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <bcopy@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <bcopy@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <bcopy@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    0x18(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <bcopy@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
imul   (%rcx),%eax
cmp    $0x0,%eax
jle    1231 <int_get_ti_header_c_+0x121>
mov    -0x40(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x28(%rbp),%rax
imul   (%rax),%edx
mov    $0x0,%al
call   1030 <bcopy@plt>
mov    0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
imul   (%rax),%ecx
mov    -0x40(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_get_ti_header_c_>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%rbx
mov    %r8,%r15
mov    %rdx,%r14
mov    %rdi,%r13
mov    0x48(%rsp),%r12
mov    0x50(%rsp),%rbp
mov    $0x4,%edx
xor    %eax,%eax
call   1030 <bcopy@plt>
lea    0x4(%r13),%rdi
mov    $0x4,%edx
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <bcopy@plt>
lea    0x8(%r13),%rdi
mov    $0x4,%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <bcopy@plt>
lea    0xc(%r13),%rdi
mov    $0x4,%edx
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <bcopy@plt>
lea    0x10(%r13),%rdi
mov    $0x4,%edx
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <bcopy@plt>
lea    0x14(%r13),%rbx
mov    (%r15),%edx
imul   (%r12),%edx
test   %edx,%edx
jle    11b6 <int_get_ti_header_c_+0xa6>
mov    0x40(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <bcopy@plt>
movslq (%r12),%rax
movslq (%r15),%rcx
imul   %rax,%rcx
add    %rcx,%rbx
sub    %r13d,%ebx
mov    %ebx,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @int_get_ti_header_c_(i8* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i8* %6, i32* %7, i32* %8) {
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32
%20 = alloca i8*
store i8* %0, i8** %10
store i32* %1, i32** %11
store i32* %2, i32** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i8* %6, i8** %16
store i32* %7, i32** %17
store i32* %8, i32** %18
%21 = load i8*, i8** %10
store i8* %21, i8** %20
%22 = load i8*, i8** %20
%23 = load i32*, i32** %11
%24 = call i32 (i8*, ...) @bcopy(i8* %22, i32* %23, i64 4)
%25 = load i8*, i8** %20
%26 = getelementptr inbounds i8, i8* %25, i64 4
store i8* %26, i8** %20
%27 = load i8*, i8** %20
%28 = load i32*, i32** %18
%29 = call i32 (i8*, ...) @bcopy(i8* %27, i32* %28, i64 4)
%30 = load i8*, i8** %20
%31 = getelementptr inbounds i8, i8* %30, i64 4
store i8* %31, i8** %20
%32 = load i8*, i8** %20
%33 = load i32*, i32** %15
%34 = call i32 (i8*, ...) @bcopy(i8* %32, i32* %33, i64 4)
%35 = load i8*, i8** %20
%36 = getelementptr inbounds i8, i8* %35, i64 4
store i8* %36, i8** %20
%37 = load i8*, i8** %20
%38 = load i32*, i32** %14
%39 = call i32 (i8*, ...) @bcopy(i8* %37, i32* %38, i64 4)
%40 = load i8*, i8** %20
%41 = getelementptr inbounds i8, i8* %40, i64 4
store i8* %41, i8** %20
%42 = load i8*, i8** %20
%43 = load i32*, i32** %17
%44 = call i32 (i8*, ...) @bcopy(i8* %42, i32* %43, i64 4)
%45 = load i8*, i8** %20
%46 = getelementptr inbounds i8, i8* %45, i64 4
store i8* %46, i8** %20
%47 = load i32*, i32** %17
%48 = load i32, i32* %47
%49 = load i32*, i32** %14
%50 = load i32, i32* %49
%51 = mul nsw i32 %48, %50
%52 = icmp sgt i32 %51, 0
br i1 %52, label %53, label %70
53: ; preds = %9
%54 = load i8*, i8** %20
%55 = load i8*, i8** %16
%56 = load i32*, i32** %17
%57 = load i32, i32* %56
%58 = load i32*, i32** %14
%59 = load i32, i32* %58
%60 = mul nsw i32 %57, %59
%61 = call i32 (i8*, ...) @bcopy(i8* %54, i8* %55, i32 %60)
%62 = load i32*, i32** %17
%63 = load i32, i32* %62
%64 = load i32*, i32** %14
%65 = load i32, i32* %64
%66 = mul nsw i32 %63, %65
%67 = load i8*, i8** %20
%68 = sext i32 %66 to i64
%69 = getelementptr inbounds i8, i8* %67, i64 %68
store i8* %69, i8** %20
br label %70
70: ; preds = %53, %9
%71 = load i8*, i8** %20
%72 = load i8*, i8** %10
%73 = ptrtoint i8* %71 to i64
%74 = ptrtoint i8* %72 to i64
%75 = sub i64 %73, %74
%76 = trunc i64 %75 to i32
%77 = load i32*, i32** %12
store i32 %76, i32* %77
ret i32 0
}

LLVM IR (-O2):
define i32 @int_get_ti_header_c_(i8* %0, i32* %1, i32* nocapture writeonly %2, i32* nocapture readnone %3, i32* %4, i32* %5, i8* %6, i32* %7, i32* %8) {
%10 = tail call i32 (i8*, ...) @bcopy(i8* %0, i32* %1, i64 4)
%11 = getelementptr inbounds i8, i8* %0, i64 4
%12 = tail call i32 (i8*, ...) @bcopy(i8* %11, i32* %8, i64 4)
%13 = getelementptr inbounds i8, i8* %0, i64 8
%14 = tail call i32 (i8*, ...) @bcopy(i8* %13, i32* %5, i64 4)
%15 = getelementptr inbounds i8, i8* %0, i64 12
%16 = tail call i32 (i8*, ...) @bcopy(i8* %15, i32* %4, i64 4)
%17 = getelementptr inbounds i8, i8* %0, i64 16
%18 = tail call i32 (i8*, ...) @bcopy(i8* %17, i32* %7, i64 4)
%19 = getelementptr inbounds i8, i8* %0, i64 20
%20 = load i32, i32* %7
%21 = load i32, i32* %4
%22 = mul nsw i32 %21, %20
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %9
%25 = tail call i32 (i8*, ...) @bcopy(i8* %19, i8* %6, i32 %22)
%26 = load i32, i32* %7
%27 = load i32, i32* %4
%28 = mul nsw i32 %27, %26
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %19, i64 %29
br label %31
31: ; preds = %24, %9
%32 = phi i8* [ %30, %24 ], [ %19, %9 ]
%33 = ptrtoint i8* %32 to i64
%34 = ptrtoint i8* %0 to i64
%35 = sub i64 %33, %34
%36 = trunc i64 %35 to i32
store i32 %36, i32* %2
ret i32 0
}