#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 *);
unsigned short sctp_associate(unsigned short, unsigned short, unsigned char *,
                              unsigned short, void *);
int /*<<< orphan*/ stderr;
unsigned int SCTP_associate(unsigned short SCTP_InstanceName,
                            unsigned short noOfOutStreams,
                            unsigned char destinationAddress[],
                            unsigned short destinationPort, void *ulp_data) {
  unsigned short result;
  if ((result =
           sctp_associate(SCTP_InstanceName, noOfOutStreams, destinationAddress,
                          destinationPort, ulp_data)) == 0) {
    fprintf(stderr, "sctp_associate: an error occured.\n");
    fflush(stderr);
  }
  return result;
}


x86 assembly (clang, -O0):
<SCTP_associate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cx,%ax
mov    %si,%cx
mov    %di,%si
mov    %si,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x2(%rbp),%si
mov    -0x4(%rbp),%cx
mov    -0x10(%rbp),%rdx
mov    -0x12(%rbp),%ax
mov    -0x20(%rbp),%r8
movzwl %si,%edi
movzwl %cx,%esi
movzwl %ax,%ecx
call   1040 <sctp_associate@plt>
mov    %ax,-0x22(%rbp)
movzwl %ax,%eax
cmp    $0x0,%eax
jne    11aa <SCTP_associate+0x7a>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movzwl -0x22(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCTP_associate>:
push   %r14
push   %rbx
push   %rax
call   1040 <sctp_associate@plt>
mov    %eax,%ebx
test   %ax,%ax
jne    115e <SCTP_associate+0x2e>
mov    0x2e99(%rip),%r14
mov    (%r14),%edi
lea    0xeaf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%r14),%edi
call   1050 <fflush@plt>
movzwl %bx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"sctp_associate: an error occured.\0A\00"
define i32 @SCTP_associate(i16 zeroext %0, i16 zeroext %1, i8* %2, i16 zeroext %3, i8* %4) {
%6 = alloca i16
%7 = alloca i16
%8 = alloca i8*
%9 = alloca i16
%10 = alloca i8*
%11 = alloca i16
store i16 %0, i16* %6
store i16 %1, i16* %7
store i8* %2, i8** %8
store i16 %3, i16* %9
store i8* %4, i8** %10
%12 = load i16, i16* %6
%13 = load i16, i16* %7
%14 = load i8*, i8** %8
%15 = load i16, i16* %9
%16 = load i8*, i8** %10
%17 = call zeroext i16 @sctp_associate(i16 zeroext %12, i16 zeroext %13, i8* %14, i16 zeroext %15, i8* %16)
store i16 %17, i16* %11
%18 = zext i16 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %5
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 @fflush(i32 %23)
br label %25
25: ; preds = %20, %5
%26 = load i16, i16* %11
%27 = zext i16 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"sctp_associate: an error occured.\0A\00"
define i32 @SCTP_associate(i16 zeroext %0, i16 zeroext %1, i8* %2, i16 zeroext %3, i8* %4) {
%6 = tail call zeroext i16 @sctp_associate(i16 zeroext %0, i16 zeroext %1, i8* %2, i16 zeroext %3, i8* %4)
%7 = icmp eq i16 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 @fflush(i32 %11)
br label %13
13: ; preds = %8, %5
%14 = zext i16 %6 to i32
ret i32 %14
}