#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*/ src;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ puts(char *);
char *strrev(char *);
int main() {
  char *src[] = {"abcdefghij", "abcde"};
  char *dst = NULL;
  for (unsigned i = 0; i < (sizeof(src) / sizeof(src[0])); i++) {
    dst = strrev(src[i]);
    puts(dst);
    {
      free(dst);
      dst = NULL;
    };
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    $0x2,%rax
jae    11aa <main+0x7a>
mov    -0x2c(%rbp),%eax
mov    -0x20(%rbp,%rax,8),%rdi
call   1050 <strrev@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1164 <main+0x34>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1050 <strrev@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xeb4(%rip),%rdi
call   1050 <strrev@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"abcdefghij\00"
@.str.1 = [6 x i8] c"abcde\00"
@__const.main.src = [2 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i8*]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [2 x i8*]* %2 to i8*
store i8* null, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = icmp ult i64 %8, 2
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = call i8* @strrev(i8* %14)
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = call i32 @puts(i8* %16)
%18 = load i8*, i8** %3
%19 = call i32 @free(i8* %18)
store i8* null, i8** %3
br label %20
20: ; preds = %10
%21 = load i32, i32* %4
%22 = add i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"abcdefghij\00"
@.str.1 = [6 x i8] c"abcde\00"
define i32 @main() {
%1 = tail call i8* @strrev(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) %1)
%3 = tail call i32 @free(i8* %1)
%4 = tail call i8* @strrev(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = tail call i32 @free(i8* %4)
ret i32 0
}