#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_iovec(int, 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_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_msghdr(int depth, unsigned int addr, char **dumped_params,
                struct target *target) {
  char **dumped_type_params;
  unsigned int arm_tracing_msg_name = addr;
  unsigned int arm_tracing_msg_namelen = addr + 4;
  unsigned int arm_tracing_msg_iov = addr + 8;
  unsigned int arm_tracing_msg_iovlen = addr + 12;
  unsigned int arm_tracing_msg_control = addr + 16;
  unsigned int arm_tracing_msg_controllen = addr + 20;
  unsigned int arm_tracing_msg_flags = addr + 24;
  int len = 0;
  if (depth < 0) {
    *dumped_params = malloc(0);
    return len;
  }
  dumped_type_params = malloc(7 * (sizeof(char *)));
  arm_tracing_msg_name = read_ptr_from_mem(arm_tracing_msg_name, target);
  arm_tracing_msg_iov = read_ptr_from_mem(arm_tracing_msg_iov, target);
  arm_tracing_msg_control = read_ptr_from_mem(arm_tracing_msg_control, target);
  if (depth == 0) {
    len += dump_ptr(arm_tracing_msg_name, &dumped_type_params[0]);
    len += dump_int_from_mem(arm_tracing_msg_namelen, &dumped_type_params[1],
                             target);
    len += dump_ptr(arm_tracing_msg_iov, &dumped_type_params[2]);
    len += dump_unsigned_int_from_mem(arm_tracing_msg_iovlen,
                                      &dumped_type_params[3], target);
    len += dump_ptr(arm_tracing_msg_control, &dumped_type_params[4]);
    len += dump_unsigned_int_from_mem(arm_tracing_msg_controllen,
                                      &dumped_type_params[5], target);
    len += dump_unsigned_int_from_mem(arm_tracing_msg_flags,
                                      &dumped_type_params[6], target);
    *dumped_params = copy_params(dumped_type_params, 7, &len);
    free_dumped_params(dumped_type_params, 7);
    return len;
  }
  if (depth >= 1) {
    len += dump_n_bytes_from_mem(arm_tracing_msg_name, &dumped_type_params[0],
                                 target, 256);
    len += dump_int_from_mem(arm_tracing_msg_namelen, &dumped_type_params[1],
                             target);
    len += dump_iovec(depth - 1, arm_tracing_msg_iov, &dumped_type_params[2],
                      target);
    len += dump_unsigned_int_from_mem(arm_tracing_msg_iovlen,
                                      &dumped_type_params[3], target);
    len += dump_n_bytes_from_mem(arm_tracing_msg_control,
                                 &dumped_type_params[4], target, 256);
    len += dump_unsigned_int_from_mem(arm_tracing_msg_controllen,
                                      &dumped_type_params[5], target);
    len += dump_unsigned_int_from_mem(arm_tracing_msg_flags,
                                      &dumped_type_params[6], target);
  }
  *dumped_params = copy_params(dumped_type_params, 7, &len);
  free_dumped_params(dumped_type_params, 7);
  return len;
}


x86 assembly (clang, -O0):
<dump_msghdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    $0x4,%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x3c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x14,%eax
mov    %eax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    120f <dump_msghdr+0x7f>
xor    %edi,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    148d <dump_msghdr+0x2fd>
mov    $0x38,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <read_ptr_from_mem@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <read_ptr_from_mem@plt>
mov    %eax,-0x34(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <read_ptr_from_mem@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1360 <dump_msghdr+0x1d0>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1050 <dump_ptr@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x8,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x10,%rsi
call   1050 <dump_ptr@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x18,%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x20,%rsi
call   1050 <dump_ptr@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x28,%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x30,%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
lea    -0x48(%rbp),%rdx
call   1060 <copy_params@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1040 <free_dumped_params@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    148d <dump_msghdr+0x2fd>
cmpl   $0x1,-0x8(%rbp)
jl     145d <dump_msghdr+0x2cd>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x100,%ecx
call   1030 <dump_n_bytes_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x8,%rsi
mov    -0x20(%rbp),%rdx
call   10b0 <dump_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x34(%rbp),%esi
mov    -0x28(%rbp),%rdx
add    $0x10,%rdx
mov    -0x20(%rbp),%rcx
call   1090 <dump_iovec@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x18,%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x20,%rsi
mov    -0x20(%rbp),%rdx
mov    $0x100,%ecx
call   1030 <dump_n_bytes_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x28,%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x28(%rbp),%rsi
add    $0x30,%rsi
mov    -0x20(%rbp),%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rcx
movslq -0x48(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
lea    -0x48(%rbp),%rdx
call   1060 <copy_params@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1040 <free_dumped_params@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_msghdr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbx
movl   $0x0,0x8(%rsp)
test   %edi,%edi
js     12b0 <dump_msghdr+0x120>
mov    %rcx,%r12
mov    %esi,%ebp
mov    %edi,%r13d
mov    %rbx,0x20(%rsp)
lea    0x4(%rbp),%eax
mov    %eax,0x10(%rsp)
lea    0xc(%rbp),%eax
mov    %eax,0x14(%rsp)
lea    0x14(%rbp),%eax
mov    %eax,0x18(%rsp)
lea    0x18(%rbp),%eax
mov    %eax,0x1c(%rsp)
lea    0x10(%rbp),%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rbp),%r14d
mov    $0x38,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %ebp,%edi
mov    %r12,%rsi
call   1070 <read_ptr_from_mem@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %r12,%rsi
call   1070 <read_ptr_from_mem@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edi
mov    %r12,%rsi
call   1070 <read_ptr_from_mem@plt>
mov    %eax,0xc(%rsp)
mov    %ebx,%edi
mov    %r15,%rsi
test   %r13d,%r13d
je     12bf <dump_msghdr+0x12f>
mov    %r12,%rdx
mov    $0x100,%ecx
call   1030 <dump_n_bytes_from_mem@plt>
mov    %rax,%rbx
lea    0x8(%r15),%rsi
mov    0x10(%rsp),%edi
mov    %r12,%rdx
call   10b0 <dump_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
add    $0xffffffff,%r13d
lea    0x10(%r15),%rdx
mov    %r13d,%edi
mov    %r14d,%esi
mov    %r12,%rcx
call   1090 <dump_iovec@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x18(%r15),%rsi
mov    0x14(%rsp),%edi
mov    %r12,%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0x20(%r15),%rsi
mov    0xc(%rsp),%edi
mov    %r12,%rdx
mov    $0x100,%ecx
call   1030 <dump_n_bytes_from_mem@plt>
mov    %rax,%rbx
add    %ebp,%ebx
lea    0x28(%r15),%rsi
mov    0x18(%rsp),%edi
mov    %r12,%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
jmp    132d <dump_msghdr+0x19d>
xor    %edi,%edi
call   1080 <malloc@plt>
mov    %rax,(%rbx)
jmp    136d <dump_msghdr+0x1dd>
call   1050 <dump_ptr@plt>
mov    %rax,%rbx
lea    0x8(%r15),%rsi
mov    0x10(%rsp),%edi
mov    %r12,%rdx
call   10b0 <dump_int_from_mem@plt>
mov    %rax,%rbp
add    %ebx,%ebp
lea    0x10(%r15),%rsi
mov    %r14d,%edi
call   1050 <dump_ptr@plt>
mov    %rax,%r14
add    %ebp,%r14d
lea    0x18(%r15),%rsi
mov    0x14(%rsp),%edi
mov    %r12,%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
lea    0x20(%r15),%rsi
mov    0xc(%rsp),%edi
call   1050 <dump_ptr@plt>
mov    %rax,%r14
add    %ebp,%r14d
lea    0x28(%r15),%rsi
mov    0x18(%rsp),%edi
mov    %r12,%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
mov    %rax,%rbp
add    %r14d,%ebp
mov    %r15,%rsi
add    $0x30,%rsi
mov    0x1c(%rsp),%edi
mov    %r12,%rdx
call   10a0 <dump_unsigned_int_from_mem@plt>
add    %ebp,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
mov    $0x7,%esi
call   1060 <copy_params@plt>
mov    0x20(%rsp),%rcx
mov    %rax,(%rcx)
mov    %r15,%rdi
mov    $0x7,%esi
call   1040 <free_dumped_params@plt>
mov    0x8(%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.target = type { i32 }
define i32 @dump_msghdr(i32 %0, i32 %1, i8** nocapture writeonly %2, %struct.target* %3) {
%5 = alloca i32
%6 = add i32 %1, 4
%7 = add i32 %1, 12
%8 = add i32 %1, 20
%9 = add i32 %1, 24
%10 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%11 = icmp slt i32 %0, 0
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = tail call i8* @malloc(i32 0)
store i8* %13, i8** %2
br label %82
14: ; preds = %4
%15 = add i32 %1, 16
%16 = add i32 %1, 8
%17 = tail call dereferenceable_or_null(56) i8* @malloc(i32 56)
%18 = bitcast i8* %17 to i8**
%19 = tail call i32 @read_ptr_from_mem(i32 %1, %struct.target* %3)
%20 = tail call i32 @read_ptr_from_mem(i32 %16, %struct.target* %3)
%21 = tail call i32 @read_ptr_from_mem(i32 %15, %struct.target* %3)
%22 = icmp eq i32 %0, 0
br i1 %22, label %23, label %52
23: ; preds = %14
%24 = tail call i64 @dump_ptr(i32 %19, i8** %18)
%25 = trunc i64 %24 to i32
%26 = getelementptr inbounds i8*, i8** %18, i64 1
%27 = tail call i64 @dump_int_from_mem(i32 %6, i8** %26, %struct.target* %3)
%28 = trunc i64 %27 to i32
%29 = add i32 %25, %28
%30 = getelementptr inbounds i8*, i8** %18, i64 2
%31 = tail call i64 @dump_ptr(i32 %20, i8** %30)
%32 = trunc i64 %31 to i32
%33 = add i32 %29, %32
%34 = getelementptr inbounds i8*, i8** %18, i64 3
%35 = tail call i64 @dump_unsigned_int_from_mem(i32 %7, i8** %34, %struct.target* %3)
%36 = trunc i64 %35 to i32
%37 = add i32 %33, %36
%38 = getelementptr inbounds i8*, i8** %18, i64 4
%39 = tail call i64 @dump_ptr(i32 %21, i8** %38)
%40 = trunc i64 %39 to i32
%41 = add i32 %37, %40
%42 = getelementptr inbounds i8*, i8** %18, i64 5
%43 = tail call i64 @dump_unsigned_int_from_mem(i32 %8, i8** %42, %struct.target* %3)
%44 = trunc i64 %43 to i32
%45 = add i32 %41, %44
%46 = getelementptr inbounds i8*, i8** %18, i64 6
%47 = tail call i64 @dump_unsigned_int_from_mem(i32 %9, i8** %46, %struct.target* %3)
%48 = trunc i64 %47 to i32
%49 = add i32 %45, %48
store i32 %49, i32* %5
%50 = call i8* @copy_params(i8** %18, i32 7, i32* %5)
store i8* %50, i8** %2
%51 = call i32 @free_dumped_params(i8** %18, i32 7)
br label %82
52: ; preds = %14
%53 = tail call i64 @dump_n_bytes_from_mem(i32 %19, i8** %18, %struct.target* %3, i32 256)
%54 = trunc i64 %53 to i32
%55 = getelementptr inbounds i8*, i8** %18, i64 1
%56 = tail call i64 @dump_int_from_mem(i32 %6, i8** %55, %struct.target* %3)
%57 = trunc i64 %56 to i32
%58 = add i32 %54, %57
%59 = add nsw i32 %0, -1
%60 = getelementptr inbounds i8*, i8** %18, i64 2
%61 = tail call i64 @dump_iovec(i32 %59, i32 %20, i8** %60, %struct.target* %3)
%62 = trunc i64 %61 to i32
%63 = add i32 %58, %62
%64 = getelementptr inbounds i8*, i8** %18, i64 3
%65 = tail call i64 @dump_unsigned_int_from_mem(i32 %7, i8** %64, %struct.target* %3)
%66 = trunc i64 %65 to i32
%67 = add i32 %63, %66
%68 = getelementptr inbounds i8*, i8** %18, i64 4
%69 = tail call i64 @dump_n_bytes_from_mem(i32 %21, i8** %68, %struct.target* %3, i32 256)
%70 = trunc i64 %69 to i32
%71 = add i32 %67, %70
%72 = getelementptr inbounds i8*, i8** %18, i64 5
%73 = tail call i64 @dump_unsigned_int_from_mem(i32 %8, i8** %72, %struct.target* %3)
%74 = trunc i64 %73 to i32
%75 = add i32 %71, %74
%76 = getelementptr inbounds i8*, i8** %18, i64 6
%77 = tail call i64 @dump_unsigned_int_from_mem(i32 %9, i8** %76, %struct.target* %3)
%78 = trunc i64 %77 to i32
%79 = add i32 %75, %78
store i32 %79, i32* %5
%80 = call i8* @copy_params(i8** %18, i32 7, i32* %5)
store i8* %80, i8** %2
%81 = call i32 @free_dumped_params(i8** %18, i32 7)
br label %82
82: ; preds = %52, %23, %12
%83 = load i32, i32* %5
ret i32 %83
}