#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 */
typedef int TotalSize;

/* Variables and functions */
int CountUTF8String(char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, size_t);
int /*<<< orphan*/ printMenuItem(char *);
size_t strlen(char *);
void printAutobahnRow(char *S, int TotalSize) {
  size_t size_S = strlen(S);
  int size_n = CountUTF8String(S);
  char *Buffer = malloc(sizeof(char) * (TotalSize) + 1);
  memcpy(Buffer, S, size_S);
  int u;
  for (u = 0; u < (TotalSize - size_n); u++) {
    Buffer[size_n + u] = ' ';
  }
  printMenuItem(Buffer);
  free(Buffer);
}


x86 assembly (clang, -O0):
<printAutobahnRow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <CountUTF8String@plt>
mov    %eax,-0x1c(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x0,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1070 <memcpy@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jge    11e7 <printAutobahnRow+0x87>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b7 <printAutobahnRow+0x57>
mov    -0x28(%rbp),%rdi
call   1040 <printMenuItem@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAutobahnRow>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
call   1050 <strlen@plt>
mov    %rax,%r13
mov    %r12,%rdi
call   1070 <CountUTF8String@plt>
mov    %eax,%ebx
lea    0x1(%r14),%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1080 <memcpy@plt>
cmp    %r14d,%ebx
jge    11cf <printAutobahnRow+0x5f>
movslq %ebx,%rax
mov    %r15,%rdi
add    %rax,%rdi
not    %ebx
add    %r14d,%ebx
add    $0x1,%rbx
mov    $0x20,%esi
mov    %rbx,%rdx
call   1060 <memset@plt>
mov    %r15,%rdi
call   1040 <printMenuItem@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @printAutobahnRow(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i8*, i8** %3
%10 = call i64 @strlen(i8* %9)
store i64 %10, i64* %5
%11 = load i8*, i8** %3
%12 = call i32 @CountUTF8String(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = mul i64 1, %14
%16 = add i64 %15, 1
%17 = trunc i64 %16 to i32
%18 = call i8* @malloc(i32 %17)
store i8* %18, i8** %7
%19 = load i8*, i8** %7
%20 = load i8*, i8** %3
%21 = load i64, i64* %5
%22 = call i32 @memcpy(i8* %19, i8* %20, i64 %21)
store i32 0, i32* %8
br label %23
23: ; preds = %36, %2
%24 = load i32, i32* %8
%25 = load i32, i32* %4
%26 = load i32, i32* %6
%27 = sub nsw i32 %25, %26
%28 = icmp slt i32 %24, %27
br i1 %28, label %29, label %39
29: ; preds = %23
%30 = load i8*, i8** %7
%31 = load i32, i32* %6
%32 = load i32, i32* %8
%33 = add nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %30, i64 %34
store i8 32, i8* %35
br label %36
36: ; preds = %29
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %23
39: ; preds = %23
%40 = load i8*, i8** %7
%41 = call i32 @printMenuItem(i8* %40)
%42 = load i8*, i8** %7
%43 = call i32 @free(i8* %42)
ret void
}

LLVM IR (-O2):
define void @printAutobahnRow(i8* %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i32 @CountUTF8String(i8* %0)
%5 = add i32 %1, 1
%6 = tail call i8* @malloc(i32 %5)
%7 = tail call i32 @memcpy(i8* %6, i8* %0, i64 %3)
%8 = icmp slt i32 %4, %1
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = sext i32 %4 to i64
%11 = getelementptr i8, i8* %6, i64 %10
%12 = xor i32 %4, -1
%13 = add i32 %12, %1
%14 = zext i32 %13 to i64
%15 = add nuw nsw i64 %14, 1
br label %16
16: ; preds = %9, %2
%17 = tail call i32 @printMenuItem(i8* %6)
%18 = tail call i32 @free(i8* %6)
ret void
}