#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*/ memcmp(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *, int);
int test_memcmp(void) {
  char dest[10] = "xyz\0Axyz\0B";
  do {
    if (!(!memcmp(dest, dest + 5, 4))) {
      printf("expression '%s' untrue at %d\n", "!memcmp(dest, dest+5, 4)", 117);
      return 0;
    }
  } while (0);
  do {
    if (!(memcmp(dest, dest + 5, 5))) {
      printf("expression '%s' untrue at %d\n", "memcmp(dest, dest+5, 5)", 118);
      return 0;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<test_memcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rdi
lea    -0xe(%rbp),%rsi
add    $0x5,%rsi
mov    $0x4,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
je     1181 <test_memcmp+0x61>
lea    0xea6(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x75,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11da <test_memcmp+0xba>
jmp    1186 <test_memcmp+0x66>
jmp    118b <test_memcmp+0x6b>
lea    -0xe(%rbp),%rdi
lea    -0xe(%rbp),%rsi
add    $0x5,%rsi
mov    $0x5,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
jne    11ce <test_memcmp+0xae>
lea    0xe59(%rip),%rdi
lea    0xe89(%rip),%rsi
mov    $0x76,%edx
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11da <test_memcmp+0xba>
jmp    11d3 <test_memcmp+0xb3>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memcmp>:
push   %rbx
sub    $0x10,%rsp
movabs $0x7a797841007a7978,%rax
78 79 7a
mov    %rax,(%rsp)
movw   $0x4200,0x8(%rsp)
lea    0x5(%rsp),%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <memcmp@plt>
test   %eax,%eax
je     116f <test_memcmp+0x4f>
lea    0xeb0(%rip),%rdi
lea    0xec7(%rip),%rsi
mov    $0x75,%edx
call   1030 <printf@plt>
xor    %eax,%eax
jmp    118a <test_memcmp+0x6a>
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <memcmp@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1190 <test_memcmp+0x70>
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe73(%rip),%rdi
lea    0xea3(%rip),%rsi
mov    $0x76,%edx
jmp    1166 <test_memcmp+0x46>

LLVM IR (-O0):
@__const.test_memcmp.dest = [10 x i8] c"xyz\00Axyz\00B"
@.str = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.1 = [25 x i8] c"!memcmp(dest, dest+5, 4)\00"
@.str.2 = [24 x i8] c"memcmp(dest, dest+5, 5)\00"
define i32 @test_memcmp() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = bitcast [10 x i8]* %2 to i8*
br label %4
4: ; preds = %0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds i8, i8* %6, i64 5
%8 = call i32 @memcmp(i8* %5, i8* %7, i32 4)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 117)
store i32 0, i32* %1
br label %24
12: ; preds = %4
br label %13
13: ; preds = %12
br label %14
14: ; preds = %13
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 5
%18 = call i32 @memcmp(i8* %15, i8* %17, i32 5)
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 118)
store i32 0, i32* %1
br label %24
22: ; preds = %14
br label %23
23: ; preds = %22
store i32 1, i32* %1
br label %24
24: ; preds = %23, %20, %10
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@__const.test_memcmp.dest = [10 x i8] c"xyz\00Axyz\00B"
@.str = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.1 = [25 x i8] c"!memcmp(dest, dest+5, 4)\00"
@.str.2 = [24 x i8] c"memcmp(dest, dest+5, 5)\00"
define i32 @test_memcmp() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%4 = call i32 @memcmp(i8* %2, i8* %3, i32 4)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 117)
br label %13
8: ; preds = %0
%9 = call i32 @memcmp(i8* %2, i8* %3, i32 5)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 118)
br label %13
13: ; preds = %8, %11, %6
%14 = phi i32 [ 0, %6 ], [ 0, %11 ], [ 1, %8 ]
ret i32 %14
}