#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 */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strreverse(char *, int);
int main(int argc, char **argv) {
  char a[] = "abc1234efg";
  printf("bef: %s\n", a);
  printf("len: %ld\n", sizeof(a) / sizeof(a[0]));
  strreverse(a, sizeof(a) / sizeof(a[0]) - 1);
  printf("aft: %s\n", a);
  strreverse(a, sizeof(a) / sizeof(a[0]) - 1);
  printf("aft: %s\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x1b(%rbp)
mov    0xec0(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xeb8(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x1b(%rbp),%rsi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea6(%rip),%rdi
mov    $0xb,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1b(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strreverse@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1b(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strreverse@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0x6534333231636261,%rax
33 34 65
mov    %rax,0x8(%rsp)
movl   $0x676665,0xf(%rsp)
lea    0xec6(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strreverse@plt>
lea    0xea3(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <strreverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.a = [11 x i8] c"abc1234efg\00"
@.str = [9 x i8] c"bef: %s\0A\00"
@.str.1 = [10 x i8] c"len: %ld\0A\00"
@.str.2 = [9 x i8] c"aft: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [11 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [11 x i8]* %6 to i8*
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 11)
%11 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%12 = call i32 @strreverse(i8* %11, i32 10)
%13 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%16 = call i32 @strreverse(i8* %15, i32 10)
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [11 x i8] c"abc1234efg\00"
@.str = [9 x i8] c"bef: %s\0A\00"
@.str.1 = [10 x i8] c"len: %ld\0A\00"
@.str.2 = [9 x i8] c"aft: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [11 x i8]
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 11)
%7 = call i32 @strreverse(i8* %4, i32 10)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%9 = call i32 @strreverse(i8* %4, i32 10)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret i32 0
}