#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*/ sendAscii(char);
int strlen(char *);
void sendString(char *str) {
  int i = 0;
  int len = strlen(str);
  for (i = 0; i < len; i++) {
    if (str[i] != 0x0d)
      sendAscii(str[i]);
  }
}


x86 assembly (clang, -O0):
<sendString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118b <sendString+0x6b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     1178 <sendString+0x58>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <sendAscii@plt>
jmp    117d <sendString+0x5d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <sendString+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendString>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    115c <sendString+0x3c>
mov    %eax,%r15d
xor    %ebx,%ebx
jmp    1149 <sendString+0x29>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r15
je     115c <sendString+0x3c>
movzbl (%r14,%rbx,1),%eax
cmp    $0xd,%al
je     1140 <sendString+0x20>
movsbl %al,%edi
call   1040 <sendAscii@plt>
jmp    1140 <sendString+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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