#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*/ assert(int);
int /*<<< orphan*/ b_copy(char *, int, char *);
scalar_t__ b_diff(char *, int, char *);
int /*<<< orphan*/ printf(char *, char *);
void test1() {
  char a[] = "123alpha";
  char b[] = "bravo123";
  b_copy(a, 5, a + 3);
  b_copy(b + 3, 5, b);
  assert(b_diff(a, 8, "alphapha") == 0);
  assert(b_diff(b, 8, "brabravo") == 0);
  printf("[%s]\n", a);
  printf("[%s]\n", b);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x9(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xea4(%rip),%al
mov    %al,-0xa(%rbp)
lea    -0x9(%rbp),%rdi
lea    -0x9(%rbp),%rdx
add    $0x3,%rdx
mov    $0x5,%esi
call   1060 <b_copy@plt>
lea    -0x12(%rbp),%rdi
add    $0x3,%rdi
lea    -0x12(%rbp),%rdx
mov    $0x5,%esi
call   1060 <b_copy@plt>
lea    -0x9(%rbp),%rdi
mov    $0x8,%esi
lea    0xe66(%rip),%rdx
call   1040 <b_diff@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x12(%rbp),%rdi
mov    $0x8,%esi
lea    0xe49(%rip),%rdx
call   1040 <b_diff@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x9(%rbp),%rsi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
lea    -0x12(%rbp),%rsi
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0x6168706c61333231,%rax
70 68 61
mov    %rax,0x10(%rsp)
movb   $0x0,0x18(%rsp)
movabs $0x3332316f76617262,%rax
31 32 33
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
lea    0x13(%rsp),%rdx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1060 <b_copy@plt>
lea    0x3(%rsp),%rdi
mov    %rsp,%r15
mov    $0x5,%esi
mov    %r15,%rdx
call   1060 <b_copy@plt>
lea    0xe6f(%rip),%rdx
mov    %r14,%rdi
mov    $0x8,%esi
call   1040 <b_diff@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xe56(%rip),%rdx
mov    %r15,%rdi
mov    $0x8,%esi
call   1040 <b_diff@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
lea    0xe3d(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test1.a = [9 x i8] c"123alpha\00"
@__const.test1.b = [9 x i8] c"bravo123\00"
@.str = [9 x i8] c"alphapha\00"
@.str.1 = [9 x i8] c"brabravo\00"
@.str.2 = [6 x i8] c"[%s]\0A\00"
define void @test1() {
%1 = alloca [9 x i8]
%2 = alloca [9 x i8]
%3 = bitcast [9 x i8]* %1 to i8*
%4 = bitcast [9 x i8]* %2 to i8*
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds i8, i8* %6, i64 3
%8 = call i32 @b_copy(i8* %5, i32 5, i8* %7)
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds i8, i8* %9, i64 3
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%12 = call i32 @b_copy(i8* %10, i32 5, i8* %11)
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%14 = call i64 @b_diff(i8* %13, i32 8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%19 = call i64 @b_diff(i8* %18, i32 8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %25)
ret void
}

LLVM IR (-O2):
@__const.test1.a = [9 x i8] c"123alpha\00"
@__const.test1.b = [9 x i8] c"bravo123\00"
@.str = [9 x i8] c"alphapha\00"
@.str.1 = [9 x i8] c"brabravo\00"
@.str.2 = [6 x i8] c"[%s]\0A\00"
define void @test1() {
%1 = alloca [9 x i8]
%2 = alloca [9 x i8]
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 3
%6 = call i32 @b_copy(i8* %3, i32 5, i8* %5)
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 3
%8 = call i32 @b_copy(i8* %7, i32 5, i8* %4)
%9 = call i64 @b_diff(i8* %3, i32 8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i64 @b_diff(i8* %4, i32 8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret void
}