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

/* Variables and functions */
struct ic_transform_ir_stmt *ic_transform_body_get(struct ic_transform_body *,
                                                   unsigned int);
unsigned int ic_transform_body_length(struct ic_transform_body *);
int /*<<< orphan*/ ic_transform_ir_stmt_print(int /*<<< orphan*/ *,
                                              struct ic_transform_ir_stmt *,
                                              unsigned int *);
int /*<<< orphan*/ puts(char *);
unsigned int ic_transform_body_print(FILE *fd, struct ic_transform_body *tbody,
                                     unsigned int *indent) {
  unsigned int i = 0;
  unsigned int len = 0;
  struct ic_transform_ir_stmt *tstmt = 0;
  unsigned int fake_indent = 0;
  if (!tbody) {
    puts("ic_transform_body_print: tbody was null");
    return 0;
  }
  if (!indent) {
    puts("ic_transform_body_print: indent was null");
    return 0;
  }
  len = ic_transform_body_length(tbody);
  for (i = 0; i < len; ++i) {
    tstmt = ic_transform_body_get(tbody, i);
    if (!tstmt) {
      puts("ic_transform_body_print: call to ic_transform_body_get failed");
      return 0;
    }
    fake_indent = *indent;
    if (!ic_transform_ir_stmt_print(fd, tstmt, &fake_indent)) {
      puts("ic_transform_body_print: call to ic_transform_stmt_print failed");
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<ic_transform_body_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1194 <ic_transform_body_print+0x54>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    125e <ic_transform_body_print+0x11e>
cmpq   $0x0,-0x20(%rbp)
jne    11b7 <ic_transform_body_print+0x77>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    125e <ic_transform_body_print+0x11e>
mov    -0x18(%rbp),%rdi
call   1050 <ic_transform_body_length@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jae    1257 <ic_transform_body_print+0x117>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <ic_transform_body_get@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1209 <ic_transform_body_print+0xc9>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    125e <ic_transform_body_print+0x11e>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1060 <ic_transform_ir_stmt_print@plt>
cmp    $0x0,%eax
jne    1244 <ic_transform_body_print+0x104>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    125e <ic_transform_body_print+0x11e>
jmp    1249 <ic_transform_body_print+0x109>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ca <ic_transform_body_print+0x8a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ic_transform_body_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
test   %rsi,%rsi
je     11b5 <ic_transform_body_print+0x75>
mov    %rdx,%r13
test   %rdx,%rdx
je     11be <ic_transform_body_print+0x7e>
mov    %rsi,%rbp
mov    %rdi,%r15
mov    %rsi,%rdi
call   1050 <ic_transform_body_length@plt>
mov    $0x1,%r14d
test   %eax,%eax
je     11df <ic_transform_body_print+0x9f>
mov    %eax,%r12d
xor    %ebx,%ebx
nopl   (%rax)
mov    %rbp,%rdi
mov    %ebx,%esi
call   1040 <ic_transform_body_get@plt>
test   %rax,%rax
je     11c7 <ic_transform_body_print+0x87>
mov    0x0(%r13),%ecx
mov    %ecx,0x4(%rsp)
mov    %r15,%rdi
mov    %rax,%rsi
lea    0x4(%rsp),%rdx
call   1060 <ic_transform_ir_stmt_print@plt>
test   %eax,%eax
je     11d0 <ic_transform_body_print+0x90>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    1180 <ic_transform_body_print+0x40>
jmp    11df <ic_transform_body_print+0x9f>
lea    0xe44(%rip),%rdi
jmp    11d7 <ic_transform_body_print+0x97>
lea    0xe63(%rip),%rdi
jmp    11d7 <ic_transform_body_print+0x97>
lea    0xe83(%rip),%rdi
jmp    11d7 <ic_transform_body_print+0x97>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ic_transform_body = type { i32 }
%struct.ic_transform_ir_stmt = type { i32 }
@.str = [40 x i8] c"ic_transform_body_print: tbody was null\00"
@.str.1 = [41 x i8] c"ic_transform_body_print: indent was null\00"
@.str.2 = [62 x i8] c"ic_transform_body_print: call to ic_transform_body_get failed\00"
@.str.3 = [64 x i8] c"ic_transform_body_print: call to ic_transform_stmt_print failed\00"
define i32 @ic_transform_body_print(i32* %0, %struct.ic_transform_body* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.ic_transform_body*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.ic_transform_ir_stmt*
%11 = alloca i32
store i32* %0, i32** %5
store %struct.ic_transform_body* %1, %struct.ic_transform_body** %6
store i32* %2, i32** %7
store i32 0, i32* %8
store i32 0, i32* %9
store %struct.ic_transform_ir_stmt* null, %struct.ic_transform_ir_stmt** %10
store i32 0, i32* %11
%12 = load %struct.ic_transform_body*, %struct.ic_transform_body** %6
%13 = icmp ne %struct.ic_transform_body* %12, null
br i1 %13, label %16, label %14
14: ; preds = %3
%15 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %50
16: ; preds = %3
%17 = load i32*, i32** %7
%18 = icmp ne i32* %17, null
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %50
21: ; preds = %16
%22 = load %struct.ic_transform_body*, %struct.ic_transform_body** %6
%23 = call i32 @ic_transform_body_length(%struct.ic_transform_body* %22)
store i32 %23, i32* %9
store i32 0, i32* %8
br label %24
24: ; preds = %46, %21
%25 = load i32, i32* %8
%26 = load i32, i32* %9
%27 = icmp ult i32 %25, %26
br i1 %27, label %28, label %49
28: ; preds = %24
%29 = load %struct.ic_transform_body*, %struct.ic_transform_body** %6
%30 = load i32, i32* %8
%31 = call %struct.ic_transform_ir_stmt* @ic_transform_body_get(%struct.ic_transform_body* %29, i32 %30)
store %struct.ic_transform_ir_stmt* %31, %struct.ic_transform_ir_stmt** %10
%32 = load %struct.ic_transform_ir_stmt*, %struct.ic_transform_ir_stmt** %10
%33 = icmp ne %struct.ic_transform_ir_stmt* %32, null
br i1 %33, label %36, label %34
34: ; preds = %28
%35 = call i32 @puts(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %50
36: ; preds = %28
%37 = load i32*, i32** %7
%38 = load i32, i32* %37
store i32 %38, i32* %11
%39 = load i32*, i32** %5
%40 = load %struct.ic_transform_ir_stmt*, %struct.ic_transform_ir_stmt** %10
%41 = call i32 @ic_transform_ir_stmt_print(i32* %39, %struct.ic_transform_ir_stmt* %40, i32* %11)
%42 = icmp ne i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %36
%44 = call i32 @puts(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %50
45: ; preds = %36
br label %46
46: ; preds = %45
%47 = load i32, i32* %8
%48 = add i32 %47, 1
store i32 %48, i32* %8
br label %24
49: ; preds = %24
store i32 1, i32* %4
br label %50
50: ; preds = %49, %43, %34, %19, %14
%51 = load i32, i32* %4
ret i32 %51
}

LLVM IR (-O2):
%struct.ic_transform_body = type { i32 }
%struct.ic_transform_ir_stmt = type { i32 }
@.str = [40 x i8] c"ic_transform_body_print: tbody was null\00"
@.str.1 = [41 x i8] c"ic_transform_body_print: indent was null\00"
@.str.2 = [62 x i8] c"ic_transform_body_print: call to ic_transform_body_get failed\00"
@.str.3 = [64 x i8] c"ic_transform_body_print: call to ic_transform_stmt_print failed\00"
define i32 @ic_transform_body_print(i32* %0, %struct.ic_transform_body* %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = icmp eq %struct.ic_transform_body* %1, null
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %31
9: ; preds = %3
%10 = icmp eq i32* %2, null
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %31
13: ; preds = %9
%14 = tail call i32 @ic_transform_body_length(%struct.ic_transform_body* %1)
%15 = icmp eq i32 %14, 0
br i1 %15, label %31, label %18
16: ; preds = %24
%17 = icmp eq i32 %28, %14
br i1 %17, label %31, label %18
18: ; preds = %13, %16
%19 = phi i32 [ %28, %16 ], [ 0, %13 ]
%20 = call %struct.ic_transform_ir_stmt* @ic_transform_body_get(%struct.ic_transform_body* %1, i32 %19)
%21 = icmp eq %struct.ic_transform_ir_stmt* %20, null
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
br label %31
24: ; preds = %18
%25 = load i32, i32* %2
store i32 %25, i32* %4
%26 = call i32 @ic_transform_ir_stmt_print(i32* %0, %struct.ic_transform_ir_stmt* %20, i32* %4)
%27 = icmp eq i32 %26, 0
%28 = add nuw i32 %19, 1
br i1 %27, label %29, label %16
29: ; preds = %24
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %16, %13, %29, %22, %11, %7
%32 = phi i32 [ 0, %29 ], [ 0, %22 ], [ 0, %11 ], [ 0, %7 ], [ 1, %13 ], [ 1, %16 ]
ret i32 %32
}