#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int sctp_receiveUnsent(unsigned int, unsigned char *, unsigned int *,
                       unsigned int *, unsigned short *, unsigned short *,
                       unsigned int *, unsigned char *, void **);
int /*<<< orphan*/ stderr;
int SCTP_receiveUnsent(unsigned int associationID, unsigned char *buffer,
                       unsigned int *length, unsigned int *tsn,
                       unsigned short *streamID, unsigned short *streamSN,
                       unsigned int *protocolId) {
  int result;
  unsigned char flags;
  void *ctx;
  if ((result = sctp_receiveUnsent(associationID, buffer, length, tsn, streamID,
                                   streamSN, protocolId, &flags, &ctx)) < 0) {
    if (result == -13) {
      fprintf(stderr,
              "sctp_receiveUnsent: Association is not in state CLOSED. \n");
    } else if (result == -3) {
      fprintf(stderr, "sctp_receiveUnsent: Association not found \n");
    } else if (result == -4) {
      fprintf(stderr,
              "sctp_receiveUnsent: parameter problem, NULL pointer passed ?\n");
    } else if (result == -1) {
      fprintf(stderr, "sctp_receiveUnsent: Library not Initialized.\n");
    } else if (result == -15) {
    } else {
      fprintf(stderr, "sctp_receiveUnsent: unknown value (%i) returned.\n",
              result);
    }
    fflush(stderr);
  }
  return result;
}


x86 assembly (clang, -O0):
<SCTP_receiveUnsent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r11
lea    -0x35(%rbp),%r10
lea    -0x40(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <sctp_receiveUnsent@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    1278 <SCTP_receiveUnsent+0x148>
cmpl   $0xfffffff3,-0x34(%rbp)
jne    11bb <SCTP_receiveUnsent+0x8b>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    126a <SCTP_receiveUnsent+0x13a>
cmpl   $0xfffffffd,-0x34(%rbp)
jne    11e1 <SCTP_receiveUnsent+0xb1>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1265 <SCTP_receiveUnsent+0x135>
cmpl   $0xfffffffc,-0x34(%rbp)
jne    1207 <SCTP_receiveUnsent+0xd7>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1260 <SCTP_receiveUnsent+0x130>
cmpl   $0xffffffff,-0x34(%rbp)
jne    122d <SCTP_receiveUnsent+0xfd>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125b <SCTP_receiveUnsent+0x12b>
cmpl   $0xfffffff1,-0x34(%rbp)
jne    123c <SCTP_receiveUnsent+0x10c>
jmp    1256 <SCTP_receiveUnsent+0x126>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
lea    0xe83(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125b <SCTP_receiveUnsent+0x12b>
jmp    1260 <SCTP_receiveUnsent+0x130>
jmp    1265 <SCTP_receiveUnsent+0x135>
jmp    126a <SCTP_receiveUnsent+0x13a>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x34(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCTP_receiveUnsent>:
push   %rbx
sub    $0x10,%rsp
sub    $0x8,%rsp
lea    0x10(%rsp),%rax
lea    0xf(%rsp),%rbx
push   %rax
push   %rbx
push   0x38(%rsp)
call   1050 <sctp_receiveUnsent@plt>
add    $0x20,%rsp
mov    %eax,%ebx
test   %eax,%eax
jns    11ea <SCTP_receiveUnsent+0xba>
add    $0xf,%eax
cmp    $0xe,%eax
ja     1186 <SCTP_receiveUnsent+0x56>
lea    0xe95(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
jmp    11d5 <SCTP_receiveUnsent+0xa5>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xf78(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11dc <SCTP_receiveUnsent+0xac>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xef1(%rip),%rsi
jmp    11d5 <SCTP_receiveUnsent+0xa5>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
jmp    11d5 <SCTP_receiveUnsent+0xa5>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xf0b(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [58 x i8] c"sctp_receiveUnsent: Association is not in state CLOSED. \0A\00"
@.str.1 = [44 x i8] c"sctp_receiveUnsent: Association not found \0A\00"
@.str.2 = [62 x i8] c"sctp_receiveUnsent: parameter problem, NULL pointer passed ?\0A\00"
@.str.3 = [46 x i8] c"sctp_receiveUnsent: Library not Initialized.\0A\00"
@.str.4 = [50 x i8] c"sctp_receiveUnsent: unknown value (%i) returned.\0A\00"
define i32 @SCTP_receiveUnsent(i32 %0, i8* %1, i32* %2, i32* %3, i16* %4, i16* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i16*
%13 = alloca i16*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i8
%17 = alloca i8*
store i32 %0, i32* %8
store i8* %1, i8** %9
store i32* %2, i32** %10
store i32* %3, i32** %11
store i16* %4, i16** %12
store i16* %5, i16** %13
store i32* %6, i32** %14
%18 = load i32, i32* %8
%19 = load i8*, i8** %9
%20 = load i32*, i32** %10
%21 = load i32*, i32** %11
%22 = load i16*, i16** %12
%23 = load i16*, i16** %13
%24 = load i32*, i32** %14
%25 = call i32 @sctp_receiveUnsent(i32 %18, i8* %19, i32* %20, i32* %21, i16* %22, i16* %23, i32* %24, i8* %16, i8** %17)
store i32 %25, i32* %15
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %66
27: ; preds = %7
%28 = load i32, i32* %15
%29 = icmp eq i32 %28, -13
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %63
33: ; preds = %27
%34 = load i32, i32* %15
%35 = icmp eq i32 %34, -3
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %62
39: ; preds = %33
%40 = load i32, i32* %15
%41 = icmp eq i32 %40, -4
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %61
45: ; preds = %39
%46 = load i32, i32* %15
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %60
51: ; preds = %45
%52 = load i32, i32* %15
%53 = icmp eq i32 %52, -15
br i1 %53, label %54, label %55
54: ; preds = %51
br label %59
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = load i32, i32* %15
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %55, %54
br label %60
60: ; preds = %59, %48
br label %61
61: ; preds = %60, %42
br label %62
62: ; preds = %61, %36
br label %63
63: ; preds = %62, %30
%64 = load i32, i32* @stderr
%65 = call i32 @fflush(i32 %64)
br label %66
66: ; preds = %63, %7
%67 = load i32, i32* %15
ret i32 %67
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"sctp_receiveUnsent: Association is not in state CLOSED. \0A\00"
@.str.1 = [44 x i8] c"sctp_receiveUnsent: Association not found \0A\00"
@.str.2 = [62 x i8] c"sctp_receiveUnsent: parameter problem, NULL pointer passed ?\0A\00"
@.str.3 = [46 x i8] c"sctp_receiveUnsent: Library not Initialized.\0A\00"
@.str.4 = [50 x i8] c"sctp_receiveUnsent: unknown value (%i) returned.\0A\00"
define i32 @SCTP_receiveUnsent(i32 %0, i8* %1, i32* %2, i32* %3, i16* %4, i16* %5, i32* %6) {
%8 = alloca i8
%9 = alloca i8*
%10 = bitcast i8** %9 to i8*
%11 = call i32 @sctp_receiveUnsent(i32 %0, i8* %1, i32* %2, i32* %3, i16* %4, i16* %5, i32* %6, i8* %8, i8** %9)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %32
13: ; preds = %7
switch i32 %11, label %26 [
i32 -13, label %14
i32 -3, label %17
i32 -4, label %20
i32 -1, label %23
i32 -15, label %29
]
14: ; preds = %13
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
br label %29
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %29
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %29
23: ; preds = %13
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
br label %29
26: ; preds = %13
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0), i32 %11)
br label %29
29: ; preds = %13, %17, %23, %26, %20, %14
%30 = load i32, i32* @stderr
%31 = call i32 @fflush(i32 %30)
br label %32
32: ; preds = %29, %7
ret i32 %11
}