#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 */
scalar_t__ EOF;
scalar_t__ sgml_fputc(unsigned int, int /*<<< orphan*/ *);
int sgml_fputs(const char *s, FILE *out) {
  for (; *s; s++)
    if (sgml_fputc((unsigned int)*s, out) == EOF)
      return EOF;
  return 0;
}


x86 assembly (clang, -O0):
<sgml_fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1175 <sgml_fputs+0x65>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
mov    -0x18(%rbp),%rsi
call   1030 <sgml_fputc@plt>
mov    0x2ea4(%rip),%rcx
cmp    (%rcx),%rax
jne    115f <sgml_fputs+0x4f>
mov    0x2e94(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    117c <sgml_fputs+0x6c>
jmp    1164 <sgml_fputs+0x54>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <sgml_fputs+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgml_fputs>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %r14d,%r14d
test   %al,%al
je     1161 <sgml_fputs+0x51>
mov    %rsi,%rbx
mov    %rdi,%rbp
add    $0x1,%rbp
mov    0x2eb7(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
mov    %rbx,%rsi
call   1030 <sgml_fputc@plt>
cmp    (%r15),%rax
je     115e <sgml_fputs+0x4e>
movzbl 0x0(%rbp),%eax
add    $0x1,%rbp
test   %al,%al
jne    1140 <sgml_fputs+0x30>
jmp    1161 <sgml_fputs+0x51>
mov    %eax,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@EOF = global i64 0
define i32 @sgml_fputs(i8* nocapture %0, i32* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %8
5: ; preds = %8
%6 = load i8, i8* %15
%7 = icmp eq i8 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %2, %5
%9 = phi i8 [ %6, %5 ], [ %3, %2 ]
%10 = phi i8* [ %15, %5 ], [ %0, %2 ]
%11 = sext i8 %9 to i32
%12 = tail call i64 @sgml_fputc(i32 %11, i32* %1)
%13 = load i64, i64* @EOF
%14 = icmp eq i64 %12, %13
%15 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %14, label %16, label %5
16: ; preds = %8
%17 = trunc i64 %12 to i32
br label %18
18: ; preds = %5, %2, %16
%19 = phi i32 [ %17, %16 ], [ 0, %2 ], [ 0, %5 ]
ret i32 %19
}