#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);
int strlen(char *);
void memset16_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) >= 10 * sizeof(int));
  clang_analyzer_eval(strlen(str) >= 10 * sizeof(int));
  free(str);
}


x86 assembly (clang, -O0):
<memset16_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
mov    $0x30,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%rax
movsbl 0xa(%rax),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <clang_analyzer_eval@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cltq
cmp    $0x28,%rax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cltq
cmp    $0x28,%rax
setae  %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):
<memset16_region_cast>:
push   %rbx
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x30,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
xor    %edi,%edi
cmpb   $0x30,0xa(%rbx)
sete   %dil
call   1070 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
cmp    $0x28,%eax
setae  %dil
call   1070 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
cmp    $0x28,%eax
setae  %dil
call   1070 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @memset16_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 48, 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, 48
%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 i32 @strlen(i8* %17)
%19 = sext i32 %18 to i64
%20 = icmp uge i64 %19, 40
%21 = zext i1 %20 to i32
%22 = call i32 @clang_analyzer_eval(i32 %21)
%23 = load i8*, i8** %1
%24 = call i32 @strlen(i8* %23)
%25 = sext i32 %24 to i64
%26 = icmp uge i64 %25, 40
%27 = zext i1 %26 to i32
%28 = call i32 @clang_analyzer_eval(i32 %27)
%29 = load i8*, i8** %1
%30 = call i32 @free(i8* %29)
ret void
}

LLVM IR (-O2):
define void @memset16_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 48, i32 40)
%5 = getelementptr inbounds i8, i8* %2, i64 10
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 48
%8 = zext i1 %7 to i32
%9 = tail call i32 @clang_analyzer_eval(i32 %8)
%10 = tail call i32 @strlen(i8* %2)
%11 = icmp ugt i32 %10, 39
%12 = zext i1 %11 to i32
%13 = tail call i32 @clang_analyzer_eval(i32 %12)
%14 = tail call i32 @strlen(i8* %2)
%15 = icmp ugt i32 %14, 39
%16 = zext i1 %15 to i32
%17 = tail call i32 @clang_analyzer_eval(i32 %16)
%18 = tail call i32 @free(i8* %2)
ret void
}