#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 /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ *generate_arm_cmd_add_r_r_r_lsl(int /*<<< orphan*/ *, int,
                                                   int, int, int);
int /*<<< orphan*/ *generate_arm_cmd_ldrb_r_r_offs(int /*<<< orphan*/ *, int,
                                                   int, int);
int /*<<< orphan*/ *generate_arm_cmd_mov_r_r_lsr(int /*<<< orphan*/ *, int, int,
                                                 int);
int get_pix(int, int, int, int, int *, int *);
uint32_t *generate_32bit_scaled_data_write(uint32_t *p, int quality, int orig_w,
                                           int dest_w, int buf1reg, int size1,
                                           int offs1, int buf2reg, int size2,
                                           int offs2, int buf3reg, int size3,
                                           int offs3, int buf4reg, int size4,
                                           int offs4) {
  int p1, p2;
  int type_y1, type_y2, type_u, type_v;
  type_y1 =
      get_pix(quality, orig_w / size1, dest_w / size1, offs1 / size1, &p1, &p2);
  if (type_y1 == 0) {
    p = generate_arm_cmd_ldrb_r_r_offs(p, 4, buf1reg, p1);
  } else {
    p = generate_arm_cmd_ldrb_r_r_offs(p, 5, buf1reg, p1);
    p = generate_arm_cmd_ldrb_r_r_offs(p, 6, buf1reg, p2);
  }
  type_u =
      get_pix(quality, orig_w / size2, dest_w / size2, offs2 / size2, &p1, &p2);
  p = generate_arm_cmd_ldrb_r_r_offs(p, 7, buf2reg, p1);
  if (type_u != 0)
    p = generate_arm_cmd_ldrb_r_r_offs(p, 8, buf2reg, p2);
  type_y2 =
      get_pix(quality, orig_w / size3, dest_w / size3, offs3 / size3, &p1, &p2);
  p = generate_arm_cmd_ldrb_r_r_offs(p, 9, buf3reg, p1);
  if (type_y2 != 0)
    p = generate_arm_cmd_ldrb_r_r_offs(p, 10, buf3reg, p2);
  type_v =
      get_pix(quality, orig_w / size4, dest_w / size4, offs4 / size4, &p1, &p2);
  p = generate_arm_cmd_ldrb_r_r_offs(p, 11, buf4reg, p1);
  if (type_v != 0)
    p = generate_arm_cmd_ldrb_r_r_offs(p, 12, buf4reg, p2);
  if (type_y1 == 2) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 14, 5, 6, 0);
    p = generate_arm_cmd_mov_r_r_lsr(p, 4, 14, 1);
  }
  if (type_u == 0) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 4, 4, 7, 8);
  } else if (type_u == 2) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 14, 7, 8, 0);
    p = generate_arm_cmd_mov_r_r_lsr(p, 14, 14, 1);
    p = generate_arm_cmd_add_r_r_r_lsl(p, 4, 4, 14, 8);
  }
  if (type_y2 == 0) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 4, 4, 9, 16);
  } else if (type_y2 == 2) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 14, 9, 10, 0);
    p = generate_arm_cmd_mov_r_r_lsr(p, 14, 14, 1);
    p = generate_arm_cmd_add_r_r_r_lsl(p, 4, 4, 14, 16);
  }
  if (type_v == 0) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 4, 4, 11, 24);
  } else if (type_v == 2) {
    p = generate_arm_cmd_add_r_r_r_lsl(p, 14, 11, 12, 0);
    p = generate_arm_cmd_mov_r_r_lsr(p, 14, 14, 1);
    p = generate_arm_cmd_add_r_r_r_lsl(p, 4, 4, 14, 24);
  }
  *p++ = 0xE4834004;
  return p;
}


x86 assembly (clang, -O0):
<generate_32bit_scaled_data_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,%esi
mov    -0x14(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x38(%rbp)
mov    0x10(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    -0x38(%rbp),%edx
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1030 <get_pix@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    11d4 <generate_32bit_scaled_data_write+0x94>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x4,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
jmp    1204 <generate_32bit_scaled_data_write+0xc4>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x5,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    $0x6,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%eax
cltd
idivl  0x20(%rbp)
mov    %eax,%esi
mov    -0x14(%rbp),%eax
cltd
idivl  0x20(%rbp)
mov    %eax,-0x3c(%rbp)
mov    0x28(%rbp),%eax
cltd
idivl  0x20(%rbp)
mov    -0x3c(%rbp),%edx
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1030 <get_pix@plt>
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x18(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x7,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     1270 <generate_32bit_scaled_data_write+0x130>
mov    -0x8(%rbp),%rdi
mov    0x18(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    $0x8,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%eax
cltd
idivl  0x38(%rbp)
mov    %eax,%esi
mov    -0x14(%rbp),%eax
cltd
idivl  0x38(%rbp)
mov    %eax,-0x40(%rbp)
mov    0x40(%rbp),%eax
cltd
idivl  0x38(%rbp)
mov    -0x40(%rbp),%edx
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1030 <get_pix@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x30(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x9,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     12dc <generate_32bit_scaled_data_write+0x19c>
mov    -0x8(%rbp),%rdi
mov    0x30(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    $0xa,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%eax
cltd
idivl  0x50(%rbp)
mov    %eax,%esi
mov    -0x14(%rbp),%eax
cltd
idivl  0x50(%rbp)
mov    %eax,-0x44(%rbp)
mov    0x58(%rbp),%eax
cltd
idivl  0x50(%rbp)
mov    -0x44(%rbp),%edx
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1030 <get_pix@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x48(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0xb,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1348 <generate_32bit_scaled_data_write+0x208>
mov    -0x8(%rbp),%rdi
mov    0x48(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    $0xc,%esi
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x2,-0x28(%rbp)
jne    138d <generate_32bit_scaled_data_write+0x24d>
mov    -0x8(%rbp),%rdi
mov    $0xe,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
mov    $0xe,%edx
mov    $0x1,%ecx
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    13bb <generate_32bit_scaled_data_write+0x27b>
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    $0x7,%ecx
mov    $0x8,%r8d
mov    %edx,%esi
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
jmp    1421 <generate_32bit_scaled_data_write+0x2e1>
cmpl   $0x2,-0x30(%rbp)
jne    141c <generate_32bit_scaled_data_write+0x2dc>
mov    -0x8(%rbp),%rdi
mov    $0xe,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xe,%edx
mov    $0x1,%ecx
mov    %edx,%esi
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    $0xe,%ecx
mov    $0x8,%r8d
mov    %edx,%esi
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
jmp    1421 <generate_32bit_scaled_data_write+0x2e1>
cmpl   $0x0,-0x2c(%rbp)
jne    144f <generate_32bit_scaled_data_write+0x30f>
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    $0x9,%ecx
mov    $0x10,%r8d
mov    %edx,%esi
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
jmp    14b5 <generate_32bit_scaled_data_write+0x375>
cmpl   $0x2,-0x2c(%rbp)
jne    14b0 <generate_32bit_scaled_data_write+0x370>
mov    -0x8(%rbp),%rdi
mov    $0xe,%esi
mov    $0x9,%edx
mov    $0xa,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xe,%edx
mov    $0x1,%ecx
mov    %edx,%esi
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    $0xe,%ecx
mov    $0x10,%r8d
mov    %edx,%esi
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
jmp    14b5 <generate_32bit_scaled_data_write+0x375>
cmpl   $0x0,-0x34(%rbp)
jne    14e3 <generate_32bit_scaled_data_write+0x3a3>
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    $0xb,%ecx
mov    $0x18,%r8d
mov    %edx,%esi
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
jmp    1549 <generate_32bit_scaled_data_write+0x409>
cmpl   $0x2,-0x34(%rbp)
jne    1544 <generate_32bit_scaled_data_write+0x404>
mov    -0x8(%rbp),%rdi
mov    $0xe,%esi
mov    $0xb,%edx
mov    $0xc,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xe,%edx
mov    $0x1,%ecx
mov    %edx,%esi
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%edx
mov    $0xe,%ecx
mov    $0x18,%r8d
mov    %edx,%esi
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,-0x8(%rbp)
jmp    1549 <generate_32bit_scaled_data_write+0x409>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
movl   $0xe4834004,(%rax)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_32bit_scaled_data_write>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%r15d
mov    %rdi,%rbp
mov    0x60(%rsp),%r13d
mov    0x50(%rsp),%edi
mov    %edx,%eax
cltd
idiv   %r9d
mov    %eax,%esi
mov    %ecx,%eax
cltd
idiv   %r9d
mov    %eax,%ecx
mov    %edi,%eax
cltd
idiv   %r9d
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %r15d,%edi
mov    %ecx,%edx
mov    %eax,%ecx
call   1030 <get_pix@plt>
mov    0x8(%rsp),%ecx
mov    %eax,0x14(%rsp)
mov    %rbp,%rdi
test   %eax,%eax
je     11bb <generate_32bit_scaled_data_write+0x7b>
mov    $0x5,%esi
mov    %ebx,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    0x4(%rsp),%ecx
mov    %rax,%rdi
mov    $0x6,%esi
jmp    11c0 <generate_32bit_scaled_data_write+0x80>
mov    $0x4,%esi
mov    %ebx,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,%rbx
mov    %r12d,%eax
cltd
idiv   %r13d
mov    %eax,%esi
mov    %r14d,%eax
cltd
idiv   %r13d
mov    %eax,%ecx
mov    0x68(%rsp),%eax
cltd
idiv   %r13d
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %r15d,%edi
mov    %ecx,%edx
mov    %eax,%ecx
call   1030 <get_pix@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    0x58(%rsp),%r13d
mov    %r13d,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,%rbx
mov    %ebp,0x10(%rsp)
test   %ebp,%ebp
je     1237 <generate_32bit_scaled_data_write+0xf7>
mov    0x4(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r13d,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,%rbx
mov    %r12d,%eax
cltd
mov    0x78(%rsp),%edi
idiv   %edi
mov    %eax,%esi
mov    %r14d,%eax
cltd
idiv   %edi
mov    %eax,%ecx
mov    0x80(%rsp),%eax
cltd
idiv   %edi
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %r15d,%edi
mov    %ecx,%edx
mov    %eax,%ecx
call   1030 <get_pix@plt>
mov    %eax,%r13d
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0x9,%esi
mov    0x70(%rsp),%ebp
mov    %ebp,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,%rbx
mov    %r13d,0xc(%rsp)
test   %r13d,%r13d
je     12a8 <generate_32bit_scaled_data_write+0x168>
mov    0x4(%rsp),%ecx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %ebp,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    %rax,%rbx
mov    %r12d,%eax
cltd
mov    0x90(%rsp),%edi
idiv   %edi
mov    %eax,%esi
mov    %r14d,%eax
cltd
idiv   %edi
mov    %eax,%ecx
mov    0x98(%rsp),%eax
cltd
idiv   %edi
lea    0x8(%rsp),%r8
lea    0x4(%rsp),%r9
mov    %r15d,%edi
mov    %ecx,%edx
mov    %eax,%ecx
call   1030 <get_pix@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    $0xb,%esi
mov    0x88(%rsp),%ebx
mov    %ebx,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
test   %r14d,%r14d
je     1314 <generate_32bit_scaled_data_write+0x1d4>
mov    0x4(%rsp),%ecx
mov    %rax,%rdi
mov    $0xc,%esi
mov    %ebx,%edx
call   1050 <generate_arm_cmd_ldrb_r_r_offs@plt>
mov    0x10(%rsp),%ebx
cmpl   $0x2,0x14(%rsp)
jne    1350 <generate_32bit_scaled_data_write+0x210>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0xe,%edx
mov    $0x1,%ecx
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
cmp    $0x2,%ebx
je     136d <generate_32bit_scaled_data_write+0x22d>
test   %ebx,%ebx
jne    13bb <generate_32bit_scaled_data_write+0x27b>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x7,%ecx
jmp    13b0 <generate_32bit_scaled_data_write+0x270>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0x7,%edx
mov    $0x8,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0xe,%edx
mov    $0x1,%ecx
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0xe,%ecx
mov    $0x8,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    0xc(%rsp),%ecx
cmp    $0x2,%ecx
je     13dc <generate_32bit_scaled_data_write+0x29c>
test   %ecx,%ecx
jne    142a <generate_32bit_scaled_data_write+0x2ea>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0x9,%ecx
jmp    141f <generate_32bit_scaled_data_write+0x2df>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0x9,%edx
mov    $0xa,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0xe,%edx
mov    $0x1,%ecx
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0xe,%ecx
mov    $0x10,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
cmp    $0x2,%r14d
je     1449 <generate_32bit_scaled_data_write+0x309>
test   %r14d,%r14d
jne    1497 <generate_32bit_scaled_data_write+0x357>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0xb,%ecx
jmp    148c <generate_32bit_scaled_data_write+0x34c>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0xb,%edx
mov    $0xc,%ecx
xor    %r8d,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
mov    %rax,%rdi
mov    $0xe,%esi
mov    $0xe,%edx
mov    $0x1,%ecx
call   1040 <generate_arm_cmd_mov_r_r_lsr@plt>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0xe,%ecx
mov    $0x18,%r8d
call   1060 <generate_arm_cmd_add_r_r_r_lsl@plt>
movl   $0xe4834004,(%rax)
add    $0x4,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @generate_32bit_scaled_data_write(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15) {
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
store i32* %0, i32** %17
store i32 %1, i32* %18
store i32 %2, i32* %19
store i32 %3, i32* %20
store i32 %4, i32* %21
store i32 %5, i32* %22
store i32 %6, i32* %23
store i32 %7, i32* %24
store i32 %8, i32* %25
store i32 %9, i32* %26
store i32 %10, i32* %27
store i32 %11, i32* %28
store i32 %12, i32* %29
store i32 %13, i32* %30
store i32 %14, i32* %31
store i32 %15, i32* %32
%39 = load i32, i32* %18
%40 = load i32, i32* %19
%41 = load i32, i32* %22
%42 = sdiv i32 %40, %41
%43 = load i32, i32* %20
%44 = load i32, i32* %22
%45 = sdiv i32 %43, %44
%46 = load i32, i32* %23
%47 = load i32, i32* %22
%48 = sdiv i32 %46, %47
%49 = call i32 @get_pix(i32 %39, i32 %42, i32 %45, i32 %48, i32* %33, i32* %34)
store i32 %49, i32* %35
%50 = load i32, i32* %35
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %16
%53 = load i32*, i32** %17
%54 = load i32, i32* %21
%55 = load i32, i32* %33
%56 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %53, i32 4, i32 %54, i32 %55)
store i32* %56, i32** %17
br label %66
57: ; preds = %16
%58 = load i32*, i32** %17
%59 = load i32, i32* %21
%60 = load i32, i32* %33
%61 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %58, i32 5, i32 %59, i32 %60)
store i32* %61, i32** %17
%62 = load i32*, i32** %17
%63 = load i32, i32* %21
%64 = load i32, i32* %34
%65 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %62, i32 6, i32 %63, i32 %64)
store i32* %65, i32** %17
br label %66
66: ; preds = %57, %52
%67 = load i32, i32* %18
%68 = load i32, i32* %19
%69 = load i32, i32* %25
%70 = sdiv i32 %68, %69
%71 = load i32, i32* %20
%72 = load i32, i32* %25
%73 = sdiv i32 %71, %72
%74 = load i32, i32* %26
%75 = load i32, i32* %25
%76 = sdiv i32 %74, %75
%77 = call i32 @get_pix(i32 %67, i32 %70, i32 %73, i32 %76, i32* %33, i32* %34)
store i32 %77, i32* %37
%78 = load i32*, i32** %17
%79 = load i32, i32* %24
%80 = load i32, i32* %33
%81 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %78, i32 7, i32 %79, i32 %80)
store i32* %81, i32** %17
%82 = load i32, i32* %37
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %89
84: ; preds = %66
%85 = load i32*, i32** %17
%86 = load i32, i32* %24
%87 = load i32, i32* %34
%88 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %85, i32 8, i32 %86, i32 %87)
store i32* %88, i32** %17
br label %89
89: ; preds = %84, %66
%90 = load i32, i32* %18
%91 = load i32, i32* %19
%92 = load i32, i32* %28
%93 = sdiv i32 %91, %92
%94 = load i32, i32* %20
%95 = load i32, i32* %28
%96 = sdiv i32 %94, %95
%97 = load i32, i32* %29
%98 = load i32, i32* %28
%99 = sdiv i32 %97, %98
%100 = call i32 @get_pix(i32 %90, i32 %93, i32 %96, i32 %99, i32* %33, i32* %34)
store i32 %100, i32* %36
%101 = load i32*, i32** %17
%102 = load i32, i32* %27
%103 = load i32, i32* %33
%104 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %101, i32 9, i32 %102, i32 %103)
store i32* %104, i32** %17
%105 = load i32, i32* %36
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %112
107: ; preds = %89
%108 = load i32*, i32** %17
%109 = load i32, i32* %27
%110 = load i32, i32* %34
%111 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %108, i32 10, i32 %109, i32 %110)
store i32* %111, i32** %17
br label %112
112: ; preds = %107, %89
%113 = load i32, i32* %18
%114 = load i32, i32* %19
%115 = load i32, i32* %31
%116 = sdiv i32 %114, %115
%117 = load i32, i32* %20
%118 = load i32, i32* %31
%119 = sdiv i32 %117, %118
%120 = load i32, i32* %32
%121 = load i32, i32* %31
%122 = sdiv i32 %120, %121
%123 = call i32 @get_pix(i32 %113, i32 %116, i32 %119, i32 %122, i32* %33, i32* %34)
store i32 %123, i32* %38
%124 = load i32*, i32** %17
%125 = load i32, i32* %30
%126 = load i32, i32* %33
%127 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %124, i32 11, i32 %125, i32 %126)
store i32* %127, i32** %17
%128 = load i32, i32* %38
%129 = icmp ne i32 %128, 0
br i1 %129, label %130, label %135
130: ; preds = %112
%131 = load i32*, i32** %17
%132 = load i32, i32* %30
%133 = load i32, i32* %34
%134 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %131, i32 12, i32 %132, i32 %133)
store i32* %134, i32** %17
br label %135
135: ; preds = %130, %112
%136 = load i32, i32* %35
%137 = icmp eq i32 %136, 2
br i1 %137, label %138, label %143
138: ; preds = %135
%139 = load i32*, i32** %17
%140 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %139, i32 14, i32 5, i32 6, i32 0)
store i32* %140, i32** %17
%141 = load i32*, i32** %17
%142 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %141, i32 4, i32 14, i32 1)
store i32* %142, i32** %17
br label %143
143: ; preds = %138, %135
%144 = load i32, i32* %37
%145 = icmp eq i32 %144, 0
br i1 %145, label %146, label %149
146: ; preds = %143
%147 = load i32*, i32** %17
%148 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %147, i32 4, i32 4, i32 7, i32 8)
store i32* %148, i32** %17
br label %160
149: ; preds = %143
%150 = load i32, i32* %37
%151 = icmp eq i32 %150, 2
br i1 %151, label %152, label %159
152: ; preds = %149
%153 = load i32*, i32** %17
%154 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %153, i32 14, i32 7, i32 8, i32 0)
store i32* %154, i32** %17
%155 = load i32*, i32** %17
%156 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %155, i32 14, i32 14, i32 1)
store i32* %156, i32** %17
%157 = load i32*, i32** %17
%158 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %157, i32 4, i32 4, i32 14, i32 8)
store i32* %158, i32** %17
br label %159
159: ; preds = %152, %149
br label %160
160: ; preds = %159, %146
%161 = load i32, i32* %36
%162 = icmp eq i32 %161, 0
br i1 %162, label %163, label %166
163: ; preds = %160
%164 = load i32*, i32** %17
%165 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %164, i32 4, i32 4, i32 9, i32 16)
store i32* %165, i32** %17
br label %177
166: ; preds = %160
%167 = load i32, i32* %36
%168 = icmp eq i32 %167, 2
br i1 %168, label %169, label %176
169: ; preds = %166
%170 = load i32*, i32** %17
%171 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %170, i32 14, i32 9, i32 10, i32 0)
store i32* %171, i32** %17
%172 = load i32*, i32** %17
%173 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %172, i32 14, i32 14, i32 1)
store i32* %173, i32** %17
%174 = load i32*, i32** %17
%175 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %174, i32 4, i32 4, i32 14, i32 16)
store i32* %175, i32** %17
br label %176
176: ; preds = %169, %166
br label %177
177: ; preds = %176, %163
%178 = load i32, i32* %38
%179 = icmp eq i32 %178, 0
br i1 %179, label %180, label %183
180: ; preds = %177
%181 = load i32*, i32** %17
%182 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %181, i32 4, i32 4, i32 11, i32 24)
store i32* %182, i32** %17
br label %194
183: ; preds = %177
%184 = load i32, i32* %38
%185 = icmp eq i32 %184, 2
br i1 %185, label %186, label %193
186: ; preds = %183
%187 = load i32*, i32** %17
%188 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %187, i32 14, i32 11, i32 12, i32 0)
store i32* %188, i32** %17
%189 = load i32*, i32** %17
%190 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %189, i32 14, i32 14, i32 1)
store i32* %190, i32** %17
%191 = load i32*, i32** %17
%192 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %191, i32 4, i32 4, i32 14, i32 24)
store i32* %192, i32** %17
br label %193
193: ; preds = %186, %183
br label %194
194: ; preds = %193, %180
%195 = load i32*, i32** %17
%196 = getelementptr inbounds i32, i32* %195, i32 1
store i32* %196, i32** %17
store i32 -461160444, i32* %195
%197 = load i32*, i32** %17
ret i32* %197
}

LLVM IR (-O2):
define i32* @generate_32bit_scaled_data_write(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15) {
%17 = alloca i32
%18 = alloca i32
%19 = bitcast i32* %17 to i8*
%20 = bitcast i32* %18 to i8*
%21 = sdiv i32 %2, %5
%22 = sdiv i32 %3, %5
%23 = sdiv i32 %6, %5
%24 = call i32 @get_pix(i32 %1, i32 %21, i32 %22, i32 %23, i32* %17, i32* %18)
%25 = icmp eq i32 %24, 0
%26 = load i32, i32* %17
br i1 %25, label %27, label %29
27: ; preds = %16
%28 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %0, i32 4, i32 %4, i32 %26)
br label %33
29: ; preds = %16
%30 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %0, i32 5, i32 %4, i32 %26)
%31 = load i32, i32* %18
%32 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %30, i32 6, i32 %4, i32 %31)
br label %33
33: ; preds = %29, %27
%34 = phi i32* [ %28, %27 ], [ %32, %29 ]
%35 = sdiv i32 %2, %8
%36 = sdiv i32 %3, %8
%37 = sdiv i32 %9, %8
%38 = call i32 @get_pix(i32 %1, i32 %35, i32 %36, i32 %37, i32* %17, i32* %18)
%39 = load i32, i32* %17
%40 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %34, i32 7, i32 %7, i32 %39)
%41 = icmp eq i32 %38, 0
br i1 %41, label %45, label %42
42: ; preds = %33
%43 = load i32, i32* %18
%44 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %40, i32 8, i32 %7, i32 %43)
br label %45
45: ; preds = %42, %33
%46 = phi i32* [ %44, %42 ], [ %40, %33 ]
%47 = sdiv i32 %2, %11
%48 = sdiv i32 %3, %11
%49 = sdiv i32 %12, %11
%50 = call i32 @get_pix(i32 %1, i32 %47, i32 %48, i32 %49, i32* %17, i32* %18)
%51 = load i32, i32* %17
%52 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %46, i32 9, i32 %10, i32 %51)
%53 = icmp eq i32 %50, 0
br i1 %53, label %57, label %54
54: ; preds = %45
%55 = load i32, i32* %18
%56 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %52, i32 10, i32 %10, i32 %55)
br label %57
57: ; preds = %54, %45
%58 = phi i32* [ %56, %54 ], [ %52, %45 ]
%59 = sdiv i32 %2, %14
%60 = sdiv i32 %3, %14
%61 = sdiv i32 %15, %14
%62 = call i32 @get_pix(i32 %1, i32 %59, i32 %60, i32 %61, i32* %17, i32* %18)
%63 = load i32, i32* %17
%64 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %58, i32 11, i32 %13, i32 %63)
%65 = icmp eq i32 %62, 0
br i1 %65, label %69, label %66
66: ; preds = %57
%67 = load i32, i32* %18
%68 = call i32* @generate_arm_cmd_ldrb_r_r_offs(i32* %64, i32 12, i32 %13, i32 %67)
br label %69
69: ; preds = %66, %57
%70 = phi i32* [ %68, %66 ], [ %64, %57 ]
%71 = icmp eq i32 %24, 2
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %70, i32 14, i32 5, i32 6, i32 0)
%74 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %73, i32 4, i32 14, i32 1)
br label %75
75: ; preds = %72, %69
%76 = phi i32* [ %74, %72 ], [ %70, %69 ]
switch i32 %38, label %83 [
i32 0, label %77
i32 2, label %79
]
77: ; preds = %75
%78 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %76, i32 4, i32 4, i32 7, i32 8)
br label %83
79: ; preds = %75
%80 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %76, i32 14, i32 7, i32 8, i32 0)
%81 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %80, i32 14, i32 14, i32 1)
%82 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %81, i32 4, i32 4, i32 14, i32 8)
br label %83
83: ; preds = %75, %79, %77
%84 = phi i32* [ %78, %77 ], [ %82, %79 ], [ %76, %75 ]
switch i32 %50, label %91 [
i32 0, label %85
i32 2, label %87
]
85: ; preds = %83
%86 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %84, i32 4, i32 4, i32 9, i32 16)
br label %91
87: ; preds = %83
%88 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %84, i32 14, i32 9, i32 10, i32 0)
%89 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %88, i32 14, i32 14, i32 1)
%90 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %89, i32 4, i32 4, i32 14, i32 16)
br label %91
91: ; preds = %83, %87, %85
%92 = phi i32* [ %86, %85 ], [ %90, %87 ], [ %84, %83 ]
switch i32 %62, label %99 [
i32 0, label %93
i32 2, label %95
]
93: ; preds = %91
%94 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %92, i32 4, i32 4, i32 11, i32 24)
br label %99
95: ; preds = %91
%96 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %92, i32 14, i32 11, i32 12, i32 0)
%97 = call i32* @generate_arm_cmd_mov_r_r_lsr(i32* %96, i32 14, i32 14, i32 1)
%98 = call i32* @generate_arm_cmd_add_r_r_r_lsl(i32* %97, i32 4, i32 4, i32 14, i32 24)
br label %99
99: ; preds = %91, %95, %93
%100 = phi i32* [ %94, %93 ], [ %98, %95 ], [ %92, %91 ]
%101 = getelementptr inbounds i32, i32* %100, i64 1
store i32 -461160444, i32* %100
ret i32* %101
}