#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*/ __ESBMC_assume(char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
void really(void) {
  int i;
  char *p = malloc(10);
  __ESBMC_assume(p);
  for (i = 0; i < 1; i++)
    p[i] = 'z';
  free(p);
  p[1] = 'z';
  p = malloc(10);
  __ESBMC_assume(p);
  p[2] = 'z';
}


x86 assembly (clang, -O0):
<really>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <__ESBMC_assume@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jge    117a <really+0x4a>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <really+0x26>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
movb   $0x7a,0x1(%rax)
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <__ESBMC_assume@plt>
mov    -0x10(%rbp),%rax
movb   $0x7a,0x2(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<really>:
push   %rbx
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <__ESBMC_assume@plt>
movb   $0x7a,(%rbx)
mov    %rbx,%rdi
call   1030 <free@plt>
movb   $0x7a,0x1(%rbx)
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <__ESBMC_assume@plt>
movb   $0x7a,0x2(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @really() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @malloc(i32 10)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @__ESBMC_assume(i8* %4)
store i32 0, i32* %1
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
store i8 122, i8* %13
br label %14
14: ; preds = %9
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %6
17: ; preds = %6
%18 = load i8*, i8** %2
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8 122, i8* %21
%22 = call i8* @malloc(i32 10)
store i8* %22, i8** %2
%23 = load i8*, i8** %2
%24 = call i32 @__ESBMC_assume(i8* %23)
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 2
store i8 122, i8* %26
ret void
}

LLVM IR (-O2):
define void @really() {
%1 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%2 = tail call i32 @__ESBMC_assume(i8* %1)
store i8 122, i8* %1
%3 = tail call i32 @free(i8* %1)
%4 = getelementptr inbounds i8, i8* %1, i64 1
store i8 122, i8* %4
%5 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%6 = tail call i32 @__ESBMC_assume(i8* %5)
%7 = getelementptr inbounds i8, i8* %5, i64 2
store i8 122, i8* %7
ret void
}