#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_receive(unsigned int, unsigned short, unsigned char *, unsigned int *,
                 unsigned short *, unsigned int *, unsigned int);
int /*<<< orphan*/ stderr;
int SCTP_receive(unsigned int associationID, unsigned short streamID,
                 unsigned char *buffer, unsigned int *length,
                 unsigned short *streamSN, unsigned int *tsn,
                 unsigned int flags) {
  int result;
  if ((result = sctp_receive(associationID, streamID, buffer, length, streamSN,
                             tsn, flags)) != 0) {
    if (result == -1) {
      fprintf(stderr, "sctp_receive: library not initialized.\n");
    } else if (result == -3) {
      fprintf(stderr, "sctp_receive: association not found.\n");
    } else if (result == -5) {
      fprintf(stderr, "sctp_receive: internal error.\n");
    } else if (result == 1) {
    } else if (result == -4) {
      fprintf(stderr,
              "sctp_receive: parameter problem (Null-Pointers, PathID ?)\n");
    }
    fflush(stderr);
  }
  return result;
}


x86 assembly (clang, -O0):
<SCTP_receive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %si,%ax
mov    0x10(%rbp),%esi
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x6(%rbp),%si
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%eax
movzwl %si,%esi
mov    %eax,(%rsp)
call   1050 <sctp_receive@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
je     1242 <SCTP_receive+0x112>
cmpl   $0xffffffff,-0x2c(%rbp)
jne    11aa <SCTP_receive+0x7a>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1234 <SCTP_receive+0x104>
cmpl   $0xfffffffd,-0x2c(%rbp)
jne    11ce <SCTP_receive+0x9e>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
call   1030 <fprintf@plt>
jmp    122f <SCTP_receive+0xff>
cmpl   $0xfffffffb,-0x2c(%rbp)
jne    11f2 <SCTP_receive+0xc2>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rsi
call   1030 <fprintf@plt>
jmp    122a <SCTP_receive+0xfa>
cmpl   $0x1,-0x2c(%rbp)
jne    1201 <SCTP_receive+0xd1>
jmp    1225 <SCTP_receive+0xf5>
cmpl   $0xfffffffc,-0x2c(%rbp)
jne    1220 <SCTP_receive+0xf0>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1225 <SCTP_receive+0xf5>
jmp    122a <SCTP_receive+0xfa>
jmp    122f <SCTP_receive+0xff>
jmp    1234 <SCTP_receive+0x104>
mov    0x2da5(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCTP_receive>:
push   %rbx
sub    $0x10,%rsp
mov    0x20(%rsp),%eax
mov    %eax,(%rsp)
call   1050 <sctp_receive@plt>
mov    %eax,%ebx
add    $0x5,%eax
cmp    $0x5,%eax
ja     1189 <SCTP_receive+0x59>
lea    0xec6(%rip),%rsi
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xefd(%rip),%rsi
jmp    117b <SCTP_receive+0x4b>
lea    0xf13(%rip),%rsi
jmp    117b <SCTP_receive+0x4b>
lea    0xec5(%rip),%rsi
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    0x2e50(%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 = [40 x i8] c"sctp_receive: library not initialized.\0A\00"
@.str.1 = [38 x i8] c"sctp_receive: association not found.\0A\00"
@.str.2 = [31 x i8] c"sctp_receive: internal error.\0A\00"
@.str.3 = [59 x i8] c"sctp_receive: parameter problem (Null-Pointers, PathID ?)\0A\00"
define i32 @SCTP_receive(i32 %0, i16 zeroext %1, i8* %2, i32* %3, i16* %4, i32* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i16
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i16*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %8
store i16 %1, i16* %9
store i8* %2, i8** %10
store i32* %3, i32** %11
store i16* %4, i16** %12
store i32* %5, i32** %13
store i32 %6, i32* %14
%16 = load i32, i32* %8
%17 = load i16, i16* %9
%18 = load i8*, i8** %10
%19 = load i32*, i32** %11
%20 = load i16*, i16** %12
%21 = load i32*, i32** %13
%22 = load i32, i32* %14
%23 = call i32 @sctp_receive(i32 %16, i16 zeroext %17, i8* %18, i32* %19, i16* %20, i32* %21, i32 %22)
store i32 %23, i32* %15
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %60
25: ; preds = %7
%26 = load i32, i32* %15
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %57
31: ; preds = %25
%32 = load i32, i32* %15
%33 = icmp eq i32 %32, -3
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %56
37: ; preds = %31
%38 = load i32, i32* %15
%39 = icmp eq i32 %38, -5
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
br label %55
43: ; preds = %37
%44 = load i32, i32* %15
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %43
br label %54
47: ; preds = %43
%48 = load i32, i32* %15
%49 = icmp eq i32 %48, -4
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %50, %47
br label %54
54: ; preds = %53, %46
br label %55
55: ; preds = %54, %40
br label %56
56: ; preds = %55, %34
br label %57
57: ; preds = %56, %28
%58 = load i32, i32* @stderr
%59 = call i32 @fflush(i32 %58)
br label %60
60: ; preds = %57, %7
%61 = load i32, i32* %15
ret i32 %61
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"sctp_receive: library not initialized.\0A\00"
@.str.1 = [38 x i8] c"sctp_receive: association not found.\0A\00"
@.str.2 = [31 x i8] c"sctp_receive: internal error.\0A\00"
@.str.3 = [59 x i8] c"sctp_receive: parameter problem (Null-Pointers, PathID ?)\0A\00"
define i32 @SCTP_receive(i32 %0, i16 zeroext %1, i8* %2, i32* %3, i16* %4, i32* %5, i32 %6) {
%8 = tail call i32 @sctp_receive(i32 %0, i16 zeroext %1, i8* %2, i32* %3, i16* %4, i32* %5, i32 %6)
switch i32 %8, label %16 [
i32 0, label %19
i32 -1, label %12
i32 -3, label %9
i32 -5, label %10
i32 -4, label %11
]
9: ; preds = %7
br label %12
10: ; preds = %7
br label %12
11: ; preds = %7
br label %12
12: ; preds = %7, %10, %11, %9
%13 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), %11 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), %10 ], [ getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), %7 ]
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* %13)
br label %16
16: ; preds = %12, %7
%17 = load i32, i32* @stderr
%18 = tail call i32 @fflush(i32 %17)
br label %19
19: ; preds = %7, %16
ret i32 %8
}