#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*/ assert(int);
int /*<<< orphan*/ reverse(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char s1[4] = {'a', 'b', 'c', '\0'};
  reverse(s1);
  assert(!strcmp("cba", s1));
  char s2[1] = {'\0'};
  reverse(s2);
  assert(!strcmp("", s2));
  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    0xea4(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x14(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x15(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
lea    -0x15(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x15(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x636261,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <reverse@plt>
xor    %edi,%edi
cmpl   $0x616263,0x4(%rsp)
sete   %dil
call   1040 <assert@plt>
movb   $0x0,0x3(%rsp)
lea    0x3(%rsp),%rdi
call   1030 <reverse@plt>
xor    %edi,%edi
cmpb   $0x0,0x3(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.s1 = [4 x i8] c"abc\00"
@.str = [4 x i8] c"cba\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i8]
%7 = alloca [1 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [4 x i8]* %6 to i8*
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%10 = call i32 @reverse(i8* %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%12 = call i32 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = bitcast [1 x i8]* %7 to i8*
%18 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
%19 = call i32 @reverse(i8* %18)
%20 = getelementptr inbounds [1 x i8], [1 x i8]* %7, i64 0, i64 0
%21 = call i32 @strcmp(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [1 x i8]
%5 = bitcast i32* %3 to i8*
store i32 6513249, i32* %3
%6 = call i32 @reverse(i8* %5)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 6382179
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
store i8 0, i8* %11
%12 = call i32 @reverse(i8* %11)
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
ret i32 0
}