#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 */
typedef int uint8_t;
typedef int uint64_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, void *, int);
int rand();
int /*<<< orphan*/ websocket_xmask(int *, int, int);
uint64_t websocket_client_wrap(void *target, void *msg, uint64_t len,
                               unsigned char opcode, unsigned char first,
                               unsigned char last, unsigned char rsv) {
  uint32_t mask = rand() | 0x01020408;
  ((uint8_t *)target)[0] =
      0 | (((first ? opcode : 0) & 15)) | ((rsv & 7) << 4) | ((last & 1) << 7);
  if (len < 126) {
    ((uint8_t *)target)[1] = len | 128;
    ((uint8_t *)target)[2] = ((uint8_t *)(&mask))[0];
    ((uint8_t *)target)[3] = ((uint8_t *)(&mask))[1];
    ((uint8_t *)target)[4] = ((uint8_t *)(&mask))[2];
    ((uint8_t *)target)[5] = ((uint8_t *)(&mask))[3];
    memcpy(((uint8_t *)target) + 6, msg, len);
    websocket_xmask((uint8_t *)target + 6, len, mask);
    return len + 6;
  } else if (len < (1UL << 16)) {
    ((uint8_t *)target)[1] = 126 | 128;
    do {
      ((uint8_t *)(((uint8_t *)target + 2)))[0] = ((uint16_t)(len) >> 8) & 0xFF;
      ((uint8_t *)(((uint8_t *)target + 2)))[1] = ((uint16_t)(len)) & 0xFF;
    } while (0);
    ;
    ((uint8_t *)target)[4] = ((uint8_t *)(&mask))[0];
    ((uint8_t *)target)[5] = ((uint8_t *)(&mask))[1];
    ((uint8_t *)target)[6] = ((uint8_t *)(&mask))[2];
    ((uint8_t *)target)[7] = ((uint8_t *)(&mask))[3];
    memcpy((uint8_t *)target + 8, msg, len);
    websocket_xmask((uint8_t *)target + 8, len, mask);
    return len + 8;
  }
  ((uint8_t *)target)[1] = 255;
  do {
    ((uint8_t *)(((uint8_t *)target + 2)))[0] = ((uint64_t)(len) >> 56) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[1] = ((uint64_t)(len) >> 48) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[2] = ((uint64_t)(len) >> 40) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[3] = ((uint64_t)(len) >> 32) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[4] = ((uint64_t)(len) >> 24) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[5] = ((uint64_t)(len) >> 16) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[6] = ((uint64_t)(len) >> 8) & 0xFF;
    ((uint8_t *)(((uint8_t *)target + 2)))[7] = ((uint64_t)(len)) & 0xFF;
  } while (0);
  ;
  ((uint8_t *)target)[10] = ((uint8_t *)(&mask))[0];
  ((uint8_t *)target)[11] = ((uint8_t *)(&mask))[1];
  ((uint8_t *)target)[12] = ((uint8_t *)(&mask))[2];
  ((uint8_t *)target)[13] = ((uint8_t *)(&mask))[3];
  memcpy((uint8_t *)target + 14, msg, len);
  websocket_xmask((uint8_t *)target + 14, len, mask);
  return len + 14;
}


x86 assembly (clang, -O0):
<websocket_client_wrap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %r8d,-0x3c(%rbp)
mov    %ecx,%eax
mov    -0x3c(%rbp),%ecx
mov    %eax,-0x38(%rbp)
mov    %edx,%eax
mov    -0x38(%rbp),%edx
mov    %eax,-0x34(%rbp)
mov    %rsi,%rax
mov    -0x34(%rbp),%esi
mov    %rax,-0x30(%rbp)
mov    %rdi,%r8
mov    -0x30(%rbp),%rdi
mov    %r9b,%al
mov    0x10(%rbp),%r9b
mov    %r8,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %dl,-0x1d(%rbp)
mov    %cl,-0x1e(%rbp)
mov    %al,-0x1f(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
or     $0x1020408,%eax
mov    %eax,-0x24(%rbp)
movzbl -0x1e(%rbp),%eax
cmp    $0x0,%eax
je     11a0 <websocket_client_wrap+0x70>
movzbl -0x1d(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    11aa <websocket_client_wrap+0x7a>
xor    %eax,%eax
mov    %eax,-0x40(%rbp)
jmp    11aa <websocket_client_wrap+0x7a>
mov    -0x40(%rbp),%ecx
and    $0xf,%ecx
or     $0x0,%ecx
movzbl 0x10(%rbp),%eax
and    $0x7,%eax
shl    $0x4,%eax
or     %eax,%ecx
movzbl -0x1f(%rbp),%eax
and    $0x1,%eax
shl    $0x7,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x7e,-0x1c(%rbp)
jge    1248 <websocket_client_wrap+0x118>
mov    -0x1c(%rbp),%ecx
or     $0x80,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x10(%rbp),%rdi
add    $0x18,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rdi
add    $0x18,%rdi
mov    -0x1c(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <websocket_xmask@plt>
mov    -0x1c(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x4(%rbp)
jmp    13f8 <websocket_client_wrap+0x2c8>
movslq -0x1c(%rbp),%rax
cmp    $0x10000,%rax
jae    12e3 <websocket_client_wrap+0x1b3>
mov    -0x10(%rbp),%rax
movl   $0xfe,0x4(%rax)
mov    -0x1c(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x1c(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
mov    -0x1c(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <websocket_xmask@plt>
mov    -0x1c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    13f8 <websocket_client_wrap+0x2c8>
jmp    12e8 <websocket_client_wrap+0x1b8>
mov    -0x10(%rbp),%rax
movl   $0xff,0x4(%rax)
mov    -0x1c(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
mov    %eax,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x1c(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
mov    %eax,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x1c(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
mov    %eax,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x1c(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x1c(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x1c(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    -0x1c(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x20(%rax)
mov    -0x1c(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x24(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x28(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x2c(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x30(%rax)
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x34(%rax)
mov    -0x10(%rbp),%rdi
add    $0x38,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rdi
add    $0x38,%rdi
mov    -0x1c(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1040 <websocket_xmask@plt>
mov    -0x1c(%rbp),%eax
add    $0xe,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<websocket_client_wrap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%ebp
mov    %r8d,%r13d
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %rsi,(%rsp)
mov    %rdi,%r12
mov    0x40(%rsp),%r14b
xor    %eax,%eax
call   1050 <rand@plt>
or     $0x1020408,%eax
and    $0xf,%bl
test   %r13d,%r13d
movzbl %bl,%ecx
cmove  %r13d,%ecx
shl    $0x4,%r14b
and    $0x70,%r14b
shl    $0x7,%bpl
or     %cl,%bpl
or     %r14b,%bpl
movzbl %bpl,%ecx
mov    %ecx,(%r12)
mov    %r15d,%ebx
cmp    $0x7d,%r15d
jg     11ad <websocket_client_wrap+0x7d>
mov    %ebx,%esi
or     $0x80,%esi
mov    $0x6,%r13d
mov    $0x18,%ebp
mov    $0x8,%ecx
mov    $0x4,%edx
jmp    1228 <websocket_client_wrap+0xf8>
mov    %ebx,%ecx
cmp    $0xffff,%ebx
ja     11e6 <websocket_client_wrap+0xb6>
movl   $0xfe,0x4(%r12)
mov    %ebx,%ecx
mov    %ebx,%edx
shr    $0x8,%edx
mov    %edx,0x8(%r12)
movzbl %cl,%esi
mov    $0x8,%r13d
mov    $0x20,%ebp
mov    $0x10,%ecx
mov    $0xc,%edx
jmp    1228 <websocket_client_wrap+0xf8>
movl   $0xff,0x4(%r12)
mov    %ebx,%ecx
mov    %ebx,%edx
shr    $0x18,%edx
mov    %edx,0x18(%r12)
mov    %ebx,%edx
shr    $0x10,%edx
movzbl %dl,%edx
mov    %edx,0x1c(%r12)
movzbl %ch,%edx
mov    %edx,0x20(%r12)
movzbl %cl,%esi
mov    $0xe,%r13d
mov    $0x38,%ebp
mov    $0x28,%ecx
mov    $0x24,%edx
mov    %esi,(%r12,%rdx,1)
mov    %eax,(%r12,%rcx,1)
add    %r12,%rbp
mov    %rbp,%rdi
mov    %eax,%r14d
mov    (%rsp),%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1040 <websocket_xmask@plt>
add    %ebx,%r13d
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @websocket_client_wrap(i8* %0, i8* %1, i32 %2, i8 zeroext %3, i8 zeroext %4, i8 zeroext %5, i8 zeroext %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
store i8* %0, i8** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i8 %3, i8* %12
store i8 %4, i8* %13
store i8 %5, i8* %14
store i8 %6, i8* %15
%17 = call i32 (...) @rand()
%18 = or i32 %17, 16909320
store i32 %18, i32* %16
%19 = load i8, i8* %13
%20 = zext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %7
%23 = load i8, i8* %12
%24 = zext i8 %23 to i32
br label %26
25: ; preds = %7
br label %26
26: ; preds = %25, %22
%27 = phi i32 [ %24, %22 ], [ 0, %25 ]
%28 = and i32 %27, 15
%29 = or i32 0, %28
%30 = load i8, i8* %15
%31 = zext i8 %30 to i32
%32 = and i32 %31, 7
%33 = shl i32 %32, 4
%34 = or i32 %29, %33
%35 = load i8, i8* %14
%36 = zext i8 %35 to i32
%37 = and i32 %36, 1
%38 = shl i32 %37, 7
%39 = or i32 %34, %38
%40 = load i8*, i8** %9
%41 = bitcast i8* %40 to i32*
%42 = getelementptr inbounds i32, i32* %41, i64 0
store i32 %39, i32* %42
%43 = load i32, i32* %11
%44 = icmp slt i32 %43, 126
br i1 %44, label %45, label %85
45: ; preds = %26
%46 = load i32, i32* %11
%47 = or i32 %46, 128
%48 = load i8*, i8** %9
%49 = bitcast i8* %48 to i32*
%50 = getelementptr inbounds i32, i32* %49, i64 1
store i32 %47, i32* %50
%51 = getelementptr inbounds i32, i32* %16, i64 0
%52 = load i32, i32* %51
%53 = load i8*, i8** %9
%54 = bitcast i8* %53 to i32*
%55 = getelementptr inbounds i32, i32* %54, i64 2
store i32 %52, i32* %55
%56 = getelementptr inbounds i32, i32* %16, i64 1
%57 = load i32, i32* %56
%58 = load i8*, i8** %9
%59 = bitcast i8* %58 to i32*
%60 = getelementptr inbounds i32, i32* %59, i64 3
store i32 %57, i32* %60
%61 = getelementptr inbounds i32, i32* %16, i64 2
%62 = load i32, i32* %61
%63 = load i8*, i8** %9
%64 = bitcast i8* %63 to i32*
%65 = getelementptr inbounds i32, i32* %64, i64 4
store i32 %62, i32* %65
%66 = getelementptr inbounds i32, i32* %16, i64 3
%67 = load i32, i32* %66
%68 = load i8*, i8** %9
%69 = bitcast i8* %68 to i32*
%70 = getelementptr inbounds i32, i32* %69, i64 5
store i32 %67, i32* %70
%71 = load i8*, i8** %9
%72 = bitcast i8* %71 to i32*
%73 = getelementptr inbounds i32, i32* %72, i64 6
%74 = load i8*, i8** %10
%75 = load i32, i32* %11
%76 = call i32 @memcpy(i32* %73, i8* %74, i32 %75)
%77 = load i8*, i8** %9
%78 = bitcast i8* %77 to i32*
%79 = getelementptr inbounds i32, i32* %78, i64 6
%80 = load i32, i32* %11
%81 = load i32, i32* %16
%82 = call i32 @websocket_xmask(i32* %79, i32 %80, i32 %81)
%83 = load i32, i32* %11
%84 = add nsw i32 %83, 6
store i32 %84, i32* %8
br label %238
85: ; preds = %26
%86 = load i32, i32* %11
%87 = sext i32 %86 to i64
%88 = icmp ult i64 %87, 65536
br i1 %88, label %89, label %142
89: ; preds = %85
%90 = load i8*, i8** %9
%91 = bitcast i8* %90 to i32*
%92 = getelementptr inbounds i32, i32* %91, i64 1
store i32 254, i32* %92
br label %93
93: ; preds = %89
%94 = load i32, i32* %11
%95 = ashr i32 %94, 8
%96 = and i32 %95, 255
%97 = load i8*, i8** %9
%98 = bitcast i8* %97 to i32*
%99 = getelementptr inbounds i32, i32* %98, i64 2
%100 = getelementptr inbounds i32, i32* %99, i64 0
store i32 %96, i32* %100
%101 = load i32, i32* %11
%102 = and i32 %101, 255
%103 = load i8*, i8** %9
%104 = bitcast i8* %103 to i32*
%105 = getelementptr inbounds i32, i32* %104, i64 2
%106 = getelementptr inbounds i32, i32* %105, i64 1
store i32 %102, i32* %106
br label %107
107: ; preds = %93
%108 = getelementptr inbounds i32, i32* %16, i64 0
%109 = load i32, i32* %108
%110 = load i8*, i8** %9
%111 = bitcast i8* %110 to i32*
%112 = getelementptr inbounds i32, i32* %111, i64 4
store i32 %109, i32* %112
%113 = getelementptr inbounds i32, i32* %16, i64 1
%114 = load i32, i32* %113
%115 = load i8*, i8** %9
%116 = bitcast i8* %115 to i32*
%117 = getelementptr inbounds i32, i32* %116, i64 5
store i32 %114, i32* %117
%118 = getelementptr inbounds i32, i32* %16, i64 2
%119 = load i32, i32* %118
%120 = load i8*, i8** %9
%121 = bitcast i8* %120 to i32*
%122 = getelementptr inbounds i32, i32* %121, i64 6
store i32 %119, i32* %122
%123 = getelementptr inbounds i32, i32* %16, i64 3
%124 = load i32, i32* %123
%125 = load i8*, i8** %9
%126 = bitcast i8* %125 to i32*
%127 = getelementptr inbounds i32, i32* %126, i64 7
store i32 %124, i32* %127
%128 = load i8*, i8** %9
%129 = bitcast i8* %128 to i32*
%130 = getelementptr inbounds i32, i32* %129, i64 8
%131 = load i8*, i8** %10
%132 = load i32, i32* %11
%133 = call i32 @memcpy(i32* %130, i8* %131, i32 %132)
%134 = load i8*, i8** %9
%135 = bitcast i8* %134 to i32*
%136 = getelementptr inbounds i32, i32* %135, i64 8
%137 = load i32, i32* %11
%138 = load i32, i32* %16
%139 = call i32 @websocket_xmask(i32* %136, i32 %137, i32 %138)
%140 = load i32, i32* %11
%141 = add nsw i32 %140, 8
store i32 %141, i32* %8
br label %238
142: ; preds = %85
br label %143
143: ; preds = %142
%144 = load i8*, i8** %9
%145 = bitcast i8* %144 to i32*
%146 = getelementptr inbounds i32, i32* %145, i64 1
store i32 255, i32* %146
br label %147
147: ; preds = %143
%148 = load i32, i32* %11
%149 = ashr i32 %148, 56
%150 = and i32 %149, 255
%151 = load i8*, i8** %9
%152 = bitcast i8* %151 to i32*
%153 = getelementptr inbounds i32, i32* %152, i64 2
%154 = getelementptr inbounds i32, i32* %153, i64 0
store i32 %150, i32* %154
%155 = load i32, i32* %11
%156 = ashr i32 %155, 48
%157 = and i32 %156, 255
%158 = load i8*, i8** %9
%159 = bitcast i8* %158 to i32*
%160 = getelementptr inbounds i32, i32* %159, i64 2
%161 = getelementptr inbounds i32, i32* %160, i64 1
store i32 %157, i32* %161
%162 = load i32, i32* %11
%163 = ashr i32 %162, 40
%164 = and i32 %163, 255
%165 = load i8*, i8** %9
%166 = bitcast i8* %165 to i32*
%167 = getelementptr inbounds i32, i32* %166, i64 2
%168 = getelementptr inbounds i32, i32* %167, i64 2
store i32 %164, i32* %168
%169 = load i32, i32* %11
%170 = ashr i32 %169, 32
%171 = and i32 %170, 255
%172 = load i8*, i8** %9
%173 = bitcast i8* %172 to i32*
%174 = getelementptr inbounds i32, i32* %173, i64 2
%175 = getelementptr inbounds i32, i32* %174, i64 3
store i32 %171, i32* %175
%176 = load i32, i32* %11
%177 = ashr i32 %176, 24
%178 = and i32 %177, 255
%179 = load i8*, i8** %9
%180 = bitcast i8* %179 to i32*
%181 = getelementptr inbounds i32, i32* %180, i64 2
%182 = getelementptr inbounds i32, i32* %181, i64 4
store i32 %178, i32* %182
%183 = load i32, i32* %11
%184 = ashr i32 %183, 16
%185 = and i32 %184, 255
%186 = load i8*, i8** %9
%187 = bitcast i8* %186 to i32*
%188 = getelementptr inbounds i32, i32* %187, i64 2
%189 = getelementptr inbounds i32, i32* %188, i64 5
store i32 %185, i32* %189
%190 = load i32, i32* %11
%191 = ashr i32 %190, 8
%192 = and i32 %191, 255
%193 = load i8*, i8** %9
%194 = bitcast i8* %193 to i32*
%195 = getelementptr inbounds i32, i32* %194, i64 2
%196 = getelementptr inbounds i32, i32* %195, i64 6
store i32 %192, i32* %196
%197 = load i32, i32* %11
%198 = and i32 %197, 255
%199 = load i8*, i8** %9
%200 = bitcast i8* %199 to i32*
%201 = getelementptr inbounds i32, i32* %200, i64 2
%202 = getelementptr inbounds i32, i32* %201, i64 7
store i32 %198, i32* %202
br label %203
203: ; preds = %147
%204 = getelementptr inbounds i32, i32* %16, i64 0
%205 = load i32, i32* %204
%206 = load i8*, i8** %9
%207 = bitcast i8* %206 to i32*
%208 = getelementptr inbounds i32, i32* %207, i64 10
store i32 %205, i32* %208
%209 = getelementptr inbounds i32, i32* %16, i64 1
%210 = load i32, i32* %209
%211 = load i8*, i8** %9
%212 = bitcast i8* %211 to i32*
%213 = getelementptr inbounds i32, i32* %212, i64 11
store i32 %210, i32* %213
%214 = getelementptr inbounds i32, i32* %16, i64 2
%215 = load i32, i32* %214
%216 = load i8*, i8** %9
%217 = bitcast i8* %216 to i32*
%218 = getelementptr inbounds i32, i32* %217, i64 12
store i32 %215, i32* %218
%219 = getelementptr inbounds i32, i32* %16, i64 3
%220 = load i32, i32* %219
%221 = load i8*, i8** %9
%222 = bitcast i8* %221 to i32*
%223 = getelementptr inbounds i32, i32* %222, i64 13
store i32 %220, i32* %223
%224 = load i8*, i8** %9
%225 = bitcast i8* %224 to i32*
%226 = getelementptr inbounds i32, i32* %225, i64 14
%227 = load i8*, i8** %10
%228 = load i32, i32* %11
%229 = call i32 @memcpy(i32* %226, i8* %227, i32 %228)
%230 = load i8*, i8** %9
%231 = bitcast i8* %230 to i32*
%232 = getelementptr inbounds i32, i32* %231, i64 14
%233 = load i32, i32* %11
%234 = load i32, i32* %16
%235 = call i32 @websocket_xmask(i32* %232, i32 %233, i32 %234)
%236 = load i32, i32* %11
%237 = add nsw i32 %236, 14
store i32 %237, i32* %8
br label %238
238: ; preds = %203, %107, %45
%239 = load i32, i32* %8
ret i32 %239
}

LLVM IR (-O2):
define i32 @websocket_client_wrap(i8* %0, i8* %1, i32 %2, i8 zeroext %3, i8 zeroext %4, i8 zeroext %5, i8 zeroext %6) {
%8 = tail call i32 (...) @rand()
%9 = or i32 %8, 16909320
%10 = icmp eq i8 %4, 0
%11 = and i8 %3, 15
%12 = select i1 %10, i8 0, i8 %11
%13 = shl i8 %6, 4
%14 = and i8 %13, 112
%15 = or i8 %12, %14
%16 = shl i8 %5, 7
%17 = or i8 %15, %16
%18 = zext i8 %17 to i32
%19 = bitcast i8* %0 to i32*
store i32 %18, i32* %19
%20 = icmp slt i32 %2, 126
br i1 %20, label %21, label %23
21: ; preds = %7
%22 = or i32 %2, 128
br label %45
23: ; preds = %7
%24 = icmp ult i32 %2, 65536
%25 = getelementptr inbounds i8, i8* %0, i64 4
%26 = bitcast i8* %25 to i32*
br i1 %24, label %27, label %32
27: ; preds = %23
store i32 254, i32* %26
%28 = lshr i32 %2, 8
%29 = getelementptr inbounds i8, i8* %0, i64 8
%30 = bitcast i8* %29 to i32*
store i32 %28, i32* %30
%31 = and i32 %2, 255
br label %45
32: ; preds = %23
store i32 255, i32* %26
%33 = lshr i32 %2, 24
%34 = getelementptr inbounds i8, i8* %0, i64 24
%35 = bitcast i8* %34 to i32*
store i32 %33, i32* %35
%36 = lshr i32 %2, 16
%37 = and i32 %36, 255
%38 = getelementptr inbounds i8, i8* %0, i64 28
%39 = bitcast i8* %38 to i32*
store i32 %37, i32* %39
%40 = lshr i32 %2, 8
%41 = and i32 %40, 255
%42 = getelementptr inbounds i8, i8* %0, i64 32
%43 = bitcast i8* %42 to i32*
store i32 %41, i32* %43
%44 = and i32 %2, 255
br label %45
45: ; preds = %32, %27, %21
%46 = phi i64 [ 36, %32 ], [ 12, %27 ], [ 4, %21 ]
%47 = phi i32 [ %44, %32 ], [ %31, %27 ], [ %22, %21 ]
%48 = phi i64 [ 40, %32 ], [ 16, %27 ], [ 8, %21 ]
%49 = phi i64 [ 56, %32 ], [ 32, %27 ], [ 24, %21 ]
%50 = phi i32 [ 14, %32 ], [ 8, %27 ], [ 6, %21 ]
%51 = getelementptr inbounds i8, i8* %0, i64 %46
%52 = bitcast i8* %51 to i32*
store i32 %47, i32* %52
%53 = getelementptr inbounds i8, i8* %0, i64 %48
%54 = bitcast i8* %53 to i32*
store i32 %9, i32* %54
%55 = getelementptr inbounds i8, i8* %0, i64 %49
%56 = bitcast i8* %55 to i32*
%57 = tail call i32 @memcpy(i32* %56, i8* %1, i32 %2)
%58 = tail call i32 @websocket_xmask(i32* %56, i32 %2, i32 %9)
%59 = add nsw i32 %50, %2
ret i32 %59
}