#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 */
int mount_tmpfs_at_path(char const *, char const *const);
int mount_tmpfs(const char *root_path, const char *const *paths) {
  int i = 0;
  int rc = 0;
  while (paths[i] != 0) {
    rc = mount_tmpfs_at_path(root_path, paths[i]);
    if (rc != 0)
      return rc;
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<mount_tmpfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     117c <mount_tmpfs+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <mount_tmpfs_at_path@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     116e <mount_tmpfs+0x5e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <mount_tmpfs+0x73>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <mount_tmpfs+0x1e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_tmpfs>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%rsi
xor    %r14d,%r14d
test   %rsi,%rsi
je     114d <mount_tmpfs+0x3d>
mov    %rdi,%rbp
add    $0x8,%rbx
nopl   0x0(%rax)
mov    %rbp,%rdi
call   1030 <mount_tmpfs_at_path@plt>
test   %eax,%eax
jne    114a <mount_tmpfs+0x3a>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1130 <mount_tmpfs+0x20>
jmp    114d <mount_tmpfs+0x3d>
mov    %eax,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mount_tmpfs(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %27, %2
%9 = load i8**, i8*** %5
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %9, i64 %11
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %30
15: ; preds = %8
%16 = load i8*, i8** %4
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @mount_tmpfs_at_path(i8* %16, i8* %21)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %15
%26 = load i32, i32* %7
store i32 %26, i32* %3
br label %31
27: ; preds = %15
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %8
30: ; preds = %8
store i32 0, i32* %3
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @mount_tmpfs(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8*, i8** %1, i64 %14
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %15, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %14, %5 ], [ 0, %2 ]
%11 = phi i8* [ %7, %5 ], [ %3, %2 ]
%12 = tail call i32 @mount_tmpfs_at_path(i8* %0, i8* %11)
%13 = icmp eq i32 %12, 0
%14 = add nuw i64 %10, 1
br i1 %13, label %5, label %15
15: ; preds = %9, %5, %2
%16 = phi i32 [ 0, %2 ], [ 0, %5 ], [ %12, %9 ]
ret i32 %16
}