#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*/ xdrproc_t;
struct svc_req {
  int rq_proc;
};
typedef int /*<<< orphan*/ caddr_t;
typedef int /*<<< orphan*/ SVCXPRT;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ svc_sendreply(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                 int /*<<< orphan*/);
int /*<<< orphan*/ svcerr_noproc(int /*<<< orphan*/ *);
int /*<<< orphan*/ xdr_void;
int svc_try_handle(struct svc_req *request, SVCXPRT *xprt) {
  fflush(stdout);
  switch (request->rq_proc) {
  case 0: {
    if (!svc_sendreply(xprt, (xdrproc_t)xdr_void, (caddr_t)NULL)) {
      fprintf(stderr, "Could not send reply! %s\n", strerror(errno));
      return 1;
    }
    return 1;
  }
  default: {
    svcerr_noproc(xprt);
    return 1;
  }
  }
}


x86 assembly (clang, -O0):
<svc_try_handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
test   %eax,%eax
jne    11e2 <svc_try_handle+0x92>
jmp    1181 <svc_try_handle+0x31>
mov    -0x18(%rbp),%rdi
mov    0x2e5c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <svc_sendreply@plt>
cmp    $0x0,%eax
jne    11d6 <svc_try_handle+0x86>
mov    0x2e33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe3b(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f2 <svc_try_handle+0xa2>
movl   $0x1,-0x4(%rbp)
jmp    11f2 <svc_try_handle+0xa2>
mov    -0x18(%rbp),%rdi
call   1050 <svcerr_noproc@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svc_try_handle>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
cmpl   $0x0,(%rbx)
je     1177 <svc_try_handle+0x27>
mov    %r14,%rdi
call   1050 <svcerr_noproc@plt>
jmp    11b6 <svc_try_handle+0x66>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
xor    %edx,%edx
call   1030 <svc_sendreply@plt>
test   %eax,%eax
jne    11b6 <svc_try_handle+0x66>
mov    0x2e43(%rip),%rax
mov    (%rax),%ebx
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe54(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.svc_req = type { i32 }
@stdout = global i32 0
@xdr_void = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"Could not send reply! %s\0A\00"
@errno = global i32 0
define i32 @svc_try_handle(%struct.svc_req* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.svc_req*
%5 = alloca i32*
store %struct.svc_req* %0, %struct.svc_req** %4
store i32* %1, i32** %5
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
%8 = load %struct.svc_req*, %struct.svc_req** %4
%9 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %8, i32 0, i32 0
%10 = load i32, i32* %9
switch i32 %10, label %22 [
i32 0, label %11
]
11: ; preds = %2
%12 = load i32*, i32** %5
%13 = load i32, i32* @xdr_void
%14 = call i32 @svc_sendreply(i32* %12, i32 %13, i32 0)
%15 = icmp ne i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i32, i32* @stderr
%18 = load i32, i32* @errno
%19 = call i8* @strerror(i32 %18)
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %25
21: ; preds = %11
store i32 1, i32* %3
br label %25
22: ; preds = %2
%23 = load i32*, i32** %5
%24 = call i32 @svcerr_noproc(i32* %23)
store i32 1, i32* %3
br label %25
25: ; preds = %22, %21, %16
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
%struct.svc_req = type { i32 }
@stdout = global i32 0
@xdr_void = global i32 0
@stderr = global i32 0
@.str = [26 x i8] c"Could not send reply! %s\0A\00"
@errno = global i32 0
define i32 @svc_try_handle(%struct.svc_req* nocapture %0, i32* %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i32, i32* @xdr_void
%10 = tail call i32 @svc_sendreply(i32* %1, i32 %9, i32 0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %19
17: ; preds = %2
%18 = tail call i32 @svcerr_noproc(i32* %1)
br label %19
19: ; preds = %8, %17, %12
ret i32 1
}