#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__ strcomp(void *, void *, int);
int /*<<< orphan*/ strcopy(void *, void *, int);
void patches(void) {
  for (int i = 0; i < 0x600000; i += 4) {
    if (strcomp((void *)0x27B00000 - i, (void *)L"Ver.", 4))
      strcopy((void *)0x27B00000 - i, (void *)L"\uE024Rei", 4);
  }
}


x86 assembly (clang, -O0):
<patches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x600000,-0x4(%rbp)
jge    119d <patches+0x7d>
movslq -0x4(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    $0x27b00000,%edi
add    %rax,%rdi
lea    0xeac(%rip),%rsi
mov    $0x4,%edx
call   1030 <strcomp@plt>
cmp    $0x0,%rax
je     118a <patches+0x6a>
movslq -0x4(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    $0x27b00000,%edi
add    %rax,%rdi
lea    0xe94(%rip),%rsi
mov    $0x4,%edx
call   1040 <strcopy@plt>
jmp    118f <patches+0x6f>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <patches+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patches>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0xfffffffffffffffc,%r12
mov    $0x27b00000,%ebx
lea    0xec5(%rip),%r14
lea    0xed2(%rip),%r15
jmp    1161 <patches+0x41>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x4,%r12
add    $0xfffffffffffffffc,%rbx
cmp    $0x5ffffc,%r12
jae    1188 <patches+0x68>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <strcomp@plt>
test   %rax,%rax
je     1150 <patches+0x30>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1040 <strcopy@plt>
jmp    1150 <patches+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i32] [i32 86, i32 101, i32 114, i32 46, i32 0]
@.str.1 = [5 x i32] [i32 57380, i32 82, i32 101, i32 105, i32 0]
define void @patches() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %19, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 6291456
br i1 %4, label %5, label %22
5: ; preds = %2
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = sub i64 0, %7
%9 = getelementptr i8, i8* inttoptr (i64 665845760 to i8*), i64 %8
%10 = call i64 @strcomp(i8* %9, i8* bitcast ([5 x i32]* @.str to i8*), i32 4)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %5
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = sub i64 0, %14
%16 = getelementptr i8, i8* inttoptr (i64 665845760 to i8*), i64 %15
%17 = call i32 @strcopy(i8* %16, i8* bitcast ([5 x i32]* @.str.1 to i8*), i32 4)
br label %18
18: ; preds = %12, %5
br label %19
19: ; preds = %18
%20 = load i32, i32* %1
%21 = add nsw i32 %20, 4
store i32 %21, i32* %1
br label %2
22: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i32] [i32 86, i32 101, i32 114, i32 46, i32 0]
@.str.1 = [5 x i32] [i32 57380, i32 82, i32 101, i32 105, i32 0]
define void @patches() {
br label %2
1: ; preds = %10
ret void
2: ; preds = %0, %10
%3 = phi i64 [ 0, %0 ], [ %11, %10 ]
%4 = sub nsw i64 0, %3
%5 = getelementptr i8, i8* inttoptr (i64 665845760 to i8*), i64 %4
%6 = tail call i64 @strcomp(i8* %5, i8* bitcast ([5 x i32]* @.str to i8*), i32 4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @strcopy(i8* %5, i8* bitcast ([5 x i32]* @.str.1 to i8*), i32 4)
br label %10
10: ; preds = %2, %8
%11 = add nuw nsw i64 %3, 4
%12 = icmp ult i64 %3, 6291452
br i1 %12, label %2, label %1
}