#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*/ printf(char *, char *);
int strlen(char *);
int main() {
  int i;
  char str[] = "001a00b";
  for (i = 0; i < strlen(str); i++)
    if (str[i] == '0')
      str[i] = '1';
  printf("%s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    118b <main+0x6b>
movslq -0x8(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%eax
cmp    $0x30,%eax
jne    1178 <main+0x58>
movslq -0x8(%rbp),%rax
movb   $0x31,-0x10(%rbp,%rax,1)
jmp    117d <main+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <main+0x21>
lea    -0x10(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movabs $0x62303061313030,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    116f <main+0x4f>
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1163 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    116f <main+0x4f>
cmpb   $0x30,(%rsp,%rbx,1)
jne    1150 <main+0x30>
movb   $0x31,(%rsp,%rbx,1)
jmp    1150 <main+0x30>
lea    0xe8a(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str = [8 x i8] c"001a00b\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i8]
store i32 0, i32* %1
%4 = bitcast [8 x i8]* %3 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %25
10: ; preds = %5
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 48
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %19
store i8 49, i8* %20
br label %21
21: ; preds = %17, %10
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %5
25: ; preds = %5
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to [8 x i8]*
%3 = bitcast i64* %1 to i8*
store i64 27637532064821296, i64* %1
%4 = call i32 @strlen(i8* %3)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %0, %12
%7 = phi i64 [ %13, %12 ], [ 0, %0 ]
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 48
br i1 %10, label %11, label %12
11: ; preds = %6
store i8 49, i8* %8
br label %12
12: ; preds = %6, %11
%13 = add nuw nsw i64 %7, 1
%14 = call i32 @strlen(i8* %3)
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %6, label %17
17: ; preds = %12, %0
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}