#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ pedigree_get_mount(char *, char *, size_t);
int /*<<< orphan*/ printf(char *, char *, char *);
int main(void) {
  size_t i = 0;
  char *mount_buf = (char *)malloc(64), *info_buf = (char *)malloc(128);
  while (!pedigree_get_mount(mount_buf, info_buf, i)) {
    printf("%s: %s\n", mount_buf, info_buf);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <pedigree_get_mount@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1189 <main+0x59>
jmp    11ae <main+0x7e>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1163 <main+0x33>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x40,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x80,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rax,%rsi
xor    %edx,%edx
call   1030 <pedigree_get_mount@plt>
test   %eax,%eax
jne    1194 <main+0x64>
mov    $0x1,%ebx
lea    0xe91(%rip),%r12
nop
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <pedigree_get_mount@plt>
add    $0x1,%rbx
test   %eax,%eax
je     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i64 0, i64* %2
%5 = call i64 @malloc(i32 64)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %3
%7 = call i64 @malloc(i32 128)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %4
br label %9
9: ; preds = %16, %0
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = load i64, i64* %2
%13 = call i32 @pedigree_get_mount(i8* %10, i8* %11, i64 %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %16, label %22
16: ; preds = %9
%17 = load i8*, i8** %3
%18 = load i8*, i8** %4
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
%20 = load i64, i64* %2
%21 = add i64 %20, 1
store i64 %21, i64* %2
br label %9
22: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 64)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @malloc(i32 128)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @pedigree_get_mount(i8* %2, i8* %4, i64 0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %0, %7
%8 = phi i64 [ %10, %7 ], [ 0, %0 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %4)
%10 = add i64 %8, 1
%11 = tail call i32 @pedigree_get_mount(i8* %2, i8* %4, i64 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %0
ret i32 0
}