#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 */
scalar_t__ strncmp(char *, char *, int);
void _zr_fix_name(char **fn) {
  for (;;) {
    if (strncmp(*fn, "./", 2) == 0)
      (*fn) = (*fn) + 2;
    else if (**fn == '/')
      (*fn) = (*fn) + 1;
    else
      break;
  }
}


x86 assembly (clang, -O0):
<_zr_fix_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xed6(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1155 <_zr_fix_name+0x45>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1189 <_zr_fix_name+0x79>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    117f <_zr_fix_name+0x6f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1184 <_zr_fix_name+0x74>
jmp    118e <_zr_fix_name+0x7e>
jmp    1189 <_zr_fix_name+0x79>
jmp    111c <_zr_fix_name+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_zr_fix_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
lea    0xedf(%rip),%r14
jmp    113b <_zr_fix_name+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2,%eax
add    %rax,%rdi
mov    %rdi,(%rbx)
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    (%rbx),%rdi
test   %rax,%rax
je     1130 <_zr_fix_name+0x20>
mov    $0x1,%eax
cmpb   $0x2f,(%rdi)
je     1135 <_zr_fix_name+0x25>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"./\00"
define void @_zr_fix_name(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %26, %1
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load i8**, i8*** %2
store i8* %11, i8** %12
br label %26
13: ; preds = %3
%14 = load i8**, i8*** %2
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 47
br i1 %18, label %19, label %24
19: ; preds = %13
%20 = load i8**, i8*** %2
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8**, i8*** %2
store i8* %22, i8** %23
br label %25
24: ; preds = %13
br label %27
25: ; preds = %19
br label %26
26: ; preds = %25, %8
br label %3
27: ; preds = %24
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"./\00"
define void @_zr_fix_name(i8** nocapture %0) {
%2 = load i8*, i8** %0
br label %3
3: ; preds = %11, %1
%4 = phi i8* [ %13, %11 ], [ %2, %1 ]
%5 = tail call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = icmp eq i64 %5, 0
%7 = load i8*, i8** %0
br i1 %6, label %11, label %8
8: ; preds = %3
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 47
br i1 %10, label %11, label %14
11: ; preds = %8, %3
%12 = phi i64 [ 2, %3 ], [ 1, %8 ]
%13 = getelementptr inbounds i8, i8* %7, i64 %12
store i8* %13, i8** %0
br label %3
14: ; preds = %8
ret void
}