int main() {
  char *letters[100];
  printf("%s", "Please Enter the letter: ");
  gets(letters);
  printf("Original Letters: %s\n", letters);
  printf("Alternated letters: %s\n", alternate(&letters));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x330(%rbp),%rdi
mov    $0x0,%al
call   1040 <gets@plt>
lea    -0x330(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x330(%rbp),%rdi
mov    $0x0,%al
call   1050 <alternate@plt>
mov    %eax,%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x320,%rsp
lea    0xec1(%rip),%rdi
lea    0xebd(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <gets@plt>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <alternate@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x320,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [26 x i8] c"Please Enter the letter: \00"
@.str.2 = [22 x i8] c"Original Letters: %s\0A\00"
@.str.3 = [24 x i8] c"Alternated letters: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8*]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8*], [100 x i8*]* %2, i64 0, i64 0
%5 = call i32 (i8**, ...) bitcast (i32 (...)* @gets to i32 (i8**, ...)*)(i8** %4)
%6 = getelementptr inbounds [100 x i8*], [100 x i8*]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8** %6)
%8 = call i32 ([100 x i8*]*, ...) bitcast (i32 (...)* @alternate to i32 ([100 x i8*]*, ...)*)([100 x i8*]* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [26 x i8] c"Please Enter the letter: \00"
@.str.2 = [22 x i8] c"Original Letters: %s\0A\00"
@.str.3 = [24 x i8] c"Alternated letters: %s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8*]
%2 = bitcast [100 x i8*]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 0
%5 = call i32 (i8**, ...) bitcast (i32 (...)* @gets to i32 (i8**, ...)*)(i8** %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8** %4)
%7 = call i32 ([100 x i8*]*, ...) bitcast (i32 (...)* @alternate to i32 ([100 x i8*]*, ...)*)([100 x i8*]* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret i32 0
}