#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 *, ...);
void f2(int *p) {
  int i = 0;
  int val = 0;
  int after = 0;
  for (i = 0; i < 10; i++) {
    printf("before discreasing * p = %d;\n", *p);
    val = *--p;
    after = *p;
    printf("and after val = %d; * p = %d; after = %d;\n", val, *p, after);
  };
  printf("----------");
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    119c <f2+0x8c>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x8(%rbp)
mov    -0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x14(%rbp),%ecx
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1138 <f2+0x28>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xedf(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbx),%ecx
lea    0xee9(%rip),%r15
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0xc(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0xc(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x10(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x10(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x14(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x14(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x18(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x18(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x1c(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x1c(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x20(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x20(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x24(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x24(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x28(%rbx),%ecx
mov    %r15,%rdi
mov    %ecx,%esi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdf1(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"before discreasing * p = %d;\0A\00"
@.str.1 = [43 x i8] c"and after val = %d; * p = %d; after = %d;\0A\00"
@.str.2 = [11 x i8] c"----------\00"
define void @f2(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %3
br label %6
6: ; preds = %23, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i32 -1
store i32* %14, i32** %2
%15 = load i32, i32* %14
store i32 %15, i32* %4
%16 = load i32*, i32** %2
%17 = load i32, i32* %16
store i32 %17, i32* %5
%18 = load i32, i32* %4
%19 = load i32*, i32** %2
%20 = load i32, i32* %19
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %20, i32 %21)
br label %23
23: ; preds = %9
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %6
26: ; preds = %6
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"before discreasing * p = %d;\0A\00"
@.str.1 = [43 x i8] c"and after val = %d; * p = %d; after = %d;\0A\00"
@.str.2 = [11 x i8] c"----------\00"
define void @f2(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 -1
%5 = load i32, i32* %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %5, i32 %5)
%7 = load i32, i32* %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds i32, i32* %0, i64 -2
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %10, i32 %10)
%12 = load i32, i32* %9
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds i32, i32* %0, i64 -3
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %15, i32 %15)
%17 = load i32, i32* %14
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds i32, i32* %0, i64 -4
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %20, i32 %20)
%22 = load i32, i32* %19
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds i32, i32* %0, i64 -5
%25 = load i32, i32* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32 %25, i32 %25)
%27 = load i32, i32* %24
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds i32, i32* %0, i64 -6
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %30, i32 %30)
%32 = load i32, i32* %29
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds i32, i32* %0, i64 -7
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %35, i32 %35)
%37 = load i32, i32* %34
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds i32, i32* %0, i64 -8
%40 = load i32, i32* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %40, i32 %40, i32 %40)
%42 = load i32, i32* %39
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds i32, i32* %0, i64 -9
%45 = load i32, i32* %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %45, i32 %45, i32 %45)
%47 = load i32, i32* %44
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds i32, i32* %0, i64 -10
%50 = load i32, i32* %49
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %50, i32 %50, i32 %50)
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
ret void
}