#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 prove2(int n) {
  int k;
  printf("now we'll prove P(%d) true.\n", n);
  k = 0;
  printf("step 0 can prove P(%d) true.\n", k);
  while (k < n) {
    printf("step %d can say \" if P(%d) true,then P(%d) true also\".\n", k + 1,
           k, k + 1);
    k = k + 1;
  }
  printf("All prove over.\n");
}


x86 assembly (clang, -O0):
<prove2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    117b <prove2+0x6b>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <prove2+0x34>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prove2>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xed3(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    1177 <prove2+0x57>
lea    0xeea(%rip),%r14
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rdx),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edx
cmp    %ebp,%ebx
jne    1160 <prove2+0x40>
lea    0xef5(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"now we'll prove P(%d) true.\0A\00"
@.str.1 = [30 x i8] c"step 0 can prove P(%d) true.\0A\00"
@.str.2 = [56 x i8] c"step %d can say \22 if P(%d) true,then P(%d) true also\22.\0A\00"
@.str.3 = [17 x i8] c"All prove over.\0A\00"
define void @prove2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %12, %1
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15, i32 %17)
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %8
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"now we'll prove P(%d) true.\0A\00"
@.str.1 = [30 x i8] c"step 0 can prove P(%d) true.\0A\00"
@.str.2 = [56 x i8] c"step %d can say \22 if P(%d) true,then P(%d) true also\22.\0A\00"
@str = [16 x i8] c"All prove over.\00"
define void @prove2(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 0)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %10
5: ; preds = %1, %5
%6 = phi i32 [ %7, %5 ], [ 0, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6, i32 %7)
%9 = icmp eq i32 %7, %0
br i1 %9, label %10, label %5
10: ; preds = %5, %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}