#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
char tolower(char);
void unix_path(char *val) {
  int len = val ? strlen(val) : 0;
  do {
    if ((len <= 0)) {
      fprintf(stderr,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/sebgod/docker-mercury/refs/heads/"
              "master/src/mmc-docker.c"
              ":"
              "147"
              ": "
              "%s",
              ("value is empty"));
      exit(EXIT_FAILURE);
    }
  } while (0);
  if (val[0] != '/') {
    int i;
    val[1] = tolower(val[0]);
    val[0] = '/';
    for (i = 2; i < len; i++) {
      if (val[i] == '\\') {
        val[i] = '/';
      }
    }
  }
}


x86 assembly (clang, -O0):
<unix_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1168 <unix_path+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
jmp    1172 <unix_path+0x32>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1172 <unix_path+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     11ac <unix_path+0x6c>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
lea    0xf02(%rip),%rdx
call   1040 <fprintf@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    11b1 <unix_path+0x71>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1229 <unix_path+0xe9>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1050 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x2f,(%rax)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1224 <unix_path+0xe4>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1211 <unix_path+0xd1>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
jmp    1216 <unix_path+0xd6>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e4 <unix_path+0xa4>
jmp    1229 <unix_path+0xe9>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unix_path>:
push   %rbp
push   %rbx
push   %rax
test   %rdi,%rdi
je     1385 <unix_path+0x245>
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    1385 <unix_path+0x245>
mov    %eax,%ebp
mov    (%rbx),%al
cmp    $0x2f,%al
je     135d <unix_path+0x21d>
movsbl %al,%edi
call   1050 <tolower@plt>
mov    %al,0x1(%rbx)
movb   $0x2f,(%rbx)
cmp    $0x3,%ebp
jb     135d <unix_path+0x21d>
mov    %ebp,%eax
lea    -0x2(%rax),%rdx
mov    $0x2,%ecx
cmp    $0x10,%rdx
jb     1379 <unix_path+0x239>
mov    %rdx,%rsi
and    $0xfffffffffffffff0,%rsi
lea    0x2(%rsi),%rcx
xor    %edi,%edi
movdqa 0xe57(%rip),%xmm0
movdqa 0xe5f(%rip),%xmm1
jmp    11cd <unix_path+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x10,%rdi
cmp    %rdi,%rsi
je     1358 <unix_path+0x218>
movq   0x2(%rbx,%rdi,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%ebp
test   $0x1,%bpl
je     11ea <unix_path+0xaa>
movb   $0x2f,0x2(%rbx,%rdi,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%ebp
shr    $0x10,%ebp
test   $0x1,%bpl
je     1205 <unix_path+0xc5>
movb   $0x2f,0x3(%rbx,%rdi,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%ebp
test   $0x1,%bpl
je     121e <unix_path+0xde>
movb   $0x2f,0x4(%rbx,%rdi,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%ebp
test   $0x1,%bpl
je     1237 <unix_path+0xf7>
movb   $0x2f,0x5(%rbx,%rdi,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%ebp
test   $0x1,%bpl
je     1250 <unix_path+0x110>
movb   $0x2f,0x6(%rbx,%rdi,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%ebp
test   $0x1,%bpl
je     1269 <unix_path+0x129>
movb   $0x2f,0x7(%rbx,%rdi,1)
pextrw $0x3,%xmm2,%ebp
test   $0x1,%bpl
je     1279 <unix_path+0x139>
movb   $0x2f,0x8(%rbx,%rdi,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%ebp
test   $0x1,%bpl
je     128e <unix_path+0x14e>
movb   $0x2f,0x9(%rbx,%rdi,1)
movq   0xa(%rbx,%rdi,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%ebp
test   $0x1,%bpl
je     12ab <unix_path+0x16b>
movb   $0x2f,0xa(%rbx,%rdi,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%ebp
shr    $0x10,%ebp
test   $0x1,%bpl
je     12c6 <unix_path+0x186>
movb   $0x2f,0xb(%rbx,%rdi,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%ebp
test   $0x1,%bpl
je     12df <unix_path+0x19f>
movb   $0x2f,0xc(%rbx,%rdi,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%ebp
test   $0x1,%bpl
je     12f8 <unix_path+0x1b8>
movb   $0x2f,0xd(%rbx,%rdi,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%ebp
test   $0x1,%bpl
je     1311 <unix_path+0x1d1>
movb   $0x2f,0xe(%rbx,%rdi,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%ebp
test   $0x1,%bpl
je     132a <unix_path+0x1ea>
movb   $0x2f,0xf(%rbx,%rdi,1)
pextrw $0x3,%xmm2,%ebp
test   $0x1,%bpl
je     133a <unix_path+0x1fa>
movb   $0x2f,0x10(%rbx,%rdi,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%ebp
test   $0x1,%bpl
je     11c0 <unix_path+0x80>
movb   $0x2f,0x11(%rbx,%rdi,1)
jmp    11c0 <unix_path+0x80>
cmp    %rsi,%rdx
jne    1379 <unix_path+0x239>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rcx
cmp    %rcx,%rax
je     135d <unix_path+0x21d>
cmpb   $0x5c,(%rbx,%rcx,1)
jne    1370 <unix_path+0x230>
movb   $0x2f,(%rbx,%rcx,1)
jmp    1370 <unix_path+0x230>
mov    0x2c54(%rip),%rax
mov    (%rax),%edi
lea    0xc8b(%rip),%rsi
lea    0xd1f(%rip),%rdx
call   1040 <fprintf@plt>
mov    0x2c30(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/sebgod/docker-mercury/refs/heads/master/src/mmc-docker.c:147: %s\00"
@.str.1 = [15 x i8] c"value is empty\00"
@EXIT_FAILURE = global i32 0
define void @unix_path(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %7
%12 = phi i32 [ %9, %7 ], [ 0, %10 ]
store i32 %12, i32* %3
br label %13
13: ; preds = %11
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %13
br label %22
22: ; preds = %21
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 47
br i1 %27, label %28, label %59
28: ; preds = %22
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = call signext i8 @tolower(i8 signext %31)
%33 = load i8*, i8** %2
%34 = getelementptr inbounds i8, i8* %33, i64 1
store i8 %32, i8* %34
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i64 0
store i8 47, i8* %36
store i32 2, i32* %4
br label %37
37: ; preds = %55, %28
%38 = load i32, i32* %4
%39 = load i32, i32* %3
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %58
41: ; preds = %37
%42 = load i8*, i8** %2
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 92
br i1 %48, label %49, label %54
49: ; preds = %41
%50 = load i8*, i8** %2
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
store i8 47, i8* %53
br label %54
54: ; preds = %49, %41
br label %55
55: ; preds = %54
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %37
58: ; preds = %37
br label %59
59: ; preds = %58, %22
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/sebgod/docker-mercury/refs/heads/master/src/mmc-docker.c:147: %s\00"
@.str.1 = [15 x i8] c"value is empty\00"
@EXIT_FAILURE = global i32 0
define void @unix_path(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %1, %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3
%12 = load i8, i8* %0
%13 = icmp eq i8 %12, 47
br i1 %13, label %130, label %14
14: ; preds = %11
%15 = tail call signext i8 @tolower(i8 signext %12)
%16 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %15, i8* %16
store i8 47, i8* %0
%17 = icmp ugt i32 %4, 2
br i1 %17, label %18, label %130
18: ; preds = %14
%19 = zext i32 %4 to i64
%20 = add nsw i64 %19, -2
%21 = icmp ult i64 %20, 16
br i1 %21, label %119, label %22
22: ; preds = %18
%23 = and i64 %20, -16
%24 = or i64 %23, 2
br label %25
25: ; preds = %114, %22
%26 = phi i64 [ 0, %22 ], [ %115, %114 ]
%27 = or i64 %26, 2
%28 = or i64 %26, 10
%29 = getelementptr inbounds i8, i8* %0, i64 %27
%30 = bitcast i8* %29 to <8 x i8>*
%31 = load <8 x i8>, <8 x i8>* %30
%32 = getelementptr inbounds i8, i8* %29, i64 8
%33 = bitcast i8* %32 to <8 x i8>*
%34 = load <8 x i8>, <8 x i8>* %33
%35 = icmp eq <8 x i8> %31, <i8 92, i8 92, i8 92, i8 92, i8 92, i8 92, i8 92, i8 92>
%36 = icmp eq <8 x i8> %34, <i8 92, i8 92, i8 92, i8 92, i8 92, i8 92, i8 92, i8 92>
%37 = extractelement <8 x i1> %35, i64 0
br i1 %37, label %38, label %40
38: ; preds = %25
%39 = getelementptr inbounds i8, i8* %0, i64 %27
store i8 47, i8* %39
br label %40
40: ; preds = %38, %25
%41 = extractelement <8 x i1> %35, i64 1
br i1 %41, label %42, label %45
42: ; preds = %40
%43 = or i64 %26, 3
%44 = getelementptr inbounds i8, i8* %0, i64 %43
store i8 47, i8* %44
br label %45
45: ; preds = %42, %40
%46 = extractelement <8 x i1> %35, i64 2
br i1 %46, label %47, label %50
47: ; preds = %45
%48 = or i64 %26, 4
%49 = getelementptr inbounds i8, i8* %0, i64 %48
store i8 47, i8* %49
br label %50
50: ; preds = %47, %45
%51 = extractelement <8 x i1> %35, i64 3
br i1 %51, label %52, label %55
52: ; preds = %50
%53 = or i64 %26, 5
%54 = getelementptr inbounds i8, i8* %0, i64 %53
store i8 47, i8* %54
br label %55
55: ; preds = %52, %50
%56 = extractelement <8 x i1> %35, i64 4
br i1 %56, label %57, label %60
57: ; preds = %55
%58 = or i64 %26, 6
%59 = getelementptr inbounds i8, i8* %0, i64 %58
store i8 47, i8* %59
br label %60
60: ; preds = %57, %55
%61 = extractelement <8 x i1> %35, i64 5
br i1 %61, label %62, label %65
62: ; preds = %60
%63 = or i64 %26, 7
%64 = getelementptr inbounds i8, i8* %0, i64 %63
store i8 47, i8* %64
br label %65
65: ; preds = %62, %60
%66 = extractelement <8 x i1> %35, i64 6
br i1 %66, label %67, label %70
67: ; preds = %65
%68 = or i64 %26, 8
%69 = getelementptr inbounds i8, i8* %0, i64 %68
store i8 47, i8* %69
br label %70
70: ; preds = %67, %65
%71 = extractelement <8 x i1> %35, i64 7
br i1 %71, label %72, label %75
72: ; preds = %70
%73 = or i64 %26, 9
%74 = getelementptr inbounds i8, i8* %0, i64 %73
store i8 47, i8* %74
br label %75
75: ; preds = %72, %70
%76 = extractelement <8 x i1> %36, i64 0
br i1 %76, label %77, label %79
77: ; preds = %75
%78 = getelementptr inbounds i8, i8* %0, i64 %28
store i8 47, i8* %78
br label %79
79: ; preds = %77, %75
%80 = extractelement <8 x i1> %36, i64 1
br i1 %80, label %81, label %84
81: ; preds = %79
%82 = or i64 %26, 11
%83 = getelementptr inbounds i8, i8* %0, i64 %82
store i8 47, i8* %83
br label %84
84: ; preds = %81, %79
%85 = extractelement <8 x i1> %36, i64 2
br i1 %85, label %86, label %89
86: ; preds = %84
%87 = or i64 %26, 12
%88 = getelementptr inbounds i8, i8* %0, i64 %87
store i8 47, i8* %88
br label %89
89: ; preds = %86, %84
%90 = extractelement <8 x i1> %36, i64 3
br i1 %90, label %91, label %94
91: ; preds = %89
%92 = or i64 %26, 13
%93 = getelementptr inbounds i8, i8* %0, i64 %92
store i8 47, i8* %93
br label %94
94: ; preds = %91, %89
%95 = extractelement <8 x i1> %36, i64 4
br i1 %95, label %96, label %99
96: ; preds = %94
%97 = or i64 %26, 14
%98 = getelementptr inbounds i8, i8* %0, i64 %97
store i8 47, i8* %98
br label %99
99: ; preds = %96, %94
%100 = extractelement <8 x i1> %36, i64 5
br i1 %100, label %101, label %104
101: ; preds = %99
%102 = or i64 %26, 15
%103 = getelementptr inbounds i8, i8* %0, i64 %102
store i8 47, i8* %103
br label %104
104: ; preds = %101, %99
%105 = extractelement <8 x i1> %36, i64 6
br i1 %105, label %106, label %109
106: ; preds = %104
%107 = add i64 %26, 16
%108 = getelementptr inbounds i8, i8* %0, i64 %107
store i8 47, i8* %108
br label %109
109: ; preds = %106, %104
%110 = extractelement <8 x i1> %36, i64 7
br i1 %110, label %111, label %114
111: ; preds = %109
%112 = add i64 %26, 17
%113 = getelementptr inbounds i8, i8* %0, i64 %112
store i8 47, i8* %113
br label %114
114: ; preds = %111, %109
%115 = add nuw i64 %26, 16
%116 = icmp eq i64 %115, %23
br i1 %116, label %117, label %25
117: ; preds = %114
%118 = icmp eq i64 %20, %23
br i1 %118, label %130, label %119
119: ; preds = %18, %117
%120 = phi i64 [ 2, %18 ], [ %24, %117 ]
br label %121
121: ; preds = %119, %127
%122 = phi i64 [ %128, %127 ], [ %120, %119 ]
%123 = getelementptr inbounds i8, i8* %0, i64 %122
%124 = load i8, i8* %123
%125 = icmp eq i8 %124, 92
br i1 %125, label %126, label %127
126: ; preds = %121
store i8 47, i8* %123
br label %127
127: ; preds = %121, %126
%128 = add nuw nsw i64 %122, 1
%129 = icmp eq i64 %128, %19
br i1 %129, label %130, label %121
130: ; preds = %127, %117, %14, %11
ret void
}