#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 */
char *get_word();
int /*<<< orphan*/ strcmp(char *, char *);
char *remove_semicolons() {
  char *word = get_word();
  while (!strcmp(word, " ") || !strcmp(word, "\t") || word[0] == '\0') {
    word = get_word();
  }
  if (!strcmp(word, ";")) {
    word[0] = '\n';
    word[1] = '\0';
    return word;
  }
  return word;
}


x86 assembly (clang, -O0):
<remove_semicolons>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <get_word@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1183 <remove_semicolons+0x63>
mov    -0x10(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1183 <remove_semicolons+0x63>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1193 <remove_semicolons+0x73>
jmp    11a3 <remove_semicolons+0x83>
mov    $0x0,%al
call   1040 <get_word@plt>
mov    %rax,-0x10(%rbp)
jmp    1133 <remove_semicolons+0x13>
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11d8 <remove_semicolons+0xb8>
mov    -0x10(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <remove_semicolons+0xc0>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_semicolons>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%r14
lea    0xecf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1040 <get_word@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1140 <remove_semicolons+0x20>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1140 <remove_semicolons+0x20>
cmpb   $0x0,(%rbx)
je     1140 <remove_semicolons+0x20>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1185 <remove_semicolons+0x65>
movw   $0xa,(%rbx)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [2 x i8] c";\00"
define i8* @remove_semicolons() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @get_word()
store i8* %3, i8** %2
br label %4
4: ; preds = %20, %0
%5 = load i8*, i8** %2
%6 = call i32 @strcmp(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = call i32 @strcmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br label %18
18: ; preds = %12, %8, %4
%19 = phi i1 [ true, %8 ], [ true, %4 ], [ %17, %12 ]
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = call i8* (...) @get_word()
store i8* %21, i8** %2
br label %4
22: ; preds = %18
%23 = load i8*, i8** %2
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %22
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 0
store i8 10, i8* %28
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8 0, i8* %30
%31 = load i8*, i8** %2
store i8* %31, i8** %1
br label %34
32: ; preds = %22
%33 = load i8*, i8** %2
store i8* %33, i8** %1
br label %34
34: ; preds = %32, %26
%35 = load i8*, i8** %1
ret i8* %35
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\09\00"
@.str.2 = [2 x i8] c";\00"
define i8* @remove_semicolons() {
br label %1
1: ; preds = %5, %0
%2 = tail call i8* (...) @get_word()
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1, %6, %9
br label %1
6: ; preds = %1
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %5, label %9
9: ; preds = %6
%10 = load i8, i8* %2
%11 = icmp eq i8 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %9
%13 = tail call i32 @strcmp(i8* %2, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
store i8 10, i8* %2
%16 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %16
br label %17
17: ; preds = %12, %15
ret i8* %2
}