#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 */
struct sockaddr_in {
  int dummy;
};
struct gsn_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ get_seq(void *);
int /*<<< orphan*/ gtp_dublicate(struct gsn_t *, int /*<<< orphan*/,
                                 struct sockaddr_in *, int /*<<< orphan*/);
int gtp_echo_resp(struct gsn_t *, int, struct sockaddr_in *, int, void *,
                  unsigned int);
int gtp_echo_ind(struct gsn_t *gsn, int version, struct sockaddr_in *peer,
                 int fd, void *pack, unsigned len) {
  if (!gtp_dublicate(gsn, 0, peer, get_seq(pack)))
    return 0;
  return gtp_echo_resp(gsn, version, peer, fd, pack, len);
}


x86 assembly (clang, -O0):
<gtp_echo_ind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <get_seq@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    %eax,%ecx
xor    %esi,%esi
call   1030 <gtp_dublicate@plt>
cmp    $0x0,%eax
jne    118d <gtp_echo_ind+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    11ab <gtp_echo_ind+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x34(%rbp),%r9d
call   1040 <gtp_echo_resp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtp_echo_ind>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r13
mov    %ecx,%r15d
mov    %rdx,%rbp
mov    %esi,%r12d
mov    %rdi,%rbx
mov    %r8,%rdi
call   1050 <get_seq@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
mov    %eax,%ecx
call   1030 <gtp_dublicate@plt>
test   %eax,%eax
je     118d <gtp_echo_ind+0x5d>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
mov    %r15d,%ecx
mov    %r13,%r8
mov    %r14d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <gtp_echo_resp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.gsn_t = type { i32 }
%struct.sockaddr_in = type { i32 }
define i32 @gtp_echo_ind(%struct.gsn_t* %0, i32 %1, %struct.sockaddr_in* %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca %struct.gsn_t*
%9 = alloca i32
%10 = alloca %struct.sockaddr_in*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store %struct.gsn_t* %0, %struct.gsn_t** %8
store i32 %1, i32* %9
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
%14 = load %struct.gsn_t*, %struct.gsn_t** %8
%15 = load %struct.sockaddr_in*, %struct.sockaddr_in** %10
%16 = load i8*, i8** %12
%17 = call i32 @get_seq(i8* %16)
%18 = call i32 @gtp_dublicate(%struct.gsn_t* %14, i32 0, %struct.sockaddr_in* %15, i32 %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %6
store i32 0, i32* %7
br label %29
21: ; preds = %6
%22 = load %struct.gsn_t*, %struct.gsn_t** %8
%23 = load i32, i32* %9
%24 = load %struct.sockaddr_in*, %struct.sockaddr_in** %10
%25 = load i32, i32* %11
%26 = load i8*, i8** %12
%27 = load i32, i32* %13
%28 = call i32 @gtp_echo_resp(%struct.gsn_t* %22, i32 %23, %struct.sockaddr_in* %24, i32 %25, i8* %26, i32 %27)
store i32 %28, i32* %7
br label %29
29: ; preds = %21, %20
%30 = load i32, i32* %7
ret i32 %30
}

LLVM IR (-O2):
%struct.gsn_t = type { i32 }
%struct.sockaddr_in = type { i32 }
define i32 @gtp_echo_ind(%struct.gsn_t* %0, i32 %1, %struct.sockaddr_in* %2, i32 %3, i8* %4, i32 %5) {
%7 = tail call i32 @get_seq(i8* %4)
%8 = tail call i32 @gtp_dublicate(%struct.gsn_t* %0, i32 0, %struct.sockaddr_in* %2, i32 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @gtp_echo_resp(%struct.gsn_t* %0, i32 %1, %struct.sockaddr_in* %2, i32 %3, i8* %4, i32 %5)
br label %12
12: ; preds = %6, %10
%13 = phi i32 [ %11, %10 ], [ 0, %6 ]
ret i32 %13
}