#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ println(char *);
int scanto(char *, int *, char);
int /*<<< orphan*/ show_result(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void show_DECTABSR(char *report) {
  int pos = 3;
  int stop;
  char *buffer = (char *)malloc(strlen(report));
  *buffer = '\0';
  strcat(report, "/");
  while ((stop = scanto(report, &pos, '/')) != 0) {
    sprintf(buffer + strlen(buffer), " %d", stop);
  }
  println("");
  show_result("Tab stops:%s", buffer);
  free(buffer);
}


x86 assembly (clang, -O0):
<show_DECTABSR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1090 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x2f,%edx
call   1050 <scanto@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     120a <show_DECTABSR+0x8a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%edx
lea    0xe02(%rip),%rsi
call   10a0 <sprintf@plt>
jmp    11be <show_DECTABSR+0x3e>
lea    0xdf0(%rip),%rdi
call   1060 <println@plt>
mov    -0x18(%rbp),%rsi
lea    0xde5(%rip),%rdi
call   1070 <show_result@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_DECTABSR>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
movl   $0x3,0xc(%rsp)
call   1040 <strlen@plt>
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
lea    0xe50(%rip),%rsi
mov    %r14,%rdi
call   1090 <strcat@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
mov    $0x2f,%edx
call   1050 <scanto@plt>
test   %eax,%eax
je     120e <show_DECTABSR+0x8e>
mov    %eax,%ebp
lea    0xe2b(%rip),%r15
lea    0xc(%rsp),%r12
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   10a0 <sprintf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x2f,%edx
call   1050 <scanto@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    11e0 <show_DECTABSR+0x60>
lea    0xdec(%rip),%rdi
call   1060 <println@plt>
lea    0xde5(%rip),%rdi
mov    %rbx,%rsi
call   1070 <show_result@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [13 x i8] c"Tab stops:%s\00"
define void @show_DECTABSR(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
store i32 3, i32* %3
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
store i8 0, i8* %10
%11 = load i8*, i8** %2
%12 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %17, %1
%14 = load i8*, i8** %2
%15 = call i32 @scanto(i8* %14, i32* %3, i8 signext 47)
store i32 %15, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = load i8*, i8** %5
%20 = call i32 @strlen(i8* %19)
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i32, i32* %4
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %13
25: ; preds = %13
%26 = call i32 @println(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%27 = load i8*, i8** %5
%28 = call i32 @show_result(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %5
%30 = call i32 @free(i8* %29)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [13 x i8] c"Tab stops:%s\00"
define void @show_DECTABSR(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 3, i32* %2
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8 0, i8* %6
%7 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanto(i8* %0, i32* %2, i8 signext 47)
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %1, %10
%11 = phi i32 [ %16, %10 ], [ %8, %1 ]
%12 = call i32 @strlen(i8* %6)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %6, i64 %13
%15 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%16 = call i32 @scanto(i8* %0, i32* %2, i8 signext 47)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %10
18: ; preds = %10, %1
%19 = call i32 @println(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @show_result(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%21 = call i32 @free(i8* %6)
ret void
}