#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*/ getchar();
int getpid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sys_yield();
int y2() {
  int i;
  for (i = 1; i < 6; i++) {
    printf("task %d, %d. kez calisiyor\n", getpid(), i);
    printf("devam etmek icin bir tusa basin\n");
    getchar();
    sys_yield();
  }
  printf("task %d bitti\n");
  return 0;
}


x86 assembly (clang, -O0):
<y2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jge    119d <y2+0x5d>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%edx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    $0x0,%al
call   1040 <sys_yield@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114f <y2+0xf>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<y2>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe9e(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1050 <sys_yield@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1050 <sys_yield@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1050 <sys_yield@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1050 <sys_yield@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
call   1050 <sys_yield@plt>
lea    0xdcd(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"task %d, %d. kez calisiyor\0A\00"
@.str.1 = [33 x i8] c"devam etmek icin bir tusa basin\0A\00"
@.str.2 = [15 x i8] c"task %d bitti\0A\00"
define i32 @y2() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 6
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = call i32 (...) @getpid()
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @getchar()
%11 = call i32 (...) @sys_yield()
br label %12
12: ; preds = %5
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %2
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"task %d, %d. kez calisiyor\0A\00"
@.str.2 = [15 x i8] c"task %d bitti\0A\00"
@str = [32 x i8] c"devam etmek icin bir tusa basin\00"
define i32 @y2() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1, i32 1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
%5 = tail call i32 (...) @sys_yield()
%6 = tail call i32 (...) @getpid()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %6, i32 2)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (...) @getchar()
%10 = tail call i32 (...) @sys_yield()
%11 = tail call i32 (...) @getpid()
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %11, i32 3)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 (...) @getchar()
%15 = tail call i32 (...) @sys_yield()
%16 = tail call i32 (...) @getpid()
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %16, i32 4)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 (...) @getchar()
%20 = tail call i32 (...) @sys_yield()
%21 = tail call i32 (...) @getpid()
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %21, i32 5)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%24 = tail call i32 (...) @getchar()
%25 = tail call i32 (...) @sys_yield()
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}