#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*/ printf(char *, int);
int /*<<< orphan*/ svc_destroy(int /*<<< orphan*/ *);
int /*<<< orphan*/ *svcfd_create(int, int, int);
int /*<<< orphan*/ xprt_register(int /*<<< orphan*/ *);
int /*<<< orphan*/ xprt_unregister(int /*<<< orphan*/ *);
int main(int argn, char *argc[]) {
  int run_mode = 0;
  int test_status = 1;
  SVCXPRT *svcr = NULL;
  int fd = 0;
  svcr = svcfd_create(fd, 1024, 1024);
  if (svcr == NULL)
    return test_status;
  xprt_register(svcr);
  xprt_unregister(svcr);
  test_status = 0;
  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)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x400,%edx
mov    %edx,%esi
call   1070 <svcfd_create@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11ac <main+0x5c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <main+0x93>
mov    -0x20(%rbp),%rdi
call   1060 <xprt_register@plt>
mov    -0x20(%rbp),%rdi
call   1050 <xprt_unregister@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <svc_destroy@plt>
mov    -0x18(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %edi,%edi
mov    $0x400,%esi
mov    $0x400,%edx
call   1070 <svcfd_create@plt>
test   %rax,%rax
je     1196 <main+0x46>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <xprt_register@plt>
mov    %rbx,%rdi
call   1050 <xprt_unregister@plt>
mov    %rbx,%rdi
call   1040 <svc_destroy@plt>
lea    0xe73(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
jmp    119b <main+0x4b>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.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* null, i32** %8
store i32 0, i32* %9
%10 = load i32, i32* %9
%11 = call i32* @svcfd_create(i32 %10, i32 1024, i32 1024)
store i32* %11, i32** %8
%12 = load i32*, i32** %8
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %7
store i32 %15, i32* %3
br label %26
16: ; preds = %2
%17 = load i32*, i32** %8
%18 = call i32 @xprt_register(i32* %17)
%19 = load i32*, i32** %8
%20 = call i32 @xprt_unregister(i32* %19)
store i32 0, i32* %7
%21 = load i32*, i32** %8
%22 = call i32 @svc_destroy(i32* %21)
%23 = load i32, i32* %7
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %7
store i32 %25, i32* %3
br label %26
26: ; preds = %16, %14
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @svcfd_create(i32 0, i32 1024, i32 1024)
%4 = icmp eq i32* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @xprt_register(i32* %3)
%7 = tail call i32 @xprt_unregister(i32* %3)
%8 = tail call i32 @svc_destroy(i32* %3)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
br label %10
10: ; preds = %2, %5
%11 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %11
}