#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 *);
void StripCRLF(char *Line) {
  int len, count;
  len = (Line ? strlen(Line) : 0);
  if (len < 1)
    return;
  for (count = len - 1; (count > -1); count--) {
    if ((Line[count] == '\r') || (Line[count] == '\n'))
      Line[count] = 0;
    else
      break;
  }
}


x86 assembly (clang, -O0):
<StripCRLF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <StripCRLF+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
jmp    1142 <StripCRLF+0x32>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <StripCRLF+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    1157 <StripCRLF+0x47>
jmp    11bd <StripCRLF+0xad>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jle    11bd <StripCRLF+0xad>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     1194 <StripCRLF+0x84>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    11a5 <StripCRLF+0x95>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11aa <StripCRLF+0x9a>
jmp    11bd <StripCRLF+0xad>
jmp    11af <StripCRLF+0x9f>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1160 <StripCRLF+0x50>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StripCRLF>:
push   %rbx
test   %rdi,%rdi
je     114f <StripCRLF+0x3f>
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    114f <StripCRLF+0x3f>
mov    %eax,%eax
add    $0x1,%rax
jmp    113e <StripCRLF+0x2e>
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rbx,%rcx,1)
add    $0xffffffffffffffff,%rax
cmp    $0x1,%rax
jbe    114f <StripCRLF+0x3f>
lea    -0x2(%rax),%ecx
movzbl (%rbx,%rcx,1),%edx
cmp    $0xd,%dl
je     1130 <StripCRLF+0x20>
cmp    $0xa,%dl
je     1130 <StripCRLF+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @StripCRLF(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
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %11
br label %48
16: ; preds = %11
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %4
br label %19
19: ; preds = %45, %16
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, -1
br i1 %21, label %22, label %48
22: ; preds = %19
%23 = load i8*, i8** %2
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 13
br i1 %29, label %38, label %30
30: ; preds = %22
%31 = load i8*, i8** %2
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 10
br i1 %37, label %38, label %43
38: ; preds = %30, %22
%39 = load i8*, i8** %2
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 0, i8* %42
br label %44
43: ; preds = %30
br label %48
44: ; preds = %38
br label %45
45: ; preds = %44
%46 = load i32, i32* %4
%47 = add nsw i32 %46, -1
store i32 %47, i32* %4
br label %19
48: ; preds = %15, %43, %19
ret void
}

LLVM IR (-O2):
define void @StripCRLF(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 1
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %14
%9 = phi i64 [ %7, %6 ], [ %10, %14 ]
%10 = add nsw i64 %9, -1
%11 = and i64 %10, 4294967295
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
switch i8 %13, label %16 [
i8 13, label %14
i8 10, label %14
]
14: ; preds = %8, %8
store i8 0, i8* %12
%15 = icmp ugt i64 %9, 1
br i1 %15, label %8, label %16
16: ; preds = %8, %14, %1, %3
ret void
}