#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 /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int const);
int /*<<< orphan*/ stress_mount_add(char **, int const, int *, char *);
int stress_mount_get(char *mnts[], const int max) {
  int n = 0;
  (void)memset(mnts, 0, max * sizeof(*mnts));
  stress_mount_add(mnts, max, &n, "/");
  stress_mount_add(mnts, max, &n, "/dev");
  stress_mount_add(mnts, max, &n, "/tmp");
  return n;
}


x86 assembly (clang, -O0):
<stress_mount_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    0xea3(%rip),%rcx
call   1040 <stress_mount_add@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    0xe8e(%rip),%rcx
call   1040 <stress_mount_add@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    0xe7c(%rip),%rcx
call   1040 <stress_mount_add@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_mount_get>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
movl   $0x0,0xc(%rsp)
lea    0x0(,%r14,8),%edx
xor    %esi,%esi
call   1030 <memset@plt>
lea    0xeb3(%rip),%rcx
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15,%rdx
call   1040 <stress_mount_add@plt>
lea    0xe9b(%rip),%rcx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15,%rdx
call   1040 <stress_mount_add@plt>
lea    0xe8b(%rip),%rcx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r15,%rdx
call   1040 <stress_mount_add@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c"/dev\00"
@.str.2 = [5 x i8] c"/tmp\00"
define i32 @stress_mount_get(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i8**, i8*** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 8
%10 = trunc i64 %9 to i32
%11 = call i32 @memset(i8** %6, i32 0, i32 %10)
%12 = load i8**, i8*** %3
%13 = load i32, i32* %4
%14 = call i32 @stress_mount_add(i8** %12, i32 %13, i32* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load i8**, i8*** %3
%16 = load i32, i32* %4
%17 = call i32 @stress_mount_add(i8** %15, i32 %16, i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = load i8**, i8*** %3
%19 = load i32, i32* %4
%20 = call i32 @stress_mount_add(i8** %18, i32 %19, i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c"/dev\00"
@.str.2 = [5 x i8] c"/tmp\00"
define i32 @stress_mount_get(i8** %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = shl i32 %1, 3
%6 = tail call i32 @memset(i8** %0, i32 0, i32 %5)
%7 = call i32 @stress_mount_add(i8** %0, i32 %1, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @stress_mount_add(i8** %0, i32 %1, i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @stress_mount_add(i8** %0, i32 %1, i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %3
ret i32 %10
}