#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 */
struct tsdev {
  int dummy;
};
struct ts_module_conf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_line_after(struct ts_module_conf *);
int /*<<< orphan*/ edit_params(struct ts_module_conf *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_conf(struct ts_module_conf *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove_line(struct ts_module_conf *);
int scanf(char *, int *);
int /*<<< orphan*/ ts_close(struct tsdev *);
struct ts_module_conf *ts_conf_get(struct tsdev *);
int ts_conf_set(struct ts_module_conf *);
int ts_reconfig(struct tsdev *);
int menu(struct tsdev *ts) {
  int choice;
  int ret = 0;
  struct ts_module_conf *conf = NULL;
  printf("tslib: edit the configuration file and loaded filters\n");
  do {
    printf("\n");
    printf("1. manually reload ts.conf\n");
    printf("2. show ts.conf modules\n");
    printf("3. add one module\n");
    printf("4. change module parameters\n");
    printf("5. remove one module\n");
    printf("6. Exit\n");
    ret = scanf("%d", &choice);
    if (ret <= 0) {
      perror("scanf");
      return -1;
    }
    switch (choice) {
    case 1:
      ret = ts_reconfig(ts);
      if (ret < 0)
        goto done;
      break;
    case 2:
      conf = ts_conf_get(ts);
      print_conf(conf);
      ret = ts_conf_set(conf);
      if (ret < 0)
        goto done;
      break;
    case 3:
      conf = ts_conf_get(ts);
      print_conf(conf);
      if (add_line_after(conf))
        goto done;
      print_conf(conf);
      ret = ts_conf_set(conf);
      if (ret < 0)
        goto done;
      ret = ts_reconfig(ts);
      if (ret < 0)
        goto done;
      break;
    case 4:
      conf = ts_conf_get(ts);
      print_conf(conf);
      edit_params(conf);
      print_conf(conf);
      ret = ts_conf_set(conf);
      if (ret < 0)
        goto done;
      ret = ts_reconfig(ts);
      if (ret < 0)
        goto done;
      break;
    case 5:
      conf = ts_conf_get(ts);
      print_conf(conf);
      remove_line(conf);
      print_conf(conf);
      ret = ts_conf_set(conf);
      if (ret < 0)
        goto done;
      ret = ts_reconfig(ts);
      if (ret < 0)
        goto done;
      break;
    case 6:
      printf("Goodbye\n");
      break;
    default:
      printf("Unknown choice.\n");
      break;
    }
  } while (choice != 6);
done:
  ts_close(ts);
  return ret;
}


x86 assembly (clang, -O0):
<menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
lea    0xf16(%rip),%rdi
call   1040 <printf@plt>
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1090 <scanf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     1260 <menu+0xb0>
lea    0xe87(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1456 <menu+0x2a6>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x5,%eax
ja     1427 <menu+0x277>
mov    -0x28(%rbp),%rax
lea    0xd80(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1050 <ts_reconfig@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12a4 <menu+0xf4>
jmp    1447 <menu+0x297>
jmp    1433 <menu+0x283>
mov    -0x10(%rbp),%rdi
call   1030 <ts_conf_get@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <ts_conf_set@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    12da <menu+0x12a>
jmp    1447 <menu+0x297>
jmp    1433 <menu+0x283>
mov    -0x10(%rbp),%rdi
call   1030 <ts_conf_get@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <add_line_after@plt>
cmp    $0x0,%eax
je     130c <menu+0x15c>
jmp    1447 <menu+0x297>
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <ts_conf_set@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1330 <menu+0x180>
jmp    1447 <menu+0x297>
mov    -0x10(%rbp),%rdi
call   1050 <ts_reconfig@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    134b <menu+0x19b>
jmp    1447 <menu+0x297>
jmp    1433 <menu+0x283>
mov    -0x10(%rbp),%rdi
call   1030 <ts_conf_get@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   10a0 <edit_params@plt>
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <ts_conf_set@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1393 <menu+0x1e3>
jmp    1447 <menu+0x297>
mov    -0x10(%rbp),%rdi
call   1050 <ts_reconfig@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13ae <menu+0x1fe>
jmp    1447 <menu+0x297>
jmp    1433 <menu+0x283>
mov    -0x10(%rbp),%rdi
call   1030 <ts_conf_get@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   1080 <remove_line@plt>
mov    -0x20(%rbp),%rdi
call   1070 <print_conf@plt>
mov    -0x20(%rbp),%rdi
call   10d0 <ts_conf_set@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13f6 <menu+0x246>
jmp    1447 <menu+0x297>
mov    -0x10(%rbp),%rdi
call   1050 <ts_reconfig@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1411 <menu+0x261>
jmp    1447 <menu+0x297>
jmp    1433 <menu+0x283>
lea    0xcbf(%rip),%rdi
call   1040 <printf@plt>
jmp    1433 <menu+0x283>
lea    0xcb7(%rip),%rdi
call   1040 <printf@plt>
jmp    1438 <menu+0x288>
cmpl   $0x6,-0x14(%rbp)
jne    11d7 <menu+0x27>
jmp    1447 <menu+0x297>
mov    -0x10(%rbp),%rdi
call   10c0 <ts_close@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe13(%rip),%r14
jmp    1206 <menu+0x46>
lea    0xee7(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x6,0x4(%rsp)
je     1330 <menu+0x170>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe40(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe61(%rip),%rdi
call   1040 <puts@plt>
lea    0xe71(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10a0 <scanf@plt>
test   %eax,%eax
jle    134a <menu+0x18a>
mov    %eax,%r13d
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     11ef <menu+0x2f>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
lea    0xe49(%rip),%rdi
jmp    *%rax
mov    %rbx,%rdi
call   1050 <ts_conf_get@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <print_conf@plt>
mov    %rbp,%rdi
call   10e0 <ts_conf_set@plt>
jmp    1320 <menu+0x160>
mov    %rbx,%rdi
call   1050 <ts_conf_get@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <print_conf@plt>
mov    %rbp,%rdi
call   1070 <add_line_after@plt>
test   %eax,%eax
je     1304 <menu+0x144>
jmp    1330 <menu+0x170>
mov    %rbx,%rdi
call   1050 <ts_conf_get@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <print_conf@plt>
mov    %rbp,%rdi
call   10b0 <edit_params@plt>
jmp    1304 <menu+0x144>
mov    %rbx,%rdi
call   1050 <ts_conf_get@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <print_conf@plt>
mov    %rbp,%rdi
call   1090 <remove_line@plt>
mov    %rbp,%rdi
call   1080 <print_conf@plt>
mov    %rbp,%rdi
call   10e0 <ts_conf_set@plt>
test   %eax,%eax
js     132d <menu+0x16d>
mov    %rbx,%rdi
call   1060 <ts_reconfig@plt>
mov    %eax,%r13d
test   %eax,%eax
jns    11fb <menu+0x3b>
jmp    1330 <menu+0x170>
mov    %eax,%r13d
mov    %rbx,%rdi
call   10d0 <ts_close@plt>
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcca(%rip),%rdi
call   10c0 <perror@plt>
mov    $0xffffffff,%r13d
jmp    1338 <menu+0x178>

LLVM IR (-O0):
%struct.tsdev = type { i32 }
%struct.ts_module_conf = type { i32 }
@.str = [55 x i8] c"tslib: edit the configuration file and loaded filters\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [28 x i8] c"1. manually reload ts.conf\0A\00"
@.str.3 = [25 x i8] c"2. show ts.conf modules\0A\00"
@.str.4 = [19 x i8] c"3. add one module\0A\00"
@.str.5 = [29 x i8] c"4. change module parameters\0A\00"
@.str.6 = [22 x i8] c"5. remove one module\0A\00"
@.str.7 = [9 x i8] c"6. Exit\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [6 x i8] c"scanf\00"
@.str.10 = [9 x i8] c"Goodbye\0A\00"
@.str.11 = [17 x i8] c"Unknown choice.\0A\00"
define i32 @menu(%struct.tsdev* %0) {
%2 = alloca i32
%3 = alloca %struct.tsdev*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.ts_module_conf*
store %struct.tsdev* %0, %struct.tsdev** %3
store i32 0, i32* %5
store %struct.ts_module_conf* null, %struct.ts_module_conf** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %112, %1
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %4)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp sle i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %8
%20 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %2
br label %120
21: ; preds = %8
%22 = load i32, i32* %4
switch i32 %22, label %109 [
i32 1, label %23
i32 2, label %30
i32 3, label %41
i32 4, label %65
i32 5, label %86
i32 6, label %107
]
23: ; preds = %21
%24 = load %struct.tsdev*, %struct.tsdev** %3
%25 = call i32 @ts_reconfig(%struct.tsdev* %24)
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %23
br label %116
29: ; preds = %23
br label %111
30: ; preds = %21
%31 = load %struct.tsdev*, %struct.tsdev** %3
%32 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %31)
store %struct.ts_module_conf* %32, %struct.ts_module_conf** %6
%33 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%34 = call i32 @print_conf(%struct.ts_module_conf* %33)
%35 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%36 = call i32 @ts_conf_set(%struct.ts_module_conf* %35)
store i32 %36, i32* %5
%37 = load i32, i32* %5
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %30
br label %116
40: ; preds = %30
br label %111
41: ; preds = %21
%42 = load %struct.tsdev*, %struct.tsdev** %3
%43 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %42)
store %struct.ts_module_conf* %43, %struct.ts_module_conf** %6
%44 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%45 = call i32 @print_conf(%struct.ts_module_conf* %44)
%46 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%47 = call i32 @add_line_after(%struct.ts_module_conf* %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %41
br label %116
50: ; preds = %41
%51 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%52 = call i32 @print_conf(%struct.ts_module_conf* %51)
%53 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%54 = call i32 @ts_conf_set(%struct.ts_module_conf* %53)
store i32 %54, i32* %5
%55 = load i32, i32* %5
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %50
br label %116
58: ; preds = %50
%59 = load %struct.tsdev*, %struct.tsdev** %3
%60 = call i32 @ts_reconfig(%struct.tsdev* %59)
store i32 %60, i32* %5
%61 = load i32, i32* %5
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %58
br label %116
64: ; preds = %58
br label %111
65: ; preds = %21
%66 = load %struct.tsdev*, %struct.tsdev** %3
%67 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %66)
store %struct.ts_module_conf* %67, %struct.ts_module_conf** %6
%68 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%69 = call i32 @print_conf(%struct.ts_module_conf* %68)
%70 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%71 = call i32 @edit_params(%struct.ts_module_conf* %70)
%72 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%73 = call i32 @print_conf(%struct.ts_module_conf* %72)
%74 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%75 = call i32 @ts_conf_set(%struct.ts_module_conf* %74)
store i32 %75, i32* %5
%76 = load i32, i32* %5
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %65
br label %116
79: ; preds = %65
%80 = load %struct.tsdev*, %struct.tsdev** %3
%81 = call i32 @ts_reconfig(%struct.tsdev* %80)
store i32 %81, i32* %5
%82 = load i32, i32* %5
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %79
br label %116
85: ; preds = %79
br label %111
86: ; preds = %21
%87 = load %struct.tsdev*, %struct.tsdev** %3
%88 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %87)
store %struct.ts_module_conf* %88, %struct.ts_module_conf** %6
%89 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%90 = call i32 @print_conf(%struct.ts_module_conf* %89)
%91 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%92 = call i32 @remove_line(%struct.ts_module_conf* %91)
%93 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%94 = call i32 @print_conf(%struct.ts_module_conf* %93)
%95 = load %struct.ts_module_conf*, %struct.ts_module_conf** %6
%96 = call i32 @ts_conf_set(%struct.ts_module_conf* %95)
store i32 %96, i32* %5
%97 = load i32, i32* %5
%98 = icmp slt i32 %97, 0
br i1 %98, label %99, label %100
99: ; preds = %86
br label %116
100: ; preds = %86
%101 = load %struct.tsdev*, %struct.tsdev** %3
%102 = call i32 @ts_reconfig(%struct.tsdev* %101)
store i32 %102, i32* %5
%103 = load i32, i32* %5
%104 = icmp slt i32 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %100
br label %116
106: ; preds = %100
br label %111
107: ; preds = %21
%108 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %111
109: ; preds = %21
%110 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %111
111: ; preds = %109, %107, %106, %85, %64, %40, %29
br label %112
112: ; preds = %111
%113 = load i32, i32* %4
%114 = icmp ne i32 %113, 6
br i1 %114, label %8, label %115
115: ; preds = %112
br label %116
116: ; preds = %115, %105, %99, %84, %78, %63, %57, %49, %39, %28
%117 = load %struct.tsdev*, %struct.tsdev** %3
%118 = call i32 @ts_close(%struct.tsdev* %117)
%119 = load i32, i32* %5
store i32 %119, i32* %2
br label %120
120: ; preds = %116, %19
%121 = load i32, i32* %2
ret i32 %121
}

LLVM IR (-O2):
%struct.tsdev = type { i32 }
%struct.ts_module_conf = type { i32 }
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [6 x i8] c"scanf\00"
@str = [54 x i8] c"tslib: edit the configuration file and loaded filters\00"
@str.12 = [27 x i8] c"1. manually reload ts.conf\00"
@str.13 = [24 x i8] c"2. show ts.conf modules\00"
@str.14 = [18 x i8] c"3. add one module\00"
@str.15 = [28 x i8] c"4. change module parameters\00"
@str.16 = [21 x i8] c"5. remove one module\00"
@str.17 = [8 x i8] c"6. Exit\00"
@str.18 = [8 x i8] c"Goodbye\00"
@str.19 = [16 x i8] c"Unknown choice.\00"
define i32 @menu(%struct.tsdev* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %63, %1
%6 = call i32 @putchar(i32 10)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.12, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.13, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.14, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.16, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.17, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %70
17: ; preds = %5
%18 = load i32, i32* %2
switch i32 %18, label %59 [
i32 1, label %19
i32 2, label %22
i32 3, label %27
i32 4, label %39
i32 5, label %49
i32 6, label %60
]
19: ; preds = %17
%20 = call i32 @ts_reconfig(%struct.tsdev* %0)
%21 = icmp slt i32 %20, 0
br i1 %21, label %67, label %63
22: ; preds = %17
%23 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %0)
%24 = call i32 @print_conf(%struct.ts_module_conf* %23)
%25 = call i32 @ts_conf_set(%struct.ts_module_conf* %23)
%26 = icmp slt i32 %25, 0
br i1 %26, label %67, label %63
27: ; preds = %17
%28 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %0)
%29 = call i32 @print_conf(%struct.ts_module_conf* %28)
%30 = call i32 @add_line_after(%struct.ts_module_conf* %28)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %67
32: ; preds = %27
%33 = call i32 @print_conf(%struct.ts_module_conf* %28)
%34 = call i32 @ts_conf_set(%struct.ts_module_conf* %28)
%35 = icmp slt i32 %34, 0
br i1 %35, label %67, label %36
36: ; preds = %32
%37 = call i32 @ts_reconfig(%struct.tsdev* %0)
%38 = icmp slt i32 %37, 0
br i1 %38, label %67, label %63
39: ; preds = %17
%40 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %0)
%41 = call i32 @print_conf(%struct.ts_module_conf* %40)
%42 = call i32 @edit_params(%struct.ts_module_conf* %40)
%43 = call i32 @print_conf(%struct.ts_module_conf* %40)
%44 = call i32 @ts_conf_set(%struct.ts_module_conf* %40)
%45 = icmp slt i32 %44, 0
br i1 %45, label %67, label %46
46: ; preds = %39
%47 = call i32 @ts_reconfig(%struct.tsdev* %0)
%48 = icmp slt i32 %47, 0
br i1 %48, label %67, label %63
49: ; preds = %17
%50 = call %struct.ts_module_conf* @ts_conf_get(%struct.tsdev* %0)
%51 = call i32 @print_conf(%struct.ts_module_conf* %50)
%52 = call i32 @remove_line(%struct.ts_module_conf* %50)
%53 = call i32 @print_conf(%struct.ts_module_conf* %50)
%54 = call i32 @ts_conf_set(%struct.ts_module_conf* %50)
%55 = icmp slt i32 %54, 0
br i1 %55, label %67, label %56
56: ; preds = %49
%57 = call i32 @ts_reconfig(%struct.tsdev* %0)
%58 = icmp slt i32 %57, 0
br i1 %58, label %67, label %63
59: ; preds = %17
br label %60
60: ; preds = %17, %59
%61 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.19, i64 0, i64 0), %59 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.18, i64 0, i64 0), %17 ]
%62 = call i32 @puts(i8* dereferenceable(1) %61)
br label %63
63: ; preds = %60, %19, %22, %36, %46, %56
%64 = phi i32 [ %57, %56 ], [ %47, %46 ], [ %37, %36 ], [ %25, %22 ], [ %20, %19 ], [ %13, %60 ]
%65 = load i32, i32* %2
%66 = icmp eq i32 %65, 6
br i1 %66, label %67, label %5
67: ; preds = %63, %56, %49, %46, %39, %36, %32, %27, %22, %19
%68 = phi i32 [ %64, %63 ], [ %54, %49 ], [ %57, %56 ], [ %44, %39 ], [ %47, %46 ], [ %13, %27 ], [ %34, %32 ], [ %37, %36 ], [ %25, %22 ], [ %20, %19 ]
%69 = call i32 @ts_close(%struct.tsdev* %0)
br label %70
70: ; preds = %67, %15
%71 = phi i32 [ -1, %15 ], [ %68, %67 ]
ret i32 %71
}