#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*/ printf(char *, ...);
int main(int argc, char **argv) {
  int i = 3;
  int *p, m = 2;
  int *q, n = 1;
  p = &m;
  q = &n;
  printf("Show the adress of p\n %p \n Show the number:%d\n", p, *p);
  printf("Show the adress of q\n %p \n Show the number:%d\n", q, *q);
  if ((--i) == 2)
    printf("First cut down then compare\n");
  else
    printf("First compare then cut down\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x2,-0x24(%rbp)
movl   $0x1,-0x34(%rbp)
lea    -0x24(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x34(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x2,%eax
jne    11a0 <main+0x90>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ae <main+0x9e>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x2,0x4(%rsp)
movl   $0x1,(%rsp)
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Show the adress of p\0A %p \0A Show the number:%d\0A\00"
@.str.1 = [47 x i8] c"Show the adress of q\0A %p \0A Show the number:%d\0A\00"
@.str.2 = [29 x i8] c"First cut down then compare\0A\00"
@.str.3 = [29 x i8] c"First compare then cut down\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 3, i32* %6
store i32 2, i32* %8
store i32 1, i32* %10
store i32* %8, i32** %7
store i32* %10, i32** %9
%11 = load i32*, i32** %7
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32* %11, i32 %13)
%15 = load i32*, i32** %9
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32* %15, i32 %17)
%19 = load i32, i32* %6
%20 = add nsw i32 %19, -1
store i32 %20, i32* %6
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %26
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"Show the adress of p\0A %p \0A Show the number:%d\0A\00"
@.str.1 = [47 x i8] c"Show the adress of q\0A %p \0A Show the number:%d\0A\00"
@str = [28 x i8] c"First cut down then compare\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 2, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32* %3, i32 2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32 1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}