#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 pbc_rmessage {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dump_value(struct pbc_rmessage *, char const *, int, int,
                              int);
int pbc_rmessage_next(struct pbc_rmessage *, char const **);
int pbc_rmessage_size(struct pbc_rmessage *, char const *);
void dump_message(struct pbc_rmessage *m, int level) {
  int t = 0;
  const char *key = NULL;
  for (;;) {
    t = pbc_rmessage_next(m, &key);
    if (key == NULL)
      break;
    if (t & 128) {
      int n = pbc_rmessage_size(m, key);
      int i;
      for (i = 0; i < n; i++) {
        dump_value(m, key, t, i, level);
      }
    } else {
      dump_value(m, key, t, 0, level);
    }
  }
}


x86 assembly (clang, -O0):
<dump_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <pbc_rmessage_next@plt>
mov    %eax,-0x10(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116e <dump_message+0x3e>
jmp    11e7 <dump_message+0xb7>
mov    -0x10(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     11cc <dump_message+0x9c>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <pbc_rmessage_size@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c7 <dump_message+0x97>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0xc(%rbp),%r8d
call   1050 <dump_value@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1196 <dump_message+0x66>
jmp    11e2 <dump_message+0xb2>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r8d
xor    %ecx,%ecx
call   1050 <dump_value@plt>
jmp    114e <dump_message+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_message>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r12
movq   $0x0,(%rsp)
mov    %rsp,%rsi
call   1030 <pbc_rmessage_next@plt>
mov    (%rsp),%rsi
test   %rsi,%rsi
je     11cd <dump_message+0x9d>
mov    %eax,%r13d
mov    %rsp,%r14
jmp    1194 <dump_message+0x64>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13d,%edx
xor    %ecx,%ecx
mov    %r15d,%r8d
call   1050 <dump_value@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1030 <pbc_rmessage_next@plt>
mov    %eax,%r13d
mov    (%rsp),%rsi
test   %rsi,%rsi
je     11cd <dump_message+0x9d>
mov    %r12,%rdi
test   $0x80,%r13b
je     1170 <dump_message+0x40>
call   1040 <pbc_rmessage_size@plt>
test   %eax,%eax
jle    117d <dump_message+0x4d>
mov    %eax,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rsi
mov    %r12,%rdi
mov    %r13d,%edx
mov    %ebp,%ecx
mov    %r15d,%r8d
call   1050 <dump_value@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11b0 <dump_message+0x80>
jmp    117d <dump_message+0x4d>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.pbc_rmessage = type { i32 }
define void @dump_message(%struct.pbc_rmessage* %0, i32 %1) {
%3 = alloca %struct.pbc_rmessage*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store %struct.pbc_rmessage* %0, %struct.pbc_rmessage** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i8* null, i8** %6
br label %9
9: ; preds = %44, %2
%10 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %3
%11 = call i32 @pbc_rmessage_next(%struct.pbc_rmessage* %10, i8** %6)
store i32 %11, i32* %5
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %9
br label %45
15: ; preds = %9
%16 = load i32, i32* %5
%17 = and i32 %16, 128
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %38
19: ; preds = %15
%20 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %3
%21 = load i8*, i8** %6
%22 = call i32 @pbc_rmessage_size(%struct.pbc_rmessage* %20, i8* %21)
store i32 %22, i32* %7
store i32 0, i32* %8
br label %23
23: ; preds = %34, %19
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %37
27: ; preds = %23
%28 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %3
%29 = load i8*, i8** %6
%30 = load i32, i32* %5
%31 = load i32, i32* %8
%32 = load i32, i32* %4
%33 = call i32 @dump_value(%struct.pbc_rmessage* %28, i8* %29, i32 %30, i32 %31, i32 %32)
br label %34
34: ; preds = %27
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %23
37: ; preds = %23
br label %44
38: ; preds = %15
%39 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %3
%40 = load i8*, i8** %6
%41 = load i32, i32* %5
%42 = load i32, i32* %4
%43 = call i32 @dump_value(%struct.pbc_rmessage* %39, i8* %40, i32 %41, i32 0, i32 %42)
br label %44
44: ; preds = %38, %37
br label %9
45: ; preds = %14
ret void
}

LLVM IR (-O2):
%struct.pbc_rmessage = type { i32 }
define void @dump_message(%struct.pbc_rmessage* %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i32 @pbc_rmessage_next(%struct.pbc_rmessage* %0, i8** %3)
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %28, label %8
8: ; preds = %2, %24
%9 = phi i8* [ %26, %24 ], [ %6, %2 ]
%10 = phi i32 [ %25, %24 ], [ %5, %2 ]
%11 = and i32 %10, 128
%12 = icmp eq i32 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %8
%14 = call i32 @pbc_rmessage_size(%struct.pbc_rmessage* %0, i8* %9)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %13, %16
%17 = phi i32 [ %20, %16 ], [ 0, %13 ]
%18 = load i8*, i8** %3
%19 = call i32 @dump_value(%struct.pbc_rmessage* %0, i8* %18, i32 %10, i32 %17, i32 %1)
%20 = add nuw nsw i32 %17, 1
%21 = icmp eq i32 %20, %14
br i1 %21, label %24, label %16
22: ; preds = %8
%23 = call i32 @dump_value(%struct.pbc_rmessage* %0, i8* %9, i32 %10, i32 0, i32 %1)
br label %24
24: ; preds = %16, %13, %22
%25 = call i32 @pbc_rmessage_next(%struct.pbc_rmessage* %0, i8** %3)
%26 = load i8*, i8** %3
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %8
28: ; preds = %24, %2
ret void
}