#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*/ config_read();
int /*<<< orphan*/ config_write();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ menu();
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int choice;
  for (;;) {
    menu();
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      config_write();
      break;
    case 2:
      config_read();
      break;
    case 3:
      exit(0);
    default:
      exit(0);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <menu@plt>
lea    0xe9a(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     11a5 <main+0x55>
jmp    1183 <main+0x33>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11b1 <main+0x61>
jmp    1194 <main+0x44>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
je     11bd <main+0x6d>
jmp    11c4 <main+0x74>
mov    $0x0,%al
call   1060 <config_write@plt>
jmp    11cb <main+0x7b>
mov    $0x0,%al
call   1040 <config_read@plt>
jmp    11cb <main+0x7b>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %edi,%edi
call   1070 <exit@plt>
jmp    1158 <main+0x8>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%r14
lea    0x4(%rsp),%rbx
jmp    1177 <main+0x27>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <config_write@plt>
xor    %eax,%eax
call   1030 <menu@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     1170 <main+0x20>
cmp    $0x2,%eax
jne    11a0 <main+0x50>
xor    %eax,%eax
call   1040 <config_read@plt>
jmp    1177 <main+0x27>
cmp    $0x3,%eax
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
br label %2
2: ; preds = %14, %0
%3 = call i32 (...) @menu()
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %12 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
6: ; preds = %2
%7 = call i32 (...) @config_write()
br label %14
8: ; preds = %2
%9 = call i32 (...) @config_read()
br label %14
10: ; preds = %2
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %8, %6
br label %2
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %11, %0
%4 = call i32 (...) @menu()
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %14 [
i32 1, label %7
i32 2, label %9
i32 3, label %12
]
7: ; preds = %3
%8 = call i32 (...) @config_write()
br label %11
9: ; preds = %3
%10 = call i32 (...) @config_read()
br label %11
11: ; preds = %9, %7
br label %3
12: ; preds = %3
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %3
%15 = call i32 @exit(i32 0)
unreachable
}