#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*/ assert(int);
int doubler(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int ret_value;
  int value = 13;
  int result;
  ret_value = doubler(NULL, NULL);
  assert(ret_value != 0);
  printf("Test passed. Failed doubling NULL, NULL\n");
  ret_value = doubler(NULL, &result);
  assert(ret_value != 0);
  printf("Test passed. Failed doubling NULL, &result\n");
  ret_value = doubler(&value, NULL);
  assert(ret_value != 0);
  printf("Test passed. Failed doubling &value, NULL\n");
  ret_value = doubler(&value, &result);
  assert(ret_value == 0);
  printf(
      "Test passed. doubler(&value, &result) where value was %d gave us: %d\n",
      value, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1050 <doubler@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    -0x10(%rbp),%rsi
call   1050 <doubler@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <doubler@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <doubler@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0xd,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
call   1060 <doubler@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
call   1050 <assert@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%r14
xor    %edi,%edi
mov    %r14,%rsi
call   1060 <doubler@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
call   1050 <assert@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <doubler@plt>
xor    %edi,%edi
test   %eax,%eax
setne  %dil
call   1050 <assert@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <doubler@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
lea    0xe1f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Test passed. Failed doubling NULL, NULL\0A\00"
@.str.1 = [44 x i8] c"Test passed. Failed doubling NULL, &result\0A\00"
@.str.2 = [43 x i8] c"Test passed. Failed doubling &value, NULL\0A\00"
@.str.3 = [70 x i8] c"Test passed. doubler(&value, &result) where value was %d gave us: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 13, i32* %3
%5 = call i32 @doubler(i32* null, i32* null)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @doubler(i32* null, i32* %4)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @doubler(i32* %3, i32* null)
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @doubler(i32* %3, i32* %4)
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [70 x i8] c"Test passed. doubler(&value, &result) where value was %d gave us: %d\0A\00"
@str = [40 x i8] c"Test passed. Failed doubling NULL, NULL\00"
@str.4 = [43 x i8] c"Test passed. Failed doubling NULL, &result\00"
@str.5 = [42 x i8] c"Test passed. Failed doubling &value, NULL\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 13, i32* %1
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @doubler(i32* null, i32* null)
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%10 = call i32 @doubler(i32* null, i32* %2)
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.4, i64 0, i64 0))
%15 = call i32 @doubler(i32* %1, i32* null)
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.5, i64 0, i64 0))
%20 = call i32 @doubler(i32* %1, i32* %2)
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 %25)
ret i32 0
}