#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char const *, size_t, int, int /*<<< orphan*/ *);
size_t strcspn(char const *, char *);
void out_(const char *data, FILE *io) {
  while (*data) {
    size_t len = strcspn(data, "\r");
    fwrite(data, len, 1, io);
    data += len;
    if (*data == '\r')
      ++data;
  }
}


x86 assembly (clang, -O0):
<out_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1194 <out_+0x74>
mov    -0x8(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcspn@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fwrite@plt>
mov    -0x18(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    118f <out_+0x6f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <out_+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     1179 <out_+0x59>
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcspn@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fwrite@plt>
lea    (%rbx,%r12,1),%rax
xor    %ecx,%ecx
cmpb   $0xd,(%rbx,%r12,1)
sete   %cl
lea    (%rax,%rcx,1),%rbx
cmpb   $0x0,(%rcx,%rax,1)
jne    1140 <out_+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0D\00"
define void @out_(i8* nocapture %0, i32* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %13, %5 ], [ %0, %2 ]
%7 = tail call i64 @strcspn(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @fwrite(i8* %6, i64 %7, i32 1, i32* %1)
%9 = getelementptr inbounds i8, i8* %6, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 13
%12 = zext i1 %11 to i64
%13 = getelementptr i8, i8* %9, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
ret void
}