#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ string_reverse(char *);
int main() {
  char x[] = "abcdefghijkl";
  string_reverse(x);
  printf("%s\n", x);
  printf("Give your name: ");
  char name[200];
  fgets(name, 200, stdin);
  string_reverse(name);
  printf("%s\n", name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeb0(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x11(%rbp),%rdi
call   1040 <string_reverse@plt>
lea    -0x11(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    0x2e52(%rip),%rax
mov    (%rax),%edx
mov    $0xc8,%esi
call   1050 <fgets@plt>
lea    -0xe0(%rbp),%rdi
call   1040 <string_reverse@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
movabs $0x6c6b6a69686766,%rax
mov    %rax,0x5(%rsp)
movabs $0x6867666564636261,%rax
66 67 68
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <string_reverse@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc8,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1050 <string_reverse@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.x = [13 x i8] c"abcdefghijkl\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [17 x i8] c"Give your name: \00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca [200 x i8]
store i32 0, i32* %1
%4 = bitcast [13 x i8]* %2 to i8*
%5 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%6 = call i32 @string_reverse(i8* %5)
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 200, i32 %11)
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%14 = call i32 @string_reverse(i8* %13)
%15 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [13 x i8] c"abcdefghijkl\00"
@.str.1 = [17 x i8] c"Give your name: \00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = call i32 @string_reverse(i8* %3)
%5 = call i32 @puts(i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 200, i32 %8)
%10 = call i32 @string_reverse(i8* %7)
%11 = call i32 @puts(i8* %7)
ret i32 0
}