#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, ...);
void prove1(int n) {
  if (n == 0) {
    printf("step 0,the P(%d) true.\n", n);
  } else {
    prove1(n - 1);
    printf("step %d,if P(%d) true ,then P(%d) true also.\n", n, n - 1, n);
    printf("so,we can say \"P(%d) true.\"\n", n);
  }
}


x86 assembly (clang, -O0):
<prove1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114b <prove1+0x2b>
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1181 <prove1+0x61>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <prove1@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
mov    -0x4(%rbp),%ecx
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prove1>:
test   %edi,%edi
je     115d <prove1+0x3d>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x1(%rbx),%ebp
mov    %ebp,%edi
call   1040 <prove1@plt>
lea    0xede(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>
lea    0xe9c(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"step 0,the P(%d) true.\0A\00"
@.str.1 = [46 x i8] c"step %d,if P(%d) true ,then P(%d) true also.\0A\00"
@.str.2 = [29 x i8] c"so,we can say \22P(%d) true.\22\0A\00"
define void @prove1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %18
8: ; preds = %1
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 1
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
%14 = load i32, i32* %2
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %13, i32 %14)
%16 = load i32, i32* %2
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"step 0,the P(%d) true.\0A\00"
@.str.1 = [46 x i8] c"step %d,if P(%d) true ,then P(%d) true also.\0A\00"
@.str.2 = [29 x i8] c"so,we can say \22P(%d) true.\22\0A\00"
define void @prove1(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0)
br label %5
5: ; preds = %3, %6
ret void
6: ; preds = %1
%7 = add nsw i32 %0, -1
tail call void @prove1(i32 %7)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %7, i32 %0)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %5
}