#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 strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void Cffcrep(char *comm, char *comm1, int *repeat) {
  int len;
  *repeat = 0;
  len = strlen(comm);
  if (len && comm[len - 1] == '&') {
    strncpy(comm1, comm, len - 1);
    comm1[len - 1] = '\0';
    *repeat = 1;
  }
  return;
}


x86 assembly (clang, -O0):
<Cffcrep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     119c <Cffcrep+0x7c>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    119c <Cffcrep+0x7c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cffcrep>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
movl   $0x0,(%rdx)
call   1040 <strlen@plt>
test   %eax,%eax
je     1168 <Cffcrep+0x48>
movslq %eax,%rbx
cmpb   $0x26,-0x1(%r12,%rbx,1)
jne    1168 <Cffcrep+0x48>
add    $0xffffffffffffffff,%rbx
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movb   $0x0,(%r14,%rbx,1)
movl   $0x1,(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Cffcrep(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
store i32 0, i32* %8
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %34
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = load i32, i32* %7
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 38
br i1 %21, label %22, label %34
22: ; preds = %13
%23 = load i8*, i8** %5
%24 = load i8*, i8** %4
%25 = load i32, i32* %7
%26 = sub nsw i32 %25, 1
%27 = call i32 @strncpy(i8* %23, i8* %24, i32 %26)
%28 = load i8*, i8** %5
%29 = load i32, i32* %7
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
store i8 0, i8* %32
%33 = load i32*, i32** %6
store i32 1, i32* %33
br label %34
34: ; preds = %22, %13, %3
ret void
}

LLVM IR (-O2):
define void @Cffcrep(i8* %0, i8* %1, i32* nocapture writeonly %2) {
store i32 0, i32* %2
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = add nsw i32 %4, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 38
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = tail call i32 @strncpy(i8* %1, i8* %0, i32 %7)
%14 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %14
store i32 1, i32* %2
br label %15
15: ; preds = %12, %6, %3
ret void
}