#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 /*<<< orphan*/ my_memcpy(int **, int *, int);
void add_datablockcmd(uint8_t **dest, uint8_t dtype, uint32_t size,
                      uint32_t romsize, uint32_t offset) {
  **dest = 0x67;
  *dest += 1;
  **dest = 0x66;
  *dest += 1;
  **dest = dtype;
  *dest += 1;
  size += 8;
  my_memcpy(dest, &size, 4);
  my_memcpy(dest, &romsize, 4);
  my_memcpy(dest, &offset, 4);
}


x86 assembly (clang, -O0):
<add_datablockcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0x67,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0x66,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <my_memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <my_memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <my_memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_datablockcmd>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %edx,0x4(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
mov    (%rdi),%rax
movabs $0x6600000067,%rcx
mov    %rcx,(%rax)
mov    %esi,0x8(%rax)
add    $0xc,%rax
mov    %rax,(%rdi)
addl   $0x8,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <my_memcpy@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <my_memcpy@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <my_memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @add_datablockcmd(i32** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32** %0, i32*** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32**, i32*** %6
%12 = load i32*, i32** %11
store i32 103, i32* %12
%13 = load i32**, i32*** %6
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32* %15, i32** %13
%16 = load i32**, i32*** %6
%17 = load i32*, i32** %16
store i32 102, i32* %17
%18 = load i32**, i32*** %6
%19 = load i32*, i32** %18
%20 = getelementptr inbounds i32, i32* %19, i64 1
store i32* %20, i32** %18
%21 = load i32, i32* %7
%22 = load i32**, i32*** %6
%23 = load i32*, i32** %22
store i32 %21, i32* %23
%24 = load i32**, i32*** %6
%25 = load i32*, i32** %24
%26 = getelementptr inbounds i32, i32* %25, i64 1
store i32* %26, i32** %24
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 8
store i32 %28, i32* %8
%29 = load i32**, i32*** %6
%30 = call i32 @my_memcpy(i32** %29, i32* %8, i32 4)
%31 = load i32**, i32*** %6
%32 = call i32 @my_memcpy(i32** %31, i32* %9, i32 4)
%33 = load i32**, i32*** %6
%34 = call i32 @my_memcpy(i32** %33, i32* %10, i32 4)
ret void
}

LLVM IR (-O2):
define void @add_datablockcmd(i32** %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %2, i32* %6
store i32 %3, i32* %7
store i32 %4, i32* %8
%9 = load i32*, i32** %0
store i32 103, i32* %9
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32 102, i32* %10
%11 = getelementptr inbounds i32, i32* %9, i64 2
store i32 %1, i32* %11
%12 = getelementptr inbounds i32, i32* %9, i64 3
store i32* %12, i32** %0
%13 = load i32, i32* %6
%14 = add nsw i32 %13, 8
store i32 %14, i32* %6
%15 = call i32 @my_memcpy(i32** %0, i32* %6, i32 4)
%16 = call i32 @my_memcpy(i32** %0, i32* %7, i32 4)
%17 = call i32 @my_memcpy(i32** %0, i32* %8, i32 4)
ret void
}