#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 */

/* Variables and functions */
int /*<<< orphan*/ signed_int_to_two_bytes(int, unsigned char *);
int /*<<< orphan*/ unsigned_int_to_two_bytes(int, unsigned char *);
void stuff_three_signed_int(int length, int ptype, int num1, int num2, int num3,
                            unsigned char *byte_ptr) {
  byte_ptr++;
  unsigned_int_to_two_bytes(length, byte_ptr);
  byte_ptr++;
  byte_ptr++;
  *byte_ptr = ptype;
  byte_ptr++;
  signed_int_to_two_bytes(num1, byte_ptr);
  byte_ptr++;
  byte_ptr++;
  signed_int_to_two_bytes(num2, byte_ptr);
  byte_ptr++;
  byte_ptr++;
  signed_int_to_two_bytes(num3, byte_ptr);
}


x86 assembly (clang, -O0):
<stuff_three_signed_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <unsigned_int_to_two_bytes@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <signed_int_to_two_bytes@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <signed_int_to_two_bytes@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <signed_int_to_two_bytes@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stuff_three_signed_int>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9,%rbx
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%ebp
lea    0x1(%r9),%rsi
call   1040 <unsigned_int_to_two_bytes@plt>
mov    %bpl,0x3(%rbx)
lea    0x4(%rbx),%rsi
mov    %r12d,%edi
call   1030 <signed_int_to_two_bytes@plt>
lea    0x6(%rbx),%rsi
mov    %r15d,%edi
call   1030 <signed_int_to_two_bytes@plt>
add    $0x8,%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <signed_int_to_two_bytes@plt>

LLVM IR (-O0):
define void @stuff_three_signed_int(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %12
%15 = load i32, i32* %7
%16 = load i8*, i8** %12
%17 = call i32 @unsigned_int_to_two_bytes(i32 %15, i8* %16)
%18 = load i8*, i8** %12
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %12
%20 = load i8*, i8** %12
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %12
%22 = load i32, i32* %8
%23 = trunc i32 %22 to i8
%24 = load i8*, i8** %12
store i8 %23, i8* %24
%25 = load i8*, i8** %12
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %12
%27 = load i32, i32* %9
%28 = load i8*, i8** %12
%29 = call i32 @signed_int_to_two_bytes(i32 %27, i8* %28)
%30 = load i8*, i8** %12
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %12
%32 = load i8*, i8** %12
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %12
%34 = load i32, i32* %10
%35 = load i8*, i8** %12
%36 = call i32 @signed_int_to_two_bytes(i32 %34, i8* %35)
%37 = load i8*, i8** %12
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %12
%39 = load i8*, i8** %12
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %12
%41 = load i32, i32* %11
%42 = load i8*, i8** %12
%43 = call i32 @signed_int_to_two_bytes(i32 %41, i8* %42)
ret void
}

LLVM IR (-O2):
define void @stuff_three_signed_int(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = getelementptr inbounds i8, i8* %5, i64 1
%8 = tail call i32 @unsigned_int_to_two_bytes(i32 %0, i8* %7)
%9 = getelementptr inbounds i8, i8* %5, i64 3
%10 = trunc i32 %1 to i8
store i8 %10, i8* %9
%11 = getelementptr inbounds i8, i8* %5, i64 4
%12 = tail call i32 @signed_int_to_two_bytes(i32 %2, i8* %11)
%13 = getelementptr inbounds i8, i8* %5, i64 6
%14 = tail call i32 @signed_int_to_two_bytes(i32 %3, i8* %13)
%15 = getelementptr inbounds i8, i8* %5, i64 8
%16 = tail call i32 @signed_int_to_two_bytes(i32 %4, i8* %15)
ret void
}