#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*/ printf(char *, char *);
int /*<<< orphan*/ str_words_in_rev(char *, int);
int strlen(char *);
int main(int argc, char const *argv[]) {
  char s[] = "I like coding";
  int len = strlen(s);
  printf("\n%s-->", s);
  str_words_in_rev(s, len);
  printf("%s \n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x1e(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1e(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1e(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <str_words_in_rev@plt>
lea    -0x1e(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movabs $0x676e69646f6320,%rax
mov    %rax,0xe(%rsp)
movabs $0x6320656b696c2049,%rax
65 20 63
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <str_words_in_rev@plt>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.s = [14 x i8] c"I like coding\00"
@.str = [7 x i8] c"\0A%s-->\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [14 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [14 x i8]* %6 to i8*
%9 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %7
%11 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%14 = load i32, i32* %7
%15 = call i32 @str_words_in_rev(i8* %13, i32 %14)
%16 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [14 x i8] c"I like coding\00"
@.str = [7 x i8] c"\0A%s-->\00"
@.str.1 = [5 x i8] c"%s \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [14 x i8]
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i32 @str_words_in_rev(i8* %4, i32 %5)
%8 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}