#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*/ bar(char *);
int foo3() {
  char c[100000] = {};
  unsigned short nchar;
  for (nchar = 0; nchar != 1000; nchar += 3) {
    c[nchar] = 'A';
  }
  bar(c);
  return 0;
}


x86 assembly (clang, -O0):
<foo3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186b0,%rsp
lea    -0x186a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x186a0,%edx
call   1040 <memset@plt>
movw   $0x0,-0x186a2(%rbp)
movzwl -0x186a2(%rbp),%eax
cmp    $0x3e8,%eax
je     117e <foo3+0x5e>
movzwl -0x186a2(%rbp),%eax
movb   $0x41,-0x186a0(%rbp,%rax,1)
41
movzwl -0x186a2(%rbp),%eax
add    $0x3,%eax
mov    %ax,-0x186a2(%rbp)
jmp    1147 <foo3+0x27>
lea    -0x186a0(%rbp),%rdi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x186b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo3>:
push   %rbx
sub    $0x186a0,%rsp
mov    %rsp,%rdi
xor    %ebx,%ebx
mov    $0x186a0,%edx
xor    %esi,%esi
call   1040 <memset@plt>
nopl   0x0(%rax)
movzwl %bx,%eax
movb   $0x41,(%rsp,%rax,1)
lea    0x3(%rbx),%eax
movzwl %ax,%eax
movb   $0x41,(%rsp,%rax,1)
lea    0x6(%rbx),%eax
movzwl %ax,%eax
movb   $0x41,(%rsp,%rax,1)
lea    0x9(%rbx),%eax
movzwl %ax,%eax
movb   $0x41,(%rsp,%rax,1)
add    $0xc,%ebx
movzwl %bx,%eax
cmp    $0x3e8,%eax
jne    1140 <foo3+0x20>
mov    %rsp,%rdi
call   1030 <bar@plt>
xor    %eax,%eax
add    $0x186a0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @foo3() {
%1 = alloca [100000 x i8]
%2 = alloca i16
%3 = bitcast [100000 x i8]* %1 to i8*
store i16 0, i16* %2
br label %4
4: ; preds = %12, %0
%5 = load i16, i16* %2
%6 = zext i16 %5 to i32
%7 = icmp ne i32 %6, 1000
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i16, i16* %2
%10 = zext i16 %9 to i64
%11 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 %10
store i8 65, i8* %11
br label %12
12: ; preds = %8
%13 = load i16, i16* %2
%14 = zext i16 %13 to i32
%15 = add nsw i32 %14, 3
%16 = trunc i32 %15 to i16
store i16 %16, i16* %2
br label %4
17: ; preds = %4
%18 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 0
%19 = call i32 @bar(i8* %18)
ret i32 0
}

LLVM IR (-O2):
define i32 @foo3() {
%1 = alloca [100000 x i8]
%2 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = phi i16 [ 0, %0 ], [ %16, %3 ]
%5 = zext i16 %4 to i64
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 %5
store i8 65, i8* %6
%7 = or i16 %4, 3
%8 = zext i16 %7 to i64
%9 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 %8
store i8 65, i8* %9
%10 = add i16 %4, 6
%11 = zext i16 %10 to i64
%12 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 %11
store i8 65, i8* %12
%13 = add i16 %4, 9
%14 = zext i16 %13 to i64
%15 = getelementptr inbounds [100000 x i8], [100000 x i8]* %1, i64 0, i64 %14
store i8 65, i8* %15
%16 = add i16 %4, 12
%17 = icmp eq i16 %16, 1000
br i1 %17, label %18, label %3
18: ; preds = %3
%19 = call i32 @bar(i8* %2)
ret i32 0
}