#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 pce_client_data {
  int dummy;
};
typedef int /*<<< orphan*/ pcep_open;
typedef int /*<<< orphan*/ pcep_keepalive;
typedef int /*<<< orphan*/ pcep_close;

/* Variables and functions */
int /*<<< orphan*/ pcep_client_send(struct pce_client_data *, char const *,
                                    int);
int /*<<< orphan*/ sleep(int);
int pce_client_session(struct pce_client_data *data) {
  const char pcep_open[] = {
      0x20, 0x01, 0x00, 0x0C, 0x01, 0x10, 0x00, 0x08, 0x20, 0x00, 0x00, 0x00,
  };
  const char pcep_keepalive[] = {
      0x20,
      0x02,
      0x00,
      0x04,
  };
  const char pcep_close[] = {
      0x20, 0x07, 0x00, 0x0C, 0x0F, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
  };
  pcep_client_send(data, pcep_open, sizeof(pcep_open));
  sleep(1);
  pcep_client_send(data, pcep_keepalive, sizeof(pcep_keepalive));
  sleep(2);
  pcep_client_send(data, pcep_close, sizeof(pcep_close));
  sleep(3);
  return 0;
}


x86 assembly (clang, -O0):
<pce_client_session>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xc(%rbp)
mov    0xed2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xebc(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xeba(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0xc,%edx
call   1030 <pcep_client_send@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <pcep_client_send@plt>
mov    $0x2,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%rdi
lea    -0x24(%rbp),%rsi
mov    $0xc,%edx
call   1030 <pcep_client_send@plt>
mov    $0x3,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pce_client_session>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movabs $0x80010010c000120,%rax
mov    %rax,0x20(%rsp)
movl   $0x20,0x28(%rsp)
movl   $0x4000220,0xc(%rsp)
04
movabs $0x800100f0c000720,%rax
mov    %rax,0x10(%rsp)
movl   $0x0,0x18(%rsp)
lea    0x20(%rsp),%rsi
mov    $0xc,%edx
call   1030 <pcep_client_send@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <pcep_client_send@plt>
mov    $0x2,%edi
call   1040 <sleep@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xc,%edx
call   1030 <pcep_client_send@plt>
mov    $0x3,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.pce_client_data = type { i32 }
@__const.pce_client_session.pcep_open = [12 x i8] c" \01\00\0C\01\10\00\08 \00\00\00"
@__const.pce_client_session.pcep_keepalive = [4 x i8] c" \02\00\04"
@__const.pce_client_session.pcep_close = [12 x i8] c" \07\00\0C\0F\10\00\08\00\00\00\00"
define i32 @pce_client_session(%struct.pce_client_data* %0) {
%2 = alloca %struct.pce_client_data*
%3 = alloca [12 x i8]
%4 = alloca [4 x i8]
%5 = alloca [12 x i8]
store %struct.pce_client_data* %0, %struct.pce_client_data** %2
%6 = bitcast [12 x i8]* %3 to i8*
%7 = bitcast [4 x i8]* %4 to i8*
%8 = bitcast [12 x i8]* %5 to i8*
%9 = load %struct.pce_client_data*, %struct.pce_client_data** %2
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%11 = call i32 @pcep_client_send(%struct.pce_client_data* %9, i8* %10, i32 12)
%12 = call i32 @sleep(i32 1)
%13 = load %struct.pce_client_data*, %struct.pce_client_data** %2
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%15 = call i32 @pcep_client_send(%struct.pce_client_data* %13, i8* %14, i32 4)
%16 = call i32 @sleep(i32 2)
%17 = load %struct.pce_client_data*, %struct.pce_client_data** %2
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%19 = call i32 @pcep_client_send(%struct.pce_client_data* %17, i8* %18, i32 12)
%20 = call i32 @sleep(i32 3)
ret i32 0
}

LLVM IR (-O2):
%struct.pce_client_data = type { i32 }
@__const.pce_client_session.pcep_open = [12 x i8] c" \01\00\0C\01\10\00\08 \00\00\00"
@__const.pce_client_session.pcep_close = [12 x i8] c" \07\00\0C\0F\10\00\08\00\00\00\00"
define i32 @pce_client_session(%struct.pce_client_data* %0) {
%2 = alloca [12 x i8]
%3 = alloca i32
%4 = alloca [12 x i8]
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
store i32 67109408, i32* %3
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%8 = call i32 @pcep_client_send(%struct.pce_client_data* %0, i8* %5, i32 12)
%9 = call i32 @sleep(i32 1)
%10 = call i32 @pcep_client_send(%struct.pce_client_data* %0, i8* %6, i32 4)
%11 = call i32 @sleep(i32 2)
%12 = call i32 @pcep_client_send(%struct.pce_client_data* %0, i8* %7, i32 12)
%13 = call i32 @sleep(i32 3)
ret i32 0
}