#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*/ StdIO_Write(char);
int /*<<< orphan*/ memcpy(char *, char *, unsigned int);
void StrIO_WriteString(char *a_, unsigned int _a_high) {
  unsigned int n;
  unsigned int high;
  char a[_a_high + 1];
  memcpy(a, a_, _a_high + 1);
  high = _a_high;
  n = 0;
  while ((n <= high) && (a[n] != (char)000)) {
    StdIO_Write(a[n]);
    n += 1;
  }
}


x86 assembly (clang, -O0):
<StrIO_WriteString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x31(%rbp)
ja     1199 <StrIO_WriteString+0x79>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11a9 <StrIO_WriteString+0x89>
jmp    11c7 <StrIO_WriteString+0xa7>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <StdIO_Write@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1174 <StrIO_WriteString+0x54>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrIO_WriteString>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rsi
lea    0x1(%r14),%edx
mov    %rsp,%r15
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %r15,%rdi
call   1040 <memcpy@plt>
xor    %ebx,%ebx
nop
mov    %ebx,%eax
movzbl (%r15,%rax,1),%eax
test   %al,%al
je     116b <StrIO_WriteString+0x4b>
movsbl %al,%edi
call   1030 <StdIO_Write@plt>
add    $0x1,%ebx
cmp    %r14d,%ebx
jbe    1150 <StrIO_WriteString+0x30>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @StrIO_WriteString(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = add i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %7
%13 = alloca i8, i64 %11
store i64 %11, i64* %8
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = add i32 %15, 1
%17 = call i32 @memcpy(i8* %13, i8* %14, i32 %16)
%18 = load i32, i32* %4
store i32 %18, i32* %6
store i32 0, i32* %5
br label %19
19: ; preds = %32, %2
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = icmp ule i32 %20, %21
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i32, i32* %5
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %13, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br label %30
30: ; preds = %23, %19
%31 = phi i1 [ false, %19 ], [ %29, %23 ]
br i1 %31, label %32, label %40
32: ; preds = %30
%33 = load i32, i32* %5
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %13, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @StdIO_Write(i8 signext %36)
%38 = load i32, i32* %5
%39 = add i32 %38, 1
store i32 %39, i32* %5
br label %19
40: ; preds = %30
%41 = load i8*, i8** %7
ret void
}

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