#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 PATH_MAX;
int /*<<< orphan*/ create_test_file(char *);
int /*<<< orphan*/ get_filename(char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void generate_file_content(char *path, int count) {
  char local_path[PATH_MAX + 1];
  strncpy(local_path, path, PATH_MAX - 1);
  int local_path_len = strlen(local_path);
  int i;
  for (i = 0; i < count; ++i) {
    get_filename(local_path + local_path_len);
    create_test_file(local_path);
  }
}


x86 assembly (clang, -O0):
<generate_file_content>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d9 <generate_file_content+0x99>
mov    -0x30(%rbp),%rdi
movslq -0x24(%rbp),%rax
add    %rax,%rdi
call   1040 <get_filename@plt>
mov    -0x30(%rbp),%rdi
call   1060 <create_test_file@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a6 <generate_file_content+0x66>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_file_content>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%rsi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
lea    0x1(%rdx),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
add    $0xffffffff,%edx
mov    %r14,%rdi
call   1030 <strncpy@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
test   %ebx,%ebx
jle    11a5 <generate_file_content+0x65>
movslq %eax,%r15
add    %r14,%r15
nopl   0x0(%rax)
mov    %r15,%rdi
call   1040 <get_filename@plt>
mov    %r14,%rdi
call   1060 <create_test_file@plt>
add    $0xffffffff,%ebx
jne    1190 <generate_file_content+0x50>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
define void @generate_file_content(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i32, i32* @PATH_MAX
%10 = add nsw i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8, i64 %11
store i64 %11, i64* %6
%14 = load i8*, i8** %3
%15 = load i32, i32* @PATH_MAX
%16 = sub nsw i32 %15, 1
%17 = call i32 @strncpy(i8* %13, i8* %14, i32 %16)
%18 = call i32 @strlen(i8* %13)
store i32 %18, i32* %7
store i32 0, i32* %8
br label %19
19: ; preds = %29, %2
%20 = load i32, i32* %8
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %13, i64 %25
%27 = call i32 @get_filename(i8* %26)
%28 = call i32 @create_test_file(i8* %13)
br label %29
29: ; preds = %23
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %19
32: ; preds = %19
%33 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
define void @generate_file_content(i8* %0, i32 %1) {
%3 = load i32, i32* @PATH_MAX
%4 = add nsw i32 %3, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = add nsw i32 %3, -1
%8 = call i32 @strncpy(i8* %6, i8* %0, i32 %7)
%9 = call i32 @strlen(i8* %6)
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = sext i32 %9 to i64
%13 = getelementptr inbounds i8, i8* %6, i64 %12
br label %14
14: ; preds = %11, %14
%15 = phi i32 [ 0, %11 ], [ %18, %14 ]
%16 = call i32 @get_filename(i8* %13)
%17 = call i32 @create_test_file(i8* %6)
%18 = add nuw nsw i32 %15, 1
%19 = icmp eq i32 %18, %1
br i1 %19, label %20, label %14
20: ; preds = %14, %2
ret void
}