#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*/ ParseActionLine(char *const);
int /*<<< orphan*/ ParseCalibrationLine(char *const);
int /*<<< orphan*/ ParseGeneralLine(char *const);
int /*<<< orphan*/ Print(int /*<<< orphan*/, char *, char *const);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *const, char *);
void ParseLine(char *const command, int *section) {
  if (strcmp(command, "[general]") == 0) {
    *section = 1;
  } else if (strcmp(command, "[calibration]") == 0) {
    *section = 2;
  } else if (strcmp(command, "[actions]") == 0) {
    *section = 3;
  } else if (*section == 0) {
    Print(stderr, "exit: error: no section started in configfile: ", command);
    exit(1);
  } else {
    switch (*section) {
    case 1:
      ParseGeneralLine(command);
      break;
    case 2:
      ParseCalibrationLine(command);
      break;
    case 3:
      ParseActionLine(command);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<ParseLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1199 <ParseLine+0x39>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    128d <ParseLine+0x12d>
mov    -0x8(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c2 <ParseLine+0x62>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    1288 <ParseLine+0x128>
mov    -0x8(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11eb <ParseLine+0x8b>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
jmp    1283 <ParseLine+0x123>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    121b <ParseLine+0xbb>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe16(%rip),%rsi
call   1070 <Print@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1254 <ParseLine+0xf4>
jmp    1232 <ParseLine+0xd2>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1262 <ParseLine+0x102>
jmp    1243 <ParseLine+0xe3>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1270 <ParseLine+0x110>
jmp    1279 <ParseLine+0x119>
mov    -0x8(%rbp),%rdi
call   1050 <ParseGeneralLine@plt>
jmp    1279 <ParseLine+0x119>
mov    -0x8(%rbp),%rdi
call   1030 <ParseCalibrationLine@plt>
jmp    1279 <ParseLine+0x119>
mov    -0x8(%rbp),%rdi
call   1060 <ParseActionLine@plt>
jmp    127e <ParseLine+0x11e>
jmp    1283 <ParseLine+0x123>
jmp    1288 <ParseLine+0x128>
jmp    128d <ParseLine+0x12d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseLine>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11cb <ParseLine+0x6b>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11d4 <ParseLine+0x74>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11dd <ParseLine+0x7d>
mov    (%r14),%eax
cmp    $0x3,%rax
ja     11e4 <ParseLine+0x84>
lea    0xe4d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <ParseGeneralLine@plt>
movl   $0x1,(%r14)
jmp    11e4 <ParseLine+0x84>
movl   $0x2,(%r14)
jmp    11e4 <ParseLine+0x84>
movl   $0x3,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <ParseCalibrationLine@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <ParseActionLine@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
mov    %rbx,%rdx
call   1070 <Print@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"[general]\00"
@.str.1 = [14 x i8] c"[calibration]\00"
@.str.2 = [10 x i8] c"[actions]\00"
@stderr = global i32 0
@.str.3 = [48 x i8] c"exit: error: no section started in configfile: \00"
define void @ParseLine(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32*, i32** %4
store i32 1, i32* %9
br label %47
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32*, i32** %4
store i32 2, i32* %15
br label %46
16: ; preds = %10
%17 = load i8*, i8** %3
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32*, i32** %4
store i32 3, i32* %21
br label %45
22: ; preds = %16
%23 = load i32*, i32** %4
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %3
%29 = call i32 @Print(i32 %27, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %22
%32 = load i32*, i32** %4
%33 = load i32, i32* %32
switch i32 %33, label %43 [
i32 1, label %34
i32 2, label %37
i32 3, label %40
]
34: ; preds = %31
%35 = load i8*, i8** %3
%36 = call i32 @ParseGeneralLine(i8* %35)
br label %43
37: ; preds = %31
%38 = load i8*, i8** %3
%39 = call i32 @ParseCalibrationLine(i8* %38)
br label %43
40: ; preds = %31
%41 = load i8*, i8** %3
%42 = call i32 @ParseActionLine(i8* %41)
br label %43
43: ; preds = %31, %40, %37, %34
br label %44
44: ; preds = %43
br label %45
45: ; preds = %44, %20
br label %46
46: ; preds = %45, %14
br label %47
47: ; preds = %46, %8
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"[general]\00"
@.str.1 = [14 x i8] c"[calibration]\00"
@.str.2 = [10 x i8] c"[actions]\00"
@stderr = global i32 0
@.str.3 = [48 x i8] c"exit: error: no section started in configfile: \00"
define void @ParseLine(i8* %0, i32* nocapture %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
store i32 1, i32* %1
br label %26
6: ; preds = %2
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 2, i32* %1
br label %26
10: ; preds = %6
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 3, i32* %1
br label %26
14: ; preds = %10
%15 = load i32, i32* %1
switch i32 %15, label %26 [
i32 0, label %16
i32 1, label %20
i32 2, label %22
i32 3, label %24
]
16: ; preds = %14
%17 = load i32, i32* @stderr
%18 = tail call i32 @Print(i32 %17, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %14
%21 = tail call i32 @ParseGeneralLine(i8* %0)
br label %26
22: ; preds = %14
%23 = tail call i32 @ParseCalibrationLine(i8* %0)
br label %26
24: ; preds = %14
%25 = tail call i32 @ParseActionLine(i8* %0)
br label %26
26: ; preds = %14, %9, %24, %22, %20, %13, %5
ret void
}