#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*/ mcharout(int);
scalar_t__ opabort();
int /*<<< orphan*/ sendbrk();
int /*<<< orphan*/ wait(int);
int zmputs(char *s) {
  static int c;
  while (*s) {
    if (opabort())
      return (-1);
    switch (c = *s++) {
    case '\336':
      wait(1);
      continue;
    case '\335':
      sendbrk();
      continue;
    default:
      mcharout(c);
    }
  }
}


x86 assembly (clang, -O0):
<zmputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11db <zmputs+0x9b>
mov    $0x0,%al
call   1030 <opabort@plt>
cmp    $0x0,%rax
je     1176 <zmputs+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11db <zmputs+0x9b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    %eax,0x2eb3(%rip)
sub    $0xffffffdd,%eax
je     11bf <zmputs+0x7f>
jmp    119f <zmputs+0x5f>
mov    -0x14(%rbp),%eax
sub    $0xffffffde,%eax
jne    11cb <zmputs+0x8b>
jmp    11b0 <zmputs+0x70>
mov    $0x1,%edi
call   1060 <wait@plt>
jmp    114c <zmputs+0xc>
mov    $0x0,%al
call   1050 <sendbrk@plt>
jmp    114c <zmputs+0xc>
mov    0x2e73(%rip),%edi
call   1040 <mcharout@plt>
jmp    114c <zmputs+0xc>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zmputs>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1199 <zmputs+0x59>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    1163 <zmputs+0x23>
nop
mov    $0x1,%edi
call   1060 <wait@plt>
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
je     1199 <zmputs+0x59>
xor    %eax,%eax
call   1030 <opabort@plt>
test   %rax,%rax
jne    1199 <zmputs+0x59>
movsbl -0x1(%rbx),%edi
cmp    $0xffffffdd,%edi
je     1190 <zmputs+0x50>
cmp    $0xffffffde,%edi
je     1150 <zmputs+0x10>
call   1040 <mcharout@plt>
jmp    115a <zmputs+0x1a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <sendbrk@plt>
jmp    115a <zmputs+0x1a>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@zmputs.c = internal global i32 0
define i32 @zmputs(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %24, %19, %17, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %4
%9 = call i64 (...) @opabort()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 -1, i32* %2
br label %25
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
store i32 %16, i32* @zmputs.c
switch i32 %16, label %21 [
i32 -34, label %17
i32 -35, label %19
]
17: ; preds = %12
%18 = call i32 @wait(i32 1)
br label %4
19: ; preds = %12
%20 = call i32 (...) @sendbrk()
br label %4
21: ; preds = %12
%22 = load i32, i32* @zmputs.c
%23 = call i32 @mcharout(i32 %22)
br label %24
24: ; preds = %21
br label %4
25: ; preds = %11, %4
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @zmputs(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %14
%5 = phi i8* [ %9, %14 ], [ %0, %1 ]
%6 = tail call i64 (...) @opabort()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
switch i32 %11, label %19 [
i32 -34, label %12
i32 -35, label %17
]
12: ; preds = %8
%13 = tail call i32 @wait(i32 1)
br label %14
14: ; preds = %12, %17, %19
%15 = load i8, i8* %9
%16 = icmp eq i8 %15, 0
br i1 %16, label %21, label %4
17: ; preds = %8
%18 = tail call i32 (...) @sendbrk()
br label %14
19: ; preds = %8
%20 = tail call i32 @mcharout(i32 %11)
br label %14
21: ; preds = %14, %4, %1
ret i32 -1
}