#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 maginaltest_MAAddMemoryBlockByList();
int /*<<< orphan*/ printf(char *);
int test_MAAddMemoryBlockByList();
int main() {
  int nret = 0;
  nret = test_MAAddMemoryBlockByList();
  if (nret) {
    printf("Testing failure\n");
  } else {
    printf("All is ok\n");
  }
  nret = maginaltest_MAAddMemoryBlockByList();
  if (nret) {
    printf("Testing failure\n");
  } else {
    printf("All is ok\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <test_MAAddMemoryBlockByList@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     116b <main+0x3b>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
jmp    1177 <main+0x47>
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <maginaltest_MAAddMemoryBlockByList@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     119c <main+0x6c>
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
jmp    11a8 <main+0x78>
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <test_MAAddMemoryBlockByList@plt>
test   %eax,%eax
lea    0xebc(%rip),%r14
lea    0xebf(%rip),%rbx
mov    %rbx,%rdi
cmove  %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <maginaltest_MAAddMemoryBlockByList@plt>
test   %eax,%eax
cmove  %r14,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Testing failure\0A\00"
@.str.1 = [11 x i8] c"All is ok\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @test_MAAddMemoryBlockByList()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = call i32 (...) @maginaltest_MAAddMemoryBlockByList()
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret i32 0
}

LLVM IR (-O2):
@str.2 = [10 x i8] c"All is ok\00"
@str.4 = [16 x i8] c"Testing failure\00"
define i32 @main() {
%1 = tail call i32 (...) @test_MAAddMemoryBlockByList()
%2 = icmp eq i32 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.4, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
%5 = tail call i32 (...) @maginaltest_MAAddMemoryBlockByList()
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.4, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}