#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 Obj {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ css_debug_obj(int /*<<< orphan*/ *, struct Obj *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void css_debug_objs(FILE *fp, struct Obj **objs) {
  int i = 0;
  struct Obj *obj = objs[i];
  if (!obj) {
    fprintf(fp, "<NULL>");
    return;
  }
  for (;;) {
    css_debug_obj(fp, obj);
    obj = objs[++i];
    if (!obj)
      break;
    fprintf(fp, " | ");
  }
}


x86 assembly (clang, -O0):
<css_debug_objs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1167 <css_debug_objs+0x47>
mov    -0x8(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11b6 <css_debug_objs+0x96>
jmp    116c <css_debug_objs+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <css_debug_obj@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11a1 <css_debug_objs+0x81>
jmp    11b6 <css_debug_objs+0x96>
mov    -0x8(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1040 <fprintf@plt>
jmp    116c <css_debug_objs+0x4c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<css_debug_objs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1198 <css_debug_objs+0x78>
mov    %r14,%rdi
call   1030 <css_debug_obj@plt>
mov    0x8(%rbx),%r15
test   %r15,%r15
je     118c <css_debug_objs+0x6c>
add    $0x10,%rbx
lea    0xeb5(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r14,%rcx
call   1040 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <css_debug_obj@plt>
mov    (%rbx),%r15
add    $0x8,%rbx
test   %r15,%r15
jne    1160 <css_debug_objs+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe61(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
%struct.Obj = type { i32 }
@.str = [7 x i8] c"<NULL>\00"
@.str.1 = [4 x i8] c" | \00"
define void @css_debug_objs(i32* %0, %struct.Obj** %1) {
%3 = alloca i32*
%4 = alloca %struct.Obj**
%5 = alloca i32
%6 = alloca %struct.Obj*
store i32* %0, i32** %3
store %struct.Obj** %1, %struct.Obj*** %4
store i32 0, i32* %5
%7 = load %struct.Obj**, %struct.Obj*** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds %struct.Obj*, %struct.Obj** %7, i64 %9
%11 = load %struct.Obj*, %struct.Obj** %10
store %struct.Obj* %11, %struct.Obj** %6
%12 = load %struct.Obj*, %struct.Obj** %6
%13 = icmp ne %struct.Obj* %12, null
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = load i32*, i32** %3
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %34
17: ; preds = %2
br label %18
18: ; preds = %31, %17
%19 = load i32*, i32** %3
%20 = load %struct.Obj*, %struct.Obj** %6
%21 = call i32 @css_debug_obj(i32* %19, %struct.Obj* %20)
%22 = load %struct.Obj**, %struct.Obj*** %4
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds %struct.Obj*, %struct.Obj** %22, i64 %25
%27 = load %struct.Obj*, %struct.Obj** %26
store %struct.Obj* %27, %struct.Obj** %6
%28 = load %struct.Obj*, %struct.Obj** %6
%29 = icmp ne %struct.Obj* %28, null
br i1 %29, label %31, label %30
30: ; preds = %18
br label %34
31: ; preds = %18
%32 = load i32*, i32** %3
%33 = call i32 @fprintf(i32* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %18
34: ; preds = %14, %30
ret void
}

LLVM IR (-O2):
%struct.Obj = type { i32 }
@.str = [7 x i8] c"<NULL>\00"
@.str.1 = [4 x i8] c" | \00"
define void @css_debug_objs(i32* %0, %struct.Obj** nocapture %1) {
%3 = load %struct.Obj*, %struct.Obj** %1
%4 = icmp eq %struct.Obj* %3, null
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @css_debug_obj(i32* %0, %struct.Obj* %3)
%7 = getelementptr inbounds %struct.Obj*, %struct.Obj** %1, i64 1
%8 = load %struct.Obj*, %struct.Obj** %7
%9 = icmp eq %struct.Obj* %8, null
br i1 %9, label %21, label %12
10: ; preds = %2
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 6, i64 1, i32* %0)
br label %21
12: ; preds = %5, %12
%13 = phi i64 [ %17, %12 ], [ 1, %5 ]
%14 = phi %struct.Obj* [ %19, %12 ], [ %8, %5 ]
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 3, i64 1, i32* %0)
%16 = tail call i32 @css_debug_obj(i32* %0, %struct.Obj* %14)
%17 = add nuw i64 %13, 1
%18 = getelementptr inbounds %struct.Obj*, %struct.Obj** %1, i64 %17
%19 = load %struct.Obj*, %struct.Obj** %18
%20 = icmp eq %struct.Obj* %19, null
br i1 %20, label %21, label %12
21: ; preds = %12, %5, %10
ret void
}