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


x86 assembly (clang, -O0):
<SCTP_receiveUnacked>:
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_receiveUnacked@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    1278 <SCTP_receiveUnacked+0x148>
cmpl   $0xfffffff3,-0x34(%rbp)
jne    11bb <SCTP_receiveUnacked+0x8b>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    126a <SCTP_receiveUnacked+0x13a>
cmpl   $0xfffffffd,-0x34(%rbp)
jne    11e1 <SCTP_receiveUnacked+0xb1>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1265 <SCTP_receiveUnacked+0x135>
cmpl   $0xfffffff1,-0x34(%rbp)
jne    11f0 <SCTP_receiveUnacked+0xc0>
jmp    1260 <SCTP_receiveUnacked+0x130>
cmpl   $0xffffffff,-0x34(%rbp)
jne    1216 <SCTP_receiveUnacked+0xe6>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125b <SCTP_receiveUnacked+0x12b>
cmpl   $0xfffffffc,-0x34(%rbp)
jne    123c <SCTP_receiveUnacked+0x10c>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1256 <SCTP_receiveUnacked+0x126>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%edx
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    125b <SCTP_receiveUnacked+0x12b>
jmp    1260 <SCTP_receiveUnacked+0x130>
jmp    1265 <SCTP_receiveUnacked+0x135>
jmp    126a <SCTP_receiveUnacked+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_receiveUnacked>:
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_receiveUnacked@plt>
add    $0x20,%rsp
mov    %eax,%ebx
test   %eax,%eax
jns    11ea <SCTP_receiveUnacked+0xba>
add    $0xf,%eax
cmp    $0xe,%eax
ja     1186 <SCTP_receiveUnacked+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_receiveUnacked+0xa5>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xf7c(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11dc <SCTP_receiveUnacked+0xac>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xf22(%rip),%rsi
jmp    11d5 <SCTP_receiveUnacked+0xa5>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
jmp    11d5 <SCTP_receiveUnacked+0xa5>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%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 = [59 x i8] c"SCTP_receiveUnacked: Association is not in state CLOSED. \0A\00"
@.str.1 = [45 x i8] c"SCTP_receiveUnacked: Association not found \0A\00"
@.str.2 = [47 x i8] c"SCTP_receiveUnacked: Library not Initialized \0A\00"
@.str.3 = [63 x i8] c"SCTP_receiveUnacked: parameter problem, NULL pointer passed ?\0A\00"
@.str.4 = [51 x i8] c"SCTP_receiveUnacked: unknown value (%i) returned.\0A\00"
define i32 @SCTP_receiveUnacked(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_receiveUnacked(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 ([59 x i8], [59 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 ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %62
39: ; preds = %33
%40 = load i32, i32* %15
%41 = icmp eq i32 %40, -15
br i1 %41, label %42, label %43
42: ; preds = %39
br label %61
43: ; preds = %39
%44 = load i32, i32* %15
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
br label %60
49: ; preds = %43
%50 = load i32, i32* %15
%51 = icmp eq i32 %50, -4
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0))
br label %59
55: ; preds = %49
%56 = load i32, i32* @stderr
%57 = load i32, i32* %15
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %55, %52
br label %60
60: ; preds = %59, %46
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 = [59 x i8] c"SCTP_receiveUnacked: Association is not in state CLOSED. \0A\00"
@.str.1 = [45 x i8] c"SCTP_receiveUnacked: Association not found \0A\00"
@.str.2 = [47 x i8] c"SCTP_receiveUnacked: Library not Initialized \0A\00"
@.str.3 = [63 x i8] c"SCTP_receiveUnacked: parameter problem, NULL pointer passed ?\0A\00"
@.str.4 = [51 x i8] c"SCTP_receiveUnacked: unknown value (%i) returned.\0A\00"
define i32 @SCTP_receiveUnacked(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_receiveUnacked(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 -15, label %29
i32 -1, label %20
i32 -4, label %23
]
14: ; preds = %13
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([59 x i8], [59 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 ([45 x i8], [45 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 ([47 x i8], [47 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 ([63 x i8], [63 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 ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i32 %11)
br label %29
29: ; preds = %13, %17, %20, %26, %23, %14
%30 = load i32, i32* @stderr
%31 = call i32 @fflush(i32 %30)
br label %32
32: ; preds = %29, %7
ret i32 %11
}