#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*/ aff_0(int);
int /*<<< orphan*/ my_putchar(char);
int my_strlen(char *);
int my_put_oct_S(int nb, char *base) {
  int bin;
  int len;
  len = my_strlen(base);
  my_putchar('\\');
  if (nb < 0) {
    my_putchar('-');
    nb *= -1;
  }
  bin = 1;
  if (nb <= 31)
    aff_0(nb);
  while (nb / bin >= len)
    bin *= len;
  while (bin > 0) {
    my_putchar(base[(nb / bin) % len]);
    bin /= len;
  }
  return (1);
}


x86 assembly (clang, -O0):
<my_put_oct_S>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    %eax,-0x18(%rbp)
mov    $0x5c,%edi
call   1040 <my_putchar@plt>
cmpl   $0x0,-0x4(%rbp)
jge    1170 <my_put_oct_S+0x40>
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x1f,-0x4(%rbp)
jg     1189 <my_put_oct_S+0x59>
mov    -0x4(%rbp),%edi
call   1050 <aff_0@plt>
jmp    118e <my_put_oct_S+0x5e>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    -0x18(%rbp),%eax
jl     11ad <my_put_oct_S+0x7d>
mov    -0x18(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    118e <my_put_oct_S+0x5e>
jmp    11b2 <my_put_oct_S+0x82>
cmpl   $0x0,-0x14(%rbp)
jle    11f0 <my_put_oct_S+0xc0>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cltd
idivl  -0x18(%rbp)
mov    -0x20(%rbp),%rax
movslq %edx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <my_putchar@plt>
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
jmp    11b2 <my_put_oct_S+0x82>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_put_oct_S>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
mov    %rsi,%rdi
call   1030 <my_strlen@plt>
mov    %eax,%ebx
mov    $0x5c,%edi
call   1040 <my_putchar@plt>
test   %r15d,%r15d
js     11d1 <my_put_oct_S+0xa1>
cmp    $0x1f,%r15d
ja     1164 <my_put_oct_S+0x34>
mov    %r15d,%edi
call   1050 <aff_0@plt>
mov    $0x1,%ebp
cmp    %ebx,%r15d
jl     11a0 <my_put_oct_S+0x70>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   %ebx,%ebp
mov    %r15d,%eax
cltd
idiv   %ebp
cmp    %ebx,%eax
jge    1180 <my_put_oct_S+0x50>
test   %ebp,%ebp
jle    11c1 <my_put_oct_S+0x91>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15d,%eax
cltd
idiv   %ebp
cltd
idiv   %ebx
movslq %edx,%rax
movsbl (%r14,%rax,1),%edi
call   1040 <my_putchar@plt>
mov    %ebp,%eax
cltd
idiv   %ebx
mov    %eax,%ebp
test   %eax,%eax
jg     11a0 <my_put_oct_S+0x70>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x2d,%edi
call   1040 <my_putchar@plt>
neg    %r15d
cmp    $0x1f,%r15d
jbe    115c <my_put_oct_S+0x2c>
jmp    1164 <my_put_oct_S+0x34>

LLVM IR (-O0):
define i32 @my_put_oct_S(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @my_strlen(i8* %7)
store i32 %8, i32* %6
%9 = call i32 @my_putchar(i8 signext 92)
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = call i32 @my_putchar(i8 signext 45)
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, -1
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %2
store i32 1, i32* %5
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 31
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %3
%21 = call i32 @aff_0(i32 %20)
br label %22
22: ; preds = %19, %16
br label %23
23: ; preds = %29, %22
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = sdiv i32 %24, %25
%27 = load i32, i32* %6
%28 = icmp sge i32 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = load i32, i32* %6
%31 = load i32, i32* %5
%32 = mul nsw i32 %31, %30
store i32 %32, i32* %5
br label %23
33: ; preds = %23
br label %34
34: ; preds = %37, %33
%35 = load i32, i32* %5
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %51
37: ; preds = %34
%38 = load i8*, i8** %4
%39 = load i32, i32* %3
%40 = load i32, i32* %5
%41 = sdiv i32 %39, %40
%42 = load i32, i32* %6
%43 = srem i32 %41, %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %38, i64 %44
%46 = load i8, i8* %45
%47 = call i32 @my_putchar(i8 signext %46)
%48 = load i32, i32* %6
%49 = load i32, i32* %5
%50 = sdiv i32 %49, %48
store i32 %50, i32* %5
br label %34
51: ; preds = %34
ret i32 1
}

LLVM IR (-O2):
define i32 @my_put_oct_S(i32 %0, i8* %1) {
%3 = tail call i32 @my_strlen(i8* %1)
%4 = tail call i32 @my_putchar(i8 signext 92)
%5 = icmp slt i32 %0, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @my_putchar(i8 signext 45)
%8 = sub nsw i32 0, %0
br label %9
9: ; preds = %6, %2
%10 = phi i32 [ %8, %6 ], [ %0, %2 ]
%11 = icmp ult i32 %10, 32
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @aff_0(i32 %10)
br label %14
14: ; preds = %12, %9
%15 = icmp slt i32 %10, %3
br i1 %15, label %18, label %20
16: ; preds = %20
%17 = icmp sgt i32 %22, 0
br i1 %17, label %18, label %35
18: ; preds = %14, %16
%19 = phi i32 [ 1, %14 ], [ %22, %16 ]
br label %25
20: ; preds = %14, %20
%21 = phi i32 [ %22, %20 ], [ 1, %14 ]
%22 = mul nsw i32 %21, %3
%23 = sdiv i32 %10, %22
%24 = icmp slt i32 %23, %3
br i1 %24, label %16, label %20
25: ; preds = %18, %25
%26 = phi i32 [ %33, %25 ], [ %19, %18 ]
%27 = sdiv i32 %10, %26
%28 = srem i32 %27, %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %1, i64 %29
%31 = load i8, i8* %30
%32 = tail call i32 @my_putchar(i8 signext %31)
%33 = sdiv i32 %26, %3
%34 = icmp sgt i32 %33, 0
br i1 %34, label %25, label %35
35: ; preds = %25, %16
ret i32 1
}