#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 *dang();
int /*<<< orphan*/ nestra(int **);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, *p, *q;
  p = dang();
  *p = 7;
  i = *p;
  printf("%d\n", i);
  assert(i == 7);
  dang();
  i = *p;
  printf("%d\n", i);
  assert(i == 3);
  nestra(&p);
  *p = 8;
  nestra(&q);
  i = *p;
  printf("%d\n", i);
  assert(i == 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <dang@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x7,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x7,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1030 <dang@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x10(%rbp),%rdi
call   1060 <nestra@plt>
mov    -0x10(%rbp),%rax
movl   $0x8,(%rax)
lea    -0x18(%rbp),%rdi
call   1060 <nestra@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x5,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <dang@plt>
mov    %rax,%rbx
mov    %rax,0x8(%rsp)
movl   $0x7,(%rax)
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
xor    %eax,%eax
call   1030 <dang@plt>
mov    (%rbx),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %edi,%edi
cmp    $0x3,%ebx
sete   %dil
call   1050 <assert@plt>
lea    0x8(%rsp),%rdi
call   1060 <nestra@plt>
mov    0x8(%rsp),%rax
movl   $0x8,(%rax)
lea    0x10(%rsp),%rdi
call   1060 <nestra@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %edi,%edi
cmp    $0x5,%ebx
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* (...) @dang()
store i32* %5, i32** %3
%6 = load i32*, i32** %3
store i32 7, i32* %6
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 7
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32* (...) @dang()
%16 = load i32*, i32** %3
%17 = load i32, i32* %16
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 3
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = call i32 @nestra(i32** %3)
%25 = load i32*, i32** %3
store i32 8, i32* %25
%26 = call i32 @nestra(i32** %4)
%27 = load i32*, i32** %3
%28 = load i32, i32* %27
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
%32 = icmp eq i32 %31, 5
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = bitcast i32** %1 to i8*
%4 = bitcast i32** %2 to i8*
%5 = tail call i32* (...) @dang()
store i32* %5, i32** %1
store i32 7, i32* %5
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 7)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32* (...) @dang()
%9 = load i32, i32* %5
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %9, 3
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = call i32 @nestra(i32** %1)
%15 = load i32*, i32** %1
store i32 8, i32* %15
%16 = call i32 @nestra(i32** %2)
%17 = load i32*, i32** %1
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = icmp eq i32 %18, 5
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
ret i32 0
}