#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 part1(int x) {
  int m = x, result;
  result = ((m++ > 0) ? m++ : 0);
  printf("macro_1(%d) = %d\n\n", (++x), result);
  printf("Explanation: Judging from the code, ++m incraments the value then "
         "passes it, while m++ passes the original value first and then it "
         "prints it, this saves us the double incremintation.\n\n\n");
}


x86 assembly (clang, -O0):
<part1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1148 <part1+0x38>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x10(%rbp)
jmp    1152 <part1+0x42>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <part1+0x42>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x4(%rbp)
mov    -0xc(%rbp),%edx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<part1>:
push   %rax
lea    0x1(%rdi),%esi
test   %edi,%edi
mov    $0x0,%edx
cmovg  %esi,%edx
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"macro_1(%d) = %d\0A\0A\00"
@.str.1 = [186 x i8] c"Explanation: Judging from the code, ++m incraments the value then passes it, while m++ passes the original value first and then it prints it, this saves us the double incremintation.\0A\0A\0A\00"
define void @part1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %9
%14 = phi i32 [ %10, %9 ], [ 0, %12 ]
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
%17 = load i32, i32* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([186 x i8], [186 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"macro_1(%d) = %d\0A\0A\00"
@str = [185 x i8] c"Explanation: Judging from the code, ++m incraments the value then passes it, while m++ passes the original value first and then it prints it, this saves us the double incremintation.\0A\0A\00"
define void @part1(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = icmp sgt i32 %0, 0
%4 = select i1 %3, i32 %2, i32 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([185 x i8], [185 x i8]* @str, i64 0, i64 0))
ret void
}