#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*/ memset(char *, int /*<<< orphan*/, int);
int strlen(char *);
void memset7_char_array_nonnull() {
  char str[5] = "abcd";
  clang_analyzer_eval(strlen(str) == 4);
  memset(str, '0', 5);
  clang_analyzer_eval(str[0] == '0');
  clang_analyzer_eval(strlen(str) >= 5);
}


x86 assembly (clang, -O0):
<memset7_char_array_nonnull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xebd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
lea    -0x5(%rbp),%rdi
mov    $0x30,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
lea    -0x5(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x5,%eax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset7_char_array_nonnull>:
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x64636261,0x8(%rsp)
64
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1050 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
xor    %edi,%edi
cmpb   $0x30,0x8(%rsp)
sete   %dil
call   1050 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %edi,%edi
cmp    $0x5,%eax
setge  %dil
call   1050 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.memset7_char_array_nonnull.str = [5 x i8] c"abcd\00"
define void @memset7_char_array_nonnull() {
%1 = alloca [5 x i8]
%2 = bitcast [5 x i8]* %1 to i8*
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = call i32 @strlen(i8* %3)
%5 = icmp eq i32 %4, 4
%6 = zext i1 %5 to i32
%7 = call i32 @clang_analyzer_eval(i32 %6)
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 48, i32 5)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%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 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = icmp sge i32 %17, 5
%19 = zext i1 %18 to i32
%20 = call i32 @clang_analyzer_eval(i32 %19)
ret void
}

LLVM IR (-O2):
@__const.memset7_char_array_nonnull.str = [5 x i8] c"abcd\00"
define void @memset7_char_array_nonnull() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = icmp eq i32 %3, 4
%5 = zext i1 %4 to i32
%6 = call i32 @clang_analyzer_eval(i32 %5)
%7 = call i32 @memset(i8* %2, i32 48, i32 5)
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 48
%10 = zext i1 %9 to i32
%11 = call i32 @clang_analyzer_eval(i32 %10)
%12 = call i32 @strlen(i8* %2)
%13 = icmp sgt i32 %12, 4
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
ret void
}