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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  system("clear");
  srand(time(NULL));
  FILE *dosya;
  if ((dosya = fopen("/home/delta/my_sandbox/sayilar.txt", "w")) == NULL) {
    printf("dosya acilamadi!\n");
    exit(1);
  }
  fprintf(dosya, "%d %d\n", (10 + (rand() % 10)), (10 + (rand() % 10)));
  fclose(dosya);
  printf("Rastgele iki sayi dosyaya yazildi\n");
  printf("...\n");
  if ((dosya = fopen("/home/delta/my_sandbox/sayilar.txt", "r")) == NULL) {
    printf("dosya acilamadi!\n");
    exit(1);
  }
  int sayi1;
  int sayi2;
  fscanf(dosya, "%d %d", &sayi1, &sayi2);
  if (sayi2 >= sayi1) {
    printf("Ikinci sayi birinci sayidan daha buyuk oldugu icin:\n");
    printf(" %2d + %2d = %d\n", sayi1, sayi2, sayi1 + sayi2);
  }
  if (sayi2 < sayi1) {
    printf("Ikinci sayi birinci sayidan daha kucuk oldugu icin:\n");
    printf(" %2d - %2d = %d\n", sayi1, sayi2, sayi1 - sayi2);
  }
  fclose(dosya);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe4a(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
lea    0xe34(%rip),%rdi
lea    0xe50(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1204 <main+0x64>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   10c0 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0xa,%edx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0x28(%rbp),%rdi
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x1c(%rbp),%edx
add    $0xa,%ecx
lea    0xdfa(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd92(%rip),%rdi
lea    0xd89(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    12a6 <main+0x106>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    0xdbb(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1060 <fscanf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     12f2 <main+0x152>
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1326 <main+0x186>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xe46(%rip),%rdi
call   1050 <system@plt>
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
lea    0xe32(%rip),%rdi
lea    0xe4e(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1316 <main+0x166>
mov    %rax,%rbx
xor    %eax,%eax
call   10d0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0xa,%ebp
xor    %eax,%eax
call   10d0 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %eax,%ecx
add    $0xa,%ecx
lea    0xde5(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xdfb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
lea    0xd8f(%rip),%rdi
lea    0xd86(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     1316 <main+0x166>
mov    %rax,%rbx
lea    0xd9c(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %rax,%rdi
call   1070 <fscanf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jl     12dc <main+0x12c>
lea    0xdfc(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    (%rdx,%rsi,1),%ecx
lea    0xd6a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%eax
mov    0x4(%rsp),%ecx
cmp    %ecx,%eax
jge    1305 <main+0x155>
lea    0xd99(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %esi,%ecx
sub    %edx,%ecx
lea    0xd4b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [35 x i8] c"/home/delta/my_sandbox/sayilar.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [18 x i8] c"dosya acilamadi!\0A\00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
@.str.5 = [35 x i8] c"Rastgele iki sayi dosyaya yazildi\0A\00"
@.str.6 = [5 x i8] c"...\0A\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [6 x i8] c"%d %d\00"
@.str.9 = [53 x i8] c"Ikinci sayi birinci sayidan daha buyuk oldugu icin:\0A\00"
@.str.10 = [17 x i8] c" %2d + %2d = %d\0A\00"
@.str.11 = [53 x i8] c"Ikinci sayi birinci sayidan daha kucuk oldugu icin:\0A\00"
@.str.12 = [17 x i8] c" %2d - %2d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
%8 = call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %8, i32** %2
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
%14 = load i32*, i32** %2
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 10
%17 = add nsw i32 10, %16
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 10
%20 = add nsw i32 10, %19
%21 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %20)
%22 = load i32*, i32** %2
%23 = call i32 @fclose(i32* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%26 = call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i32* %26, i32** %2
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %13
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %13
%32 = load i32*, i32** %2
%33 = call i32 @fscanf(i32* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %3, i32* %4)
%34 = load i32, i32* %4
%35 = load i32, i32* %3
%36 = icmp sge i32 %34, %35
br i1 %36, label %37, label %45
37: ; preds = %31
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0))
%39 = load i32, i32* %3
%40 = load i32, i32* %4
%41 = load i32, i32* %3
%42 = load i32, i32* %4
%43 = add nsw i32 %41, %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %39, i32 %40, i32 %43)
br label %45
45: ; preds = %37, %31
%46 = load i32, i32* %4
%47 = load i32, i32* %3
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %57
49: ; preds = %45
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.11, i64 0, i64 0))
%51 = load i32, i32* %3
%52 = load i32, i32* %4
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = sub nsw i32 %53, %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %51, i32 %52, i32 %55)
br label %57
57: ; preds = %49, %45
%58 = load i32*, i32** %2
%59 = call i32 @fclose(i32* %58)
%60 = load i32, i32* %1
ret i32 %60
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [35 x i8] c"/home/delta/my_sandbox/sayilar.txt\00"
@.str.2 = [2 x i8] c"w\00"
@.str.4 = [7 x i8] c"%d %d\0A\00"
@.str.7 = [2 x i8] c"r\00"
@.str.8 = [6 x i8] c"%d %d\00"
@.str.10 = [17 x i8] c" %2d + %2d = %d\0A\00"
@.str.12 = [17 x i8] c" %2d - %2d = %d\0A\00"
@str = [34 x i8] c"Rastgele iki sayi dosyaya yazildi\00"
@str.13 = [4 x i8] c"...\00"
@str.14 = [52 x i8] c"Ikinci sayi birinci sayidan daha kucuk oldugu icin:\00"
@str.15 = [52 x i8] c"Ikinci sayi birinci sayidan daha buyuk oldugu icin:\00"
@str.17 = [17 x i8] c"dosya acilamadi!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 10
%14 = add nsw i32 %13, 10
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 10
%17 = add nsw i32 %16, 10
%18 = tail call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %14, i32 %17)
%19 = tail call i32 @fclose(i32* %6)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.13, i64 0, i64 0))
%22 = tail call i32* @fopen(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %27
24: ; preds = %11
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %11
%28 = bitcast i32* %1 to i8*
%29 = bitcast i32* %2 to i8*
%30 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %1, i32* %2)
%31 = load i32, i32* %2
%32 = load i32, i32* %1
%33 = icmp slt i32 %31, %32
br i1 %33, label %42, label %34
34: ; preds = %27
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.15, i64 0, i64 0))
%36 = load i32, i32* %1
%37 = load i32, i32* %2
%38 = add nsw i32 %37, %36
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %36, i32 %37, i32 %38)
%40 = load i32, i32* %2
%41 = load i32, i32* %1
br label %42
42: ; preds = %34, %27
%43 = phi i32 [ %41, %34 ], [ %32, %27 ]
%44 = phi i32 [ %40, %34 ], [ %31, %27 ]
%45 = icmp slt i32 %44, %43
br i1 %45, label %46, label %52
46: ; preds = %42
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.14, i64 0, i64 0))
%48 = load i32, i32* %1
%49 = load i32, i32* %2
%50 = sub nsw i32 %48, %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %48, i32 %49, i32 %50)
br label %52
52: ; preds = %46, %42
%53 = call i32 @fclose(i32* %22)
ret i32 0
}