#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 main() {
  int val1, val2, temp, x, y = 12;
  double old = 2.3, new = 8.91, tempd;
  printf("Example of the use of Symbolic Constants\n"
         "  (Macro Version)\n\n");
  printf("Enter value 1: ");
  scanf("%d", &val1);
  printf("Enter value 2: ");
  scanf("%d", &val2);
  if (val1 < val2) {
    temp = val1;
    val1 = val2;
    val2 = temp;
  };
  printf("val1=%d val2=%d\n\n", val1, val2);
  x = 4 * ((5) - (27 - y));
  printf("x=%d\n\n", x);
  {
    tempd = old;
    old = new;
    new = tempd;
  };
  printf("old=%2.2lf new=%2.2lf\n\n", old, new);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x18(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <main+0x98>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1b,%ecx
sub    -0x18(%rbp),%ecx
mov    $0x5,%eax
sub    %ecx,%eax
shl    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe68(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf28(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%esi
cmp    %esi,%eax
jge    1196 <main+0x66>
mov    %esi,0xc(%rsp)
mov    %eax,0x8(%rsp)
mov    %eax,%edx
jmp    119a <main+0x6a>
mov    %esi,%edx
mov    %eax,%esi
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0xffffffd8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8a(%rip),%rdi
movsd  0xe36(%rip),%xmm0
movsd  0xe36(%rip),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Example of the use of Symbolic Constants\0A (Macro Version)\0A\0A\00"
@.str.1 = [16 x i8] c"Enter value 1: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"Enter value 2: \00"
@.str.4 = [18 x i8] c"val1=%d val2=%d\0A\0A\00"
@.str.5 = [7 x i8] c"x=%d\0A\0A\00"
@.str.6 = [24 x i8] c"old=%2.2lf new=%2.2lf\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %1
store i32 12, i32* %6
store double 2.300000e+00, double* %7
store double 8.910000e+00, double* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %22
18: ; preds = %0
%19 = load i32, i32* %2
store i32 %19, i32* %4
%20 = load i32, i32* %3
store i32 %20, i32* %2
%21 = load i32, i32* %4
store i32 %21, i32* %3
br label %22
22: ; preds = %18, %0
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %6
%27 = sub nsw i32 27, %26
%28 = sub nsw i32 5, %27
%29 = mul nsw i32 4, %28
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = load double, double* %7
store double %32, double* %9
%33 = load double, double* %8
store double %33, double* %7
%34 = load double, double* %9
store double %34, double* %8
%35 = load double, double* %7
%36 = load double, double* %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double %35, double %36)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"Enter value 1: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"Enter value 2: \00"
@.str.4 = [18 x i8] c"val1=%d val2=%d\0A\0A\00"
@.str.5 = [7 x i8] c"x=%d\0A\0A\00"
@.str.6 = [24 x i8] c"old=%2.2lf new=%2.2lf\0A\0A\00"
@str = [60 x i8] c"Example of the use of Symbolic Constants\0A (Macro Version)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 %11, i32* %1
store i32 %10, i32* %2
br label %14
14: ; preds = %13, %0
%15 = phi i32 [ %10, %13 ], [ %11, %0 ]
%16 = phi i32 [ %11, %13 ], [ %10, %0 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %15)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 -40)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), double 8.910000e+00, double 2.300000e+00)
ret i32 0
}