#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 karakter_sayisi(char const *);
int /*<<< orphan*/ printf(char *, ...);
int cumle_kelime(const char *s) {
  int i;
  int kelime_sayisi = 1;
  int karakter_say = karakter_sayisi(s);
  printf("Cumledeki kelimeler:\n");
  for (i = 0; i <= karakter_say; i++) {
    if (s[i] == ' ') {
      printf("\n");
      kelime_sayisi++;
    } else {
      printf("%c", s[i]);
    }
  }
  printf("\n\n");
  return kelime_sayisi;
}


x86 assembly (clang, -O0):
<cumle_kelime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <karakter_sayisi@plt>
mov    %eax,-0x14(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11be <cumle_kelime+0x9e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    1191 <cumle_kelime+0x71>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ab <cumle_kelime+0x8b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b0 <cumle_kelime+0x90>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <cumle_kelime+0x34>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cumle_kelime>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <karakter_sayisi@plt>
mov    %eax,%ebx
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
js     1188 <cumle_kelime+0x58>
add    $0x1,%ebx
mov    $0x1,%r15d
xor    %ebp,%ebp
jmp    116e <cumle_kelime+0x3e>
xchg   %ax,%ax
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
je     118e <cumle_kelime+0x5e>
movsbl (%r14,%rbp,1),%edi
cmp    $0x20,%edi
jne    1160 <cumle_kelime+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
jmp    1165 <cumle_kelime+0x35>
mov    $0x1,%r15d
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Cumledeki kelimeler:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
define i32 @cumle_kelime(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @karakter_sayisi(i8* %6)
store i32 %7, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %9
9: ; preds = %34, %1
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 32
br i1 %20, label %21, label %25
21: ; preds = %13
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %33
25: ; preds = %13
%26 = load i8*, i8** %2
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %25, %21
br label %34
34: ; preds = %33
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %9
37: ; preds = %9
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
@str = [21 x i8] c"Cumledeki kelimeler:\00"
@str.4 = [2 x i8] c"\0A\00"
define i32 @cumle_kelime(i8* %0) {
%2 = tail call i32 @karakter_sayisi(i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%4 = icmp slt i32 %2, 0
br i1 %4, label %24, label %5
5: ; preds = %1
%6 = add nuw i32 %2, 1
%7 = zext i32 %6 to i64
br label %8
8: ; preds = %5, %20
%9 = phi i64 [ 0, %5 ], [ %22, %20 ]
%10 = phi i32 [ 1, %5 ], [ %21, %20 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %9
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 32
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = tail call i32 @putchar(i32 10)
%16 = add nsw i32 %10, 1
br label %20
17: ; preds = %8
%18 = sext i8 %12 to i32
%19 = tail call i32 @putchar(i32 %18)
br label %20
20: ; preds = %14, %17
%21 = phi i32 [ %16, %14 ], [ %10, %17 ]
%22 = add nuw nsw i64 %9, 1
%23 = icmp eq i64 %22, %7
br i1 %23, label %24, label %8
24: ; preds = %20, %1
%25 = phi i32 [ 1, %1 ], [ %21, %20 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
ret i32 %25
}