#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*/ isalpha(char);
int strlen(char *);
int getMachineUniqueLicence(char *uniqueId) {
  int length;
  length = strlen(uniqueId);
  while (length) {
    if (!isalpha(uniqueId[length - 1])) {
      uniqueId[length - 1] = 'A' + uniqueId[length - 1] % 25;
    }
    length--;
  }
  return (1);
}


x86 assembly (clang, -O0):
<getMachineUniqueLicence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     119b <getMachineUniqueLicence+0x7b>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    118d <getMachineUniqueLicence+0x6d>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    $0x19,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <getMachineUniqueLicence+0x18>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMachineUniqueLicence>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
je     1190 <getMachineUniqueLicence+0x70>
mov    %eax,%r15d
cltq
neg    %r15d
add    %rax,%r14
add    $0xffffffffffffffff,%r14
xor    %ebx,%ebx
jmp    1159 <getMachineUniqueLicence+0x39>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffffffffffff,%rbx
cmp    %ebx,%r15d
je     1190 <getMachineUniqueLicence+0x70>
movsbl (%r14,%rbx,1),%edi
call   1040 <isalpha@plt>
test   %eax,%eax
jne    1150 <getMachineUniqueLicence+0x30>
movsbl (%r14,%rbx,1),%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
add    $0x41,%al
mov    %al,(%r14,%rbx,1)
jmp    1150 <getMachineUniqueLicence+0x30>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @getMachineUniqueLicence(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
br label %6
6: ; preds = %34, %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %37
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @isalpha(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %34, label %18
18: ; preds = %9
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = srem i32 %25, 25
%27 = add nsw i32 65, %26
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %2
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
store i8 %28, i8* %33
br label %34
34: ; preds = %18, %9
%35 = load i32, i32* %3
%36 = add nsw i32 %35, -1
store i32 %36, i32* %3
br label %6
37: ; preds = %6
ret i32 1
}

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