#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 main(int argc, const char *argv[]) {
  int x, i, j;
  char c;
  printf("This program needs 2 initial digits and reverse their variables\n\n");
  printf("Please enter first Number: ");
  scanf("%d", &i);
  printf("Please enter second Number: ");
  scanf("%d", &j);
  printf("Please specify the Reversiation method:\nw for (With helpful "
         "variable)\no for (Without helpfl variable)\n");
  scanf(" %c", &c);
  switch (c) {
  case 'w':
    x = i;
    i = j;
    j = x;
    printf("\nThe reversation made with getting help from 3rd variable:\n");
    printf("The first number is: %d\n", i);
    printf("The second number is: %d \n", j);
    break;
  case 'o':
    i = i + j;
    j = i - j;
    i = i - j;
    printf("\nThe reversation made without getting help from 3rd variable:\n");
    printf("The first number is: %d\n", i);
    printf("The second number is: %d \n", j);
    break;
  default:
    printf("Not valid option choosed\n");
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x25(%rbp)
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xefe(%rip),%rdi
mov    %rdi,-0x30(%rbp)
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x25(%rbp),%al
lea    0xeea(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x25(%rbp),%al
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x25(%rbp),%al
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x25(%rbp),%al
lea    0xf40(%rip),%rdi
lea    -0x1d(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1d(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x6f,%eax
je     121b <main+0xfb>
jmp    11c3 <main+0xa3>
mov    -0x24(%rbp),%eax
sub    $0x77,%eax
jne    126b <main+0x14b>
jmp    11d4 <main+0xb4>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xf27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
lea    0xf26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf2c(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
lea    0x7(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%eax
cmp    $0x6f,%eax
je     11c9 <main+0x99>
cmp    $0x77,%eax
jne    120b <main+0xdb>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
mov    %ecx,0xc(%rsp)
mov    %eax,0x8(%rsp)
lea    0xf92(%rip),%rdi
jmp    11e0 <main+0xb0>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
mov    %eax,0x8(%rsp)
mov    %ecx,0xc(%rsp)
lea    0xf3b(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
lea    0xe50(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1217 <main+0xe7>
lea    0xf82(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [66 x i8] c"This program needs 2 initial digits and reverse their variables\0A\0A\00"
@.str.1 = [28 x i8] c"Please enter first Number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [29 x i8] c"Please enter second Number: \00"
@.str.4 = [103 x i8] c"Please specify the Reversiation method:\0Aw for (With helpful variable)\0Ao for (Without helpfl variable)\0A\00"
@.str.5 = [4 x i8] c" %c\00"
@.str.6 = [60 x i8] c"\0AThe reversation made with getting help from 3rd variable:\0A\00"
@.str.7 = [25 x i8] c"The first number is: %d\0A\00"
@.str.8 = [27 x i8] c"The second number is: %d \0A\00"
@.str.9 = [63 x i8] c"\0AThe reversation made without getting help from 3rd variable:\0A\00"
@.str.10 = [26 x i8] c"Not valid option choosed\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
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%17 = load i8, i8* %9
%18 = sext i8 %17 to i32
switch i32 %18, label %43 [
i32 119, label %19
i32 111, label %28
]
19: ; preds = %2
%20 = load i32, i32* %7
store i32 %20, i32* %6
%21 = load i32, i32* %8
store i32 %21, i32* %7
%22 = load i32, i32* %6
store i32 %22, i32* %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0))
%24 = load i32, i32* %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %26)
br label %45
28: ; preds = %2
%29 = load i32, i32* %7
%30 = load i32, i32* %8
%31 = add nsw i32 %29, %30
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = sub nsw i32 %32, %33
store i32 %34, i32* %8
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = sub nsw i32 %35, %36
store i32 %37, i32* %7
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0))
%39 = load i32, i32* %7
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %8
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %41)
br label %45
43: ; preds = %2
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %3
br label %45
45: ; preds = %43, %28, %19
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"Please enter first Number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [29 x i8] c"Please enter second Number: \00"
@.str.5 = [4 x i8] c" %c\00"
@.str.7 = [25 x i8] c"The first number is: %d\0A\00"
@.str.8 = [27 x i8] c"The second number is: %d \0A\00"
@str = [65 x i8] c"This program needs 2 initial digits and reverse their variables\0A\00"
@str.11 = [102 x i8] c"Please specify the Reversiation method:\0Aw for (With helpful variable)\0Ao for (Without helpfl variable)\00"
@str.12 = [62 x i8] c"\0AThe reversation made without getting help from 3rd variable:\00"
@str.13 = [59 x i8] c"\0AThe reversation made with getting help from 3rd variable:\00"
@str.14 = [25 x i8] c"Not valid option choosed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @str.11, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
switch i32 %16, label %33 [
i32 119, label %17
i32 111, label %25
]
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
store i32 %19, i32* %3
store i32 %18, i32* %4
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.13, i64 0, i64 0))
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %23)
br label %35
25: ; preds = %2
%26 = load i32, i32* %3
%27 = load i32, i32* %4
store i32 %26, i32* %4
store i32 %27, i32* %3
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.12, i64 0, i64 0))
%29 = load i32, i32* %3
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %31)
br label %35
33: ; preds = %2
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0))
br label %35
35: ; preds = %17, %25, %33
ret i32 0
}