#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ system(char *);
void dev_mode() {
  char dev_mode_secim = '\0';
  while (dev_mode_secim != 'B') {
    system("clear");
    printf("DEVELOPER MODE\n--------------\n");
    printf("[A] TEST 1\n");
    printf("\n[B] ANA MENU'YA GERI DON\n");
    dev_mode_secim = '\0';
    printf("\n");
    printf("Seciminiz: ");
    scanf(" %c", &dev_mode_secim);
    switch (dev_mode_secim) {
    case 'A': {
      printf("Test 1\n");
    } break;
    case 'B': {
      printf("DUYURU: Ana menu'ya geri donuyorum\n");
      fflush(stdout);
      system("sleep 2");
    } break;
    default: {
      printf("DUYURU: HATALI SECIM!!!\n");
      fflush(stdout);
      system("sleep 2");
    }
    }
  }
}


x86 assembly (clang, -O0):
<dev_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x42,%eax
je     1242 <dev_mode+0x102>
lea    0xea0(%rip),%rdi
call   1030 <system@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
movb   $0x0,-0x1(%rbp)
lea    0xf13(%rip),%rdi
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x41,%eax
je     11db <dev_mode+0x9b>
jmp    11ca <dev_mode+0x8a>
mov    -0x8(%rbp),%eax
sub    $0x42,%eax
je     11ec <dev_mode+0xac>
jmp    1217 <dev_mode+0xd7>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
jmp    123d <dev_mode+0xfd>
lea    0xe71(%rip),%rdi
call   1040 <printf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe7b(%rip),%rdi
call   1030 <system@plt>
jmp    123d <dev_mode+0xfd>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe50(%rip),%rdi
call   1030 <system@plt>
jmp    114c <dev_mode+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_mode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x0,0x7(%rsp)
lea    0xea7(%rip),%r15
lea    0xebe(%rip),%r12
lea    0xec2(%rip),%r13
lea    0xe7a(%rip),%rbx
lea    0xe7f(%rip),%rbp
lea    0x7(%rsp),%r14
jmp    11cd <dev_mode+0x6d>
nopw   0x0(%rax,%rax,1)
lea    0xee4(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
lea    0xe55(%rip),%rdi
call   1050 <system@plt>
cmpb   $0x42,0x7(%rsp)
je     124c <dev_mode+0xec>
lea    0xe2c(%rip),%rdi
call   1050 <system@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
movb   $0x0,0x7(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <scanf@plt>
movsbl 0x7(%rsp),%eax
cmp    $0x42,%eax
je     1240 <dev_mode+0xe0>
cmp    $0x41,%eax
jne    11a0 <dev_mode+0x40>
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
cmpb   $0x42,0x7(%rsp)
jne    11cd <dev_mode+0x6d>
jmp    124c <dev_mode+0xec>
nopl   0x0(%rax,%rax,1)
lea    0xe1a(%rip),%rdi
jmp    11a7 <dev_mode+0x47>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [31 x i8] c"DEVELOPER MODE\0A--------------\0A\00"
@.str.2 = [12 x i8] c"[A] TEST 1\0A\00"
@.str.3 = [27 x i8] c"\0A[B] ANA MENU'YA GERI DON\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [12 x i8] c"Seciminiz: \00"
@.str.6 = [4 x i8] c" %c\00"
@.str.7 = [8 x i8] c"Test 1\0A\00"
@.str.8 = [36 x i8] c"DUYURU: Ana menu'ya geri donuyorum\0A\00"
@stdout = global i32 0
@.str.9 = [8 x i8] c"sleep 2\00"
@.str.10 = [25 x i8] c"DUYURU: HATALI SECIM!!!\0A\00"
define void @dev_mode() {
%1 = alloca i8
store i8 0, i8* %1
br label %2
2: ; preds = %28, %0
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 66
br i1 %5, label %6, label %29
6: ; preds = %2
%7 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i8 0, i8* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%14 = load i8, i8* %1
%15 = sext i8 %14 to i32
switch i32 %15, label %23 [
i32 65, label %16
i32 66, label %18
]
16: ; preds = %6
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %28
18: ; preds = %6
%19 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
%20 = load i32, i32* @stdout
%21 = call i32 @fflush(i32 %20)
%22 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %28
23: ; preds = %6
%24 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
%25 = load i32, i32* @stdout
%26 = call i32 @fflush(i32 %25)
%27 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %28
28: ; preds = %23, %18, %16
br label %2
29: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.5 = [12 x i8] c"Seciminiz: \00"
@.str.6 = [4 x i8] c" %c\00"
@stdout = global i32 0
@.str.9 = [8 x i8] c"sleep 2\00"
@str = [30 x i8] c"DEVELOPER MODE\0A--------------\00"
@str.11 = [11 x i8] c"[A] TEST 1\00"
@str.12 = [26 x i8] c"\0A[B] ANA MENU'YA GERI DON\00"
@str.13 = [35 x i8] c"DUYURU: Ana menu'ya geri donuyorum\00"
@str.14 = [7 x i8] c"Test 1\00"
@str.15 = [24 x i8] c"DUYURU: HATALI SECIM!!!\00"
define void @dev_mode() {
%1 = alloca i8
store i8 0, i8* %1
br label %2
2: ; preds = %0, %24
%3 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.11, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.12, i64 0, i64 0))
store i8 0, i8* %1
%7 = call i32 @putchar(i32 10)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %1)
%10 = load i8, i8* %1
%11 = sext i8 %10 to i32
switch i32 %11, label %19 [
i32 65, label %12
i32 66, label %14
]
12: ; preds = %2
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.14, i64 0, i64 0))
br label %24
14: ; preds = %2
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.13, i64 0, i64 0))
%16 = load i32, i32* @stdout
%17 = call i32 @fflush(i32 %16)
%18 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %24
19: ; preds = %2
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.15, i64 0, i64 0))
%21 = load i32, i32* @stdout
%22 = call i32 @fflush(i32 %21)
%23 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %24
24: ; preds = %19, %14, %12
%25 = load i8, i8* %1
%26 = icmp eq i8 %25, 66
br i1 %26, label %27, label %2
27: ; preds = %24
ret void
}