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

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
struct ic_token *ic_token_list_get(struct ic_token_list *, unsigned int);
unsigned int ic_token_list_length(struct ic_token_list *);
int /*<<< orphan*/ ic_token_print_debug(int /*<<< orphan*/ *,
                                        struct ic_token *);
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ puts(char *);
void ic_token_list_print_debug(FILE *fd, struct ic_token_list *list) {
  struct ic_token *token = 0;
  unsigned int i = 0;
  unsigned int len = 0;
  if (!list) {
    puts("ic_token_list_print: ERROR list was null");
    return;
  }
  len = ic_token_list_length(list);
  for (i = 0; i < len; ++i) {
    token = ic_token_list_get(list, i);
    if (!token) {
      printf(
          "ic_token_list_print: call to ic_token_list_get for i '%d' failed\n",
          i);
      return;
    }
    if (i) {
      fputs(" ", fd);
    }
    ic_token_print_debug(fd, token);
  }
}


x86 assembly (clang, -O0):
<ic_token_list_print_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a2 <ic_token_list_print_debug+0x42>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
jmp    1225 <ic_token_list_print_debug+0xc5>
mov    -0x10(%rbp),%rdi
call   1040 <ic_token_list_length@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    1225 <ic_token_list_print_debug+0xc5>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1070 <ic_token_list_get@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11f0 <ic_token_list_print_debug+0x90>
mov    -0x1c(%rbp),%esi
lea    0xe43(%rip),%rdi
call   1050 <printf@plt>
jmp    1225 <ic_token_list_print_debug+0xc5>
cmpl   $0x0,-0x1c(%rbp)
je     120a <ic_token_list_print_debug+0xaa>
mov    -0x8(%rbp),%rsi
lea    0xe66(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <ic_token_print_debug@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b5 <ic_token_list_print_debug+0x55>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_token_list_print_debug>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rsi,%rsi
je     11d1 <ic_token_list_print_debug+0x71>
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rsi,%rdi
call   1040 <ic_token_list_length@plt>
test   %eax,%eax
je     11c8 <ic_token_list_print_debug+0x68>
mov    %eax,%r15d
xor    %ebp,%ebp
jmp    11a3 <ic_token_list_print_debug+0x43>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <ic_token_print_debug@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
je     11c8 <ic_token_list_print_debug+0x68>
mov    %r14,%rdi
mov    %ebp,%esi
call   1060 <ic_token_list_get@plt>
test   %rax,%rax
je     11e5 <ic_token_list_print_debug+0x85>
mov    %rax,%rbx
test   %ebp,%ebp
je     1190 <ic_token_list_print_debug+0x30>
mov    $0x20,%edi
mov    %r12,%rsi
call   1070 <fputc@plt>
jmp    1190 <ic_token_list_print_debug+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe28(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>
lea    0xe3d(%rip),%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
%struct.ic_token_list = type { i32 }
%struct.ic_token = type { i32 }
@.str = [41 x i8] c"ic_token_list_print: ERROR list was null\00"
@.str.1 = [66 x i8] c"ic_token_list_print: call to ic_token_list_get for i '%d' failed\0A\00"
@.str.2 = [2 x i8] c" \00"
define void @ic_token_list_print_debug(i32* %0, %struct.ic_token_list* %1) {
%3 = alloca i32*
%4 = alloca %struct.ic_token_list*
%5 = alloca %struct.ic_token*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store %struct.ic_token_list* %1, %struct.ic_token_list** %4
store %struct.ic_token* null, %struct.ic_token** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load %struct.ic_token_list*, %struct.ic_token_list** %4
%9 = icmp ne %struct.ic_token_list* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %41
12: ; preds = %2
%13 = load %struct.ic_token_list*, %struct.ic_token_list** %4
%14 = call i32 @ic_token_list_length(%struct.ic_token_list* %13)
store i32 %14, i32* %7
store i32 0, i32* %6
br label %15
15: ; preds = %38, %12
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %41
19: ; preds = %15
%20 = load %struct.ic_token_list*, %struct.ic_token_list** %4
%21 = load i32, i32* %6
%22 = call %struct.ic_token* @ic_token_list_get(%struct.ic_token_list* %20, i32 %21)
store %struct.ic_token* %22, %struct.ic_token** %5
%23 = load %struct.ic_token*, %struct.ic_token** %5
%24 = icmp ne %struct.ic_token* %23, null
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = load i32, i32* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %41
28: ; preds = %19
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32*, i32** %3
%33 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %32)
br label %34
34: ; preds = %31, %28
%35 = load i32*, i32** %3
%36 = load %struct.ic_token*, %struct.ic_token** %5
%37 = call i32 @ic_token_print_debug(i32* %35, %struct.ic_token* %36)
br label %38
38: ; preds = %34
%39 = load i32, i32* %6
%40 = add i32 %39, 1
store i32 %40, i32* %6
br label %15
41: ; preds = %10, %25, %15
ret void
}

LLVM IR (-O2):
%struct.ic_token_list = type { i32 }
%struct.ic_token = type { i32 }
@.str = [41 x i8] c"ic_token_list_print: ERROR list was null\00"
@.str.1 = [66 x i8] c"ic_token_list_print: call to ic_token_list_get for i '%d' failed\0A\00"
define void @ic_token_list_print_debug(i32* %0, %struct.ic_token_list* %1) {
%3 = icmp eq %struct.ic_token_list* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %23
6: ; preds = %2
%7 = tail call i32 @ic_token_list_length(%struct.ic_token_list* %1)
%8 = icmp eq i32 %7, 0
br i1 %8, label %23, label %9
9: ; preds = %6, %19
%10 = phi i32 [ %21, %19 ], [ 0, %6 ]
%11 = tail call %struct.ic_token* @ic_token_list_get(%struct.ic_token_list* %1, i32 %10)
%12 = icmp eq %struct.ic_token* %11, null
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %23
15: ; preds = %9
%16 = icmp eq i32 %10, 0
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = tail call i32 @fputc(i32 32, i32* %0)
br label %19
19: ; preds = %17, %15
%20 = tail call i32 @ic_token_print_debug(i32* %0, %struct.ic_token* %11)
%21 = add nuw i32 %10, 1
%22 = icmp eq i32 %21, %7
br i1 %22, label %23, label %9
23: ; preds = %19, %6, %13, %4
ret void
}