#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 */
struct wordinfo_node {
  int dummy;
};

/* Variables and functions */
scalar_t__ isupper(char);
char tolower(char);
int /*<<< orphan*/ wordlist_insert(char *, struct wordinfo_node *);
void process_token(char *token, struct wordinfo_node *info) {
  char *ptr = token;
  while (ptr && *ptr) {
    if (isupper(*ptr))
      *ptr = tolower(*ptr);
    ptr++;
  }
  wordlist_insert(token, info);
}


x86 assembly (clang, -O0):
<process_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
je     1168 <process_token+0x38>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1178 <process_token+0x48>
jmp    11b3 <process_token+0x83>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isupper@plt>
cmp    $0x0,%rax
je     11a2 <process_token+0x72>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1148 <process_token+0x18>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <wordlist_insert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_token>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
test   %rdi,%rdi
je     1175 <process_token+0x45>
mov    (%r15),%al
test   %al,%al
je     1175 <process_token+0x45>
mov    %r15,%rbx
jmp    115c <process_token+0x2c>
nopl   0x0(%rax)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1175 <process_token+0x45>
movsbl %al,%edi
call   1050 <isupper@plt>
test   %rax,%rax
je     1150 <process_token+0x20>
movsbl (%rbx),%edi
call   1040 <tolower@plt>
mov    %al,(%rbx)
jmp    1150 <process_token+0x20>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <wordlist_insert@plt>

LLVM IR (-O0):
%struct.wordinfo_node = type { i32 }
define void @process_token(i8* %0, %struct.wordinfo_node* %1) {
%3 = alloca i8*
%4 = alloca %struct.wordinfo_node*
%5 = alloca i8*
store i8* %0, i8** %3
store %struct.wordinfo_node* %1, %struct.wordinfo_node** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %27, %2
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br label %15
15: ; preds = %10, %7
%16 = phi i1 [ false, %7 ], [ %14, %10 ]
br i1 %16, label %17, label %30
17: ; preds = %15
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = call i64 @isupper(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load i8*, i8** %5
%24 = load i8, i8* %23
%25 = call signext i8 @tolower(i8 signext %24)
%26 = load i8*, i8** %5
store i8 %25, i8* %26
br label %27
27: ; preds = %22, %17
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %5
br label %7
30: ; preds = %15
%31 = load i8*, i8** %3
%32 = load %struct.wordinfo_node*, %struct.wordinfo_node** %4
%33 = call i32 @wordlist_insert(i8* %31, %struct.wordinfo_node* %32)
ret void
}

LLVM IR (-O2):
%struct.wordinfo_node = type { i32 }
define void @process_token(i8* %0, %struct.wordinfo_node* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %4, %15
%8 = phi i8 [ %17, %15 ], [ %5, %4 ]
%9 = phi i8* [ %16, %15 ], [ %0, %4 ]
%10 = tail call i64 @isupper(i8 signext %8)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = load i8, i8* %9
%14 = tail call signext i8 @tolower(i8 signext %13)
store i8 %14, i8* %9
br label %15
15: ; preds = %12, %7
%16 = getelementptr inbounds i8, i8* %9, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %7
19: ; preds = %15, %4, %2
%20 = tail call i32 @wordlist_insert(i8* %0, %struct.wordinfo_node* %1)
ret void
}