#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 */
struct packetheader {
  int dummy;
};
struct ILibWebServer_Session {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ UpnpProcessHTTPPacket(struct ILibWebServer_Session *,
                                         struct packetheader *, char *, int,
                                         int);
void UpnpSessionReceiveSink(struct ILibWebServer_Session *sender,
                            int InterruptFlag, struct packetheader *header,
                            char *bodyBuffer, int *beginPointer, int endPointer,
                            int done) {
  if (header != NULL && done != 0 && InterruptFlag == 0) {
    UpnpProcessHTTPPacket(sender, header, bodyBuffer,
                          beginPointer == NULL ? 0 : *beginPointer, endPointer);
    if (beginPointer != NULL) {
      *beginPointer = endPointer;
    }
  }
}


x86 assembly (clang, -O0):
<UpnpSessionReceiveSink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11b8 <UpnpSessionReceiveSink+0xa8>
cmpl   $0x0,0x10(%rbp)
je     11b8 <UpnpSessionReceiveSink+0xa8>
cmpl   $0x0,-0xc(%rbp)
jne    11b8 <UpnpSessionReceiveSink+0xa8>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    117e <UpnpSessionReceiveSink+0x6e>
xor    %eax,%eax
mov    %eax,-0x4c(%rbp)
jmp    1187 <UpnpSessionReceiveSink+0x77>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rdi
mov    -0x4c(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
call   1030 <UpnpProcessHTTPPacket@plt>
cmpq   $0x0,-0x28(%rbp)
je     11b3 <UpnpSessionReceiveSink+0xa3>
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b8 <UpnpSessionReceiveSink+0xa8>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnpSessionReceiveSink>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jne    1142 <UpnpSessionReceiveSink+0x32>
test   %rdx,%rdx
je     1142 <UpnpSessionReceiveSink+0x32>
cmpl   $0x0,0x20(%rsp)
je     1142 <UpnpSessionReceiveSink+0x32>
mov    %r9d,%ebp
mov    %r8,%rbx
test   %r8,%r8
je     1149 <UpnpSessionReceiveSink+0x39>
mov    (%rbx),%eax
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %eax,%ecx
mov    %ebp,%r8d
call   1030 <UpnpProcessHTTPPacket@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rdx,%rsi
mov    %rcx,%rdx
xor    %ecx,%ecx
mov    %ebp,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <UpnpProcessHTTPPacket@plt>

LLVM IR (-O0):
%struct.ILibWebServer_Session = type { i32 }
%struct.packetheader = type { i32 }
define void @UpnpSessionReceiveSink(%struct.ILibWebServer_Session* %0, i32 %1, %struct.packetheader* %2, i8* %3, i32* %4, i32 %5, i32 %6) {
%8 = alloca %struct.ILibWebServer_Session*
%9 = alloca i32
%10 = alloca %struct.packetheader*
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
store %struct.ILibWebServer_Session* %0, %struct.ILibWebServer_Session** %8
store i32 %1, i32* %9
store %struct.packetheader* %2, %struct.packetheader** %10
store i8* %3, i8** %11
store i32* %4, i32** %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load %struct.packetheader*, %struct.packetheader** %10
%16 = icmp ne %struct.packetheader* %15, null
br i1 %16, label %17, label %43
17: ; preds = %7
%18 = load i32, i32* %14
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %43
20: ; preds = %17
%21 = load i32, i32* %9
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = load %struct.ILibWebServer_Session*, %struct.ILibWebServer_Session** %8
%25 = load %struct.packetheader*, %struct.packetheader** %10
%26 = load i8*, i8** %11
%27 = load i32*, i32** %12
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %30
29: ; preds = %23
br label %33
30: ; preds = %23
%31 = load i32*, i32** %12
%32 = load i32, i32* %31
br label %33
33: ; preds = %30, %29
%34 = phi i32 [ 0, %29 ], [ %32, %30 ]
%35 = load i32, i32* %13
%36 = call i32 @UpnpProcessHTTPPacket(%struct.ILibWebServer_Session* %24, %struct.packetheader* %25, i8* %26, i32 %34, i32 %35)
%37 = load i32*, i32** %12
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %42
39: ; preds = %33
%40 = load i32, i32* %13
%41 = load i32*, i32** %12
store i32 %40, i32* %41
br label %42
42: ; preds = %39, %33
br label %43
43: ; preds = %42, %20, %17, %7
ret void
}

LLVM IR (-O2):
%struct.ILibWebServer_Session = type { i32 }
%struct.packetheader = type { i32 }
define void @UpnpSessionReceiveSink(%struct.ILibWebServer_Session* %0, i32 %1, %struct.packetheader* %2, i8* %3, i32* %4, i32 %5, i32 %6) {
%8 = icmp ne %struct.packetheader* %2, null
%9 = icmp ne i32 %6, 0
%10 = and i1 %8, %9
%11 = icmp eq i32 %1, 0
%12 = and i1 %11, %10
br i1 %12, label %13, label %20
13: ; preds = %7
%14 = icmp eq i32* %4, null
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 @UpnpProcessHTTPPacket(%struct.ILibWebServer_Session* %0, %struct.packetheader* %2, i8* %3, i32 0, i32 %5)
br label %20
17: ; preds = %13
%18 = load i32, i32* %4
%19 = tail call i32 @UpnpProcessHTTPPacket(%struct.ILibWebServer_Session* %0, %struct.packetheader* %2, i8* %3, i32 %18, i32 %5)
store i32 %5, i32* %4
br label %20
20: ; preds = %15, %17, %7
ret void
}