#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*/ memset(unsigned char *, int /*<<< orphan*/, int);
void extractPayload(unsigned char (*tmpReq)[256],
                    unsigned char (*payload)[256]) {
  unsigned int i, u;
  memset(*payload, 0, sizeof(*payload));
  u = 0;
  for (i = 4; (*tmpReq)[i]; i++) {
    if (((*tmpReq)[i] != 10) && ((*tmpReq)[i] != 13)) {
      (*payload)[u] = (*tmpReq)[i];
      u++;
    }
  }
}


x86 assembly (clang, -O0):
<extractPayload>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     11a7 <extractPayload+0x97>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1194 <extractPayload+0x84>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     1194 <extractPayload+0x84>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <extractPayload+0x89>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <extractPayload+0x2e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractPayload>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %ebp,%ebp
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
mov    $0x4,%eax
jmp    1143 <extractPayload+0x33>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
mov    %eax,%ecx
movzbl (%rbx,%rcx,1),%ecx
cmp    $0xa,%cl
je     1140 <extractPayload+0x30>
cmp    $0xd,%cl
je     1140 <extractPayload+0x30>
test   %cl,%cl
je     1162 <extractPayload+0x52>
mov    %ebp,%edx
mov    %cl,(%r14,%rdx,1)
add    $0x1,%ebp
jmp    1140 <extractPayload+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @extractPayload([256 x i8]* nocapture %0, [256 x i8]* %1) {
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = tail call i32 @memset(i8* %3, i32 0, i32 256)
br label %5
5: ; preds = %15, %2
%6 = phi i32 [ 4, %2 ], [ %17, %15 ]
%7 = phi i32 [ 0, %2 ], [ %16, %15 ]
%8 = zext i32 %6 to i64
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %0, i64 0, i64 %8
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 0, label %18
i8 10, label %15
i8 13, label %15
]
11: ; preds = %5
%12 = zext i32 %7 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 %12
store i8 %10, i8* %13
%14 = add i32 %7, 1
br label %15
15: ; preds = %5, %5, %11
%16 = phi i32 [ %14, %11 ], [ %7, %5 ], [ %7, %5 ]
%17 = add i32 %6, 1
br label %5
18: ; preds = %5
ret void
}