#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*/ strcat(char *, char *);
void ConcStr(char *s, char *r) {
  char *ptr, str[2];
  str[1] = 0;
  ptr = r;
  while (*ptr) {
    if (*ptr == '/')
      strcat(s, "\\");
    str[0] = *ptr;
    strcat(s, str);
    ptr++;
  }
}


x86 assembly (clang, -O0):
<ConcStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x19(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1180 <ConcStr+0x70>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1159 <ConcStr+0x49>
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1a(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1030 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112c <ConcStr+0x1c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConcStr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movb   $0x0,0x7(%rsp)
lea    0xed6(%rip),%r15
lea    0x6(%rsp),%r12
jmp    1161 <ConcStr+0x51>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcat@plt>
movzbl (%rbx),%eax
mov    %al,0x6(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <strcat@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x2f,%al
je     1140 <ConcStr+0x30>
test   %al,%al
jne    114e <ConcStr+0x3e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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