#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 */
scalar_t__ endsWith(char *, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ removeEndChar(char *);
scalar_t__ startsWith(char *, char);
int strlen2(char *);
char *strtok(char const *, char *);
void pushLineEntriesToTable(const char *line) {
  char *tokenPtr;
  char temp[10];
  tokenPtr = strtok(line, " ");
  while (tokenPtr != NULL) {
    if (strlen2(tokenPtr) > 1) {
      if (startsWith(tokenPtr, '(')) {
        printf("(\n");
        tokenPtr++;
      }
      if (strlen2(tokenPtr) > 1 && endsWith(tokenPtr, ')')) {
        removeEndChar(tokenPtr);
        printf("%s\n", tokenPtr);
        printf(")\n");
      } else
        printf("%s\n", tokenPtr);
    } else
      printf("%s\n", tokenPtr);
    tokenPtr = strtok(NULL, " ");
  }
}


x86 assembly (clang, -O0):
<pushLineEntriesToTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1269 <pushLineEntriesToTable+0x109>
mov    -0x10(%rbp),%rdi
call   1060 <strlen2@plt>
cmp    $0x1,%eax
jle    123e <pushLineEntriesToTable+0xde>
mov    -0x10(%rbp),%rdi
mov    $0x28,%esi
call   1030 <startsWith@plt>
cmp    $0x0,%rax
je     11cf <pushLineEntriesToTable+0x6f>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen2@plt>
cmp    $0x1,%eax
jle    1227 <pushLineEntriesToTable+0xc7>
mov    -0x10(%rbp),%rdi
mov    $0x29,%esi
call   1080 <endsWith@plt>
cmp    $0x0,%rax
je     1227 <pushLineEntriesToTable+0xc7>
mov    -0x10(%rbp),%rdi
call   1050 <removeEndChar@plt>
mov    -0x10(%rbp),%rsi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1239 <pushLineEntriesToTable+0xd9>
mov    -0x10(%rbp),%rsi
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1250 <pushLineEntriesToTable+0xf0>
mov    -0x10(%rbp),%rsi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xda5(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x10(%rbp)
jmp    1180 <pushLineEntriesToTable+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushLineEntriesToTable>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe91(%rip),%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     1219 <pushLineEntriesToTable+0xb9>
mov    %rax,%rbx
lea    0xe7b(%rip),%r14
lea    0xe76(%rip),%r15
lea    0xe6b(%rip),%r12
jmp    11ba <pushLineEntriesToTable+0x5a>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    %r12,%rsi
call   1070 <strtok@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1219 <pushLineEntriesToTable+0xb9>
mov    %rbx,%rdi
call   1060 <strlen2@plt>
cmp    $0x2,%eax
jl     11a0 <pushLineEntriesToTable+0x40>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1040 <startsWith@plt>
test   %rax,%rax
je     11e5 <pushLineEntriesToTable+0x85>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1060 <strlen2@plt>
cmp    $0x2,%eax
jl     11a0 <pushLineEntriesToTable+0x40>
mov    %rbx,%rdi
mov    $0x29,%esi
call   1080 <endsWith@plt>
test   %rax,%rax
je     11a0 <pushLineEntriesToTable+0x40>
mov    %rbx,%rdi
call   1050 <removeEndChar@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
jmp    11a3 <pushLineEntriesToTable+0x43>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [3 x i8] c"(\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [3 x i8] c")\0A\00"
define void @pushLineEntriesToTable(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [10 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %3
br label %7
7: ; preds = %43, %1
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %45
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = call i32 @strlen2(i8* %11)
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %40
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = call i64 @startsWith(i8* %15, i8 signext 40)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %22
22: ; preds = %18, %14
%23 = load i8*, i8** %3
%24 = call i32 @strlen2(i8* %23)
%25 = icmp sgt i32 %24, 1
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i8*, i8** %3
%28 = call i64 @endsWith(i8* %27, i8 signext 41)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i8*, i8** %3
%32 = call i32 @removeEndChar(i8* %31)
%33 = load i8*, i8** %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %39
36: ; preds = %26, %22
%37 = load i8*, i8** %3
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %36, %30
br label %43
40: ; preds = %10
%41 = load i8*, i8** %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %40, %39
%44 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %44, i8** %3
br label %7
45: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@str = [2 x i8] c")\00"
@str.4 = [2 x i8] c"(\00"
define void @pushLineEntriesToTable(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %32, label %4
4: ; preds = %1, %29
%5 = phi i8* [ %30, %29 ], [ %2, %1 ]
%6 = tail call i32 @strlen2(i8* %5)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %27
8: ; preds = %4
%9 = tail call i64 @startsWith(i8* %5, i8 signext 40)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
%13 = getelementptr inbounds i8, i8* %5, i64 1
br label %14
14: ; preds = %11, %8
%15 = phi i8* [ %13, %11 ], [ %5, %8 ]
%16 = tail call i32 @strlen2(i8* %15)
%17 = icmp sgt i32 %16, 1
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = tail call i64 @endsWith(i8* %15, i8 signext 41)
%20 = icmp eq i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = tail call i32 @removeEndChar(i8* %15)
%23 = tail call i32 @puts(i8* %15)
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %29
25: ; preds = %18, %14
%26 = tail call i32 @puts(i8* %15)
br label %29
27: ; preds = %4
%28 = tail call i32 @puts(i8* %5)
br label %29
29: ; preds = %21, %25, %27
%30 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %4
32: ; preds = %29, %1
ret void
}