#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*/ free(char *);
char *get_token(char **);
int /*<<< orphan*/ remove_punctuation(char *);
int /*<<< orphan*/ strcat(char *, char *);
char *strdup(char *);
char *standardize(char *instring) {
  static char buffer[100];
  char *temp, *temp_ptr = temp = strdup(instring);
  char *tok_ptr, *substitute();
  int x;
  if (!*instring) {
    free(temp_ptr);
    *buffer = '\0';
    return buffer;
  }
  remove_punctuation(temp);
  *buffer = '\0';
  while (1) {
    tok_ptr = get_token(&temp);
    if (!*tok_ptr)
      break;
    strcat(buffer, substitute(tok_ptr));
  }
  free(temp_ptr);
  return buffer;
}


x86 assembly (clang, -O0):
<standardize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11aa <standardize+0x4a>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movb   $0x0,0x2ec6(%rip)
lea    0x2ebf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120c <standardize+0xac>
mov    -0x18(%rbp),%rdi
call   1040 <remove_punctuation@plt>
movb   $0x0,0x2ea6(%rip)
lea    -0x18(%rbp),%rdi
call   1080 <get_token@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11d9 <standardize+0x79>
jmp    11f8 <standardize+0x98>
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1050 <substitute@plt>
mov    %rax,%rsi
lea    0x2e72(%rip),%rdi
call   1060 <strcat@plt>
jmp    11ba <standardize+0x5a>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
lea    0x2e58(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standardize>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1070 <strdup@plt>
mov    %rax,%r14
mov    %rax,0x8(%rsp)
cmpb   $0x0,(%rbx)
je     11dc <standardize+0x7c>
mov    %r14,%rdi
call   1040 <remove_punctuation@plt>
movb   $0x0,0x2ed3(%rip)
lea    0x8(%rsp),%rdi
call   1080 <get_token@plt>
cmpb   $0x0,(%rax)
je     11d2 <standardize+0x72>
lea    0x2ebd(%rip),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <substitute@plt>
mov    %r15,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
call   1080 <get_token@plt>
cmpb   $0x0,(%rax)
jne    11b0 <standardize+0x50>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    11eb <standardize+0x8b>
mov    %r14,%rdi
call   1030 <free@plt>
movb   $0x0,0x2e75(%rip)
lea    0x2e6e(%rip),%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@standardize.buffer = internal global [100 x i8] zeroinitializer
define i8* @standardize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = call i8* @strdup(i8* %8)
store i8* %9, i8** %4
store i8* %9, i8** %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %1
%14 = load i8*, i8** %5
%15 = call i32 @free(i8* %14)
store i8 0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0)
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0), i8** %2
br label %32
16: ; preds = %1
%17 = load i8*, i8** %4
%18 = call i32 @remove_punctuation(i8* %17)
store i8 0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0)
br label %19
19: ; preds = %16, %25
%20 = call i8* @get_token(i8** %4)
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %19
br label %29
25: ; preds = %19
%26 = load i8*, i8** %6
%27 = call i8* (i8*, ...) bitcast (i8* (...)* @substitute to i8* (i8*, ...)*)(i8* %26)
%28 = call i32 @strcat(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0), i8* %27)
br label %19
29: ; preds = %24
%30 = load i8*, i8** %5
%31 = call i32 @free(i8* %30)
store i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0), i8** %2
br label %32
32: ; preds = %29, %13
%33 = load i8*, i8** %2
ret i8* %33
}

LLVM IR (-O2):
@standardize.buffer = internal global [100 x i8] zeroinitializer
define i8* @standardize(i8* nocapture %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = tail call i8* @strdup(i8* %0)
store i8* %4, i8** %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @free(i8* %4)
store i8 0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0)
br label %23
9: ; preds = %1
%10 = tail call i32 @remove_punctuation(i8* %4)
store i8 0, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0)
%11 = call i8* @get_token(i8** %2)
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %21, label %14
14: ; preds = %9, %14
%15 = phi i8* [ %18, %14 ], [ %11, %9 ]
%16 = call i8* (i8*, ...) bitcast (i8* (...)* @substitute to i8* (i8*, ...)*)(i8* %15)
%17 = call i32 @strcat(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0), i8* %16)
%18 = call i8* @get_token(i8** %2)
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %14
21: ; preds = %14, %9
%22 = call i32 @free(i8* %4)
br label %23
23: ; preds = %21, %7
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @standardize.buffer, i64 0, i64 0)
}