#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 */
typedef int /*<<< orphan*/ SVCXPRT;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ printf(char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ svc_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ *svctcp_create(int, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argn, char *argc[]) {
  int run_mode = 0;
  int test_status = 1;
  int sock = 600;
  SVCXPRT *svcr = NULL;
  sock = socket(AF_UNIX, SOCK_DGRAM, IPPROTO_TCP);
  svcr = svctcp_create(sock, 0, 0);
  test_status = (svcr != NULL) ? 0 : 1;
  svc_destroy(svcr);
  printf("%d\n", test_status);
  return test_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movl   $0x258,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    0x2e55(%rip),%rax
mov    (%rax),%esi
mov    0x2e54(%rip),%rax
mov    (%rax),%edx
call   1060 <socket@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <svctcp_create@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <svc_destroy@plt>
mov    -0x18(%rbp),%esi
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
call   1060 <socket@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <svctcp_create@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %rax,%rdi
call   1050 <svc_destroy@plt>
lea    0xe7d(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@AF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 1, i32* %7
store i32 600, i32* %8
store i32* null, i32** %9
%10 = load i32, i32* @AF_UNIX
%11 = load i32, i32* @SOCK_DGRAM
%12 = load i32, i32* @IPPROTO_TCP
%13 = call i32 @socket(i32 %10, i32 %11, i32 %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = call i32* @svctcp_create(i32 %14, i32 0, i32 0)
store i32* %15, i32** %9
%16 = load i32*, i32** %9
%17 = icmp ne i32* %16, null
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 0, i32 1
store i32 %19, i32* %7
%20 = load i32*, i32** %9
%21 = call i32 @svc_destroy(i32* %20)
%22 = load i32, i32* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
@AF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @AF_UNIX
%4 = load i32, i32* @SOCK_DGRAM
%5 = load i32, i32* @IPPROTO_TCP
%6 = tail call i32 @socket(i32 %3, i32 %4, i32 %5)
%7 = tail call i32* @svctcp_create(i32 %6, i32 0, i32 0)
%8 = icmp eq i32* %7, null
%9 = zext i1 %8 to i32
%10 = tail call i32 @svc_destroy(i32* %7)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 %9
}