#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_l(char *content, int size) {
  unsigned int width = size / 3 + 3;
  unsigned int height = 1;
  const char _bmp_header1[18] = {0x42, 0x4d, 0x2f, 0x2a, 0x00, 0x00,
                                 0x00, 0x00, 0x00, 0x00, 0x7a, 0x00,
                                 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00};
  char sizew[4], sizeh[4];
  const char _bmp_header2[134 - 32] = {
      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,
      0x2a, 0x2f, 0x3d, 0x30, 0x3b, 0x0a};
  const char _bmp_footer[6] = {0x2f, 0x2f, 0x00, 0x00, 0x00, 0x00};
  char *buffer = (char *)malloc(134 + size);
  for (int i = 0; i < 4; i++) {
    sizew[i] = (width >> i * 8) & 0xff;
    sizeh[i] = (height >> i * 8) & 0xff;
  }
  memcpy(buffer, _bmp_header1, 18);
  memcpy(&buffer[18], sizew, 4);
  memcpy(&buffer[22], sizeh, 4);
  memcpy(&buffer[26], _bmp_header2, 134 - 26);
  memcpy(&buffer[134 - 6], content, size);
  memcpy(&buffer[134 - 6 + size], _bmp_footer, 6);
  return buffer;
}


x86 assembly (clang, -O0):
<bmp_js_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea9(%rip),%ax
mov    %ax,-0x20(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x66,%edx
call   1030 <memcpy@plt>
mov    0xefd(%rip),%eax
mov    %eax,-0xa6(%rbp)
mov    0xef4(%rip),%ax
mov    %ax,-0xa2(%rbp)
mov    -0xc(%rbp),%edi
add    $0x86,%edi
call   1040 <malloc@plt>
mov    %rax,-0xb0(%rbp)
movl   $0x0,-0xb4(%rbp)
cmpl   $0x4,-0xb4(%rbp)
jge    121d <bmp_js_l+0xfd>
mov    -0x10(%rbp),%eax
mov    -0xb4(%rbp),%ecx
shl    $0x3,%ecx
shr    %cl,%eax
and    $0xff,%eax
mov    %al,%cl
movslq -0xb4(%rbp),%rax
mov    %cl,-0x34(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
mov    -0xb4(%rbp),%ecx
shl    $0x3,%ecx
shr    %cl,%eax
and    $0xff,%eax
mov    %al,%cl
movslq -0xb4(%rbp),%rax
mov    %cl,-0x38(%rbp,%rax,1)
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    11bc <bmp_js_l+0x9c>
mov    -0xb0(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x12,%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rdi
add    $0x12,%rdi
lea    -0x34(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rdi
add    $0x16,%rdi
lea    -0x38(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rdi
add    $0x1a,%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x6c,%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rdi
add    $0x80,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    $0x80,%eax
cltq
add    %rax,%rdi
lea    -0xa6(%rbp),%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
mov    -0xb0(%rbp),%rax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmp_js_l>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%r14
movslq %esi,%r15
imul   $0x55555556,%r15,%rax
mov    %rax,%rcx
shr    $0x20,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%ebx
add    $0x3,%ebx
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movw   $0x0,0x20(%rsp)
movaps 0xf0a(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe7b(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movabs $0xa3b303d2f2a0000,%rax
30 3b 0a
mov    %rax,0x8e(%rsp)
movw   $0x0,0x8(%rsp)
movl   $0x2f2f,0x4(%rsp)
lea    0x86(%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%r12
mov    %bl,(%rsp)
movl   $0x1,0xc(%rsp)
mov    %bh,0x1(%rsp)
mov    %ebx,%eax
shr    $0x10,%eax
mov    %al,0x2(%rsp)
shr    $0x18,%ebx
mov    %bl,0x3(%rsp)
lea    0x10(%rsp),%rsi
mov    %r12,%rdi
mov    $0x12,%edx
call   1030 <memcpy@plt>
lea    0x12(%r12),%rdi
mov    %rsp,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
lea    0x16(%r12),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
lea    0x1a(%r12),%rdi
lea    0x30(%rsp),%rsi
mov    $0x6c,%edx
call   1030 <memcpy@plt>
lea    0x80(%r12),%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
lea    (%r15,%r12,1),%rdi
add    $0x80,%rdi
lea    0x4(%rsp),%rsi
mov    $0x6,%edx
call   1030 <memcpy@plt>
mov    %r12,%rax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.bmp_js_l._bmp_header1 = [18 x i8] c"BM/*\00\00\00\00\00\00z\00\00\00l\00\00\00"
@__const.bmp_js_l._bmp_header2 = [102 x i8] c"\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*/=0;\0A"
@__const.bmp_js_l._bmp_footer = [6 x i8] c"//\00\00\00\00"
define i8* @bmp_js_l(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [18 x i8]
%8 = alloca [4 x i8]
%9 = alloca [4 x i8]
%10 = alloca [102 x i8]
%11 = alloca [6 x i8]
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 3
%16 = add nsw i32 %15, 3
store i32 %16, i32* %5
store i32 1, i32* %6
%17 = bitcast [18 x i8]* %7 to i8*
%18 = bitcast [102 x i8]* %10 to i8*
%19 = bitcast [6 x i8]* %11 to i8*
%20 = load i32, i32* %4
%21 = add nsw i32 134, %20
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %12
store i32 0, i32* %13
br label %24
24: ; preds = %46, %2
%25 = load i32, i32* %13
%26 = icmp slt i32 %25, 4
br i1 %26, label %27, label %49
27: ; preds = %24
%28 = load i32, i32* %5
%29 = load i32, i32* %13
%30 = mul nsw i32 %29, 8
%31 = lshr i32 %28, %30
%32 = and i32 %31, 255
%33 = trunc i32 %32 to i8
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 %35
store i8 %33, i8* %36
%37 = load i32, i32* %6
%38 = load i32, i32* %13
%39 = mul nsw i32 %38, 8
%40 = lshr i32 %37, %39
%41 = and i32 %40, 255
%42 = trunc i32 %41 to i8
%43 = load i32, i32* %13
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 %44
store i8 %42, i8* %45
br label %46
46: ; preds = %27
%47 = load i32, i32* %13
%48 = add nsw i32 %47, 1
store i32 %48, i32* %13
br label %24
49: ; preds = %24
%50 = load i8*, i8** %12
%51 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%52 = call i32 @memcpy(i8* %50, i8* %51, i32 18)
%53 = load i8*, i8** %12
%54 = getelementptr inbounds i8, i8* %53, i64 18
%55 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%56 = call i32 @memcpy(i8* %54, i8* %55, i32 4)
%57 = load i8*, i8** %12
%58 = getelementptr inbounds i8, i8* %57, i64 22
%59 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%60 = call i32 @memcpy(i8* %58, i8* %59, i32 4)
%61 = load i8*, i8** %12
%62 = getelementptr inbounds i8, i8* %61, i64 26
%63 = getelementptr inbounds [102 x i8], [102 x i8]* %10, i64 0, i64 0
%64 = call i32 @memcpy(i8* %62, i8* %63, i32 108)
%65 = load i8*, i8** %12
%66 = getelementptr inbounds i8, i8* %65, i64 128
%67 = load i8*, i8** %3
%68 = load i32, i32* %4
%69 = call i32 @memcpy(i8* %66, i8* %67, i32 %68)
%70 = load i8*, i8** %12
%71 = load i32, i32* %4
%72 = add nsw i32 128, %71
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %70, i64 %73
%75 = getelementptr inbounds [6 x i8], [6 x i8]* %11, i64 0, i64 0
%76 = call i32 @memcpy(i8* %74, i8* %75, i32 6)
%77 = load i8*, i8** %12
ret i8* %77
}

LLVM IR (-O2):
@__const.bmp_js_l._bmp_header1 = [18 x i8] c"BM/*\00\00\00\00\00\00z\00\00\00l\00\00\00"
@__const.bmp_js_l._bmp_header2 = [102 x i8] c"\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*/=0;\0A"
@__const.bmp_js_l._bmp_footer = [6 x i8] c"//\00\00\00\00"
define i8* @bmp_js_l(i8* %0, i32 %1) {
%3 = alloca [18 x i8]
%4 = alloca [4 x i8]
%5 = alloca [4 x i8]
%6 = alloca [102 x i8]
%7 = alloca [6 x i8]
%8 = sdiv i32 %1, 3
%9 = add nsw i32 %8, 3
%10 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [102 x i8], [102 x i8]* %6, i64 0, i64 0
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%15 = add nsw i32 %1, 134
%16 = tail call i64 @malloc(i32 %15)
%17 = trunc i32 %9 to i8
store i8 %17, i8* %11
store i8 1, i8* %12
%18 = lshr i32 %9, 8
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
store i8 %19, i8* %20
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 1
store i8 0, i8* %21
%22 = lshr i32 %9, 16
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
store i8 %23, i8* %24
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
store i8 0, i8* %25
%26 = lshr i32 %9, 24
%27 = trunc i32 %26 to i8
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
store i8 %27, i8* %28
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 3
store i8 0, i8* %29
%30 = inttoptr i64 %16 to i8*
%31 = call i32 @memcpy(i8* %30, i8* %10, i32 18)
%32 = getelementptr inbounds i8, i8* %30, i64 18
%33 = call i32 @memcpy(i8* %32, i8* %11, i32 4)
%34 = getelementptr inbounds i8, i8* %30, i64 22
%35 = call i32 @memcpy(i8* %34, i8* %12, i32 4)
%36 = getelementptr inbounds i8, i8* %30, i64 26
%37 = call i32 @memcpy(i8* %36, i8* %13, i32 108)
%38 = getelementptr inbounds i8, i8* %30, i64 128
%39 = call i32 @memcpy(i8* %38, i8* %0, i32 %1)
%40 = add nsw i32 %1, 128
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %30, i64 %41
%43 = call i32 @memcpy(i8* %42, i8* %14, i32 6)
ret i8* %30
}