#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 */
int /*<<< orphan*/ printf(char *, ...);
void print_content(void **in, int depth) {
  if (depth >= 4) {
    printf("...");
    return;
  }
  long x = (long)in;
  if (x & 1) {
    printf("%ld", x >> 1);
  } else {
    long size = *((long *)in);
    void **data = in + 1;
    int i;
    printf("{s:%ld", size);
    for (i = 0; i < size; i++) {
      printf(", ");
      print_content(*data, depth + 1);
      data++;
    }
    printf("}");
  }
}


x86 assembly (clang, -O0):
<print_content>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jl     114c <print_content+0x2c>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_content+0xe7>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1181 <print_content+0x61>
mov    -0x18(%rbp),%rsi
sar    $0x1,%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1207 <print_content+0xe7>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    11f9 <print_content+0xd9>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1040 <print_content@plt>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b1 <print_content+0x91>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_content>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x4,%esi
jl     1153 <print_content+0x23>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    %rdi,%r12
test   $0x1,%r12b
jne    11c1 <print_content+0x91>
mov    %esi,%ebp
mov    (%r12),%r14
lea    0xe9b(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14,%r14
jle    11af <print_content+0x7f>
add    $0x1,%ebp
lea    0xe89(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r12,%rbx,8),%rdi
mov    %ebp,%esi
call   1050 <print_content@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1190 <print_content+0x60>
mov    $0x7d,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
sar    %r12
lea    0xe3c(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"...\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [7 x i8] c"{s:%ld\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [2 x i8] c"}\00"
define void @print_content(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8**
%8 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 4
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %50
13: ; preds = %2
%14 = load i8**, i8*** %3
%15 = ptrtoint i8** %14 to i64
store i64 %15, i64* %5
%16 = load i64, i64* %5
%17 = and i64 %16, 1
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = load i64, i64* %5
%21 = ashr i64 %20, 1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %21)
br label %50
23: ; preds = %13
%24 = load i8**, i8*** %3
%25 = bitcast i8** %24 to i64*
%26 = load i64, i64* %25
store i64 %26, i64* %6
%27 = load i8**, i8*** %3
%28 = getelementptr inbounds i8*, i8** %27, i64 1
store i8** %28, i8*** %7
%29 = load i64, i64* %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 %29)
store i32 0, i32* %8
br label %31
31: ; preds = %45, %23
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = load i64, i64* %6
%35 = icmp slt i64 %33, %34
br i1 %35, label %36, label %48
36: ; preds = %31
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%38 = load i8**, i8*** %7
%39 = load i8*, i8** %38
%40 = bitcast i8* %39 to i8**
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
%43 = load i8**, i8*** %7
%44 = getelementptr inbounds i8*, i8** %43, i32 1
store i8** %44, i8*** %7
br label %45
45: ; preds = %36
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %31
48: ; preds = %31
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %11, %48, %19
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"...\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [7 x i8] c"{s:%ld\00"
@.str.3 = [3 x i8] c", \00"
define void @print_content(i8** %0, i32 %1) {
%3 = icmp sgt i32 %1, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %31
6: ; preds = %2
%7 = ptrtoint i8** %0 to i64
%8 = and i64 %7, 1
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = ashr i64 %7, 1
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %11)
br label %31
13: ; preds = %6
%14 = bitcast i8** %0 to i64*
%15 = load i64, i64* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 %15)
%17 = icmp sgt i64 %15, 0
br i1 %17, label %18, label %29
18: ; preds = %13
%19 = add nsw i32 %1, 1
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %27, %20 ]
%22 = phi i8** [ %0, %18 ], [ %23, %20 ]
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%25 = bitcast i8** %23 to i8***
%26 = load i8**, i8*** %25
tail call void @print_content(i8** %26, i32 %19)
%27 = add nuw nsw i64 %21, 1
%28 = icmp eq i64 %27, %15
br i1 %28, label %29, label %20
29: ; preds = %20, %13
%30 = tail call i32 @putchar(i32 125)
br label %31
31: ; preds = %10, %29, %4
ret void
}