#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*/ getch();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ *strncmp(char *, char *, int);
int main() {
  char metin1[100], metin2[100];
  int sayi;
  printf("Ilk metini giriniz   :");
  gets(metin1);
  printf("Ikinci metini giriniz:");
  gets(metin2);
  printf("\nKarsilastirmak istediginiz karakter sayisi kactir:");
  scanf("%d", &sayi);
  printf("\n\tSONUC\n");
  if (strncmp(metin1, metin2, sayi) == NULL)
    printf("%s ve %s alfabede ayni yerdedirler.", metin1, metin2);
  else if (strncmp(metin1, metin2, sayi) < 0)
    printf("%s alfabede %s den once gelir.", metin1, metin2);
  else
    printf("%s alfabede %s den once gelir.", metin2, metin1);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <gets@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <gets@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0xe4(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
mov    -0xe4(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1200 <main+0xb0>
lea    -0x70(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125c <main+0x10c>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
mov    -0xe4(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jae    123e <main+0xee>
lea    -0x70(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1257 <main+0x107>
lea    -0xe0(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125c <main+0x10c>
mov    $0x0,%al
call   1070 <getch@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xe8,%rsp
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x80(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xedf(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strncmp@plt>
test   %rax,%rax
je     120d <main+0xad>
mov    0xc(%rsp),%edx
lea    0x80(%rsp),%r14
lea    0x10(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strncmp@plt>
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
jmp    1221 <main+0xc1>
lea    0xe51(%rip),%rdi
lea    0x80(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <getch@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Ilk metini giriniz :\00"
@.str.1 = [23 x i8] c"Ikinci metini giriniz:\00"
@.str.2 = [52 x i8] c"\0AKarsilastirmak istediginiz karakter sayisi kactir:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [9 x i8] c"\0A\09SONUC\0A\00"
@.str.5 = [36 x i8] c"%s ve %s alfabede ayni yerdedirler.\00"
@.str.6 = [31 x i8] c"%s alfabede %s den once gelir.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%16 = load i32, i32* %4
%17 = call i32* @strncmp(i8* %14, i8* %15, i32 %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %23
19: ; preds = %0
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8* %20, i8* %21)
br label %38
23: ; preds = %0
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%26 = load i32, i32* %4
%27 = call i32* @strncmp(i8* %24, i8* %25, i32 %26)
%28 = icmp ult i32* %27, null
br i1 %28, label %29, label %33
29: ; preds = %23
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %30, i8* %31)
br label %37
33: ; preds = %23
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %34, i8* %35)
br label %37
37: ; preds = %33, %29
br label %38
38: ; preds = %37, %19
%39 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Ilk metini giriniz :\00"
@.str.1 = [23 x i8] c"Ikinci metini giriniz:\00"
@.str.2 = [52 x i8] c"\0AKarsilastirmak istediginiz karakter sayisi kactir:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [36 x i8] c"%s ve %s alfabede ayni yerdedirler.\00"
@.str.6 = [31 x i8] c"%s alfabede %s den once gelir.\00"
@str = [8 x i8] c"\0A\09SONUC\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @gets(i8* %5)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = call i32* @strncmp(i8* %4, i8* %5, i32 %14)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8* %4, i8* %5)
br label %23
19: ; preds = %0
%20 = load i32, i32* %3
%21 = call i32* @strncmp(i8* %4, i8* %5, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i8* %5, i8* %4)
br label %23
23: ; preds = %19, %17
%24 = call i32 (...) @getch()
ret i32 0
}