#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef char uint16_t;
typedef int /*<<< orphan*/ tcphdr;
typedef int /*<<< orphan*/ svalue;
struct tcphdr {
  char th_sport;
  char th_dport;
  char th_seq;
  char th_ack;
  int th_off;
  int th_x2;
  char th_flags;
  char th_win;
  char th_urp;
};
struct TYPE_4__ {
  char s_addr;
};
struct TYPE_3__ {
  char s_addr;
};
struct ip {
  char ip_p;
  TYPE_2__ ip_dst;
  TYPE_1__ ip_src;
};
typedef int /*<<< orphan*/ cvalue;

/* Variables and functions */
int IP_MAXPACKET;
char checksum(char *, int);
char htons(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
uint16_t tcp4_checksum(struct ip iphdr, struct tcphdr tcphdr) {
  uint16_t svalue;
  char buf[IP_MAXPACKET], cvalue;
  char *ptr;
  int chksumlen = 0;
  ptr = &buf[0];
  memcpy(ptr, &iphdr.ip_src.s_addr, sizeof(iphdr.ip_src.s_addr));
  ptr += sizeof(iphdr.ip_src.s_addr);
  chksumlen += sizeof(iphdr.ip_src.s_addr);
  memcpy(ptr, &iphdr.ip_dst.s_addr, sizeof(iphdr.ip_dst.s_addr));
  ptr += sizeof(iphdr.ip_dst.s_addr);
  chksumlen += sizeof(iphdr.ip_dst.s_addr);
  *ptr = 0;
  ptr++;
  chksumlen += 1;
  memcpy(ptr, &iphdr.ip_p, sizeof(iphdr.ip_p));
  ptr += sizeof(iphdr.ip_p);
  chksumlen += sizeof(iphdr.ip_p);
  svalue = htons(sizeof(tcphdr));
  memcpy(ptr, &svalue, sizeof(svalue));
  ptr += sizeof(svalue);
  chksumlen += sizeof(svalue);
  memcpy(ptr, &tcphdr.th_sport, sizeof(tcphdr.th_sport));
  ptr += sizeof(tcphdr.th_sport);
  chksumlen += sizeof(tcphdr.th_sport);
  memcpy(ptr, &tcphdr.th_dport, sizeof(tcphdr.th_dport));
  ptr += sizeof(tcphdr.th_dport);
  chksumlen += sizeof(tcphdr.th_dport);
  memcpy(ptr, &tcphdr.th_seq, sizeof(tcphdr.th_seq));
  ptr += sizeof(tcphdr.th_seq);
  chksumlen += sizeof(tcphdr.th_seq);
  memcpy(ptr, &tcphdr.th_ack, sizeof(tcphdr.th_ack));
  ptr += sizeof(tcphdr.th_ack);
  chksumlen += sizeof(tcphdr.th_ack);
  cvalue = (tcphdr.th_off << 4) + tcphdr.th_x2;
  memcpy(ptr, &cvalue, sizeof(cvalue));
  ptr += sizeof(cvalue);
  chksumlen += sizeof(cvalue);
  memcpy(ptr, &tcphdr.th_flags, sizeof(tcphdr.th_flags));
  ptr += sizeof(tcphdr.th_flags);
  chksumlen += sizeof(tcphdr.th_flags);
  memcpy(ptr, &tcphdr.th_win, sizeof(tcphdr.th_win));
  ptr += sizeof(tcphdr.th_win);
  chksumlen += sizeof(tcphdr.th_win);
  *ptr = 0;
  ptr++;
  *ptr = 0;
  ptr++;
  chksumlen += 2;
  memcpy(ptr, &tcphdr.th_urp, sizeof(tcphdr.th_urp));
  ptr += sizeof(tcphdr.th_urp);
  chksumlen += sizeof(tcphdr.th_urp);
  return checksum((uint16_t *)buf, chksumlen);
}


x86 assembly (clang, -O0):
<tcp4_checksum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %di,%ax
mov    %ax,-0xc(%rbp)
shr    $0x10,%edi
mov    %dil,%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x6(%rbp)
mov    -0xc(%rbp),%ax
mov    %ax,-0x8(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x30(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x58(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x38(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x8(%rbp),%rsi
add    $0x2,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    $0x10,%edi
call   1030 <htons@plt>
mov    %al,-0x21(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x21(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0x2,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0x3,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x4,%eax
add    -0x18(%rbp),%eax
mov    %al,-0x39(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x39(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0xc,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0xd,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0xe,%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movslq -0x4c(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
call   1040 <checksum@plt>
mov    -0x30(%rbp),%rcx
mov    %rcx,%rsp
movsbl %al,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp4_checksum>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r15
mov    %di,-0x30(%rbp)
shr    $0x10,%edi
mov    %dil,-0x2e(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdx,-0x38(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%r12d
mov    %rsp,%r13
add    $0xf,%r12
and    $0xfffffffffffffff0,%r12
mov    %r13,%rbx
sub    %r12,%rbx
mov    %rbx,%rsp
lea    -0x2e(%rbp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x1(%rbx),%rdi
lea    -0x2f(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
movb   $0x0,0x2(%rbx)
lea    0x3(%rbx),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x4(%rbx),%r14
mov    $0x10,%edi
call   1030 <htons@plt>
mov    %al,-0x2a(%rbp)
lea    -0x2a(%rbp),%rsi
mov    %r14,%rdi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x5(%rbx),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x6(%rbx),%rdi
lea    -0x3f(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x7(%rbx),%rdi
lea    -0x3e(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x8(%rbx),%rdi
lea    -0x3d(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0x9(%rbx),%rdi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
add    -0x38(%rbp),%eax
mov    %al,-0x29(%rbp)
lea    -0x29(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0xa(%rbx),%rdi
lea    -0x34(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
lea    0xb(%rbx),%rdi
lea    -0x33(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
neg    %r12
movw   $0x0,0xc(%r13,%r12,1)
lea    0xe(%rbx),%rdi
lea    -0x32(%rbp),%rsi
mov    $0x1,%edx
call   1050 <memcpy@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1040 <checksum@plt>
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ip = type { i8, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i8 }
%struct.TYPE_3__ = type { i8 }
%struct.tcphdr = type { i8, i8, i8, i8, i32, i32, i8, i8, i8 }
@IP_MAXPACKET = global i32 0
define signext i8 @tcp4_checksum(i24 %0, i64 %1, i64 %2) {
%4 = alloca %struct.ip
%5 = alloca i24
%6 = alloca %struct.tcphdr
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i32
store i24 %0, i24* %5
%13 = bitcast %struct.ip* %4 to i8*
%14 = bitcast i24* %5 to i8*
%15 = bitcast %struct.tcphdr* %6 to { i64, i64 }*
%16 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %15, i32 0, i32 0
store i64 %1, i64* %16
%17 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %15, i32 0, i32 1
store i64 %2, i64* %17
%18 = load i32, i32* @IP_MAXPACKET
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %8
%21 = alloca i8, i64 %19
store i64 %19, i64* %9
store i32 0, i32* %12
%22 = getelementptr inbounds i8, i8* %21, i64 0
store i8* %22, i8** %11
%23 = load i8*, i8** %11
%24 = getelementptr inbounds %struct.ip, %struct.ip* %4, i32 0, i32 2
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %24, i32 0, i32 0
%26 = call i32 @memcpy(i8* %23, i8* %25, i32 1)
%27 = load i8*, i8** %11
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8* %28, i8** %11
%29 = load i32, i32* %12
%30 = sext i32 %29 to i64
%31 = add i64 %30, 1
%32 = trunc i64 %31 to i32
store i32 %32, i32* %12
%33 = load i8*, i8** %11
%34 = getelementptr inbounds %struct.ip, %struct.ip* %4, i32 0, i32 1
%35 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %34, i32 0, i32 0
%36 = call i32 @memcpy(i8* %33, i8* %35, i32 1)
%37 = load i8*, i8** %11
%38 = getelementptr inbounds i8, i8* %37, i64 1
store i8* %38, i8** %11
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = add i64 %40, 1
%42 = trunc i64 %41 to i32
store i32 %42, i32* %12
%43 = load i8*, i8** %11
store i8 0, i8* %43
%44 = load i8*, i8** %11
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %11
%46 = load i32, i32* %12
%47 = add nsw i32 %46, 1
store i32 %47, i32* %12
%48 = load i8*, i8** %11
%49 = getelementptr inbounds %struct.ip, %struct.ip* %4, i32 0, i32 0
%50 = call i32 @memcpy(i8* %48, i8* %49, i32 1)
%51 = load i8*, i8** %11
%52 = getelementptr inbounds i8, i8* %51, i64 1
store i8* %52, i8** %11
%53 = load i32, i32* %12
%54 = sext i32 %53 to i64
%55 = add i64 %54, 1
%56 = trunc i64 %55 to i32
store i32 %56, i32* %12
%57 = call signext i8 @htons(i32 16)
store i8 %57, i8* %7
%58 = load i8*, i8** %11
%59 = call i32 @memcpy(i8* %58, i8* %7, i32 1)
%60 = load i8*, i8** %11
%61 = getelementptr inbounds i8, i8* %60, i64 1
store i8* %61, i8** %11
%62 = load i32, i32* %12
%63 = sext i32 %62 to i64
%64 = add i64 %63, 1
%65 = trunc i64 %64 to i32
store i32 %65, i32* %12
%66 = load i8*, i8** %11
%67 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 0
%68 = call i32 @memcpy(i8* %66, i8* %67, i32 1)
%69 = load i8*, i8** %11
%70 = getelementptr inbounds i8, i8* %69, i64 1
store i8* %70, i8** %11
%71 = load i32, i32* %12
%72 = sext i32 %71 to i64
%73 = add i64 %72, 1
%74 = trunc i64 %73 to i32
store i32 %74, i32* %12
%75 = load i8*, i8** %11
%76 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 1
%77 = call i32 @memcpy(i8* %75, i8* %76, i32 1)
%78 = load i8*, i8** %11
%79 = getelementptr inbounds i8, i8* %78, i64 1
store i8* %79, i8** %11
%80 = load i32, i32* %12
%81 = sext i32 %80 to i64
%82 = add i64 %81, 1
%83 = trunc i64 %82 to i32
store i32 %83, i32* %12
%84 = load i8*, i8** %11
%85 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 2
%86 = call i32 @memcpy(i8* %84, i8* %85, i32 1)
%87 = load i8*, i8** %11
%88 = getelementptr inbounds i8, i8* %87, i64 1
store i8* %88, i8** %11
%89 = load i32, i32* %12
%90 = sext i32 %89 to i64
%91 = add i64 %90, 1
%92 = trunc i64 %91 to i32
store i32 %92, i32* %12
%93 = load i8*, i8** %11
%94 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 3
%95 = call i32 @memcpy(i8* %93, i8* %94, i32 1)
%96 = load i8*, i8** %11
%97 = getelementptr inbounds i8, i8* %96, i64 1
store i8* %97, i8** %11
%98 = load i32, i32* %12
%99 = sext i32 %98 to i64
%100 = add i64 %99, 1
%101 = trunc i64 %100 to i32
store i32 %101, i32* %12
%102 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 4
%103 = load i32, i32* %102
%104 = shl i32 %103, 4
%105 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 5
%106 = load i32, i32* %105
%107 = add nsw i32 %104, %106
%108 = trunc i32 %107 to i8
store i8 %108, i8* %10
%109 = load i8*, i8** %11
%110 = call i32 @memcpy(i8* %109, i8* %10, i32 1)
%111 = load i8*, i8** %11
%112 = getelementptr inbounds i8, i8* %111, i64 1
store i8* %112, i8** %11
%113 = load i32, i32* %12
%114 = sext i32 %113 to i64
%115 = add i64 %114, 1
%116 = trunc i64 %115 to i32
store i32 %116, i32* %12
%117 = load i8*, i8** %11
%118 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 6
%119 = call i32 @memcpy(i8* %117, i8* %118, i32 1)
%120 = load i8*, i8** %11
%121 = getelementptr inbounds i8, i8* %120, i64 1
store i8* %121, i8** %11
%122 = load i32, i32* %12
%123 = sext i32 %122 to i64
%124 = add i64 %123, 1
%125 = trunc i64 %124 to i32
store i32 %125, i32* %12
%126 = load i8*, i8** %11
%127 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 7
%128 = call i32 @memcpy(i8* %126, i8* %127, i32 1)
%129 = load i8*, i8** %11
%130 = getelementptr inbounds i8, i8* %129, i64 1
store i8* %130, i8** %11
%131 = load i32, i32* %12
%132 = sext i32 %131 to i64
%133 = add i64 %132, 1
%134 = trunc i64 %133 to i32
store i32 %134, i32* %12
%135 = load i8*, i8** %11
store i8 0, i8* %135
%136 = load i8*, i8** %11
%137 = getelementptr inbounds i8, i8* %136, i32 1
store i8* %137, i8** %11
%138 = load i8*, i8** %11
store i8 0, i8* %138
%139 = load i8*, i8** %11
%140 = getelementptr inbounds i8, i8* %139, i32 1
store i8* %140, i8** %11
%141 = load i32, i32* %12
%142 = add nsw i32 %141, 2
store i32 %142, i32* %12
%143 = load i8*, i8** %11
%144 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i32 0, i32 8
%145 = call i32 @memcpy(i8* %143, i8* %144, i32 1)
%146 = load i8*, i8** %11
%147 = getelementptr inbounds i8, i8* %146, i64 1
store i8* %147, i8** %11
%148 = load i32, i32* %12
%149 = sext i32 %148 to i64
%150 = add i64 %149, 1
%151 = trunc i64 %150 to i32
store i32 %151, i32* %12
%152 = load i32, i32* %12
%153 = call signext i8 @checksum(i8* %21, i32 %152)
%154 = load i8*, i8** %8
ret i8 %153
}

LLVM IR (-O2):
%struct.ip = type { i8, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i8 }
%struct.TYPE_3__ = type { i8 }
%struct.tcphdr = type { i8, i8, i8, i8, i32, i32, i8, i8, i8 }
@IP_MAXPACKET = global i32 0
define signext i8 @tcp4_checksum(i24 %0, i64 %1, i64 %2) {
%4 = alloca %struct.ip
%5 = alloca { i64, i64 }
%6 = bitcast { i64, i64 }* %5 to %struct.tcphdr*
%7 = alloca i8
%8 = alloca i8
%9 = bitcast %struct.ip* %4 to i24*
store i24 %0, i24* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %5, i64 0, i32 0
store i64 %1, i64* %10
%11 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %5, i64 0, i32 1
store i64 %2, i64* %11
%12 = load i32, i32* @IP_MAXPACKET
%13 = zext i32 %12 to i64
%14 = tail call i8* @llvm.stacksave()
%15 = alloca i8, i64 %13
%16 = getelementptr inbounds %struct.ip, %struct.ip* %4, i64 0, i32 2, i32 0
%17 = call i32 @memcpy(i8* %15, i8* %16, i32 1)
%18 = getelementptr inbounds i8, i8* %15, i64 1
%19 = getelementptr inbounds %struct.ip, %struct.ip* %4, i64 0, i32 1, i32 0
%20 = call i32 @memcpy(i8* %18, i8* %19, i32 1)
%21 = getelementptr inbounds i8, i8* %15, i64 2
store i8 0, i8* %21
%22 = getelementptr inbounds i8, i8* %15, i64 3
%23 = getelementptr inbounds %struct.ip, %struct.ip* %4, i64 0, i32 0
%24 = call i32 @memcpy(i8* %22, i8* %23, i32 1)
%25 = getelementptr inbounds i8, i8* %15, i64 4
%26 = call signext i8 @htons(i32 16)
store i8 %26, i8* %7
%27 = call i32 @memcpy(i8* %25, i8* %7, i32 1)
%28 = getelementptr inbounds i8, i8* %15, i64 5
%29 = bitcast { i64, i64 }* %5 to i8*
%30 = call i32 @memcpy(i8* %28, i8* %29, i32 1)
%31 = getelementptr inbounds i8, i8* %15, i64 6
%32 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 1
%33 = call i32 @memcpy(i8* %31, i8* %32, i32 1)
%34 = getelementptr inbounds i8, i8* %15, i64 7
%35 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 2
%36 = call i32 @memcpy(i8* %34, i8* %35, i32 1)
%37 = getelementptr inbounds i8, i8* %15, i64 8
%38 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 3
%39 = call i32 @memcpy(i8* %37, i8* %38, i32 1)
%40 = getelementptr inbounds i8, i8* %15, i64 9
%41 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 4
%42 = load i32, i32* %41
%43 = shl i32 %42, 4
%44 = bitcast i64* %11 to i32*
%45 = load i32, i32* %44
%46 = add nsw i32 %43, %45
%47 = trunc i32 %46 to i8
store i8 %47, i8* %8
%48 = call i32 @memcpy(i8* %40, i8* %8, i32 1)
%49 = getelementptr inbounds i8, i8* %15, i64 10
%50 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 6
%51 = call i32 @memcpy(i8* %49, i8* %50, i32 1)
%52 = getelementptr inbounds i8, i8* %15, i64 11
%53 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 7
%54 = call i32 @memcpy(i8* %52, i8* %53, i32 1)
%55 = getelementptr inbounds i8, i8* %15, i64 12
store i8 0, i8* %55
%56 = getelementptr inbounds i8, i8* %15, i64 13
store i8 0, i8* %56
%57 = getelementptr inbounds i8, i8* %15, i64 14
%58 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %6, i64 0, i32 8
%59 = call i32 @memcpy(i8* %57, i8* %58, i32 1)
%60 = call signext i8 @checksum(i8* %15, i32 15)
ret i8 %60
}