#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*/ strcat(char *, char *);
int strlen(char *);
char *longerString(char *string, int largo) {
  int i, a = (largo - strlen(string)) / 8;
  if (strlen(string) % 8 == 0)
    a--;
  for (i = 0; i < a; i++) {
    strcat(string, "\t");
  }
  return string;
}


x86 assembly (clang, -O0):
<longerString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
sub    %ecx,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1173 <longerString+0x53>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a4 <longerString+0x84>
mov    -0x8(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117a <longerString+0x5a>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<longerString>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <strlen@plt>
sub    %eax,%r14d
lea    0x7(%r14),%ebp
test   %r14d,%r14d
cmovns %r14d,%ebp
sar    $0x3,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
and    $0x7,%eax
cmp    $0x1,%eax
sbb    $0x0,%ebp
test   %ebp,%ebp
jle    1170 <longerString+0x50>
lea    0xea4(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
add    $0xffffffff,%ebp
jne    1160 <longerString+0x40>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\09\00"
define i8* @longerString(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %7, %9
%11 = sdiv i32 %10, 8
store i32 %11, i32* %6
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
%14 = srem i32 %13, 8
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* %6
%18 = add nsw i32 %17, -1
store i32 %18, i32* %6
br label %19
19: ; preds = %16, %2
store i32 0, i32* %5
br label %20
20: ; preds = %27, %19
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8*, i8** %3
%26 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %24
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %20
30: ; preds = %20
%31 = load i8*, i8** %3
ret i8* %31
}

LLVM IR (-O2):
@.str = [2 x i8] c"\09\00"
define i8* @longerString(i8* returned %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = sub nsw i32 %1, %3
%5 = sdiv i32 %4, 8
%6 = tail call i32 @strlen(i8* %0)
%7 = and i32 %6, 7
%8 = icmp eq i32 %7, 0
%9 = sext i1 %8 to i32
%10 = add nsw i32 %5, %9
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2, %12
%13 = phi i32 [ %15, %12 ], [ 0, %2 ]
%14 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, %10
br i1 %16, label %17, label %12
17: ; preds = %12, %2
ret i8* %0
}