#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 *if_max(int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, char *argv[]) {
  int a, b, *max;
  printf("Please input two numbers:");
  scanf("%d,%d", &a, &b);
  max = if_max(&a, &b);
  if (max == &a)
    printf("\nmax is %d,min is %d\n", a, b);
  else
    printf("\nmax is %d,min is %d\n", b, a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <if_max@plt>
mov    %rax,-0x20(%rbp)
lea    -0x14(%rbp),%rax
cmp    %rax,-0x20(%rbp)
jne    11a0 <main+0x70>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b4 <main+0x84>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <if_max@plt>
cmp    %rbx,%rax
je     1175 <main+0x45>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
jmp    117c <main+0x4c>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please input two numbers:\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [22 x i8] c"\0Amax is %d,min is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%11 = call i32* @if_max(i32* %6, i32* %7)
store i32* %11, i32** %8
%12 = load i32*, i32** %8
%13 = icmp eq i32* %12, %6
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %16)
br label %22
18: ; preds = %2
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %18, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please input two numbers:\00"
@.str.1 = [6 x i8] c"%d,%d\00"
@.str.2 = [22 x i8] c"\0Amax is %d,min is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%9 = call i32* @if_max(i32* %3, i32* %4)
%10 = icmp eq i32* %9, %3
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
br label %19
15: ; preds = %2
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17)
br label %19
19: ; preds = %15, %11
ret i32 0
}