#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 */
char *strchr(char *, char);
int modify(char *str) {
  int ret = 0;
  char *pos = NULL;
  while ((pos = strchr(str, '1')) != NULL) {
    *pos = '@';
    ret = 1;
  }
  while ((pos = strchr(str, '0')) != NULL) {
    *pos = '%';
    ret = 1;
  }
  while ((pos = strchr(str, 'l')) != NULL) {
    *pos = 'L';
    ret = 1;
  }
  while ((pos = strchr(str, 'O')) != NULL) {
    *pos = 'o';
    ret = 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<modify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x31,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     115a <modify+0x4a>
mov    -0x18(%rbp),%rax
movb   $0x40,(%rax)
movl   $0x1,-0xc(%rbp)
jmp    112b <modify+0x1b>
jmp    115f <modify+0x4f>
mov    -0x8(%rbp),%rdi
mov    $0x30,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     118e <modify+0x7e>
mov    -0x18(%rbp),%rax
movb   $0x25,(%rax)
movl   $0x1,-0xc(%rbp)
jmp    115f <modify+0x4f>
jmp    1193 <modify+0x83>
mov    -0x8(%rbp),%rdi
mov    $0x6c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11c2 <modify+0xb2>
mov    -0x18(%rbp),%rax
movb   $0x4c,(%rax)
movl   $0x1,-0xc(%rbp)
jmp    1193 <modify+0x83>
jmp    11c7 <modify+0xb7>
mov    -0x8(%rbp),%rdi
mov    $0x4f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11f6 <modify+0xe6>
mov    -0x18(%rbp),%rax
movb   $0x6f,(%rax)
movl   $0x1,-0xc(%rbp)
jmp    11c7 <modify+0xb7>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modify>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x31,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     114c <modify+0x3c>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x40,(%rax)
mov    %rbx,%rdi
mov    $0x31,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <modify+0x20>
mov    $0x1,%ebp
jmp    114e <modify+0x3e>
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0x30,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     117a <modify+0x6a>
movb   $0x25,(%rax)
mov    %rbx,%rdi
mov    $0x30,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1160 <modify+0x50>
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11aa <modify+0x9a>
nopl   0x0(%rax)
movb   $0x4c,(%rax)
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1190 <modify+0x80>
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x4f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11da <modify+0xca>
nopl   0x0(%rax)
movb   $0x6f,(%rax)
mov    %rbx,%rdi
mov    $0x4f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    11c0 <modify+0xb0>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @modify(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
store i8* null, i8** %4
br label %5
5: ; preds = %9, %1
%6 = load i8*, i8** %2
%7 = call i8* @strchr(i8* %6, i8 signext 49)
store i8* %7, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = load i8*, i8** %4
store i8 64, i8* %10
store i32 1, i32* %3
br label %5
11: ; preds = %5
br label %12
12: ; preds = %16, %11
%13 = load i8*, i8** %2
%14 = call i8* @strchr(i8* %13, i8 signext 48)
store i8* %14, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i8*, i8** %4
store i8 37, i8* %17
store i32 1, i32* %3
br label %12
18: ; preds = %12
br label %19
19: ; preds = %23, %18
%20 = load i8*, i8** %2
%21 = call i8* @strchr(i8* %20, i8 signext 108)
store i8* %21, i8** %4
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i8*, i8** %4
store i8 76, i8* %24
store i32 1, i32* %3
br label %19
25: ; preds = %19
br label %26
26: ; preds = %30, %25
%27 = load i8*, i8** %2
%28 = call i8* @strchr(i8* %27, i8 signext 79)
store i8* %28, i8** %4
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = load i8*, i8** %4
store i8 111, i8* %31
store i32 1, i32* %3
br label %26
32: ; preds = %26
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @modify(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 49)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %8, %1
%5 = phi i32 [ 0, %1 ], [ 1, %8 ]
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 48)
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %16
8: ; preds = %1, %8
%9 = phi i8* [ %10, %8 ], [ %2, %1 ]
store i8 64, i8* %9
%10 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 49)
%11 = icmp eq i8* %10, null
br i1 %11, label %4, label %8
12: ; preds = %16, %4
%13 = phi i32 [ %5, %4 ], [ 1, %16 ]
%14 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 108)
%15 = icmp eq i8* %14, null
br i1 %15, label %20, label %24
16: ; preds = %4, %16
%17 = phi i8* [ %18, %16 ], [ %6, %4 ]
store i8 37, i8* %17
%18 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 48)
%19 = icmp eq i8* %18, null
br i1 %19, label %12, label %16
20: ; preds = %24, %12
%21 = phi i32 [ %13, %12 ], [ 1, %24 ]
%22 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 79)
%23 = icmp eq i8* %22, null
br i1 %23, label %32, label %28
24: ; preds = %12, %24
%25 = phi i8* [ %26, %24 ], [ %14, %12 ]
store i8 76, i8* %25
%26 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 108)
%27 = icmp eq i8* %26, null
br i1 %27, label %20, label %24
28: ; preds = %20, %28
%29 = phi i8* [ %30, %28 ], [ %22, %20 ]
store i8 111, i8* %29
%30 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 79)
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %28
32: ; preds = %28, %20
%33 = phi i32 [ %21, %20 ], [ 1, %28 ]
ret i32 %33
}