#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*/ GetMsg(int, unsigned char *, int *, int *);
int /*<<< orphan*/ SendDataToAppl(int, unsigned char *, int);
int AGWDoReceivedData(int Stream) {
  unsigned char Buffer[400];
  int len, count;
  do {
    GetMsg(Stream, Buffer, &len, &count);
    if (len > 0)
      SendDataToAppl(Stream, Buffer, len);
  } while (count > 0);
  return 0;
}


x86 assembly (clang, -O0):
<AGWDoReceivedData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1a0(%rbp),%rsi
lea    -0x1a4(%rbp),%rdx
lea    -0x1a8(%rbp),%rcx
call   1040 <GetMsg@plt>
cmpl   $0x0,-0x1a4(%rbp)
jle    116d <AGWDoReceivedData+0x4d>
mov    -0x4(%rbp),%edi
lea    -0x1a0(%rbp),%rsi
mov    -0x1a4(%rbp),%edx
call   1030 <SendDataToAppl@plt>
jmp    1172 <AGWDoReceivedData+0x52>
cmpl   $0x0,-0x1a8(%rbp)
jg     112e <AGWDoReceivedData+0xe>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AGWDoReceivedData>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1a8,%rsp
mov    %edi,%ebx
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
jmp    1157 <AGWDoReceivedData+0x37>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0x8(%rsp)
jle    117b <AGWDoReceivedData+0x5b>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <GetMsg@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    1150 <AGWDoReceivedData+0x30>
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <SendDataToAppl@plt>
jmp    1150 <AGWDoReceivedData+0x30>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @AGWDoReceivedData(i32 %0) {
%2 = alloca i32
%3 = alloca [400 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
br label %6
6: ; preds = %18, %1
%7 = load i32, i32* %2
%8 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%9 = call i32 @GetMsg(i32 %7, i8* %8, i32* %4, i32* %5)
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %6
%13 = load i32, i32* %2
%14 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @SendDataToAppl(i32 %13, i8* %14, i32 %15)
br label %17
17: ; preds = %12, %6
br label %18
18: ; preds = %17
%19 = load i32, i32* %5
%20 = icmp sgt i32 %19, 0
br i1 %20, label %6, label %21
21: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
define i32 @AGWDoReceivedData(i32 %0) {
%2 = alloca [400 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [400 x i8], [400 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
br label %8
8: ; preds = %14, %1
%9 = call i32 @GetMsg(i32 %0, i8* %5, i32* %3, i32* %4)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @SendDataToAppl(i32 %0, i8* %5, i32 %10)
br label %14
14: ; preds = %8, %12
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %8, label %17
17: ; preds = %14
ret i32 0
}