#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 */
struct node {
  int dummy;
};
struct module {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ import_moddir(char **, size_t *, struct module *,
                                 struct node *);
void import_module_path(char **module_path, size_t *mplen, struct module *mod,
                        struct node *import) {
  import_moddir(module_path, mplen, mod, import);
  char *mp = *module_path;
  for (size_t n = 0; mp[n] != '\0'; ++n) {
    if (mp[n] == '/') {
      mp[n] = '.';
    }
  }
}


x86 assembly (clang, -O0):
<import_module_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <import_moddir@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     119c <import_module_path+0x8c>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1186 <import_module_path+0x76>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
movb   $0x2e,(%rax,%rcx,1)
jmp    118b <import_module_path+0x7b>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1150 <import_module_path+0x40>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<import_module_path>:
push   %rbx
mov    %rdi,%rbx
call   1030 <import_moddir@plt>
mov    (%rbx),%rax
jmp    1127 <import_module_path+0x17>
xchg   %ax,%ax
movb   $0x2e,(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x2f,%cl
je     1120 <import_module_path+0x10>
test   %cl,%cl
jne    1123 <import_module_path+0x13>
pop    %rbx
ret

LLVM IR (-O0):
%struct.module = type { i32 }
%struct.node = type { i32 }
define void @import_module_path(i8** %0, i64* %1, %struct.module* %2, %struct.node* %3) {
%5 = alloca i8**
%6 = alloca i64*
%7 = alloca %struct.module*
%8 = alloca %struct.node*
%9 = alloca i8*
%10 = alloca i64
store i8** %0, i8*** %5
store i64* %1, i64** %6
store %struct.module* %2, %struct.module** %7
store %struct.node* %3, %struct.node** %8
%11 = load i8**, i8*** %5
%12 = load i64*, i64** %6
%13 = load %struct.module*, %struct.module** %7
%14 = load %struct.node*, %struct.node** %8
%15 = call i32 @import_moddir(i8** %11, i64* %12, %struct.module* %13, %struct.node* %14)
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
store i8* %17, i8** %9
store i64 0, i64* %10
br label %18
18: ; preds = %37, %4
%19 = load i8*, i8** %9
%20 = load i64, i64* %10
%21 = getelementptr inbounds i8, i8* %19, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %40
25: ; preds = %18
%26 = load i8*, i8** %9
%27 = load i64, i64* %10
%28 = getelementptr inbounds i8, i8* %26, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 47
br i1 %31, label %32, label %36
32: ; preds = %25
%33 = load i8*, i8** %9
%34 = load i64, i64* %10
%35 = getelementptr inbounds i8, i8* %33, i64 %34
store i8 46, i8* %35
br label %36
36: ; preds = %32, %25
br label %37
37: ; preds = %36
%38 = load i64, i64* %10
%39 = add i64 %38, 1
store i64 %39, i64* %10
br label %18
40: ; preds = %18
ret void
}

LLVM IR (-O2):
%struct.module = type { i32 }
%struct.node = type { i32 }
define void @import_module_path(i8** %0, i64* %1, %struct.module* %2, %struct.node* %3) {
%5 = tail call i32 @import_moddir(i8** %0, i64* %1, %struct.module* %2, %struct.node* %3)
%6 = load i8*, i8** %0
br label %7
7: ; preds = %13, %4
%8 = phi i64 [ 0, %4 ], [ %14, %13 ]
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
switch i8 %10, label %13 [
i8 0, label %11
i8 47, label %12
]
11: ; preds = %7
ret void
12: ; preds = %7
store i8 46, i8* %9
br label %13
13: ; preds = %7, %12
%14 = add i64 %8, 1
br label %7
}