#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*/ sprintf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ zeroblog_remove_carriage_returns(char *);
int test_zeroblog_remove_carriage_returns() {
  char text[(1024 * 256)];
  char expected[(1024 * 256)];
  sprintf(text, "%s", "This\\nis\\na\\ntest");
  sprintf(expected, "%s", "This\nis\na\ntest");
  zeroblog_remove_carriage_returns(text);
  if (strcmp(text, expected) != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<test_zeroblog_remove_carriage_returns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80010,%rsp
lea    -0x40010(%rbp),%rdi
lea    0xeb7(%rip),%rsi
lea    0xeb3(%rip),%rdx
call   1050 <sprintf@plt>
lea    -0x80010(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    0xeab(%rip),%rdx
call   1050 <sprintf@plt>
lea    -0x40010(%rbp),%rdi
call   1040 <zeroblog_remove_carriage_returns@plt>
lea    -0x40010(%rbp),%rdi
lea    -0x80010(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11a4 <test_zeroblog_remove_carriage_returns+0x74>
movl   $0x1,-0x4(%rbp)
jmp    11ab <test_zeroblog_remove_carriage_returns+0x7b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_zeroblog_remove_carriage_returns>:
push   %rbx
sub    $0x80000,%rsp
movups 0xed1(%rip),%xmm0
movaps %xmm0,0x40000(%rsp)
movw   $0x74,0x40010(%rsp)
movabs $0xa73690a73696854,%rax
69 73 0a
mov    %rax,(%rsp)
movabs $0x747365740a610a,%rax
mov    %rax,0x7(%rsp)
lea    0x40000(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <zeroblog_remove_carriage_returns@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x80000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"This\\nis\\na\\ntest\00"
@.str.2 = [15 x i8] c"This\0Ais\0Aa\0Atest\00"
define i32 @test_zeroblog_remove_carriage_returns() {
%1 = alloca i32
%2 = alloca [262144 x i8]
%3 = alloca [262144 x i8]
%4 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%8 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%9 = call i32 @zeroblog_remove_carriage_returns(i8* %8)
%10 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [262144 x i8], [262144 x i8]* %3, i64 0, i64 0
%12 = call i64 @strcmp(i8* %10, i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %0
store i32 1, i32* %1
br label %16
15: ; preds = %0
store i32 0, i32* %1
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"This\\nis\\na\\ntest\00"
@.str.2 = [15 x i8] c"This\0Ais\0Aa\0Atest\00"
define i32 @test_zeroblog_remove_carriage_returns() {
%1 = alloca [262144 x i8]
%2 = alloca [262144 x i8]
%3 = getelementptr inbounds [262144 x i8], [262144 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [262144 x i8], [262144 x i8]* %2, i64 0, i64 0
%5 = call i32 @zeroblog_remove_carriage_returns(i8* %3)
%6 = call i64 @strcmp(i8* %3, i8* %4)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}