char *ABSPS(int dn) {
  static char buf[100], *lb = buf;
  char *p;
  if (lb > buf + sizeof(buf) - 10)
    lb = buf;
  p = lb;
  *lb++ = '\\';
  *lb++ = 's';
  if (dn >= 10) {
    if (dn >= 40)
      *lb++ = '(';
    *lb++ = dn / 10 + '0';
    *lb++ = dn % 10 + '0';
  } else {
    *lb++ = dn + '0';
  }
  *lb++ = '\0';
  return p;
}


x86 assembly (clang, -O0):
<ABSPS>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0x2f32(%rip),%rax
add    $0x5a,%rax
cmp    %rax,0x2f07(%rip)
jbe    112d <ABSPS+0x2d>
lea    0x2f1a(%rip),%rax
mov    %rax,0x2ef3(%rip)
mov    0x2eec(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ee1(%rip),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x2ed3(%rip)
movb   $0x5c,(%rax)
mov    0x2ec9(%rip),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x2ebb(%rip)
movb   $0x73,(%rax)
cmpl   $0xa,-0x4(%rbp)
jl     11e7 <ABSPS+0xe7>
cmpl   $0x28,-0x4(%rbp)
jl     1194 <ABSPS+0x94>
mov    0x2e9d(%rip),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x2e8f(%rip)
movb   $0x28,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,%cl
mov    0x2e75(%rip),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x2e67(%rip)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    0x2e4e(%rip),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x2e40(%rip)
mov    %cl,(%rax)
jmp    1206 <ABSPS+0x106>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    0x2e2a(%rip),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x2e1c(%rip)
mov    %cl,(%rax)
mov    0x2e13(%rip),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x2e05(%rip)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ABSPS>:
mov    0x2f19(%rip),%rcx
lea    0x2f32(%rip),%rax
lea    0x2f85(%rip),%rdx
cmp    %rdx,%rcx
cmovbe %rcx,%rax
movw   $0x735c,(%rax)
cmp    $0xa,%edi
jl     1135 <ABSPS+0x35>
cmp    $0x28,%edi
jb     1143 <ABSPS+0x43>
lea    0x3(%rax),%rcx
movb   $0x28,0x2(%rax)
jmp    1147 <ABSPS+0x47>
add    $0x30,%dil
lea    0x3(%rax),%rcx
mov    %dil,0x2(%rax)
jmp    116e <ABSPS+0x6e>
lea    0x2(%rax),%rcx
mov    %edi,%edx
mov    $0xcccccccd,%esi
imul   %rdx,%rsi
shr    $0x23,%rsi
lea    0x30(%rsi),%edx
mov    %dl,(%rcx)
add    %esi,%esi
lea    (%rsi,%rsi,4),%edx
sub    %edx,%edi
or     $0x30,%dil
mov    %dil,0x1(%rcx)
add    $0x2,%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,0x2ea7(%rip)
movb   $0x0,(%rcx)
ret

LLVM IR (-O0):
@ABSPS.buf = internal global [100 x i8] zeroinitializer
@ABSPS.lb = internal global i8* getelementptr inbounds ([100 x i8], [100 x i8]* @ABSPS.buf, i32 0, i32 0)
define i8* @ABSPS(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i8*, i8** @ABSPS.lb
%5 = icmp ugt i8* %4, getelementptr inbounds ([100 x i8], [100 x i8]* @ABSPS.buf, i64 1, i64 -10)
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @ABSPS.buf, i64 0, i64 0), i8** @ABSPS.lb
br label %7
7: ; preds = %6, %1
%8 = load i8*, i8** @ABSPS.lb
store i8* %8, i8** %3
%9 = load i8*, i8** @ABSPS.lb
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** @ABSPS.lb
store i8 92, i8* %9
%11 = load i8*, i8** @ABSPS.lb
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** @ABSPS.lb
store i8 115, i8* %11
%13 = load i32, i32* %2
%14 = icmp sge i32 %13, 10
br i1 %14, label %15, label %34
15: ; preds = %7
%16 = load i32, i32* %2
%17 = icmp sge i32 %16, 40
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i8*, i8** @ABSPS.lb
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** @ABSPS.lb
store i8 40, i8* %19
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %2
%23 = sdiv i32 %22, 10
%24 = add nsw i32 %23, 48
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** @ABSPS.lb
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** @ABSPS.lb
store i8 %25, i8* %26
%28 = load i32, i32* %2
%29 = srem i32 %28, 10
%30 = add nsw i32 %29, 48
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** @ABSPS.lb
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** @ABSPS.lb
store i8 %31, i8* %32
br label %40
34: ; preds = %7
%35 = load i32, i32* %2
%36 = add nsw i32 %35, 48
%37 = trunc i32 %36 to i8
%38 = load i8*, i8** @ABSPS.lb
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** @ABSPS.lb
store i8 %37, i8* %38
br label %40
40: ; preds = %34, %21
%41 = load i8*, i8** @ABSPS.lb
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** @ABSPS.lb
store i8 0, i8* %41
%43 = load i8*, i8** %3
ret i8* %43
}

LLVM IR (-O2):
@ABSPS.buf = internal global [100 x i8] zeroinitializer
@ABSPS.lb = internal unnamed_addr global i8* getelementptr inbounds ([100 x i8], [100 x i8]* @ABSPS.buf, i64 0, i64 0)
define i8* @ABSPS(i32 %0) {
%2 = load i8*, i8** @ABSPS.lb
%3 = icmp ugt i8* %2, getelementptr inbounds ([100 x i8], [100 x i8]* @ABSPS.buf, i64 0, i64 90)
%4 = select i1 %3, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @ABSPS.buf, i64 0, i64 0), i8* %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 92, i8* %4
%6 = getelementptr inbounds i8, i8* %4, i64 2
store i8 115, i8* %5
%7 = icmp sgt i32 %0, 9
br i1 %7, label %8, label %22
8: ; preds = %1
%9 = icmp ugt i32 %0, 39
br i1 %9, label %10, label %12
10: ; preds = %8
%11 = getelementptr inbounds i8, i8* %4, i64 3
store i8 40, i8* %6
br label %12
12: ; preds = %10, %8
%13 = phi i8* [ %11, %10 ], [ %6, %8 ]
%14 = udiv i32 %0, 10
%15 = trunc i32 %14 to i8
%16 = add i8 %15, 48
%17 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %16, i8* %13
%18 = urem i32 %0, 10
%19 = trunc i32 %18 to i8
%20 = or i8 %19, 48
%21 = getelementptr inbounds i8, i8* %13, i64 2
store i8 %20, i8* %17
br label %26
22: ; preds = %1
%23 = trunc i32 %0 to i8
%24 = add i8 %23, 48
%25 = getelementptr inbounds i8, i8* %4, i64 3
store i8 %24, i8* %6
br label %26
26: ; preds = %22, %12
%27 = phi i8* [ %25, %22 ], [ %21, %12 ]
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8* %28, i8** @ABSPS.lb
store i8 0, i8* %27
ret i8* %4
}