puts(str) char *str;
{
  auto char *p, c;
  auto int f;
  extern int cout;
  if (nargs() != 1)
    IEHzap("puts  ");
  p = str;
  while ((c = *p++) != '\0')
    cputc(c, cout);
  cputc('\n', cout);
  return (str);
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <nargs@plt>
cmp    $0x1,%eax
je     115a <puts+0x2a>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <IEHzap@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     119b <puts+0x6b>
movsbl -0x11(%rbp),%edi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1030 <cputc@plt>
jmp    1162 <puts+0x32>
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <cputc@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <nargs@plt>
cmp    $0x1,%eax
je     1152 <puts+0x22>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <IEHzap@plt>
mov    (%r14),%al
test   %al,%al
je     1188 <puts+0x58>
lea    0x1(%r14),%rbx
mov    0x2e74(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
mov    (%r15),%esi
xor    %eax,%eax
call   1030 <cputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1170 <puts+0x40>
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <cputc@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"puts \00"
@cout = external global i32
define i32 @puts(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 (...) @nargs()
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @IEHzap to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %2
store i8* %11, i8** %3
br label %12
12: ; preds = %18, %10
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %13
store i8 %15, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %12
%19 = load i8, i8* %4
%20 = sext i8 %19 to i32
%21 = load i32, i32* @cout
%22 = call i32 (i32, i32, ...) bitcast (i32 (...)* @cputc to i32 (i32, i32, ...)*)(i32 %20, i32 %21)
br label %12
23: ; preds = %12
%24 = load i32, i32* @cout
%25 = call i32 (i32, i32, ...) bitcast (i32 (...)* @cputc to i32 (i32, i32, ...)*)(i32 10, i32 %24)
%26 = load i8*, i8** %2
%27 = ptrtoint i8* %26 to i32
ret i32 %27
}

LLVM IR (-O2):
@.str = [7 x i8] c"puts \00"
@cout = external global i32
define i32 @puts(i8* %0) {
%2 = tail call i32 (...) @nargs()
%3 = icmp eq i32 %2, 1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @IEHzap to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %6, %9
%10 = phi i8 [ %16, %9 ], [ %7, %6 ]
%11 = phi i8* [ %13, %9 ], [ %0, %6 ]
%12 = sext i8 %10 to i32
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i32, i32* @cout
%15 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @cputc to i32 (i32, i32, ...)*)(i32 %12, i32 %14)
%16 = load i8, i8* %13
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %6
%19 = load i32, i32* @cout
%20 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @cputc to i32 (i32, i32, ...)*)(i32 10, i32 %19)
%21 = ptrtoint i8* %0 to i64
%22 = trunc i64 %21 to i32
ret i32 %22
}