#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 */
void planetcore_prepare_table(char *table) {
  do {
    if (*table == '\n')
      *table = 0;
    table++;
  } while (*(table - 1) || *table != '\n');
  *table = 0;
}


x86 assembly (clang, -O0):
<planetcore_prepare_table>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    111f <planetcore_prepare_table+0x1f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl -0x1(%rax),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    1151 <planetcore_prepare_table+0x51>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1108 <planetcore_prepare_table+0x8>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<planetcore_prepare_table>:
mov    (%rdi),%al
jmp    111e <planetcore_prepare_table+0x1e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x0,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0xa,%al
je     112c <planetcore_prepare_table+0x2c>
cmp    $0xa,%al
je     1110 <planetcore_prepare_table+0x10>
add    $0x1,%rdi
test   %al,%al
je     1117 <planetcore_prepare_table+0x17>
jmp    1100 <planetcore_prepare_table>
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @planetcore_prepare_table(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %24, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 10
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = load i8*, i8** %2
store i8 0, i8* %9
br label %10
10: ; preds = %8, %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %13
13: ; preds = %10
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 -1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 10
br label %24
24: ; preds = %19, %13
%25 = phi i1 [ true, %13 ], [ %23, %19 ]
br i1 %25, label %3, label %26
26: ; preds = %24
%27 = load i8*, i8** %2
store i8 0, i8* %27
ret void
}

LLVM IR (-O2):
define void @planetcore_prepare_table(i8* nocapture %0) {
br label %2
2: ; preds = %11, %1
%3 = phi i8* [ %0, %1 ], [ %12, %11 ]
%4 = load i8, i8* %3
br label %5
5: ; preds = %2, %14
%6 = phi i8 [ %4, %2 ], [ %16, %14 ]
%7 = phi i8* [ %3, %2 ], [ %15, %14 ]
%8 = icmp eq i8 %6, 10
br i1 %8, label %9, label %11
9: ; preds = %5
store i8 0, i8* %7
%10 = getelementptr inbounds i8, i8* %7, i64 1
br label %14
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = icmp eq i8 %6, 0
br i1 %13, label %14, label %2
14: ; preds = %9, %11
%15 = phi i8* [ %10, %9 ], [ %12, %11 ]
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 10
br i1 %17, label %18, label %5
18: ; preds = %14
store i8 0, i8* %15
ret void
}