#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *bmp_js(char *content, int size) {
  const char _bmp_header[139] = {
      0x42, 0x4d, 0x3d, 0x30, 0x3b, 0x2f, 0x2f, 0x00, 0x00, 0x00, 0x7a, 0x00,
      0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
      0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
      0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff,
      0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x0a};
  char *buffer = (char *)malloc(139 + size);
  memcpy(buffer, _bmp_header, 139);
  memcpy(&buffer[139], content, size);
  return buffer;
}


x86 assembly (clang, -O0):
<bmp_js>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0x8b,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%edi
add    $0x8b,%edi
call   1040 <malloc@plt>
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x8b,%edx
call   1030 <memcpy@plt>
mov    -0xa8(%rbp),%rdi
add    $0x8b,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0xa8(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmp_js>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %esi,%r12d
mov    %rdi,%r14
lea    0xec5(%rip),%rsi
mov    %rsp,%r15
mov    $0x8b,%edx
mov    %r15,%rdi
call   1030 <memcpy@plt>
lea    0x8b(%r12),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    $0x8b,%edx
call   1030 <memcpy@plt>
lea    0x8b(%rbx),%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.bmp_js._bmp_header = [139 x i8] c"BM=0;//\00\00\00z\00\00\00l\00\00\00\02\00\00\00\02\00\00\00\01\00\18\00\00\00\00\00\10\00\00\00\13\0B\00\00\13\0B\00\00\00\00\00\00\00\00\00\00BGRs\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\00\00\FF\FF\FF\FF\FF\FF\00\00\0A"
define i8* @bmp_js(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [139 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = bitcast [139 x i8]* %5 to i8*
%8 = load i32, i32* %4
%9 = add nsw i32 139, %8
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = getelementptr inbounds [139 x i8], [139 x i8]* %5, i64 0, i64 0
%14 = call i32 @memcpy(i8* %12, i8* %13, i32 139)
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i64 139
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = call i32 @memcpy(i8* %16, i8* %17, i32 %18)
%20 = load i8*, i8** %6
ret i8* %20
}

LLVM IR (-O2):
@__const.bmp_js._bmp_header = [139 x i8] c"BM=0;//\00\00\00z\00\00\00l\00\00\00\02\00\00\00\02\00\00\00\01\00\18\00\00\00\00\00\10\00\00\00\13\0B\00\00\13\0B\00\00\00\00\00\00\00\00\00\00BGRs\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\FF\FF\FF\FF\FF\00\00\FF\FF\FF\FF\FF\FF\00\00\0A"
define i8* @bmp_js(i8* %0, i32 %1) {
%3 = alloca [139 x i8]
%4 = getelementptr inbounds [139 x i8], [139 x i8]* %3, i64 0, i64 0
%5 = add nsw i32 %1, 139
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = call i32 @memcpy(i8* %7, i8* %4, i32 139)
%9 = getelementptr inbounds i8, i8* %7, i64 139
%10 = call i32 @memcpy(i8* %9, i8* %0, i32 %1)
ret i8* %7
}