#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*/ assert_equal_str(char *, char *, char *, char *);
int /*<<< orphan*/ free(char *);
char *pl_expandtabs(char *, int);
void test_expandtabs() {
  char *ret_val;
  ret_val = pl_expandtabs("this is a\ttabbed\t\tstring", 4);
  assert_equal_str("this is a   tabbed      string", ret_val, "test_expandtabs",
                   "Test 1: Strings are not equal.");
  free(ret_val);
  ret_val = pl_expandtabs("'\t'", 10);
  assert_equal_str("'         '", ret_val, "test_expandtabs",
                   "Test 2: Strings are not equal.");
  free(ret_val);
  ret_val = pl_expandtabs("asd\tdsa", 0);
  assert_equal_str("asddsa", ret_val, "test_expandtabs",
                   "Test 3: Strings are not equal.");
  free(ret_val);
}


x86 assembly (clang, -O0):
<test_expandtabs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x4,%esi
call   1050 <pl_expandtabs@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec1(%rip),%rdi
lea    0xed9(%rip),%rdx
lea    0xee2(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xeec(%rip),%rdi
mov    $0xa,%esi
call   1050 <pl_expandtabs@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed7(%rip),%rdi
lea    0xe9d(%rip),%rdx
lea    0xed5(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xedf(%rip),%rdi
xor    %esi,%esi
call   1050 <pl_expandtabs@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed1(%rip),%rdi
lea    0xe64(%rip),%rdx
lea    0xeca(%rip),%rcx
call   1040 <assert_equal_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_expandtabs>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
mov    $0x4,%esi
call   1050 <pl_expandtabs@plt>
mov    %rax,%rbx
lea    0xeca(%rip),%rdi
lea    0xee2(%rip),%r14
lea    0xeeb(%rip),%rcx
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xef0(%rip),%rdi
mov    $0xa,%esi
call   1050 <pl_expandtabs@plt>
mov    %rax,%rbx
lea    0xee0(%rip),%rdi
lea    0xee5(%rip),%rcx
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xeea(%rip),%rdi
xor    %esi,%esi
call   1050 <pl_expandtabs@plt>
mov    %rax,%rbx
lea    0xee1(%rip),%rdi
lea    0xee1(%rip),%rcx
mov    %rax,%rsi
mov    %r14,%rdx
call   1040 <assert_equal_str@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"this is a\09tabbed\09\09string\00"
@.str.1 = [31 x i8] c"this is a tabbed string\00"
@.str.2 = [16 x i8] c"test_expandtabs\00"
@.str.3 = [31 x i8] c"Test 1: Strings are not equal.\00"
@.str.4 = [4 x i8] c"'\09'\00"
@.str.5 = [12 x i8] c"' '\00"
@.str.6 = [31 x i8] c"Test 2: Strings are not equal.\00"
@.str.7 = [8 x i8] c"asd\09dsa\00"
@.str.8 = [7 x i8] c"asddsa\00"
@.str.9 = [31 x i8] c"Test 3: Strings are not equal.\00"
define void @test_expandtabs() {
%1 = alloca i8*
%2 = call i8* @pl_expandtabs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 4)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @assert_equal_str(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%5 = load i8*, i8** %1
%6 = call i32 @free(i8* %5)
%7 = call i8* @pl_expandtabs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 10)
store i8* %7, i8** %1
%8 = load i8*, i8** %1
%9 = call i32 @assert_equal_str(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%10 = load i8*, i8** %1
%11 = call i32 @free(i8* %10)
%12 = call i8* @pl_expandtabs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 0)
store i8* %12, i8** %1
%13 = load i8*, i8** %1
%14 = call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%15 = load i8*, i8** %1
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"this is a\09tabbed\09\09string\00"
@.str.1 = [31 x i8] c"this is a tabbed string\00"
@.str.2 = [16 x i8] c"test_expandtabs\00"
@.str.3 = [31 x i8] c"Test 1: Strings are not equal.\00"
@.str.4 = [4 x i8] c"'\09'\00"
@.str.5 = [12 x i8] c"' '\00"
@.str.6 = [31 x i8] c"Test 2: Strings are not equal.\00"
@.str.7 = [8 x i8] c"asd\09dsa\00"
@.str.8 = [7 x i8] c"asddsa\00"
@.str.9 = [31 x i8] c"Test 3: Strings are not equal.\00"
define void @test_expandtabs() {
%1 = tail call i8* @pl_expandtabs(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 @free(i8* %1)
%4 = tail call i8* @pl_expandtabs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 10)
%5 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
%6 = tail call i32 @free(i8* %4)
%7 = tail call i8* @pl_expandtabs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 0)
%8 = tail call i32 @assert_equal_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%9 = tail call i32 @free(i8* %7)
ret void
}