#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*/ compareIntegers(int *, int *);
scalar_t__ compareStrings(char *, char *);
int /*<<< orphan*/ countTillThisNum(int);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printPointerValue(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ swapPointers(int *, int *);
int main() {
  printf("Enter a and b\n");
  int *a = malloc(sizeof(int));
  int *b = malloc(sizeof(int));
  scanf("%d", a);
  scanf("%d", b);
  printf("\na = ");
  printPointerValue(a);
  printf("\nb = ");
  printPointerValue(b);
  printf("\n\nAfter swapping - \n");
  swapPointers(a, b);
  printf("\na = ");
  printPointerValue(a);
  printf("\nb = ");
  printPointerValue(b);
  printf("\n\n%c is bigger.\n", (!compareIntegers(a, b)) ? 'a' : 'b');
  free(b);
  printf("Enter two strings\n");
  char s1[256], s2[256];
  scanf("%s", s1);
  scanf("%s", s2);
  printf("\n\nString %c comes first.\n", (compareStrings(s1, s2)) ? '1' : '2');
  printf("\nEnter a number.\n");
  scanf("%d", a);
  printf("\nSeries = \n");
  countTillThisNum(*a);
  free(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <printPointerValue@plt>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <printPointerValue@plt>
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <swapPointers@plt>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <printPointerValue@plt>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <printPointerValue@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <compareIntegers@plt>
cmp    $0x0,%eax
setne  %cl
xor    $0xff,%cl
mov    $0x62,%esi
mov    $0x61,%eax
test   $0x1,%cl
cmovne %eax,%esi
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    -0x220(%rbp),%rsi
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    -0x120(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1040 <compareStrings@plt>
mov    %rax,%rcx
mov    $0x32,%esi
mov    $0x31,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1050 <countTillThisNum@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
lea    0xe86(%rip),%rdi
call   1050 <puts@plt>
mov    $0x4,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
lea    0xe23(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0xe05(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
call   10b0 <printPointerValue@plt>
lea    0xdf2(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10b0 <printPointerValue@plt>
lea    0xe1b(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10c0 <swapPointers@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,%rdi
call   10b0 <printPointerValue@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10b0 <printPointerValue@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <compareIntegers@plt>
cmp    $0x1,%eax
mov    $0x62,%esi
sbb    $0x0,%esi
lea    0xd8e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xdc8(%rip),%rdi
call   1050 <puts@plt>
lea    0xd7d(%rip),%r13
lea    0x100(%rsp),%r12
mov    %r13,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %rsp,%rbx
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <compareStrings@plt>
cmp    $0x1,%rax
mov    $0x31,%esi
adc    $0x0,%esi
lea    0xd3d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd7d(%rip),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0xd75(%rip),%rdi
call   1050 <puts@plt>
mov    (%r15),%edi
call   1060 <countTillThisNum@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter a and b\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"\0Aa = \00"
@.str.3 = [6 x i8] c"\0Ab = \00"
@.str.4 = [21 x i8] c"\0A\0AAfter swapping - \0A\00"
@.str.5 = [17 x i8] c"\0A\0A%c is bigger.\0A\00"
@.str.6 = [19 x i8] c"Enter two strings\0A\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [26 x i8] c"\0A\0AString %c comes first.\0A\00"
@.str.9 = [18 x i8] c"\0AEnter a number.\0A\00"
@.str.10 = [12 x i8] c"\0ASeries = \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32* @malloc(i32 4)
store i32* %7, i32** %2
%8 = call i32* @malloc(i32 4)
store i32* %8, i32** %3
%9 = load i32*, i32** %2
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %3
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32*, i32** %2
%15 = call i32 @printPointerValue(i32* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32*, i32** %3
%18 = call i32 @printPointerValue(i32* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%20 = load i32*, i32** %2
%21 = load i32*, i32** %3
%22 = call i32 @swapPointers(i32* %20, i32* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32*, i32** %2
%25 = call i32 @printPointerValue(i32* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32*, i32** %3
%28 = call i32 @printPointerValue(i32* %27)
%29 = load i32*, i32** %2
%30 = load i32*, i32** %3
%31 = call i32 @compareIntegers(i32* %29, i32* %30)
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
%34 = zext i1 %33 to i64
%35 = select i1 %33, i32 97, i32 98
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %35)
%37 = load i32*, i32** %3
%38 = call i32 @free(i32* %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%41 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %40)
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%46 = call i64 @compareStrings(i8* %44, i8* %45)
%47 = icmp ne i64 %46, 0
%48 = zext i1 %47 to i64
%49 = select i1 %47, i32 49, i32 50
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%52 = load i32*, i32** %2
%53 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%55 = load i32*, i32** %2
%56 = load i32, i32* %55
%57 = call i32 @countTillThisNum(i32 %56)
%58 = load i32*, i32** %2
%59 = call i32 @free(i32* %58)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"\0Aa = \00"
@.str.3 = [6 x i8] c"\0Ab = \00"
@.str.5 = [17 x i8] c"\0A\0A%c is bigger.\0A\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [26 x i8] c"\0A\0AString %c comes first.\0A\00"
@str = [14 x i8] c"Enter a and b\00"
@str.11 = [20 x i8] c"\0A\0AAfter swapping - \00"
@str.12 = [18 x i8] c"Enter two strings\00"
@str.13 = [17 x i8] c"\0AEnter a number.\00"
@str.14 = [11 x i8] c"\0ASeries = \00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32* @malloc(i32 4)
%5 = tail call i32* @malloc(i32 4)
%6 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%7 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @printPointerValue(i32* %4)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @printPointerValue(i32* %5)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
%13 = tail call i32 @swapPointers(i32* %4, i32* %5)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @printPointerValue(i32* %4)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @printPointerValue(i32* %5)
%18 = tail call i32 @compareIntegers(i32* %4, i32* %5)
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32 97, i32 98
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = tail call i32 @free(i32* %5)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.12, i64 0, i64 0))
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %24)
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %25)
%28 = call i64 @compareStrings(i8* %24, i8* %25)
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i32 50, i32 49
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %30)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.13, i64 0, i64 0))
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.14, i64 0, i64 0))
%35 = load i32, i32* %4
%36 = call i32 @countTillThisNum(i32 %35)
%37 = call i32 @free(i32* %4)
ret i32 0
}