#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int delta_io() {
  int c = 3;
  do {
    system("clear");
    printf("Press 1 to code or 2 to decode\n");
    scanf("%d", &c);
  } while (c > 2);
  switch (c) {
  case 1:
    return 1;
    break;
  case 2:
    return 0;
    break;
  }
}


x86 assembly (clang, -O0):
<delta_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x8(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jg     113f <delta_io+0xf>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1196 <delta_io+0x66>
jmp    1185 <delta_io+0x55>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11a2 <delta_io+0x72>
jmp    11a9 <delta_io+0x79>
movl   $0x1,-0x4(%rbp)
jmp    11a9 <delta_io+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delta_io>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x3,0x4(%rsp)
lea    0xeb9(%rip),%r14
lea    0xebb(%rip),%r15
lea    0xeb1(%rip),%r12
lea    0x4(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    $0x2,%ecx
jg     1160 <delta_io+0x30>
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [32 x i8] c"Press 1 to code or 2 to decode\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @delta_io() {
%1 = alloca i32
%2 = alloca i32
store i32 3, i32* %2
br label %3
3: ; preds = %7, %0
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 2
br i1 %9, label %3, label %10
10: ; preds = %7
%11 = load i32, i32* %2
switch i32 %11, label %14 [
i32 1, label %12
i32 2, label %13
]
12: ; preds = %10
store i32 1, i32* %1
br label %14
13: ; preds = %10
store i32 0, i32* %1
br label %14
14: ; preds = %12, %13, %10
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [31 x i8] c"Press 1 to code or 2 to decode\00"
define i32 @delta_io() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 3, i32* %1
br label %3
3: ; preds = %3, %0
%4 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 2
br i1 %8, label %3, label %9
9: ; preds = %3
%10 = icmp eq i32 %7, 1
%11 = zext i1 %10 to i32
ret i32 %11
}