#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*/ clang_analyzer_eval(int);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
scalar_t__ strlen(char *);
void memset14_region_cast() {
  char *str = (char *)malloc(10 * sizeof(int));
  int *array = (int *)str;
  memset(array, 0, 10 * sizeof(int));
  clang_analyzer_eval(str[10] == '\0');
  clang_analyzer_eval(strlen((char *)array) == 0);
  clang_analyzer_eval(strlen(str) == 0);
  free(str);
}


x86 assembly (clang, -O0):
<memset14_region_cast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%rax
movsbl 0xa(%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset14_region_cast>:
push   %rbx
mov    $0x28,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
xor    %edi,%edi
cmpb   $0x0,0xa(%rbx)
sete   %dil
call   1060 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmpb   $0x0,(%rbx)
sete   %dil
call   1060 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmpb   $0x0,(%rbx)
sete   %dil
call   1060 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @memset14_region_cast() {
%1 = alloca i8*
%2 = alloca i32*
%3 = call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 @memset(i32* %7, i32 0, i32 40)
%9 = load i8*, i8** %1
%10 = getelementptr inbounds i8, i8* %9, i64 10
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
%16 = load i32*, i32** %2
%17 = bitcast i32* %16 to i8*
%18 = call i64 @strlen(i8* %17)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @clang_analyzer_eval(i32 %20)
%22 = load i8*, i8** %1
%23 = call i64 @strlen(i8* %22)
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @clang_analyzer_eval(i32 %25)
%27 = load i8*, i8** %1
%28 = call i32 @free(i8* %27)
ret void
}

LLVM IR (-O2):
define void @memset14_region_cast() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i8*
%3 = inttoptr i64 %1 to i32*
%4 = tail call i32 @memset(i32* %3, i32 0, i32 40)
%5 = getelementptr inbounds i8, i8* %2, i64 10
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @clang_analyzer_eval(i32 %8)
%10 = load i8, i8* %2
%11 = icmp eq i8 %10, 0
%12 = zext i1 %11 to i32
%13 = tail call i32 @clang_analyzer_eval(i32 %12)
%14 = load i8, i8* %2
%15 = icmp eq i8 %14, 0
%16 = zext i1 %15 to i32
%17 = tail call i32 @clang_analyzer_eval(i32 %16)
%18 = tail call i32 @free(i8* %2)
ret void
}