#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*/ abort();
int /*<<< orphan*/ bar(char *);
int /*<<< orphan*/ foo(char *);
scalar_t__ memcmp(char *, char *, int);
int main(void) {
  char x[] = "IJKLMNOPQR";
  foo(x);
  if (memcmp(x, "IJKL\0NOPQR", sizeof x) != 0)
    abort();
  x[4] = 'M';
  bar(x);
  if (memcmp(x, "IJKLMNOP\0R", sizeof x) != 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xea7(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe9f(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xf(%rbp),%rdi
call   1060 <foo@plt>
lea    -0xf(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0xb,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     119d <main+0x5d>
mov    $0x0,%al
call   1030 <abort@plt>
movb   $0x4d,-0xb(%rbp)
lea    -0xf(%rbp),%rdi
call   1040 <bar@plt>
lea    -0xf(%rbp),%rdi
lea    0xe61(%rip),%rsi
mov    $0xb,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     11d0 <main+0x90>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x504f4e4d4c4b4a49,%rax
4e 4f 50
mov    %rax,(%rsp)
movl   $0x525150,0x7(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <foo@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11b0 <main+0x70>
movb   $0x4d,0x4(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <bar@plt>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11b0 <main+0x70>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const.main.x = [11 x i8] c"IJKLMNOPQR\00"
@.str = [11 x i8] c"IJKL\00NOPQR\00"
@.str.1 = [11 x i8] c"IJKLMNOP\00R\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
store i32 0, i32* %1
%3 = bitcast [11 x i8]* %2 to i8*
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%5 = call i32 @foo(i8* %4)
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%7 = call i64 @memcmp(i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 11)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %0
%12 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 4
store i8 77, i8* %12
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%14 = call i32 @bar(i8* %13)
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%16 = call i64 @memcmp(i8* %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 11)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [11 x i8] c"IJKLMNOPQR\00"
@.str = [11 x i8] c"IJKL\00NOPQR\00"
@.str.1 = [11 x i8] c"IJKLMNOP\00R\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = call i32 @foo(i8* %2)
%4 = call i64 @memcmp(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 11)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 4
store i8 77, i8* %9
%10 = call i32 @bar(i8* %2)
%11 = call i64 @memcmp(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 11)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %8
ret i32 0
}