#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*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
main() {
  int fd;
  fd = socket(PF_INET, SOCK_STREAM, 132);
  if (fd <= 0) {
    perror("checksctp");
    exit(1);
  } else {
    fprintf(stderr, "SCTP supported\n");
  }
  close(fd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    0x2e69(%rip),%rax
mov    (%rax),%esi
mov    $0x84,%edx
call   1070 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     119e <main+0x4e>
lea    0xe71(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
mov    $0x84,%edx
call   1070 <socket@plt>
test   %eax,%eax
jg     1187 <main+0x37>
lea    0xe88(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    %eax,%ebx
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
call   1040 <fprintf@plt>
mov    %ebx,%edi
call   1030 <close@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"checksctp\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"SCTP supported\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @PF_INET
%4 = load i32, i32* @SOCK_STREAM
%5 = call i32 @socket(i32 %3, i32 %4, i32 132)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = call i32 @close(i32 %15)
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"checksctp\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"SCTP supported\0A\00"
define i32 @main() {
%1 = load i32, i32* @PF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 132)
%4 = icmp slt i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @close(i32 %3)
%12 = tail call i32 @exit(i32 0)
unreachable
}