#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_send_private(unsigned int, unsigned short, unsigned char *,
                      unsigned int, unsigned int, short, void *, unsigned int,
                      int, int);
int /*<<< orphan*/ stderr;
int SCTP_send(unsigned int associationID, unsigned short streamID,
              unsigned char *buffer, unsigned int length,
              unsigned int protocolId, short path_id, void *context,
              unsigned int lifetime, int unorderedDelivery, int dontBundle) {
  int result;
  if ((result = sctp_send_private(associationID, streamID, buffer, length,
                                  protocolId, path_id, context, lifetime,
                                  unorderedDelivery, dontBundle)) != 0) {
    if (result == -11) {
    } else if (result == -1) {
      fprintf(stderr, "sctp_send: library not initialized.\n");
    } else if (result == -3) {
      fprintf(stderr, "sctp_send: association not found.\n");
    } else if (result == 1) {
      fprintf(stderr, "sctp_send: association in shutdown state - don't send "
                      "any more data !\n");
    } else if (result == -5) {
      fprintf(stderr, "sctp_send: internal error !\n");
    } else if (result == -4) {
      fprintf(stderr,
              "sctp_send: Parameter Problem (invalid path or stream id).\n");
    } else {
      fprintf(stderr, "sctp_send: unkown result (%i) returned.\n", result);
    }
    fflush(stderr);
  }
  return result;
}


x86 assembly (clang, -O0):
<SCTP_send>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %r9w,%ax
mov    0x28(%rbp),%r9d
mov    0x20(%rbp),%r9d
mov    0x18(%rbp),%r9d
mov    0x10(%rbp),%r9
mov    %edi,-0xc(%rbp)
mov    %si,-0xe(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %ax,-0x22(%rbp)
mov    -0xc(%rbp),%edi
mov    -0xe(%rbp),%si
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x22(%rbp),%r9w
mov    0x10(%rbp),%rbx
mov    0x18(%rbp),%r11d
mov    0x20(%rbp),%r10d
mov    0x28(%rbp),%eax
movzwl %si,%esi
movswl %r9w,%r9d
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1050 <sctp_send_private@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
je     12c1 <SCTP_send+0x191>
cmpl   $0xfffffff5,-0x28(%rbp)
jne    11c2 <SCTP_send+0x92>
jmp    12b3 <SCTP_send+0x183>
cmpl   $0xffffffff,-0x28(%rbp)
jne    11e8 <SCTP_send+0xb8>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ae <SCTP_send+0x17e>
cmpl   $0xfffffffd,-0x28(%rbp)
jne    120e <SCTP_send+0xde>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
lea    0xe23(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12a9 <SCTP_send+0x179>
cmpl   $0x1,-0x28(%rbp)
jne    1234 <SCTP_send+0x104>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12a4 <SCTP_send+0x174>
cmpl   $0xfffffffb,-0x28(%rbp)
jne    125a <SCTP_send+0x12a>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    129f <SCTP_send+0x16f>
cmpl   $0xfffffffc,-0x28(%rbp)
jne    1280 <SCTP_send+0x150>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    129a <SCTP_send+0x16a>
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%edx
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    129f <SCTP_send+0x16f>
jmp    12a4 <SCTP_send+0x174>
jmp    12a9 <SCTP_send+0x179>
jmp    12ae <SCTP_send+0x17e>
jmp    12b3 <SCTP_send+0x183>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x28(%rbp),%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCTP_send>:
push   %rbx
mov    0x18(%rsp),%r10d
mov    0x20(%rsp),%ebx
mov    0x28(%rsp),%eax
push   %rax
push   %rbx
push   %r10
push   0x28(%rsp)
call   1050 <sctp_send_private@plt>
add    $0x20,%rsp
mov    %eax,%ebx
add    $0xb,%eax
cmp    $0xc,%eax
ja     117b <SCTP_send+0x4b>
lea    0xea0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xf4a(%rip),%rsi
jmp    11dc <SCTP_send+0xac>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xf90(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11e3 <SCTP_send+0xb3>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xf3a(%rip),%rsi
jmp    11dc <SCTP_send+0xac>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
jmp    11dc <SCTP_send+0xac>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
jmp    11dc <SCTP_send+0xac>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"sctp_send: library not initialized.\0A\00"
@.str.1 = [35 x i8] c"sctp_send: association not found.\0A\00"
@.str.2 = [71 x i8] c"sctp_send: association in shutdown state - don't send any more data !\0A\00"
@.str.3 = [29 x i8] c"sctp_send: internal error !\0A\00"
@.str.4 = [59 x i8] c"sctp_send: Parameter Problem (invalid path or stream id).\0A\00"
@.str.5 = [41 x i8] c"sctp_send: unkown result (%i) returned.\0A\00"
define i32 @SCTP_send(i32 %0, i16 zeroext %1, i8* %2, i32 %3, i32 %4, i16 signext %5, i8* %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca i32
%12 = alloca i16
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i16
%17 = alloca i8*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 %0, i32* %11
store i16 %1, i16* %12
store i8* %2, i8** %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i16 %5, i16* %16
store i8* %6, i8** %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%22 = load i32, i32* %11
%23 = load i16, i16* %12
%24 = load i8*, i8** %13
%25 = load i32, i32* %14
%26 = load i32, i32* %15
%27 = load i16, i16* %16
%28 = load i8*, i8** %17
%29 = load i32, i32* %18
%30 = load i32, i32* %19
%31 = load i32, i32* %20
%32 = call i32 @sctp_send_private(i32 %22, i16 zeroext %23, i8* %24, i32 %25, i32 %26, i16 signext %27, i8* %28, i32 %29, i32 %30, i32 %31)
store i32 %32, i32* %21
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %80
34: ; preds = %10
%35 = load i32, i32* %21
%36 = icmp eq i32 %35, -11
br i1 %36, label %37, label %38
37: ; preds = %34
br label %77
38: ; preds = %34
%39 = load i32, i32* %21
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %76
44: ; preds = %38
%45 = load i32, i32* %21
%46 = icmp eq i32 %45, -3
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %75
50: ; preds = %44
%51 = load i32, i32* %21
%52 = icmp eq i32 %51, 1
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i32, i32* @stderr
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
br label %74
56: ; preds = %50
%57 = load i32, i32* %21
%58 = icmp eq i32 %57, -5
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %73
62: ; preds = %56
%63 = load i32, i32* %21
%64 = icmp eq i32 %63, -4
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
br label %72
68: ; preds = %62
%69 = load i32, i32* @stderr
%70 = load i32, i32* %21
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %68, %65
br label %73
73: ; preds = %72, %59
br label %74
74: ; preds = %73, %53
br label %75
75: ; preds = %74, %47
br label %76
76: ; preds = %75, %41
br label %77
77: ; preds = %76, %37
%78 = load i32, i32* @stderr
%79 = call i32 @fflush(i32 %78)
br label %80
80: ; preds = %77, %10
%81 = load i32, i32* %21
ret i32 %81
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"sctp_send: library not initialized.\0A\00"
@.str.1 = [35 x i8] c"sctp_send: association not found.\0A\00"
@.str.2 = [71 x i8] c"sctp_send: association in shutdown state - don't send any more data !\0A\00"
@.str.3 = [29 x i8] c"sctp_send: internal error !\0A\00"
@.str.4 = [59 x i8] c"sctp_send: Parameter Problem (invalid path or stream id).\0A\00"
@.str.5 = [41 x i8] c"sctp_send: unkown result (%i) returned.\0A\00"
define i32 @SCTP_send(i32 %0, i16 zeroext %1, i8* %2, i32 %3, i32 %4, i16 signext %5, i8* %6, i32 %7, i32 %8, i32 %9) {
%11 = tail call i32 @sctp_send_private(i32 %0, i16 zeroext %1, i8* %2, i32 %3, i32 %4, i16 signext %5, i8* %6, i32 %7, i32 %8, i32 %9)
switch i32 %11, label %27 [
i32 0, label %33
i32 -11, label %30
i32 -1, label %12
i32 -3, label %15
i32 1, label %18
i32 -5, label %21
i32 -4, label %24
]
12: ; preds = %10
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %30
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
br label %30
18: ; preds = %10
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0))
br label %30
21: ; preds = %10
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %30
24: ; preds = %10
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
br label %30
27: ; preds = %10
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %11)
br label %30
30: ; preds = %10, %12, %18, %24, %27, %21, %15
%31 = load i32, i32* @stderr
%32 = tail call i32 @fflush(i32 %31)
br label %33
33: ; preds = %10, %30
ret i32 %11
}