#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 */
unsigned char SendByteUART(unsigned char);
unsigned char SendStringUART(unsigned char *data) {
  for (int loop = 0; data[loop] != '\0'; loop++) {
    unsigned char bytereturn;
    bytereturn = SendByteUART(data[loop]);
    if (bytereturn == 1) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<SendStringUART>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1175 <SendStringUART+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <SendByteUART@plt>
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
cmp    $0x1,%eax
jne    1162 <SendStringUART+0x52>
movb   $0x1,-0x1(%rbp)
jmp    1179 <SendStringUART+0x69>
jmp    1167 <SendStringUART+0x57>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <SendStringUART+0x13>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendStringUART>:
push   %rbx
mov    (%rdi),%cl
test   %cl,%cl
je     113e <SendStringUART+0x2e>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movzbl %cl,%edi
call   1030 <SendByteUART@plt>
cmp    $0x1,%al
je     1137 <SendStringUART+0x27>
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1120 <SendStringUART+0x10>
cmp    $0x1,%al
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

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