#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*/ send_string(unsigned char *, int);
void send_selection(unsigned char *str, int count) {
  int i;
  for (i = 0; i < count; i++)
    if (str[i] == '\n')
      str[i] = '\r';
  send_string(str, count);
}


x86 assembly (clang, -O0):
<send_selection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1166 <send_selection+0x56>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1153 <send_selection+0x43>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0xd,(%rax,%rcx,1)
jmp    1158 <send_selection+0x48>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <send_selection+0x16>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <send_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_selection>:
test   %esi,%esi
jle    12cb <send_selection+0x1bb>
mov    %esi,%r8d
cmp    $0x10,%esi
jae    1127 <send_selection+0x17>
xor    %ecx,%ecx
jmp    12d9 <send_selection+0x1c9>
mov    %r8d,%ecx
and    $0xfffffff0,%ecx
xor    %edx,%edx
movdqa 0xec9(%rip),%xmm0
movdqa 0xed1(%rip),%xmm1
jmp    115d <send_selection+0x4d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x10,%rdx
cmp    %rdx,%rcx
je     12c6 <send_selection+0x1b6>
movq   (%rdi,%rdx,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%eax
test   $0x1,%al
je     1176 <send_selection+0x66>
movb   $0xd,(%rdi,%rdx,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%eax
shr    $0x10,%eax
test   $0x1,%al
je     118f <send_selection+0x7f>
movb   $0xd,0x1(%rdi,%rdx,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%eax
test   $0x1,%al
je     11a6 <send_selection+0x96>
movb   $0xd,0x2(%rdi,%rdx,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%eax
test   $0x1,%al
je     11bd <send_selection+0xad>
movb   $0xd,0x3(%rdi,%rdx,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%eax
test   $0x1,%al
je     11d4 <send_selection+0xc4>
movb   $0xd,0x4(%rdi,%rdx,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%eax
test   $0x1,%al
je     11eb <send_selection+0xdb>
movb   $0xd,0x5(%rdi,%rdx,1)
pextrw $0x3,%xmm2,%eax
test   $0x1,%al
je     11f9 <send_selection+0xe9>
movb   $0xd,0x6(%rdi,%rdx,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%eax
test   $0x1,%al
je     120c <send_selection+0xfc>
movb   $0xd,0x7(%rdi,%rdx,1)
movq   0x8(%rdi,%rdx,1),%xmm3
movdqa %xmm3,%xmm2
pcmpeqb %xmm0,%xmm2
movd   %xmm2,%eax
test   $0x1,%al
je     1227 <send_selection+0x117>
movb   $0xd,0x8(%rdi,%rdx,1)
movdqa %xmm2,%xmm4
pslld  $0x8,%xmm4
movd   %xmm4,%eax
shr    $0x10,%eax
test   $0x1,%al
je     1240 <send_selection+0x130>
movb   $0xd,0x9(%rdi,%rdx,1)
pshuflw $0x55,%xmm3,%xmm4
pcmpeqb %xmm0,%xmm4
pextrw $0x2,%xmm4,%eax
test   $0x1,%al
je     1257 <send_selection+0x147>
movb   $0xd,0xa(%rdi,%rdx,1)
movdqa %xmm2,%xmm4
psllq  $0x18,%xmm4
pextrw $0x3,%xmm4,%eax
test   $0x1,%al
je     126e <send_selection+0x15e>
movb   $0xd,0xb(%rdi,%rdx,1)
pshufd $0x55,%xmm3,%xmm3
pcmpeqb %xmm1,%xmm3
pextrw $0x4,%xmm3,%eax
test   $0x1,%al
je     1285 <send_selection+0x175>
movb   $0xd,0xc(%rdi,%rdx,1)
movdqa %xmm2,%xmm3
pslldq $0x5,%xmm3
pextrw $0x5,%xmm3,%eax
test   $0x1,%al
je     129c <send_selection+0x18c>
movb   $0xd,0xd(%rdi,%rdx,1)
pextrw $0x3,%xmm2,%eax
test   $0x1,%al
je     12aa <send_selection+0x19a>
movb   $0xd,0xe(%rdi,%rdx,1)
pslldq $0x7,%xmm2
pextrw $0x7,%xmm2,%eax
test   $0x1,%al
je     1150 <send_selection+0x40>
movb   $0xd,0xf(%rdi,%rdx,1)
jmp    1150 <send_selection+0x40>
cmp    %r8,%rcx
jne    12d9 <send_selection+0x1c9>
jmp    1030 <send_string@plt>
add    $0x1,%rcx
cmp    %rcx,%r8
je     12cb <send_selection+0x1bb>
cmpb   $0xa,(%rdi,%rcx,1)
jne    12d0 <send_selection+0x1c0>
movb   $0xd,(%rdi,%rcx,1)
jmp    12d0 <send_selection+0x1c0>

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

LLVM IR (-O2):
define void @send_selection(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %113
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = icmp ult i32 %1, 16
br i1 %6, label %102, label %7
7: ; preds = %4
%8 = and i64 %5, 4294967280
br label %9
9: ; preds = %97, %7
%10 = phi i64 [ 0, %7 ], [ %98, %97 ]
%11 = or i64 %10, 8
%12 = getelementptr inbounds i8, i8* %0, i64 %10
%13 = bitcast i8* %12 to <8 x i8>*
%14 = load <8 x i8>, <8 x i8>* %13
%15 = getelementptr inbounds i8, i8* %12, i64 8
%16 = bitcast i8* %15 to <8 x i8>*
%17 = load <8 x i8>, <8 x i8>* %16
%18 = icmp eq <8 x i8> %14, <i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10>
%19 = icmp eq <8 x i8> %17, <i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10, i8 10>
%20 = extractelement <8 x i1> %18, i64 0
br i1 %20, label %21, label %23
21: ; preds = %9
%22 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 13, i8* %22
br label %23
23: ; preds = %21, %9
%24 = extractelement <8 x i1> %18, i64 1
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = or i64 %10, 1
%27 = getelementptr inbounds i8, i8* %0, i64 %26
store i8 13, i8* %27
br label %28
28: ; preds = %25, %23
%29 = extractelement <8 x i1> %18, i64 2
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = or i64 %10, 2
%32 = getelementptr inbounds i8, i8* %0, i64 %31
store i8 13, i8* %32
br label %33
33: ; preds = %30, %28
%34 = extractelement <8 x i1> %18, i64 3
br i1 %34, label %35, label %38
35: ; preds = %33
%36 = or i64 %10, 3
%37 = getelementptr inbounds i8, i8* %0, i64 %36
store i8 13, i8* %37
br label %38
38: ; preds = %35, %33
%39 = extractelement <8 x i1> %18, i64 4
br i1 %39, label %40, label %43
40: ; preds = %38
%41 = or i64 %10, 4
%42 = getelementptr inbounds i8, i8* %0, i64 %41
store i8 13, i8* %42
br label %43
43: ; preds = %40, %38
%44 = extractelement <8 x i1> %18, i64 5
br i1 %44, label %45, label %48
45: ; preds = %43
%46 = or i64 %10, 5
%47 = getelementptr inbounds i8, i8* %0, i64 %46
store i8 13, i8* %47
br label %48
48: ; preds = %45, %43
%49 = extractelement <8 x i1> %18, i64 6
br i1 %49, label %50, label %53
50: ; preds = %48
%51 = or i64 %10, 6
%52 = getelementptr inbounds i8, i8* %0, i64 %51
store i8 13, i8* %52
br label %53
53: ; preds = %50, %48
%54 = extractelement <8 x i1> %18, i64 7
br i1 %54, label %55, label %58
55: ; preds = %53
%56 = or i64 %10, 7
%57 = getelementptr inbounds i8, i8* %0, i64 %56
store i8 13, i8* %57
br label %58
58: ; preds = %55, %53
%59 = extractelement <8 x i1> %19, i64 0
br i1 %59, label %60, label %62
60: ; preds = %58
%61 = getelementptr inbounds i8, i8* %0, i64 %11
store i8 13, i8* %61
br label %62
62: ; preds = %60, %58
%63 = extractelement <8 x i1> %19, i64 1
br i1 %63, label %64, label %67
64: ; preds = %62
%65 = or i64 %10, 9
%66 = getelementptr inbounds i8, i8* %0, i64 %65
store i8 13, i8* %66
br label %67
67: ; preds = %64, %62
%68 = extractelement <8 x i1> %19, i64 2
br i1 %68, label %69, label %72
69: ; preds = %67
%70 = or i64 %10, 10
%71 = getelementptr inbounds i8, i8* %0, i64 %70
store i8 13, i8* %71
br label %72
72: ; preds = %69, %67
%73 = extractelement <8 x i1> %19, i64 3
br i1 %73, label %74, label %77
74: ; preds = %72
%75 = or i64 %10, 11
%76 = getelementptr inbounds i8, i8* %0, i64 %75
store i8 13, i8* %76
br label %77
77: ; preds = %74, %72
%78 = extractelement <8 x i1> %19, i64 4
br i1 %78, label %79, label %82
79: ; preds = %77
%80 = or i64 %10, 12
%81 = getelementptr inbounds i8, i8* %0, i64 %80
store i8 13, i8* %81
br label %82
82: ; preds = %79, %77
%83 = extractelement <8 x i1> %19, i64 5
br i1 %83, label %84, label %87
84: ; preds = %82
%85 = or i64 %10, 13
%86 = getelementptr inbounds i8, i8* %0, i64 %85
store i8 13, i8* %86
br label %87
87: ; preds = %84, %82
%88 = extractelement <8 x i1> %19, i64 6
br i1 %88, label %89, label %92
89: ; preds = %87
%90 = or i64 %10, 14
%91 = getelementptr inbounds i8, i8* %0, i64 %90
store i8 13, i8* %91
br label %92
92: ; preds = %89, %87
%93 = extractelement <8 x i1> %19, i64 7
br i1 %93, label %94, label %97
94: ; preds = %92
%95 = or i64 %10, 15
%96 = getelementptr inbounds i8, i8* %0, i64 %95
store i8 13, i8* %96
br label %97
97: ; preds = %94, %92
%98 = add nuw i64 %10, 16
%99 = icmp eq i64 %98, %8
br i1 %99, label %100, label %9
100: ; preds = %97
%101 = icmp eq i64 %8, %5
br i1 %101, label %113, label %102
102: ; preds = %4, %100
%103 = phi i64 [ 0, %4 ], [ %8, %100 ]
br label %104
104: ; preds = %102, %110
%105 = phi i64 [ %111, %110 ], [ %103, %102 ]
%106 = getelementptr inbounds i8, i8* %0, i64 %105
%107 = load i8, i8* %106
%108 = icmp eq i8 %107, 10
br i1 %108, label %109, label %110
109: ; preds = %104
store i8 13, i8* %106
br label %110
110: ; preds = %104, %109
%111 = add nuw nsw i64 %105, 1
%112 = icmp eq i64 %111, %5
br i1 %112, label %113, label %104
113: ; preds = %110, %100, %2
%114 = tail call i32 @send_string(i8* %0, i32 %1)
ret void
}