#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
int send_msg_to_aggregator(int *, int, char *);
int aggregator_report(int proc_id, uint32_t tput, char *server_ip) {
  uint8_t msg[5];
  msg[0] = proc_id;
  msg[1] = (tput >> 24) & 0xFF;
  msg[2] = (tput >> 16) & 0xFF;
  msg[3] = (tput >> 8) & 0xFF;
  msg[4] = tput & 0xFF;
  return send_msg_to_aggregator(msg, 5, server_ip);
}


x86 assembly (clang, -O0):
<aggregator_report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x5,%esi
call   1030 <send_msg_to_aggregator@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aggregator_report>:
sub    $0x18,%rsp
mov    %esi,%eax
mov    %edi,(%rsp)
mov    %esi,%ecx
movzbl %ah,%esi
movzbl %al,%edi
shr    $0x18,%eax
mov    %eax,0x4(%rsp)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x8(%rsp)
mov    %esi,0xc(%rsp)
mov    %edi,0x10(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <send_msg_to_aggregator@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @aggregator_report(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [5 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %5
%11 = ashr i32 %10, 24
%12 = and i32 %11, 255
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 1
store i32 %12, i32* %13
%14 = load i32, i32* %5
%15 = ashr i32 %14, 16
%16 = and i32 %15, 255
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 2
store i32 %16, i32* %17
%18 = load i32, i32* %5
%19 = ashr i32 %18, 8
%20 = and i32 %19, 255
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 3
store i32 %20, i32* %21
%22 = load i32, i32* %5
%23 = and i32 %22, 255
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 4
store i32 %23, i32* %24
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 0
%26 = load i8*, i8** %6
%27 = call i32 @send_msg_to_aggregator(i32* %25, i32 5, i8* %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @aggregator_report(i32 %0, i32 %1, i8* %2) {
%4 = alloca [5 x i32]
%5 = bitcast [5 x i32]* %4 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
store i32 %0, i32* %6
%7 = lshr i32 %1, 24
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 1
store i32 %7, i32* %8
%9 = lshr i32 %1, 16
%10 = and i32 %9, 255
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 2
store i32 %10, i32* %11
%12 = lshr i32 %1, 8
%13 = and i32 %12, 255
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 3
store i32 %13, i32* %14
%15 = and i32 %1, 255
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 4
store i32 %15, i32* %16
%17 = call i32 @send_msg_to_aggregator(i32* %6, i32 5, i8* %2)
ret i32 %17
}