#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*/ free(char *);
int /*<<< orphan*/ read_script(char *);
char *strdup(char const *);
int /*<<< orphan*/ sub_path_env(char **);
int run_init_script(const char **confignames) {
  int i = 0;
  while (confignames[i]) {
    char *config = strdup(confignames[i++]);
    sub_path_env(&config);
    (void)read_script(config);
    free(config);
  }
  return 0;
}


x86 assembly (clang, -O0):
<run_init_script>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11a5 <run_init_script+0x65>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <strdup@plt>
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <sub_path_env@plt>
mov    -0x18(%rbp),%rdi
call   1050 <read_script@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1153 <run_init_script+0x13>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_init_script>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     118f <run_init_script+0x4f>
add    $0x8,%rbx
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
call   1060 <strdup@plt>
mov    %rax,(%rsp)
mov    %r14,%rdi
call   1040 <sub_path_env@plt>
mov    (%rsp),%rdi
call   1050 <read_script@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1160 <run_init_script+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @run_init_script(i8** nocapture %0) {
%2 = alloca i8*
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = bitcast i8** %2 to i8*
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %10, %7 ]
%9 = phi i8* [ %3, %5 ], [ %18, %7 ]
%10 = add nuw i64 %8, 1
%11 = call i8* @strdup(i8* %9)
store i8* %11, i8** %2
%12 = call i32 @sub_path_env(i8** %2)
%13 = load i8*, i8** %2
%14 = call i32 @read_script(i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 @free(i8* %15)
%17 = getelementptr inbounds i8*, i8** %0, i64 %10
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %7
20: ; preds = %7, %1
ret i32 0
}