#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*/ num_rt;
typedef int /*<<< orphan*/ data_size;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ memcpy(void *, void *, int);
int /*<<< orphan*/ perror(char *);
int write(int, char *, int);
void send_round_trip_num_and_data_size(int client_socket, long num_rt,
                                       long data_size) {
  char buf[128];
  memcpy((void *)buf, (void *)&num_rt, sizeof(num_rt));
  if (write(client_socket, buf, sizeof(num_rt)) == -1) {
    perror("write rt_num failed\n");
    exit(-1);
  }
  memcpy((void *)buf, (void *)&data_size, sizeof(data_size));
  if (write(client_socket, buf, sizeof(data_size)) == -1) {
    perror("write data_size failed\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<send_round_trip_num_and_data_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0xa0(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    119e <send_round_trip_num_and_data_size+0x5e>
lea    0xe71(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    11e6 <send_round_trip_num_and_data_size+0xa6>
lea    0xe3e(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_round_trip_num_and_data_size>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %edi,%ebx
mov    %rsi,0x8(%rsp)
mov    %rdx,(%rsp)
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
je     11b4 <send_round_trip_num_and_data_size+0x74>
lea    0x10(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
je     11bd <send_round_trip_num_and_data_size+0x7d>
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe45(%rip),%rdi
jmp    11c4 <send_round_trip_num_and_data_size+0x84>
lea    0xe51(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"write rt_num failed\0A\00"
@.str.1 = [24 x i8] c"write data_size failed\0A\00"
define void @send_round_trip_num_and_data_size(i32 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca [128 x i8]
store i32 %0, i32* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%9 = bitcast i64* %5 to i8*
%10 = call i32 @memcpy(i8* %8, i8* %9, i32 8)
%11 = load i32, i32* %4
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%13 = call i32 @write(i32 %11, i8* %12, i32 8)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %3
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%20 = bitcast i64* %6 to i8*
%21 = call i32 @memcpy(i8* %19, i8* %20, i32 8)
%22 = load i32, i32* %4
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%24 = call i32 @write(i32 %22, i8* %23, i32 8)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %29
26: ; preds = %18
%27 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @exit(i32 -1)
unreachable
29: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"write rt_num failed\0A\00"
@.str.1 = [24 x i8] c"write data_size failed\0A\00"
define void @send_round_trip_num_and_data_size(i32 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca [128 x i8]
store i64 %1, i64* %4
store i64 %2, i64* %5
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%8 = bitcast i64* %4 to i8*
%9 = call i32 @memcpy(i8* %7, i8* %8, i32 8)
%10 = call i32 @write(i32 %0, i8* %7, i32 8)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %3
%16 = bitcast i64* %5 to i8*
%17 = call i32 @memcpy(i8* %7, i8* %16, i32 8)
%18 = call i32 @write(i32 %0, i8* %7, i32 8)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @exit(i32 -1)
unreachable
23: ; preds = %15
ret void
}