#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*/ pst_debug_func(char *);
int /*<<< orphan*/ pst_debug_func_ret();
int /*<<< orphan*/ pst_debug_msg_info(int, char *, int);
int /*<<< orphan*/ pst_debug_msg_text(char *, ...);
char *removeCR(char *c) {
  char *a, *b;
  {
    pst_debug_func("removeCR");
    {
      pst_debug_msg_info(
          404,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/anarchivist/pyflag/refs/heads/main/src/"
          "mailtools/readpst.c",
          9);
      pst_debug_msg_text("Entering function %s\n", "removeCR");
    };
  };
  a = b = c;
  while (*a != '\0') {
    *b = *a;
    if (*a != '\r')
      b++;
    a++;
  }
  *b = '\0';
  {
    {
      pst_debug_msg_info(
          413,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/anarchivist/pyflag/refs/heads/main/src/"
          "mailtools/readpst.c",
          10);
      pst_debug_msg_text("Leaving function\n");
    };
    pst_debug_func_ret();
  };
  return c;
}


x86 assembly (clang, -O0):
<removeCR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1050 <pst_debug_func@plt>
mov    $0x194,%edi
lea    0xea5(%rip),%rsi
mov    $0x9,%edx
call   1030 <pst_debug_msg_info@plt>
lea    0xf29(%rip),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1040 <pst_debug_msg_text@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d8 <removeCR+0x98>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     11c7 <removeCR+0x87>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    118f <removeCR+0x4f>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    $0x19d,%edi
lea    0xe1e(%rip),%rsi
mov    $0xa,%edx
call   1030 <pst_debug_msg_info@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <pst_debug_msg_text@plt>
mov    $0x0,%al
call   1060 <pst_debug_func_ret@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeCR>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
call   1050 <pst_debug_func@plt>
lea    0xeac(%rip),%rsi
mov    $0x194,%edi
mov    $0x9,%edx
call   1030 <pst_debug_msg_info@plt>
lea    0xf2b(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <pst_debug_msg_text@plt>
mov    (%rbx),%al
mov    %rbx,%rcx
test   %al,%al
je     11aa <removeCR+0x6a>
lea    0x1(%rbx),%rdx
mov    %rbx,%rcx
nopl   (%rax)
mov    %al,(%rcx)
movzbl (%rdx),%eax
xor    %esi,%esi
cmpb   $0xd,-0x1(%rdx)
setne  %sil
add    %rsi,%rcx
add    $0x1,%rdx
test   %al,%al
jne    1190 <removeCR+0x50>
movb   $0x0,(%rcx)
lea    0xe55(%rip),%rsi
mov    $0x19d,%edi
mov    $0xa,%edx
call   1030 <pst_debug_msg_info@plt>
lea    0xeea(%rip),%rdi
xor    %eax,%eax
call   1040 <pst_debug_msg_text@plt>
xor    %eax,%eax
call   1060 <pst_debug_func_ret@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"removeCR\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/anarchivist/pyflag/refs/heads/main/src/mailtools/readpst.c\00"
@.str.2 = [22 x i8] c"Entering function %s\0A\00"
@.str.3 = [18 x i8] c"Leaving function\0A\00"
define i8* @removeCR(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i32 @pst_debug_func(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @pst_debug_msg_info(i32 404, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 9)
%7 = call i32 (i8*, ...) @pst_debug_msg_text(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
store i8* %8, i8** %4
store i8* %8, i8** %3
br label %9
9: ; preds = %25, %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = load i8*, i8** %4
store i8 %16, i8* %17
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 13
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
br label %25
25: ; preds = %22, %14
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
br label %9
28: ; preds = %9
%29 = load i8*, i8** %4
store i8 0, i8* %29
%30 = call i32 @pst_debug_msg_info(i32 413, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 10)
%31 = call i32 (i8*, ...) @pst_debug_msg_text(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 (...) @pst_debug_func_ret()
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
@.str = [9 x i8] c"removeCR\00"
@.str.1 = [149 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/anarchivist/pyflag/refs/heads/main/src/mailtools/readpst.c\00"
@.str.2 = [22 x i8] c"Entering function %s\0A\00"
@.str.3 = [18 x i8] c"Leaving function\0A\00"
define i8* @removeCR(i8* returned %0) {
%2 = tail call i32 @pst_debug_func(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @pst_debug_msg_info(i32 404, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 9)
%4 = tail call i32 (i8*, ...) @pst_debug_msg_text(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %1, %7
%8 = phi i8 [ %16, %7 ], [ %5, %1 ]
%9 = phi i8* [ %14, %7 ], [ %0, %1 ]
%10 = phi i8* [ %15, %7 ], [ %0, %1 ]
store i8 %8, i8* %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 13
%13 = zext i1 %12 to i64
%14 = getelementptr i8, i8* %9, i64 %13
%15 = getelementptr inbounds i8, i8* %10, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %1
%19 = phi i8* [ %0, %1 ], [ %14, %7 ]
store i8 0, i8* %19
%20 = tail call i32 @pst_debug_msg_info(i32 413, i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.1, i64 0, i64 0), i32 10)
%21 = tail call i32 (i8*, ...) @pst_debug_msg_text(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 (...) @pst_debug_func_ret()
ret i8* %0
}