#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 ss7 {
  int dummy;
};

/* Variables and functions */
int isup_send_message_ciconly(struct ss7 *, int, int, unsigned int);
int /*<<< orphan*/ ss7_error(struct ss7 *, char *, unsigned int);
int isup_lpa(struct ss7 *ss7, int cic, unsigned int dpc) {
  int res;
  if (!ss7) {
    return -1;
  }
  res = isup_send_message_ciconly(ss7, 0x24, cic, dpc);
  if (res == -1) {
    ss7_error(ss7, "Unable to send LPA to DPC: %d\n", dpc);
  }
  return res;
}


x86 assembly (clang, -O0):
<isup_lpa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1149 <isup_lpa+0x29>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <isup_lpa+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    $0x24,%esi
call   1040 <isup_send_message_ciconly@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    117d <isup_lpa+0x5d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe88(%rip),%rsi
call   1030 <ss7_error@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isup_lpa>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     115b <isup_lpa+0x3b>
mov    %edx,%ebp
mov    %esi,%edx
mov    %rdi,%rbx
mov    $0x24,%esi
mov    %ebp,%ecx
call   1040 <isup_send_message_ciconly@plt>
cmp    $0xffffffff,%eax
jne    115b <isup_lpa+0x3b>
lea    0xeb4(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1030 <ss7_error@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.ss7 = type { i32 }
@.str = [31 x i8] c"Unable to send LPA to DPC: %d\0A\00"
define i32 @isup_lpa(%struct.ss7* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.ss7*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.ss7* %0, %struct.ss7** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load %struct.ss7*, %struct.ss7** %5
%10 = icmp ne %struct.ss7* %9, null
br i1 %10, label %12, label %11
11: ; preds = %3
store i32 -1, i32* %4
br label %25
12: ; preds = %3
%13 = load %struct.ss7*, %struct.ss7** %5
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = call i32 @isup_send_message_ciconly(%struct.ss7* %13, i32 36, i32 %14, i32 %15)
store i32 %16, i32* %8
%17 = load i32, i32* %8
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %23
19: ; preds = %12
%20 = load %struct.ss7*, %struct.ss7** %5
%21 = load i32, i32* %7
%22 = call i32 @ss7_error(%struct.ss7* %20, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %12
%24 = load i32, i32* %8
store i32 %24, i32* %4
br label %25
25: ; preds = %23, %11
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.ss7 = type { i32 }
@.str = [31 x i8] c"Unable to send LPA to DPC: %d\0A\00"
define i32 @isup_lpa(%struct.ss7* %0, i32 %1, i32 %2) {
%4 = icmp eq %struct.ss7* %0, null
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = tail call i32 @isup_send_message_ciconly(%struct.ss7* %0, i32 36, i32 %1, i32 %2)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @ss7_error(%struct.ss7* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %10
10: ; preds = %5, %8, %3
%11 = phi i32 [ -1, %3 ], [ -1, %8 ], [ %6, %5 ]
ret i32 %11
}