#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__ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
char toupper(char);
unsigned char FAT_compare_fat_names(char name1[11], char name2[11]) {
  unsigned int i;
  char name1_upper[11];
  char name2_upper[11];
  memcpy(name1_upper, name1, 11);
  memcpy(name2_upper, name2, 11);
  for (i = 0; i < 11; i++) {
    name1_upper[i] = toupper(name1[i]);
    name2_upper[i] = toupper(name2[i]);
  }
  return (memcmp(name1_upper, name2_upper, 11) == 0);
}


x86 assembly (clang, -O0):
<FAT_compare_fat_names>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1f(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0xb,%edx
call   1050 <memcpy@plt>
lea    -0x2a(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xb,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jae    11b5 <FAT_compare_fat_names+0x85>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x14(%rbp),%eax
mov    %cl,-0x1f(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x14(%rbp),%eax
mov    %cl,-0x2a(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <FAT_compare_fat_names+0x3b>
lea    -0x1f(%rbp),%rdi
lea    -0x2a(%rbp),%rsi
mov    $0xb,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FAT_compare_fat_names>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xd(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xb,%edx
call   1050 <memcpy@plt>
lea    0x2(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0xb,%edx
call   1050 <memcpy@plt>
movsbl (%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0xd(%rsp)
movsbl (%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x2(%rsp)
movsbl 0x1(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0xe(%rsp)
movsbl 0x1(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x3(%rsp)
movsbl 0x2(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0xf(%rsp)
movsbl 0x2(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x4(%rsp)
movsbl 0x3(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x10(%rsp)
movsbl 0x3(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x5(%rsp)
movsbl 0x4(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x11(%rsp)
movsbl 0x4(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x6(%rsp)
movsbl 0x5(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x12(%rsp)
movsbl 0x5(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x7(%rsp)
movsbl 0x6(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x13(%rsp)
movsbl 0x6(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x8(%rsp)
movsbl 0x7(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x14(%rsp)
movsbl 0x7(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0x9(%rsp)
movsbl 0x8(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x15(%rsp)
movsbl 0x8(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0xa(%rsp)
movsbl 0x9(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x16(%rsp)
movsbl 0x9(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0xb(%rsp)
movsbl 0xa(%rbx),%edi
call   1030 <toupper@plt>
mov    %al,0x17(%rsp)
movsbl 0xa(%r12),%edi
call   1030 <toupper@plt>
mov    %al,0xc(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0xb,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
sete   %al
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define zeroext i8 @FAT_compare_fat_names(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [11 x i8]
%7 = alloca [11 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @memcpy(i8* %8, i8* %9, i32 11)
%11 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @memcpy(i8* %11, i8* %12, i32 11)
store i32 0, i32* %5
br label %14
14: ; preds = %36, %2
%15 = load i32, i32* %5
%16 = icmp ult i32 %15, 11
br i1 %16, label %17, label %39
17: ; preds = %14
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = call signext i8 @toupper(i8 signext %22)
%24 = load i32, i32* %5
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 %25
store i8 %23, i8* %26
%27 = load i8*, i8** %4
%28 = load i32, i32* %5
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = call signext i8 @toupper(i8 signext %31)
%33 = load i32, i32* %5
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 %34
store i8 %32, i8* %35
br label %36
36: ; preds = %17
%37 = load i32, i32* %5
%38 = add i32 %37, 1
store i32 %38, i32* %5
br label %14
39: ; preds = %14
%40 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%41 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%42 = call i64 @memcmp(i8* %40, i8* %41, i32 11)
%43 = icmp eq i64 %42, 0
%44 = zext i1 %43 to i32
%45 = trunc i32 %44 to i8
ret i8 %45
}

LLVM IR (-O2):
define zeroext i8 @FAT_compare_fat_names(i8* %0, i8* %1) {
%3 = alloca [11 x i8]
%4 = alloca [11 x i8]
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%7 = call i32 @memcpy(i8* %5, i8* %0, i32 11)
%8 = call i32 @memcpy(i8* %6, i8* %1, i32 11)
%9 = load i8, i8* %0
%10 = call signext i8 @toupper(i8 signext %9)
store i8 %10, i8* %5
%11 = load i8, i8* %1
%12 = call signext i8 @toupper(i8 signext %11)
store i8 %12, i8* %6
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = call signext i8 @toupper(i8 signext %14)
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 1
store i8 %15, i8* %16
%17 = getelementptr inbounds i8, i8* %1, i64 1
%18 = load i8, i8* %17
%19 = call signext i8 @toupper(i8 signext %18)
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 1
store i8 %19, i8* %20
%21 = getelementptr inbounds i8, i8* %0, i64 2
%22 = load i8, i8* %21
%23 = call signext i8 @toupper(i8 signext %22)
%24 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 2
store i8 %23, i8* %24
%25 = getelementptr inbounds i8, i8* %1, i64 2
%26 = load i8, i8* %25
%27 = call signext i8 @toupper(i8 signext %26)
%28 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 2
store i8 %27, i8* %28
%29 = getelementptr inbounds i8, i8* %0, i64 3
%30 = load i8, i8* %29
%31 = call signext i8 @toupper(i8 signext %30)
%32 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 3
store i8 %31, i8* %32
%33 = getelementptr inbounds i8, i8* %1, i64 3
%34 = load i8, i8* %33
%35 = call signext i8 @toupper(i8 signext %34)
%36 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 3
store i8 %35, i8* %36
%37 = getelementptr inbounds i8, i8* %0, i64 4
%38 = load i8, i8* %37
%39 = call signext i8 @toupper(i8 signext %38)
%40 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 4
store i8 %39, i8* %40
%41 = getelementptr inbounds i8, i8* %1, i64 4
%42 = load i8, i8* %41
%43 = call signext i8 @toupper(i8 signext %42)
%44 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 4
store i8 %43, i8* %44
%45 = getelementptr inbounds i8, i8* %0, i64 5
%46 = load i8, i8* %45
%47 = call signext i8 @toupper(i8 signext %46)
%48 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 5
store i8 %47, i8* %48
%49 = getelementptr inbounds i8, i8* %1, i64 5
%50 = load i8, i8* %49
%51 = call signext i8 @toupper(i8 signext %50)
%52 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 5
store i8 %51, i8* %52
%53 = getelementptr inbounds i8, i8* %0, i64 6
%54 = load i8, i8* %53
%55 = call signext i8 @toupper(i8 signext %54)
%56 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 6
store i8 %55, i8* %56
%57 = getelementptr inbounds i8, i8* %1, i64 6
%58 = load i8, i8* %57
%59 = call signext i8 @toupper(i8 signext %58)
%60 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 6
store i8 %59, i8* %60
%61 = getelementptr inbounds i8, i8* %0, i64 7
%62 = load i8, i8* %61
%63 = call signext i8 @toupper(i8 signext %62)
%64 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 7
store i8 %63, i8* %64
%65 = getelementptr inbounds i8, i8* %1, i64 7
%66 = load i8, i8* %65
%67 = call signext i8 @toupper(i8 signext %66)
%68 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 7
store i8 %67, i8* %68
%69 = getelementptr inbounds i8, i8* %0, i64 8
%70 = load i8, i8* %69
%71 = call signext i8 @toupper(i8 signext %70)
%72 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 8
store i8 %71, i8* %72
%73 = getelementptr inbounds i8, i8* %1, i64 8
%74 = load i8, i8* %73
%75 = call signext i8 @toupper(i8 signext %74)
%76 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 8
store i8 %75, i8* %76
%77 = getelementptr inbounds i8, i8* %0, i64 9
%78 = load i8, i8* %77
%79 = call signext i8 @toupper(i8 signext %78)
%80 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 9
store i8 %79, i8* %80
%81 = getelementptr inbounds i8, i8* %1, i64 9
%82 = load i8, i8* %81
%83 = call signext i8 @toupper(i8 signext %82)
%84 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 9
store i8 %83, i8* %84
%85 = getelementptr inbounds i8, i8* %0, i64 10
%86 = load i8, i8* %85
%87 = call signext i8 @toupper(i8 signext %86)
%88 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 10
store i8 %87, i8* %88
%89 = getelementptr inbounds i8, i8* %1, i64 10
%90 = load i8, i8* %89
%91 = call signext i8 @toupper(i8 signext %90)
%92 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 10
store i8 %91, i8* %92
%93 = call i64 @memcmp(i8* %5, i8* %6, i32 11)
%94 = icmp eq i64 %93, 0
%95 = zext i1 %94 to i8
ret i8 %95
}