#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 *, int, ...);
void array1(char ar1[]) {
  int i = 0;
  int prov = 0;
  for (i = 0; prov == 0; ++i) {
    printf("before check prov = %d; i = %d; ar1[%d] = %c; ", prov, i, i,
           ar1[i]);
    if (ar1[i] == 'c')
      prov = 1;
    printf("after check prov = %d;\n", prov);
  };
  printf("after check in function with for we have i = %d; ar[%d] = %c;\n", i,
         i, ar1[i]);
}


x86 assembly (clang, -O0):
<array1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    119a <array1+0x8a>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rdi
movsbl (%rax,%rdi,1),%r8d
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x63,%eax
jne    117b <array1+0x6b>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <array1+0x21>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
lea    0xede(%rip),%r15
lea    0xf06(%rip),%r12
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%r8d
mov    %r15,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
movzbl (%r14,%rbx,1),%ebp
xor    %esi,%esi
cmp    $0x63,%bpl
sete   %sil
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x63,%bpl
jne    1130 <array1+0x20>
mov    %ebx,%eax
movsbl (%r14,%rax,1),%ecx
lea    0xed1(%rip),%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"before check prov = %d; i = %d; ar1[%d] = %c; \00"
@.str.1 = [24 x i8] c"after check prov = %d;\0A\00"
@.str.2 = [63 x i8] c"after check in function with for we have i = %d; ar[%d] = %c;\0A\00"
define void @array1(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %30, %1
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %33
8: ; preds = %5
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11, i32 %17)
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 99
br i1 %25, label %26, label %27
26: ; preds = %8
store i32 1, i32* %4
br label %27
27: ; preds = %26, %8
%28 = load i32, i32* %4
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %5
33: ; preds = %5
%34 = load i32, i32* %3
%35 = load i32, i32* %3
%36 = load i8*, i8** %2
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %35, i32 %41)
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"before check prov = %d; i = %d; ar1[%d] = %c; \00"
@.str.1 = [24 x i8] c"after check prov = %d;\0A\00"
@.str.2 = [63 x i8] c"after check in function with for we have i = %d; ar[%d] = %c;\0A\00"
define void @array1(i8* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %13, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = trunc i64 %3 to i32
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 0, i32 %7, i32 %7, i32 %6)
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 99
%11 = zext i1 %10 to i32
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = add nuw i64 %3, 1
br i1 %10, label %14, label %2
14: ; preds = %2
%15 = trunc i64 %13 to i32
%16 = and i64 %13, 4294967295
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %15, i32 %19)
ret void
}