#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 arp_ListenProbeSocketParamSet(int, char *, char *);
int arp_ListenProbeSockfdCreate(int *);
int arp_ListenProbeSocketSet(char *sNetcardname, char *sIP, int *piSockfd) {
  int iRet = 0;
  iRet = arp_ListenProbeSockfdCreate(piSockfd);
  if (iRet != 0) {
    return iRet;
  }
  iRet = arp_ListenProbeSocketParamSet((*piSockfd), sNetcardname, sIP);
  if (iRet == 0) {
    return iRet;
  }
  return iRet;
}


x86 assembly (clang, -O0):
<arp_ListenProbeSocketSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <arp_ListenProbeSockfdCreate@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     115c <arp_ListenProbeSocketSet+0x3c>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <arp_ListenProbeSocketSet+0x6d>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <arp_ListenProbeSocketParamSet@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1187 <arp_ListenProbeSocketSet+0x67>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118d <arp_ListenProbeSocketSet+0x6d>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arp_ListenProbeSocketSet>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1040 <arp_ListenProbeSockfdCreate@plt>
test   %eax,%eax
je     1140 <arp_ListenProbeSocketSet+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rbx),%edi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <arp_ListenProbeSocketParamSet@plt>

LLVM IR (-O0):
define i32 @arp_ListenProbeSocketSet(i8* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i32 0, i32* %8
%9 = load i32*, i32** %7
%10 = call i32 @arp_ListenProbeSockfdCreate(i32* %9)
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i32, i32* %8
store i32 %14, i32* %4
br label %27
15: ; preds = %3
%16 = load i32*, i32** %7
%17 = load i32, i32* %16
%18 = load i8*, i8** %5
%19 = load i8*, i8** %6
%20 = call i32 @arp_ListenProbeSocketParamSet(i32 %17, i8* %18, i8* %19)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = load i32, i32* %8
store i32 %24, i32* %4
br label %27
25: ; preds = %15
%26 = load i32, i32* %8
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %23, %13
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @arp_ListenProbeSocketSet(i8* %0, i8* %1, i32* %2) {
%4 = tail call i32 @arp_ListenProbeSockfdCreate(i32* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = tail call i32 @arp_ListenProbeSocketParamSet(i32 %7, i8* %0, i8* %1)
br label %9
9: ; preds = %6, %3
%10 = phi i32 [ %4, %3 ], [ %8, %6 ]
ret i32 %10
}