#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 /*<<< orphan*/ scanf(char *, int *, int *, int *);
void main() {
  int x, y, z;
  int ch;
  int max(int, int);
  printf("Enter the x,y,z:\n");
  scanf("%d %d %d", &x, &y, &z);
  ch = (x > y) ? x : y;
  if (ch <= z) {
    printf("use define to get max = %d", z);
  } else {
    printf("use define to get max = %d", ch);
  }
  printf("\n");
  ch = max(x, y);
  if (ch <= z) {
    printf("use function to get max = %d", z);
  } else {
    printf("use function to get max = %d", ch);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1175 <main+0x45>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    117b <main+0x4b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11a3 <main+0x73>
mov    -0xc(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x84>
mov    -0x10(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <max@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f2 <main+0xc2>
mov    -0xc(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1203 <main+0xd3>
mov    -0x10(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xe99(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1070 <scanf@plt>
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%esi
cmp    %esi,%eax
cmovg  %eax,%esi
mov    0xc(%rsp),%eax
cmp    %eax,%esi
cmovle %eax,%esi
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
call   1060 <max@plt>
mov    0xc(%rsp),%esi
cmp    %esi,%eax
cmovg  %eax,%esi
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter the x,y,z:\0A\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [27 x i8] c"use define to get max = %d\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [29 x i8] c"use function to get max = %d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i32, i32* %1
br label %14
12: ; preds = %0
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ %11, %10 ], [ %13, %12 ]
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %25
22: ; preds = %14
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %19
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* %1
%28 = load i32, i32* %2
%29 = call i32 @max(i32 %27, i32 %28)
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = load i32, i32* %3
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %25
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %34)
br label %39
36: ; preds = %25
%37 = load i32, i32* %4
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %36, %33
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [27 x i8] c"use define to get max = %d\00"
@.str.4 = [29 x i8] c"use function to get max = %d\00"
@str = [17 x i8] c"Enter the x,y,z:\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
%12 = select i1 %11, i32 %9, i32 %10
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
%15 = select i1 %14, i32 %12, i32 %13
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @putchar(i32 10)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 @max(i32 %18, i32 %19)
%21 = load i32, i32* %3
%22 = icmp sgt i32 %20, %21
%23 = select i1 %22, i32 %20, i32 %21
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %23)
ret void
}