#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(void) {
  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    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x258,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    0x2e63(%rip),%rax
mov    (%rax),%esi
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
call   1060 <socket@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <svctcp_create@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <svc_destroy@plt>
mov    -0x8(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%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() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
store i32 1, i32* %2
store i32 600, i32* %3
store i32* null, i32** %4
%5 = load i32, i32* @AF_UNIX
%6 = load i32, i32* @SOCK_DGRAM
%7 = load i32, i32* @IPPROTO_TCP
%8 = call i32 @socket(i32 %5, i32 %6, i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32* @svctcp_create(i32 %9, i32 0, i32 0)
store i32* %10, i32** %4
%11 = load i32*, i32** %4
%12 = icmp ne i32* %11, null
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 0, i32 1
store i32 %14, i32* %2
%15 = load i32*, i32** %4
%16 = call i32 @svc_destroy(i32* %15)
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %2
ret i32 %19
}

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() {
%1 = load i32, i32* @AF_UNIX
%2 = load i32, i32* @SOCK_DGRAM
%3 = load i32, i32* @IPPROTO_TCP
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
%5 = tail call i32* @svctcp_create(i32 %4, i32 0, i32 0)
%6 = icmp eq i32* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @svc_destroy(i32* %5)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 %7
}