#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 rtpheader {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char, char);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int getrtp(int fd, struct rtpheader *rh, char **data, int *lengthData) {
  static char buf[1600];
  int headerSize;
  int lengthPacket;
  lengthPacket = recv(fd, buf, 1590, 0);
  headerSize = 3;
  *lengthData = lengthPacket - headerSize;
  *data = (char *)buf + headerSize;
  fprintf(stderr, "[%d] %02x %x\n", lengthPacket, buf[8], buf[0]);
  return (0);
}


x86 assembly (clang, -O0):
<getrtp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    0x2eff(%rip),%rsi
mov    $0x636,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x28(%rbp)
movl   $0x3,-0x24(%rbp)
mov    -0x28(%rbp),%ecx
sub    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movslq -0x24(%rbp),%rax
lea    0x2ed2(%rip),%rcx
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
mov    0x2ebe(%rip),%al
lea    0xe6f(%rip),%rsi
movsbl %al,%ecx
movsbl 0x2ea4(%rip),%r8d
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrtp>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
lea    0x2f0f(%rip),%rsi
mov    $0x636,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
lea    -0x3(%rax),%ecx
mov    %ecx,(%rbx)
lea    0x2efa(%rip),%rcx
mov    %rcx,(%r14)
mov    0x2e8d(%rip),%rcx
mov    (%rcx),%edi
movsbl 0x2eec(%rip),%ecx
movsbl 0x2edc(%rip),%r8d
lea    0xe95(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rtpheader = type { i32 }
@getrtp.buf = internal global [1600 x i8] zeroinitializer
@stderr = global i32 0
@.str = [14 x i8] c"[%d] %02x %x\0A\00"
define i32 @getrtp(i32 %0, %struct.rtpheader* %1, i8** %2, i32* %3) {
%5 = alloca i32
%6 = alloca %struct.rtpheader*
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store %struct.rtpheader* %1, %struct.rtpheader** %6
store i8** %2, i8*** %7
store i32* %3, i32** %8
%11 = load i32, i32* %5
%12 = call i32 @recv(i32 %11, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 0), i32 1590, i32 0)
store i32 %12, i32* %10
store i32 3, i32* %9
%13 = load i32, i32* %10
%14 = load i32, i32* %9
%15 = sub nsw i32 %13, %14
%16 = load i32*, i32** %8
store i32 %15, i32* %16
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 0), i64 %18
%20 = load i8**, i8*** %7
store i8* %19, i8** %20
%21 = load i32, i32* @stderr
%22 = load i32, i32* %10
%23 = load i8, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 8)
%24 = load i8, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 0)
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22, i8 signext %23, i8 signext %24)
ret i32 0
}

LLVM IR (-O2):
%struct.rtpheader = type { i32 }
@getrtp.buf = internal global [1600 x i8] zeroinitializer
@stderr = global i32 0
@.str = [14 x i8] c"[%d] %02x %x\0A\00"
define i32 @getrtp(i32 %0, %struct.rtpheader* nocapture readnone %1, i8** nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @recv(i32 %0, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 0), i32 1590, i32 0)
%6 = add nsw i32 %5, -3
store i32 %6, i32* %3
store i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 3), i8** %2
%7 = load i32, i32* @stderr
%8 = load i8, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 8)
%9 = load i8, i8* getelementptr inbounds ([1600 x i8], [1600 x i8]* @getrtp.buf, i64 0, i64 0)
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5, i8 signext %8, i8 signext %9)
ret i32 0
}