#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 Superblock {
  int dummy;
};
struct Inode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dump_data_block(struct Superblock *, unsigned int);
scalar_t__ get_inode_data_block(struct Superblock *, struct Inode *,
                                int /*<<< orphan*/, unsigned int *);
void dump_inode_content(struct Superblock *sblock, struct Inode *inode) {
  unsigned int db_nr = 0;
  unsigned int db_block_nr = 0;
  while (get_inode_data_block(sblock, inode, db_nr++, &db_block_nr)) {
    dump_data_block(sblock, db_block_nr);
  }
}


x86 assembly (clang, -O0):
<dump_inode_content>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
lea    -0x18(%rbp),%rcx
call   1040 <get_inode_data_block@plt>
cmp    $0x0,%rax
je     1175 <dump_inode_content+0x55>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <dump_data_block@plt>
jmp    113e <dump_inode_content+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_inode_content>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rcx
xor    %edx,%edx
call   1040 <get_inode_data_block@plt>
test   %rax,%rax
je     1174 <dump_inode_content+0x54>
mov    $0x1,%ebp
lea    0x4(%rsp),%r15
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <dump_data_block@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
call   1040 <get_inode_data_block@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    1150 <dump_inode_content+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.Superblock = type { i32 }
%struct.Inode = type { i32 }
define void @dump_inode_content(%struct.Superblock* %0, %struct.Inode* %1) {
%3 = alloca %struct.Superblock*
%4 = alloca %struct.Inode*
%5 = alloca i32
%6 = alloca i32
store %struct.Superblock* %0, %struct.Superblock** %3
store %struct.Inode* %1, %struct.Inode** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %14, %2
%8 = load %struct.Superblock*, %struct.Superblock** %3
%9 = load %struct.Inode*, %struct.Inode** %4
%10 = load i32, i32* %5
%11 = add i32 %10, 1
store i32 %11, i32* %5
%12 = call i64 @get_inode_data_block(%struct.Superblock* %8, %struct.Inode* %9, i32 %10, i32* %6)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %7
%15 = load %struct.Superblock*, %struct.Superblock** %3
%16 = load i32, i32* %6
%17 = call i32 @dump_data_block(%struct.Superblock* %15, i32 %16)
br label %7
18: ; preds = %7
ret void
}

LLVM IR (-O2):
%struct.Superblock = type { i32 }
%struct.Inode = type { i32 }
define void @dump_inode_content(%struct.Superblock* %0, %struct.Inode* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i64 @get_inode_data_block(%struct.Superblock* %0, %struct.Inode* %1, i32 0, i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %9, %7 ], [ 0, %2 ]
%9 = add i32 %8, 1
%10 = load i32, i32* %3
%11 = call i32 @dump_data_block(%struct.Superblock* %0, i32 %10)
%12 = call i64 @get_inode_data_block(%struct.Superblock* %0, %struct.Inode* %1, i32 %9, i32* %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %2
ret void
}