#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*/ check_pp(char *);
char *gather_word(char *, char *);
int /*<<< orphan*/ replace_word(char *);
int /*<<< orphan*/ strchr(char *, char);
size_t const strlen(char *);
void process_line(char *buf) {
  char *in_ptr, *out_ptr;
  char word[128], *ptr;
  const size_t len = 31UL;
  check_pp(buf);
  for (in_ptr = out_ptr = buf; *in_ptr;) {
    if (!strchr(
            "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$",
            *in_ptr))
      *out_ptr++ = *in_ptr++;
    else {
      in_ptr = gather_word(in_ptr, word);
      if (strlen(word) > len)
        replace_word(word);
      for (ptr = word; *ptr; ptr++, out_ptr++)
        *out_ptr = *ptr;
    }
  }
  *out_ptr = 0;
}


x86 assembly (clang, -O0):
<process_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x1f,-0xb0(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <check_pp@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     125f <process_line+0x10f>
mov    -0x10(%rbp),%rax
lea    0xe69(%rip),%rdi
movsbl (%rax),%esi
call   1050 <strchr@plt>
cmp    $0x0,%eax
jne    11cf <process_line+0x7f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    125a <process_line+0x10a>
mov    -0x10(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1070 <gather_word@plt>
mov    %rax,-0x10(%rbp)
lea    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1f,%rax
jbe    1205 <process_line+0xb5>
lea    -0xa0(%rbp),%rdi
call   1040 <replace_word@plt>
lea    -0xa0(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1255 <process_line+0x105>
mov    -0xa8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xa8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1213 <process_line+0xc3>
jmp    125a <process_line+0x10a>
jmp    117f <process_line+0x2f>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_line>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%r13
call   1060 <check_pp@plt>
mov    0x0(%r13),%al
test   %al,%al
je     1203 <process_line+0xb3>
lea    0x1(%rsp),%r12
lea    0xe80(%rip),%r14
mov    %rsp,%r15
mov    %r13,%rbx
jmp    11a6 <process_line+0x56>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%al
add    $0x1,%r13
mov    %al,(%rbx)
add    $0x1,%rbx
mov    0x0(%r13),%al
test   %al,%al
je     1206 <process_line+0xb6>
movsbl %al,%esi
mov    %r14,%rdi
call   1050 <strchr@plt>
test   %eax,%eax
je     1190 <process_line+0x40>
mov    %r13,%rdi
mov    %r15,%rsi
call   1070 <gather_word@plt>
mov    %rax,%r13
mov    %r15,%rdi
call   1030 <strlen@plt>
cmp    $0x20,%rax
jb     11d9 <process_line+0x89>
mov    %r15,%rdi
call   1040 <replace_word@plt>
mov    (%rsp),%al
test   %al,%al
je     119e <process_line+0x4e>
mov    %r12,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    11f0 <process_line+0xa0>
jmp    119e <process_line+0x4e>
mov    %r13,%rbx
movb   $0x0,(%rbx)
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [65 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\00"
define void @process_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [128 x i8]
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %2
store i64 31, i64* %7
%8 = load i8*, i8** %2
%9 = call i32 @check_pp(i8* %8)
%10 = load i8*, i8** %2
store i8* %10, i8** %4
store i8* %10, i8** %3
br label %11
11: ; preds = %52, %1
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %53
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call i32 @strchr(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %3
%23 = load i8, i8* %21
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
store i8 %23, i8* %24
br label %52
26: ; preds = %15
%27 = load i8*, i8** %3
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%29 = call i8* @gather_word(i8* %27, i8* %28)
store i8* %29, i8** %3
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%31 = call i64 @strlen(i8* %30)
%32 = icmp ugt i64 %31, 31
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%35 = call i32 @replace_word(i8* %34)
br label %36
36: ; preds = %33, %26
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
store i8* %37, i8** %6
br label %38
38: ; preds = %46, %36
%39 = load i8*, i8** %6
%40 = load i8, i8* %39
%41 = icmp ne i8 %40, 0
br i1 %41, label %42, label %51
42: ; preds = %38
%43 = load i8*, i8** %6
%44 = load i8, i8* %43
%45 = load i8*, i8** %4
store i8 %44, i8* %45
br label %46
46: ; preds = %42
%47 = load i8*, i8** %6
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %6
%49 = load i8*, i8** %4
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %4
br label %38
51: ; preds = %38
br label %52
52: ; preds = %51, %20
br label %11
53: ; preds = %11
%54 = load i8*, i8** %4
store i8 0, i8* %54
ret void
}

LLVM IR (-O2):
@.str = [65 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\00"
define void @process_line(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @check_pp(i8* %0)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %39, label %7
7: ; preds = %1, %34
%8 = phi i8 [ %37, %34 ], [ %5, %1 ]
%9 = phi i8* [ %36, %34 ], [ %0, %1 ]
%10 = phi i8* [ %35, %34 ], [ %0, %1 ]
%11 = call i32 @strchr(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = load i8, i8* %9
%16 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %15, i8* %10
br label %34
17: ; preds = %7
%18 = call i8* @gather_word(i8* %9, i8* %3)
%19 = call i64 @strlen(i8* %3)
%20 = icmp ugt i64 %19, 31
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @replace_word(i8* %3)
br label %23
23: ; preds = %21, %17
%24 = load i8, i8* %3
%25 = icmp eq i8 %24, 0
br i1 %25, label %34, label %26
26: ; preds = %23, %26
%27 = phi i8 [ %32, %26 ], [ %24, %23 ]
%28 = phi i8* [ %30, %26 ], [ %3, %23 ]
%29 = phi i8* [ %31, %26 ], [ %10, %23 ]
store i8 %27, i8* %29
%30 = getelementptr inbounds i8, i8* %28, i64 1
%31 = getelementptr inbounds i8, i8* %29, i64 1
%32 = load i8, i8* %30
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %26
34: ; preds = %26, %23, %13
%35 = phi i8* [ %16, %13 ], [ %10, %23 ], [ %31, %26 ]
%36 = phi i8* [ %14, %13 ], [ %18, %23 ], [ %18, %26 ]
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 0
br i1 %38, label %39, label %7
39: ; preds = %34, %1
%40 = phi i8* [ %0, %1 ], [ %35, %34 ]
store i8 0, i8* %40
ret void
}