#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*/ __mf_set_options(char *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int main() {
  volatile int *k = (int *)malloc(sizeof(int));
  volatile int l;
  if (k == NULL)
    abort();
  *k = 5;
  free((void *)k);
  __mf_set_options("-ignore-reads");
  l = *k;
  __mf_set_options("-no-ignore-reads");
  l = *k;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <main+0x2f>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
lea    0xe7a(%rip),%rdi
call   1060 <__mf_set_options@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xe62(%rip),%rdi
call   1060 <__mf_set_options@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1191 <main+0x51>
mov    %rax,%rbx
movl   $0x5,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
lea    0xe97(%rip),%rdi
call   1060 <__mf_set_options@plt>
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
lea    0xe82(%rip),%rdi
call   1060 <__mf_set_options@plt>
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"-ignore-reads\00"
@.str.1 = [17 x i8] c"-no-ignore-reads\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %0
%11 = load i32*, i32** %2
store volatile i32 5, i32* %11
%12 = load i32*, i32** %2
%13 = bitcast i32* %12 to i8*
%14 = call i32 @free(i8* %13)
%15 = call i32 @__mf_set_options(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%16 = load i32*, i32** %2
%17 = load volatile i32, i32* %16
store volatile i32 %17, i32* %3
%18 = call i32 @__mf_set_options(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32*, i32** %2
%20 = load volatile i32, i32* %19
store volatile i32 %20, i32* %3
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"-ignore-reads\00"
@.str.1 = [17 x i8] c"-no-ignore-reads\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
%4 = bitcast i32* %1 to i8*
%5 = icmp eq i64 %2, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
store volatile i32 5, i32* %3
%9 = inttoptr i64 %2 to i8*
%10 = tail call i32 @free(i8* %9)
%11 = tail call i32 @__mf_set_options(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = load volatile i32, i32* %3
store volatile i32 %12, i32* %1
%13 = tail call i32 @__mf_set_options(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%14 = load volatile i32, i32* %3
store volatile i32 %14, i32* %1
ret i32 0
}