#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*/ pst_debug(int, char *, char *);
int /*<<< orphan*/ pst_debug_func(char *);
int /*<<< orphan*/ pst_debug_func_ret();
char *strpbrk(char *, char *);
void check_filename(char *fname) {
  char *t = fname;
  {
    pst_debug_func("check_filename");
    pst_debug(1004,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Distrotech/libpst/refs/heads/master/"
              "src/readpst.c",
              "Entering function\n");
  };
  if (!t) {
    {
      pst_debug(1006,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/Distrotech/libpst/refs/"
                "heads/master/src/readpst.c",
                "Leaving function\n");
      pst_debug_func_ret();
    };
    return;
  }
  while ((t = strpbrk(t, "/\\:"))) {
    *t = '_';
  }
  {
    pst_debug(1013,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Distrotech/libpst/refs/heads/master/"
              "src/readpst.c",
              "Leaving function\n");
    pst_debug_func_ret();
  };
}


x86 assembly (clang, -O0):
<check_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xea5(%rip),%rdi
call   1050 <pst_debug_func@plt>
mov    $0x3ec,%edi
lea    0xea3(%rip),%rsi
lea    0xf28(%rip),%rdx
call   1030 <pst_debug@plt>
cmpq   $0x0,-0x10(%rbp)
jne    11a7 <check_filename+0x67>
mov    $0x3ee,%edi
lea    0xe80(%rip),%rsi
lea    0xf18(%rip),%rdx
call   1030 <pst_debug@plt>
mov    $0x0,%al
call   1060 <pst_debug_func_ret@plt>
jmp    11f5 <check_filename+0xb5>
jmp    11ac <check_filename+0x6c>
mov    -0x10(%rbp),%rdi
lea    0xf09(%rip),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     11d6 <check_filename+0x96>
mov    -0x10(%rbp),%rax
movb   $0x5f,(%rax)
jmp    11ac <check_filename+0x6c>
mov    $0x3f5,%edi
lea    0xe2d(%rip),%rsi
lea    0xec5(%rip),%rdx
call   1030 <pst_debug@plt>
mov    $0x0,%al
call   1060 <pst_debug_func_ret@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_filename>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb3(%rip),%rdi
call   1050 <pst_debug_func@plt>
lea    0xeb6(%rip),%rsi
lea    0xf3b(%rip),%rdx
mov    $0x3ec,%edi
call   1030 <pst_debug@plt>
test   %rbx,%rbx
je     11a5 <check_filename+0x65>
lea    0xf4a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strpbrk@plt>
mov    $0x3f5,%ebp
test   %rax,%rax
je     11aa <check_filename+0x6a>
lea    0xf31(%rip),%rbx
nop
movb   $0x5f,(%rax)
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strpbrk@plt>
test   %rax,%rax
jne    1190 <check_filename+0x50>
jmp    11aa <check_filename+0x6a>
mov    $0x3ee,%ebp
lea    0xe5e(%rip),%rsi
lea    0xef6(%rip),%rdx
mov    %ebp,%edi
call   1030 <pst_debug@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <pst_debug_func_ret@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"check_filename\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Distrotech/libpst/refs/heads/master/src/readpst.c\00"
@.str.2 = [19 x i8] c"Entering function\0A\00"
@.str.3 = [18 x i8] c"Leaving function\0A\00"
@.str.4 = [4 x i8] c"/\\:\00"
define void @check_filename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = call i32 @pst_debug_func(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @pst_debug(i32 1004, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = call i32 @pst_debug(i32 1006, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (...) @pst_debug_func_ret()
br label %22
12: ; preds = %1
br label %13
13: ; preds = %17, %12
%14 = load i8*, i8** %3
%15 = call i8* @strpbrk(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i8* %15, i8** %3
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load i8*, i8** %3
store i8 95, i8* %18
br label %13
19: ; preds = %13
%20 = call i32 @pst_debug(i32 1013, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (...) @pst_debug_func_ret()
br label %22
22: ; preds = %19, %9
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"check_filename\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Distrotech/libpst/refs/heads/master/src/readpst.c\00"
@.str.2 = [19 x i8] c"Entering function\0A\00"
@.str.3 = [18 x i8] c"Leaving function\0A\00"
@.str.4 = [4 x i8] c"/\\:\00"
define void @check_filename(i8* %0) {
%2 = tail call i32 @pst_debug_func(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @pst_debug(i32 1004, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%4 = icmp eq i8* %0, null
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = tail call i8* @strpbrk(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %5, %8
%9 = phi i8* [ %10, %8 ], [ %6, %5 ]
store i8 95, i8* %9
%10 = tail call i8* @strpbrk(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %8
12: ; preds = %8, %5, %1
%13 = phi i32 [ 1006, %1 ], [ 1013, %5 ], [ 1013, %8 ]
%14 = tail call i32 @pst_debug(i32 %13, i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i32 (...) @pst_debug_func_ret()
ret void
}