#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__ strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void buildTable(char str[], char table[]) {
  int p;
  char ch;
  strcpy(table, str);
  for (p = strlen(str), ch = 'A'; ch <= 'Z'; ch++)
    if (strchr(str, ch) == 0)
      table[p++] = ch;
}


x86 assembly (clang, -O0):
<buildTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
movb   $0x41,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x5a,%eax
jg     11ab <buildTable+0x7b>
mov    -0x8(%rbp),%rdi
movsbl -0x15(%rbp),%esi
call   1050 <strchr@plt>
cmp    $0x0,%rax
jne    1199 <buildTable+0x69>
mov    -0x15(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    119e <buildTable+0x6e>
mov    -0x15(%rbp),%al
add    $0x1,%al
mov    %al,-0x15(%rbp)
jmp    115d <buildTable+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildTable>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    $0x41,%bl
jmp    1168 <buildTable+0x38>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%bl
cmp    $0x5b,%bl
je     1184 <buildTable+0x54>
movsbl %bl,%esi
mov    %r15,%rdi
call   1050 <strchr@plt>
test   %rax,%rax
jne    1160 <buildTable+0x30>
movslq %ebp,%rax
add    $0x1,%ebp
mov    %bl,(%r14,%rax,1)
jmp    1160 <buildTable+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @buildTable(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %5
store i8 65, i8* %6
br label %12
12: ; preds = %29, %2
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 90
br i1 %15, label %16, label %32
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = load i8, i8* %6
%19 = call i64 @strchr(i8* %17, i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %16
%22 = load i8, i8* %6
%23 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
store i8 %22, i8* %27
br label %28
28: ; preds = %21, %16
br label %29
29: ; preds = %28
%30 = load i8, i8* %6
%31 = add i8 %30, 1
store i8 %31, i8* %6
br label %12
32: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @buildTable(i8* %0, i8* %1) {
%3 = tail call i32 @strcpy(i8* %1, i8* %0)
%4 = tail call i32 @strlen(i8* %0)
br label %5
5: ; preds = %2, %14
%6 = phi i8 [ 65, %2 ], [ %16, %14 ]
%7 = phi i32 [ %4, %2 ], [ %15, %14 ]
%8 = tail call i64 @strchr(i8* %0, i8 signext %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = add nsw i32 %7, 1
%12 = sext i32 %7 to i64
%13 = getelementptr inbounds i8, i8* %1, i64 %12
store i8 %6, i8* %13
br label %14
14: ; preds = %5, %10
%15 = phi i32 [ %11, %10 ], [ %7, %5 ]
%16 = add nuw nsw i8 %6, 1
%17 = icmp eq i8 %16, 91
br i1 %17, label %18, label %5
18: ; preds = %14
ret void
}