#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 compareInts(int *, int *);
int compareStrings(char *, char *);
int /*<<< orphan*/ countTillNum(int);
int /*<<< orphan*/ printPointerValue(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ swapPointers(int *, int *);
int main(int argc, char const *argv[]) {
  int choice, a, b, n;
  char string1[100], string2[100];
  printf(
      "Enter the respectivec choice: \n1 for swapping pointers\n2 for "
      "comparing integers\n3 for comparing strings\n4 for counting till n\n");
  scanf("%d", &choice);
  switch (choice) {
  case 1:
    printf("Enter two integers to swap: ");
    scanf("%d%d", &a, &b);
    swapPointers(&a, &b);
    printf("After swapping\n");
    printPointerValue(&a);
    printPointerValue(&b);
    break;
  case 2:
    printf("Enter two integers to compare: ");
    scanf("%d%d", &a, &b);
    printf("Comparison result: %d\n", compareInts(&a, &b));
    break;
  case 3:
    printf("Enter two strings to compare\n");
    scanf("%s%s", string1, string2);
    printf("Comparison result: %d\n", compareStrings(string1, string2));
    break;
  case 4:
    printf("Enter the value of n: ");
    scanf("%d", &n);
    printf("\n");
    countTillNum(n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x109(%rbp)
call   1040 <printf@plt>
mov    -0x109(%rbp),%al
lea    0xf04(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x108(%rbp)
sub    $0x3,%eax
ja     1306 <main+0x196>
mov    -0x108(%rbp),%rax
lea    0xe27(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1090 <swapPointers@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1080 <printPointerValue@plt>
lea    -0x1c(%rbp),%rdi
call   1080 <printPointerValue@plt>
jmp    1306 <main+0x196>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5f(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <compareInts@plt>
mov    %eax,%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1306 <main+0x196>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rsi
lea    -0x100(%rbp),%rdx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   1030 <compareStrings@plt>
mov    %eax,%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1306 <main+0x196>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdc9(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
call   1050 <countTillNum@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
lea    0xee4(%rip),%rdi
call   1050 <puts@plt>
lea    0xe82(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     12ee <main+0x15e>
lea    0xe30(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe3f(%rip),%rdi
lea    0x10(%rsp),%rbx
lea    0x80(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10b0 <swapPointers@plt>
lea    0xf06(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   10a0 <printPointerValue@plt>
mov    %r14,%rdi
call   10a0 <printPointerValue@plt>
jmp    12ee <main+0x15e>
lea    0xdf7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xde4(%rip),%rdi
lea    0x10(%rsp),%rbx
lea    0x80(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <compareInts@plt>
jmp    12a8 <main+0x118>
lea    0xe8c(%rip),%rdi
call   1050 <puts@plt>
lea    0xde6(%rip),%rdi
lea    0x10(%rsp),%rbx
lea    0x80(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <compareStrings@plt>
lea    0xda3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12ee <main+0x15e>
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd60(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%edi
call   1070 <countTillNum@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [127 x i8] c"Enter the respectivec choice: \0A1 for swapping pointers\0A2 for comparing integers\0A3 for comparing strings\0A4 for counting till n\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Enter two integers to swap: \00"
@.str.3 = [5 x i8] c"%d%d\00"
@.str.4 = [16 x i8] c"After swapping\0A\00"
@.str.5 = [32 x i8] c"Enter two integers to compare: \00"
@.str.6 = [23 x i8] c"Comparison result: %d\0A\00"
@.str.7 = [30 x i8] c"Enter two strings to compare\0A\00"
@.str.8 = [5 x i8] c"%s%s\00"
@.str.9 = [23 x i8] c"Enter the value of n: \00"
@.str.10 = [2 x i8] c"\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 i32
%10 = alloca [100 x i8]
%11 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
switch i32 %14, label %42 [
i32 1, label %15
i32 2, label %22
i32 3, label %27
i32 4, label %36
]
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %7, i32* %8)
%18 = call i32 @swapPointers(i32* %7, i32* %8)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @printPointerValue(i32* %7)
%21 = call i32 @printPointerValue(i32* %8)
br label %42
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %7, i32* %8)
%25 = call i32 @compareInts(i32* %7, i32* %8)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %25)
br label %42
27: ; preds = %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %29, i8* %30)
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%34 = call i32 @compareStrings(i8* %32, i8* %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %34)
br label %42
36: ; preds = %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%40 = load i32, i32* %9
%41 = call i32 @countTillNum(i32 %40)
br label %42
42: ; preds = %36, %2, %27, %22, %15
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Enter two integers to swap: \00"
@.str.3 = [5 x i8] c"%d%d\00"
@.str.5 = [32 x i8] c"Enter two integers to compare: \00"
@.str.6 = [23 x i8] c"Comparison result: %d\0A\00"
@.str.8 = [5 x i8] c"%s%s\00"
@.str.9 = [23 x i8] c"Enter the value of n: \00"
@str = [126 x i8] c"Enter the respectivec choice: \0A1 for swapping pointers\0A2 for comparing integers\0A3 for comparing strings\0A4 for counting till n\00"
@str.11 = [29 x i8] c"Enter two strings to compare\00"
@str.12 = [15 x i8] c"After swapping\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([126 x i8], [126 x i8]* @str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
switch i32 %17, label %41 [
i32 1, label %18
i32 2, label %25
i32 3, label %30
i32 4, label %35
]
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%21 = call i32 @swapPointers(i32* %4, i32* %5)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.12, i64 0, i64 0))
%23 = call i32 @printPointerValue(i32* %4)
%24 = call i32 @printPointerValue(i32* %5)
br label %41
25: ; preds = %2
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%28 = call i32 @compareInts(i32* %4, i32* %5)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %28)
br label %41
30: ; preds = %2
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.11, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %13, i8* %14)
%33 = call i32 @compareStrings(i8* %13, i8* %14)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32 %33)
br label %41
35: ; preds = %2
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%38 = call i32 @putchar(i32 10)
%39 = load i32, i32* %6
%40 = call i32 @countTillNum(i32 %39)
br label %41
41: ; preds = %35, %2, %30, %25, %18
ret i32 0
}