#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 */
struct target {
  int dummy;
};

/* Variables and functions */
char *copy_params(char **, int, int *);
scalar_t__ dump_int_from_mem(unsigned int, char **, struct target *);
scalar_t__ dump_ipc_perm(int, unsigned int, char **, struct target *);
scalar_t__ dump_long_int_from_mem(unsigned int, char **, struct target *);
scalar_t__ dump_n_bytes_from_mem(unsigned int, char **, struct target *, int);
scalar_t__ dump_ptr(unsigned int, char **);
scalar_t__ dump_short_unsigned_int_from_mem(unsigned int, char **,
                                            struct target *);
int /*<<< orphan*/ free_dumped_params(char **, int);
void *malloc(int);
unsigned int read_ptr_from_mem(unsigned int, struct target *);
int dump_shmid_ds(int depth, unsigned int addr, char **dumped_params,
                  struct target *target) {
  char **dumped_type_params;
  unsigned int anonymous_inner_struct_32 = addr;
  unsigned int arm_tracing_shm_segsz = addr + 16;
  unsigned int arm_tracing_shm_atime = addr + 20;
  unsigned int arm_tracing_shm_dtime = addr + 24;
  unsigned int arm_tracing_shm_ctime = addr + 28;
  unsigned int arm_tracing_shm_cpid = addr + 32;
  unsigned int arm_tracing_shm_lpid = addr + 34;
  unsigned int arm_tracing_shm_nattch = addr + 36;
  unsigned int arm_tracing_shm_unused = addr + 38;
  unsigned int arm_tracing_shm_unused2 = addr + 40;
  unsigned int arm_tracing_shm_unused3 = addr + 44;
  int len = 0;
  if (depth < 0) {
    *dumped_params = malloc(0);
    return len;
  }
  dumped_type_params = malloc(11 * (sizeof(char *)));
  arm_tracing_shm_unused2 = read_ptr_from_mem(arm_tracing_shm_unused2, target);
  arm_tracing_shm_unused3 = read_ptr_from_mem(arm_tracing_shm_unused3, target);
  if (depth == 0) {
    len += dump_ipc_perm(depth, anonymous_inner_struct_32,
                         &dumped_type_params[0], target);
    len += dump_int_from_mem(arm_tracing_shm_segsz, &dumped_type_params[1],
                             target);
    len += dump_long_int_from_mem(arm_tracing_shm_atime, &dumped_type_params[2],
                                  target);
    len += dump_long_int_from_mem(arm_tracing_shm_dtime, &dumped_type_params[3],
                                  target);
    len += dump_long_int_from_mem(arm_tracing_shm_ctime, &dumped_type_params[4],
                                  target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_cpid,
                                            &dumped_type_params[5], target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_lpid,
                                            &dumped_type_params[6], target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_nattch,
                                            &dumped_type_params[7], target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_unused,
                                            &dumped_type_params[8], target);
    len += dump_ptr(arm_tracing_shm_unused2, &dumped_type_params[9]);
    len += dump_ptr(arm_tracing_shm_unused3, &dumped_type_params[10]);
    *dumped_params = copy_params(dumped_type_params, 11, &len);
    free_dumped_params(dumped_type_params, 11);
    return len;
  }
  if (depth >= 1) {
    len += dump_ipc_perm(depth, anonymous_inner_struct_32,
                         &dumped_type_params[0], target);
    len += dump_int_from_mem(arm_tracing_shm_segsz, &dumped_type_params[1],
                             target);
    len += dump_long_int_from_mem(arm_tracing_shm_atime, &dumped_type_params[2],
                                  target);
    len += dump_long_int_from_mem(arm_tracing_shm_dtime, &dumped_type_params[3],
                                  target);
    len += dump_long_int_from_mem(arm_tracing_shm_ctime, &dumped_type_params[4],
                                  target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_cpid,
                                            &dumped_type_params[5], target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_lpid,
                                            &dumped_type_params[6], target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_nattch,
                                            &dumped_type_params[7], target);
    len += dump_short_unsigned_int_from_mem(arm_tracing_shm_unused,
                                            &dumped_type_params[8], target);
    len += dump_n_bytes_from_mem(arm_tracing_shm_unused2,
                                 &dumped_type_params[9], target, 256);
    len += dump_n_bytes_from_mem(arm_tracing_shm_unused3,
                                 &dumped_type_params[10], target, 256);
  }
  *dumped_params = copy_params(dumped_type_params, 11, &len);
  free_dumped_params(dumped_type_params, 11);
  return len;
}


x86 assembly (clang, -O0):
<dump_shmid_ds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1c,%eax
mov    %eax,-0x3c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
add    $0x22,%eax
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%eax
add    $0x24,%eax
mov    %eax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
add    $0x26,%eax
mov    %eax,-0x4c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x28,%eax
mov    %eax,-0x50(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2c,%eax
mov    %eax,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1243 <dump_shmid_ds+0xa3>
xor    %edi,%edi
call   10a0 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x58(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15be <dump_shmid_ds+0x41e>
mov    $0x58,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <read_ptr_from_mem@plt>
mov    %eax,-0x50(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1080 <read_ptr_from_mem@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1410 <dump_shmid_ds+0x270>
mov    -0x8(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1090 <dump_ipc_perm@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x8,%rsi
mov    -0x20(%rbp),%rdx
call   10c0 <dump_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x10,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x18,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x20,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x28,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x30,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x38,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x40,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x48,%rsi
call   1060 <dump_ptr@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x50,%rsi
call   1060 <dump_ptr@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0xb,%esi
lea    -0x58(%rbp),%rdx
call   1070 <copy_params@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
mov    $0xb,%esi
call   1050 <free_dumped_params@plt>
mov    -0x58(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15be <dump_shmid_ds+0x41e>
cmpl   $0x1,-0x8(%rbp)
jl     158e <dump_shmid_ds+0x3ee>
mov    -0x8(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1090 <dump_ipc_perm@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x8,%rsi
mov    -0x20(%rbp),%rdx
call   10c0 <dump_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x10,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x18,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x20,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x28,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x30,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x38,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x4c(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x40,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x48,%rsi
mov    -0x20(%rbp),%rdx
mov    $0x100,%ecx
call   1040 <dump_n_bytes_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x50,%rsi
mov    -0x20(%rbp),%rdx
mov    $0x100,%ecx
call   1040 <dump_n_bytes_from_mem@plt>
mov    %rax,%rcx
movslq -0x58(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x58(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0xb,%esi
lea    -0x58(%rbp),%rdx
call   1070 <copy_params@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
mov    $0xb,%esi
call   1050 <free_dumped_params@plt>
mov    -0x58(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_shmid_ds>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
movl   $0x0,0x8(%rsp)
test   %edi,%edi
js     133f <dump_shmid_ds+0x19f>
mov    %rcx,%r15
mov    %esi,%r14d
mov    %edi,%r12d
mov    %rbx,0x30(%rsp)
lea    0x10(%r14),%eax
mov    %eax,0xc(%rsp)
lea    0x14(%r14),%eax
mov    %eax,0x10(%rsp)
lea    0x18(%r14),%eax
mov    %eax,0x14(%rsp)
lea    0x1c(%r14),%eax
mov    %eax,0x18(%rsp)
lea    0x20(%r14),%eax
mov    %eax,0x1c(%rsp)
lea    0x22(%r14),%eax
mov    %eax,0x20(%rsp)
lea    0x24(%r14),%eax
mov    %eax,0x24(%rsp)
lea    0x26(%r14),%eax
mov    %eax,0x28(%rsp)
lea    0x2c(%r14),%r13d
lea    0x28(%r14),%ebp
mov    $0x58,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %r15,%rsi
call   1080 <read_ptr_from_mem@plt>
mov    %eax,0x2c(%rsp)
mov    %r13d,%edi
mov    %r15,%rsi
call   1080 <read_ptr_from_mem@plt>
mov    %eax,%r13d
test   %r12d,%r12d
je     134e <dump_shmid_ds+0x1ae>
mov    %r12d,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1090 <dump_ipc_perm@plt>
mov    %rax,%r14
lea    0x8(%rbx),%rsi
mov    0xc(%rsp),%edi
mov    %r15,%rdx
call   10c0 <dump_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
lea    0x10(%rbx),%rsi
mov    0x10(%rsp),%edi
mov    %r15,%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rbx,%r14
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x18(%r14),%rsi
mov    0x14(%rsp),%edi
mov    %r15,%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0x20(%r14),%rsi
mov    0x18(%rsp),%edi
mov    %r15,%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x28(%r14),%rsi
mov    0x1c(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0x30(%r14),%rsi
mov    0x20(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x38(%r14),%rsi
mov    0x24(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0x40(%r14),%rsi
mov    0x28(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x48(%r14),%rsi
mov    0x2c(%rsp),%edi
mov    %r15,%rdx
mov    $0x100,%ecx
call   1040 <dump_n_bytes_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
mov    %r14,%rsi
add    $0x50,%rsi
mov    %r13d,%edi
mov    %r15,%rdx
mov    $0x100,%ecx
call   1040 <dump_n_bytes_from_mem@plt>
jmp    1434 <dump_shmid_ds+0x294>
xor    %edi,%edi
call   10a0 <malloc@plt>
mov    %rax,(%rbx)
jmp    1461 <dump_shmid_ds+0x2c1>
xor    %edi,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1090 <dump_ipc_perm@plt>
mov    %rax,%r14
lea    0x8(%rbx),%rsi
mov    0xc(%rsp),%edi
mov    %r15,%rdx
call   10c0 <dump_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
lea    0x10(%rbx),%rsi
mov    0x10(%rsp),%edi
mov    %r15,%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%r14
add    %ebp,%r14d
lea    0x18(%rbx),%rsi
mov    0x14(%rsp),%edi
mov    %r15,%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
lea    0x20(%rbx),%rsi
mov    0x18(%rsp),%edi
mov    %r15,%rdx
call   1030 <dump_long_int_from_mem@plt>
mov    %rax,%r14
add    %ebp,%r14d
lea    0x28(%rbx),%rsi
mov    0x1c(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
lea    0x30(%rbx),%rsi
mov    0x20(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%r14
add    %ebp,%r14d
lea    0x38(%rbx),%rsi
mov    0x24(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
lea    0x40(%rbx),%rsi
mov    0x28(%rsp),%edi
mov    %r15,%rdx
call   10b0 <dump_short_unsigned_int_from_mem@plt>
mov    %rbx,%r14
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x48(%r14),%rsi
mov    0x2c(%rsp),%edi
call   1060 <dump_ptr@plt>
mov    %rax,%rbp
add    %ebx,%ebp
mov    %r14,%rsi
add    $0x50,%rsi
mov    %r13d,%edi
call   1060 <dump_ptr@plt>
add    %ebp,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    $0xb,%esi
call   1070 <copy_params@plt>
mov    0x30(%rsp),%rcx
mov    %rax,(%rcx)
mov    %r14,%rdi
mov    $0xb,%esi
call   1050 <free_dumped_params@plt>
mov    0x8(%rsp),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.target = type { i32 }
define i32 @dump_shmid_ds(i32 %0, i32 %1, i8** %2, %struct.target* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca %struct.target*
%10 = alloca i8**
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store %struct.target* %3, %struct.target** %9
%23 = load i32, i32* %7
store i32 %23, i32* %11
%24 = load i32, i32* %7
%25 = add i32 %24, 16
store i32 %25, i32* %12
%26 = load i32, i32* %7
%27 = add i32 %26, 20
store i32 %27, i32* %13
%28 = load i32, i32* %7
%29 = add i32 %28, 24
store i32 %29, i32* %14
%30 = load i32, i32* %7
%31 = add i32 %30, 28
store i32 %31, i32* %15
%32 = load i32, i32* %7
%33 = add i32 %32, 32
store i32 %33, i32* %16
%34 = load i32, i32* %7
%35 = add i32 %34, 34
store i32 %35, i32* %17
%36 = load i32, i32* %7
%37 = add i32 %36, 36
store i32 %37, i32* %18
%38 = load i32, i32* %7
%39 = add i32 %38, 38
store i32 %39, i32* %19
%40 = load i32, i32* %7
%41 = add i32 %40, 40
store i32 %41, i32* %20
%42 = load i32, i32* %7
%43 = add i32 %42, 44
store i32 %43, i32* %21
store i32 0, i32* %22
%44 = load i32, i32* %6
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %4
%47 = call i8* @malloc(i32 0)
%48 = load i8**, i8*** %8
store i8* %47, i8** %48
%49 = load i32, i32* %22
store i32 %49, i32* %5
br label %277
50: ; preds = %4
%51 = call i8* @malloc(i32 88)
%52 = bitcast i8* %51 to i8**
store i8** %52, i8*** %10
%53 = load i32, i32* %20
%54 = load %struct.target*, %struct.target** %9
%55 = call i32 @read_ptr_from_mem(i32 %53, %struct.target* %54)
store i32 %55, i32* %20
%56 = load i32, i32* %21
%57 = load %struct.target*, %struct.target** %9
%58 = call i32 @read_ptr_from_mem(i32 %56, %struct.target* %57)
store i32 %58, i32* %21
%59 = load i32, i32* %6
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %166
61: ; preds = %50
%62 = load i32, i32* %6
%63 = load i32, i32* %11
%64 = load i8**, i8*** %10
%65 = getelementptr inbounds i8*, i8** %64, i64 0
%66 = load %struct.target*, %struct.target** %9
%67 = call i64 @dump_ipc_perm(i32 %62, i32 %63, i8** %65, %struct.target* %66)
%68 = load i32, i32* %22
%69 = sext i32 %68 to i64
%70 = add nsw i64 %69, %67
%71 = trunc i64 %70 to i32
store i32 %71, i32* %22
%72 = load i32, i32* %12
%73 = load i8**, i8*** %10
%74 = getelementptr inbounds i8*, i8** %73, i64 1
%75 = load %struct.target*, %struct.target** %9
%76 = call i64 @dump_int_from_mem(i32 %72, i8** %74, %struct.target* %75)
%77 = load i32, i32* %22
%78 = sext i32 %77 to i64
%79 = add nsw i64 %78, %76
%80 = trunc i64 %79 to i32
store i32 %80, i32* %22
%81 = load i32, i32* %13
%82 = load i8**, i8*** %10
%83 = getelementptr inbounds i8*, i8** %82, i64 2
%84 = load %struct.target*, %struct.target** %9
%85 = call i64 @dump_long_int_from_mem(i32 %81, i8** %83, %struct.target* %84)
%86 = load i32, i32* %22
%87 = sext i32 %86 to i64
%88 = add nsw i64 %87, %85
%89 = trunc i64 %88 to i32
store i32 %89, i32* %22
%90 = load i32, i32* %14
%91 = load i8**, i8*** %10
%92 = getelementptr inbounds i8*, i8** %91, i64 3
%93 = load %struct.target*, %struct.target** %9
%94 = call i64 @dump_long_int_from_mem(i32 %90, i8** %92, %struct.target* %93)
%95 = load i32, i32* %22
%96 = sext i32 %95 to i64
%97 = add nsw i64 %96, %94
%98 = trunc i64 %97 to i32
store i32 %98, i32* %22
%99 = load i32, i32* %15
%100 = load i8**, i8*** %10
%101 = getelementptr inbounds i8*, i8** %100, i64 4
%102 = load %struct.target*, %struct.target** %9
%103 = call i64 @dump_long_int_from_mem(i32 %99, i8** %101, %struct.target* %102)
%104 = load i32, i32* %22
%105 = sext i32 %104 to i64
%106 = add nsw i64 %105, %103
%107 = trunc i64 %106 to i32
store i32 %107, i32* %22
%108 = load i32, i32* %16
%109 = load i8**, i8*** %10
%110 = getelementptr inbounds i8*, i8** %109, i64 5
%111 = load %struct.target*, %struct.target** %9
%112 = call i64 @dump_short_unsigned_int_from_mem(i32 %108, i8** %110, %struct.target* %111)
%113 = load i32, i32* %22
%114 = sext i32 %113 to i64
%115 = add nsw i64 %114, %112
%116 = trunc i64 %115 to i32
store i32 %116, i32* %22
%117 = load i32, i32* %17
%118 = load i8**, i8*** %10
%119 = getelementptr inbounds i8*, i8** %118, i64 6
%120 = load %struct.target*, %struct.target** %9
%121 = call i64 @dump_short_unsigned_int_from_mem(i32 %117, i8** %119, %struct.target* %120)
%122 = load i32, i32* %22
%123 = sext i32 %122 to i64
%124 = add nsw i64 %123, %121
%125 = trunc i64 %124 to i32
store i32 %125, i32* %22
%126 = load i32, i32* %18
%127 = load i8**, i8*** %10
%128 = getelementptr inbounds i8*, i8** %127, i64 7
%129 = load %struct.target*, %struct.target** %9
%130 = call i64 @dump_short_unsigned_int_from_mem(i32 %126, i8** %128, %struct.target* %129)
%131 = load i32, i32* %22
%132 = sext i32 %131 to i64
%133 = add nsw i64 %132, %130
%134 = trunc i64 %133 to i32
store i32 %134, i32* %22
%135 = load i32, i32* %19
%136 = load i8**, i8*** %10
%137 = getelementptr inbounds i8*, i8** %136, i64 8
%138 = load %struct.target*, %struct.target** %9
%139 = call i64 @dump_short_unsigned_int_from_mem(i32 %135, i8** %137, %struct.target* %138)
%140 = load i32, i32* %22
%141 = sext i32 %140 to i64
%142 = add nsw i64 %141, %139
%143 = trunc i64 %142 to i32
store i32 %143, i32* %22
%144 = load i32, i32* %20
%145 = load i8**, i8*** %10
%146 = getelementptr inbounds i8*, i8** %145, i64 9
%147 = call i64 @dump_ptr(i32 %144, i8** %146)
%148 = load i32, i32* %22
%149 = sext i32 %148 to i64
%150 = add nsw i64 %149, %147
%151 = trunc i64 %150 to i32
store i32 %151, i32* %22
%152 = load i32, i32* %21
%153 = load i8**, i8*** %10
%154 = getelementptr inbounds i8*, i8** %153, i64 10
%155 = call i64 @dump_ptr(i32 %152, i8** %154)
%156 = load i32, i32* %22
%157 = sext i32 %156 to i64
%158 = add nsw i64 %157, %155
%159 = trunc i64 %158 to i32
store i32 %159, i32* %22
%160 = load i8**, i8*** %10
%161 = call i8* @copy_params(i8** %160, i32 11, i32* %22)
%162 = load i8**, i8*** %8
store i8* %161, i8** %162
%163 = load i8**, i8*** %10
%164 = call i32 @free_dumped_params(i8** %163, i32 11)
%165 = load i32, i32* %22
store i32 %165, i32* %5
br label %277
166: ; preds = %50
%167 = load i32, i32* %6
%168 = icmp sge i32 %167, 1
br i1 %168, label %169, label %270
169: ; preds = %166
%170 = load i32, i32* %6
%171 = load i32, i32* %11
%172 = load i8**, i8*** %10
%173 = getelementptr inbounds i8*, i8** %172, i64 0
%174 = load %struct.target*, %struct.target** %9
%175 = call i64 @dump_ipc_perm(i32 %170, i32 %171, i8** %173, %struct.target* %174)
%176 = load i32, i32* %22
%177 = sext i32 %176 to i64
%178 = add nsw i64 %177, %175
%179 = trunc i64 %178 to i32
store i32 %179, i32* %22
%180 = load i32, i32* %12
%181 = load i8**, i8*** %10
%182 = getelementptr inbounds i8*, i8** %181, i64 1
%183 = load %struct.target*, %struct.target** %9
%184 = call i64 @dump_int_from_mem(i32 %180, i8** %182, %struct.target* %183)
%185 = load i32, i32* %22
%186 = sext i32 %185 to i64
%187 = add nsw i64 %186, %184
%188 = trunc i64 %187 to i32
store i32 %188, i32* %22
%189 = load i32, i32* %13
%190 = load i8**, i8*** %10
%191 = getelementptr inbounds i8*, i8** %190, i64 2
%192 = load %struct.target*, %struct.target** %9
%193 = call i64 @dump_long_int_from_mem(i32 %189, i8** %191, %struct.target* %192)
%194 = load i32, i32* %22
%195 = sext i32 %194 to i64
%196 = add nsw i64 %195, %193
%197 = trunc i64 %196 to i32
store i32 %197, i32* %22
%198 = load i32, i32* %14
%199 = load i8**, i8*** %10
%200 = getelementptr inbounds i8*, i8** %199, i64 3
%201 = load %struct.target*, %struct.target** %9
%202 = call i64 @dump_long_int_from_mem(i32 %198, i8** %200, %struct.target* %201)
%203 = load i32, i32* %22
%204 = sext i32 %203 to i64
%205 = add nsw i64 %204, %202
%206 = trunc i64 %205 to i32
store i32 %206, i32* %22
%207 = load i32, i32* %15
%208 = load i8**, i8*** %10
%209 = getelementptr inbounds i8*, i8** %208, i64 4
%210 = load %struct.target*, %struct.target** %9
%211 = call i64 @dump_long_int_from_mem(i32 %207, i8** %209, %struct.target* %210)
%212 = load i32, i32* %22
%213 = sext i32 %212 to i64
%214 = add nsw i64 %213, %211
%215 = trunc i64 %214 to i32
store i32 %215, i32* %22
%216 = load i32, i32* %16
%217 = load i8**, i8*** %10
%218 = getelementptr inbounds i8*, i8** %217, i64 5
%219 = load %struct.target*, %struct.target** %9
%220 = call i64 @dump_short_unsigned_int_from_mem(i32 %216, i8** %218, %struct.target* %219)
%221 = load i32, i32* %22
%222 = sext i32 %221 to i64
%223 = add nsw i64 %222, %220
%224 = trunc i64 %223 to i32
store i32 %224, i32* %22
%225 = load i32, i32* %17
%226 = load i8**, i8*** %10
%227 = getelementptr inbounds i8*, i8** %226, i64 6
%228 = load %struct.target*, %struct.target** %9
%229 = call i64 @dump_short_unsigned_int_from_mem(i32 %225, i8** %227, %struct.target* %228)
%230 = load i32, i32* %22
%231 = sext i32 %230 to i64
%232 = add nsw i64 %231, %229
%233 = trunc i64 %232 to i32
store i32 %233, i32* %22
%234 = load i32, i32* %18
%235 = load i8**, i8*** %10
%236 = getelementptr inbounds i8*, i8** %235, i64 7
%237 = load %struct.target*, %struct.target** %9
%238 = call i64 @dump_short_unsigned_int_from_mem(i32 %234, i8** %236, %struct.target* %237)
%239 = load i32, i32* %22
%240 = sext i32 %239 to i64
%241 = add nsw i64 %240, %238
%242 = trunc i64 %241 to i32
store i32 %242, i32* %22
%243 = load i32, i32* %19
%244 = load i8**, i8*** %10
%245 = getelementptr inbounds i8*, i8** %244, i64 8
%246 = load %struct.target*, %struct.target** %9
%247 = call i64 @dump_short_unsigned_int_from_mem(i32 %243, i8** %245, %struct.target* %246)
%248 = load i32, i32* %22
%249 = sext i32 %248 to i64
%250 = add nsw i64 %249, %247
%251 = trunc i64 %250 to i32
store i32 %251, i32* %22
%252 = load i32, i32* %20
%253 = load i8**, i8*** %10
%254 = getelementptr inbounds i8*, i8** %253, i64 9
%255 = load %struct.target*, %struct.target** %9
%256 = call i64 @dump_n_bytes_from_mem(i32 %252, i8** %254, %struct.target* %255, i32 256)
%257 = load i32, i32* %22
%258 = sext i32 %257 to i64
%259 = add nsw i64 %258, %256
%260 = trunc i64 %259 to i32
store i32 %260, i32* %22
%261 = load i32, i32* %21
%262 = load i8**, i8*** %10
%263 = getelementptr inbounds i8*, i8** %262, i64 10
%264 = load %struct.target*, %struct.target** %9
%265 = call i64 @dump_n_bytes_from_mem(i32 %261, i8** %263, %struct.target* %264, i32 256)
%266 = load i32, i32* %22
%267 = sext i32 %266 to i64
%268 = add nsw i64 %267, %265
%269 = trunc i64 %268 to i32
store i32 %269, i32* %22
br label %270
270: ; preds = %169, %166
%271 = load i8**, i8*** %10
%272 = call i8* @copy_params(i8** %271, i32 11, i32* %22)
%273 = load i8**, i8*** %8
store i8* %272, i8** %273
%274 = load i8**, i8*** %10
%275 = call i32 @free_dumped_params(i8** %274, i32 11)
%276 = load i32, i32* %22
store i32 %276, i32* %5
br label %277
277: ; preds = %270, %61, %46
%278 = load i32, i32* %5
ret i32 %278
}

LLVM IR (-O2):
%struct.target = type { i32 }
define i32 @dump_shmid_ds(i32 %0, i32 %1, i8** nocapture writeonly %2, %struct.target* %3) {
%5 = alloca i32
%6 = add i32 %1, 16
%7 = add i32 %1, 20
%8 = add i32 %1, 24
%9 = add i32 %1, 28
%10 = add i32 %1, 32
%11 = add i32 %1, 34
%12 = add i32 %1, 36
%13 = add i32 %1, 38
%14 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%15 = icmp slt i32 %0, 0
br i1 %15, label %16, label %18
16: ; preds = %4
%17 = tail call i8* @malloc(i32 0)
store i8* %17, i8** %2
br label %116
18: ; preds = %4
%19 = add i32 %1, 44
%20 = add i32 %1, 40
%21 = tail call dereferenceable_or_null(88) i8* @malloc(i32 88)
%22 = bitcast i8* %21 to i8**
%23 = tail call i32 @read_ptr_from_mem(i32 %20, %struct.target* %3)
%24 = tail call i32 @read_ptr_from_mem(i32 %19, %struct.target* %3)
%25 = icmp eq i32 %0, 0
br i1 %25, label %26, label %71
26: ; preds = %18
%27 = tail call i64 @dump_ipc_perm(i32 0, i32 %1, i8** %22, %struct.target* %3)
%28 = trunc i64 %27 to i32
%29 = getelementptr inbounds i8*, i8** %22, i64 1
%30 = tail call i64 @dump_int_from_mem(i32 %6, i8** %29, %struct.target* %3)
%31 = trunc i64 %30 to i32
%32 = add i32 %28, %31
%33 = getelementptr inbounds i8*, i8** %22, i64 2
%34 = tail call i64 @dump_long_int_from_mem(i32 %7, i8** %33, %struct.target* %3)
%35 = trunc i64 %34 to i32
%36 = add i32 %32, %35
%37 = getelementptr inbounds i8*, i8** %22, i64 3
%38 = tail call i64 @dump_long_int_from_mem(i32 %8, i8** %37, %struct.target* %3)
%39 = trunc i64 %38 to i32
%40 = add i32 %36, %39
%41 = getelementptr inbounds i8*, i8** %22, i64 4
%42 = tail call i64 @dump_long_int_from_mem(i32 %9, i8** %41, %struct.target* %3)
%43 = trunc i64 %42 to i32
%44 = add i32 %40, %43
%45 = getelementptr inbounds i8*, i8** %22, i64 5
%46 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %10, i8** %45, %struct.target* %3)
%47 = trunc i64 %46 to i32
%48 = add i32 %44, %47
%49 = getelementptr inbounds i8*, i8** %22, i64 6
%50 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %11, i8** %49, %struct.target* %3)
%51 = trunc i64 %50 to i32
%52 = add i32 %48, %51
%53 = getelementptr inbounds i8*, i8** %22, i64 7
%54 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %12, i8** %53, %struct.target* %3)
%55 = trunc i64 %54 to i32
%56 = add i32 %52, %55
%57 = getelementptr inbounds i8*, i8** %22, i64 8
%58 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %13, i8** %57, %struct.target* %3)
%59 = trunc i64 %58 to i32
%60 = add i32 %56, %59
%61 = getelementptr inbounds i8*, i8** %22, i64 9
%62 = tail call i64 @dump_ptr(i32 %23, i8** %61)
%63 = trunc i64 %62 to i32
%64 = add i32 %60, %63
%65 = getelementptr inbounds i8*, i8** %22, i64 10
%66 = tail call i64 @dump_ptr(i32 %24, i8** %65)
%67 = trunc i64 %66 to i32
%68 = add i32 %64, %67
store i32 %68, i32* %5
%69 = call i8* @copy_params(i8** %22, i32 11, i32* %5)
store i8* %69, i8** %2
%70 = call i32 @free_dumped_params(i8** %22, i32 11)
br label %116
71: ; preds = %18
%72 = tail call i64 @dump_ipc_perm(i32 %0, i32 %1, i8** %22, %struct.target* %3)
%73 = trunc i64 %72 to i32
%74 = getelementptr inbounds i8*, i8** %22, i64 1
%75 = tail call i64 @dump_int_from_mem(i32 %6, i8** %74, %struct.target* %3)
%76 = trunc i64 %75 to i32
%77 = add i32 %73, %76
%78 = getelementptr inbounds i8*, i8** %22, i64 2
%79 = tail call i64 @dump_long_int_from_mem(i32 %7, i8** %78, %struct.target* %3)
%80 = trunc i64 %79 to i32
%81 = add i32 %77, %80
%82 = getelementptr inbounds i8*, i8** %22, i64 3
%83 = tail call i64 @dump_long_int_from_mem(i32 %8, i8** %82, %struct.target* %3)
%84 = trunc i64 %83 to i32
%85 = add i32 %81, %84
%86 = getelementptr inbounds i8*, i8** %22, i64 4
%87 = tail call i64 @dump_long_int_from_mem(i32 %9, i8** %86, %struct.target* %3)
%88 = trunc i64 %87 to i32
%89 = add i32 %85, %88
%90 = getelementptr inbounds i8*, i8** %22, i64 5
%91 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %10, i8** %90, %struct.target* %3)
%92 = trunc i64 %91 to i32
%93 = add i32 %89, %92
%94 = getelementptr inbounds i8*, i8** %22, i64 6
%95 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %11, i8** %94, %struct.target* %3)
%96 = trunc i64 %95 to i32
%97 = add i32 %93, %96
%98 = getelementptr inbounds i8*, i8** %22, i64 7
%99 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %12, i8** %98, %struct.target* %3)
%100 = trunc i64 %99 to i32
%101 = add i32 %97, %100
%102 = getelementptr inbounds i8*, i8** %22, i64 8
%103 = tail call i64 @dump_short_unsigned_int_from_mem(i32 %13, i8** %102, %struct.target* %3)
%104 = trunc i64 %103 to i32
%105 = add i32 %101, %104
%106 = getelementptr inbounds i8*, i8** %22, i64 9
%107 = tail call i64 @dump_n_bytes_from_mem(i32 %23, i8** %106, %struct.target* %3, i32 256)
%108 = trunc i64 %107 to i32
%109 = add i32 %105, %108
%110 = getelementptr inbounds i8*, i8** %22, i64 10
%111 = tail call i64 @dump_n_bytes_from_mem(i32 %24, i8** %110, %struct.target* %3, i32 256)
%112 = trunc i64 %111 to i32
%113 = add i32 %109, %112
store i32 %113, i32* %5
%114 = call i8* @copy_params(i8** %22, i32 11, i32* %5)
store i8* %114, i8** %2
%115 = call i32 @free_dumped_params(i8** %22, i32 11)
br label %116
116: ; preds = %71, %26, %16
%117 = load i32, i32* %5
ret i32 %117
}