#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*/ subputs(char *);
void subputsbin(const char *s) {
  char octal[5];
  unsigned char ch;
  while ((ch = *s++) != 0) {
    octal[4] = 0;
    octal[3] = '0' + (ch & 7);
    ch >>= 3;
    octal[2] = '0' + (ch & 7);
    ch >>= 3;
    octal[1] = '0' + (ch & 7);
    octal[0] = '\\';
    subputs(octal);
  }
}


x86 assembly (clang, -O0):
<subputsbin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xe(%rbp)
movzbl %al,%eax
cmp    $0x0,%eax
je     118d <subputsbin+0x7d>
movb   $0x0,-0x9(%rbp)
movzbl -0xe(%rbp),%eax
and    $0x7,%eax
add    $0x30,%eax
mov    %al,-0xa(%rbp)
movzbl -0xe(%rbp),%eax
sar    $0x3,%eax
mov    %al,-0xe(%rbp)
movzbl -0xe(%rbp),%eax
and    $0x7,%eax
add    $0x30,%eax
mov    %al,-0xb(%rbp)
movzbl -0xe(%rbp),%eax
sar    $0x3,%eax
mov    %al,-0xe(%rbp)
movzbl -0xe(%rbp),%eax
and    $0x7,%eax
add    $0x30,%eax
mov    %al,-0xc(%rbp)
movb   $0x5c,-0xd(%rbp)
lea    -0xd(%rbp),%rdi
call   1030 <subputs@plt>
jmp    111c <subputsbin+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subputsbin>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1171 <subputsbin+0x61>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0x3(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
movb   $0x0,0x7(%rsp)
mov    %eax,%ecx
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x6(%rsp)
mov    %eax,%ecx
shr    $0x3,%cl
and    $0x7,%cl
or     $0x30,%cl
mov    %cl,0x5(%rsp)
shr    $0x6,%al
or     $0x30,%al
mov    %al,0x4(%rsp)
movb   $0x5c,0x3(%rsp)
mov    %r14,%rdi
call   1030 <subputs@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <subputsbin+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @subputsbin(i8* %0) {
%2 = alloca i8*
%3 = alloca [5 x i8]
%4 = alloca i8
store i8* %0, i8** %2
br label %5
5: ; preds = %11, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
store i8 %8, i8* %4
%9 = zext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %42
11: ; preds = %5
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 0, i8* %12
%13 = load i8, i8* %4
%14 = zext i8 %13 to i32
%15 = and i32 %14, 7
%16 = add nsw i32 48, %15
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
store i8 %17, i8* %18
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = ashr i32 %20, 3
%22 = trunc i32 %21 to i8
store i8 %22, i8* %4
%23 = load i8, i8* %4
%24 = zext i8 %23 to i32
%25 = and i32 %24, 7
%26 = add nsw i32 48, %25
%27 = trunc i32 %26 to i8
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
store i8 %27, i8* %28
%29 = load i8, i8* %4
%30 = zext i8 %29 to i32
%31 = ashr i32 %30, 3
%32 = trunc i32 %31 to i8
store i8 %32, i8* %4
%33 = load i8, i8* %4
%34 = zext i8 %33 to i32
%35 = and i32 %34, 7
%36 = add nsw i32 48, %35
%37 = trunc i32 %36 to i8
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
store i8 %37, i8* %38
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
store i8 92, i8* %39
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%41 = call i32 @subputs(i8* %40)
br label %5
42: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @subputsbin(i8* nocapture %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %25, label %6
6: ; preds = %1
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
br label %11
11: ; preds = %6, %11
%12 = phi i8 [ %4, %6 ], [ %23, %11 ]
%13 = phi i8* [ %0, %6 ], [ %14, %11 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 0, i8* %7
%15 = and i8 %12, 7
%16 = or i8 %15, 48
store i8 %16, i8* %8
%17 = lshr i8 %12, 3
%18 = and i8 %17, 7
%19 = or i8 %18, 48
store i8 %19, i8* %9
%20 = lshr i8 %12, 6
%21 = or i8 %20, 48
store i8 %21, i8* %10
store i8 92, i8* %3
%22 = call i32 @subputs(i8* %3)
%23 = load i8, i8* %14
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %11
25: ; preds = %11, %1
ret void
}