#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, char const *);
int handler(int lineno, int flag, const char *section, const char *key,
            const char *value) {
  if (flag == 1)
    printf("    %4d:s:[%s]\n", lineno, section);
  else if (flag == 2) {
    printf("    %4d:k:[%s]\n", lineno, key);
    printf("    %4d:v:[%s]\n", lineno, value);
  }
  return 0;
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    114c <handler+0x3c>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <handler+0x71>
cmpl   $0x2,-0x8(%rbp)
jne    117c <handler+0x6c>
mov    -0x4(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <handler+0x71>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x2,%esi
je     112b <handler+0x1b>
cmp    $0x1,%esi
jne    1150 <handler+0x40>
lea    0xed9(%rip),%rdi
mov    %ebx,%esi
jmp    114b <handler+0x3b>
mov    %r8,%r14
lea    0xedb(%rip),%rdi
mov    %ebx,%esi
mov    %rcx,%rdx
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c" %4d:s:[%s]\0A\00"
@.str.1 = [16 x i8] c" %4d:k:[%s]\0A\00"
@.str.2 = [16 x i8] c" %4d:v:[%s]\0A\00"
define i32 @handler(i32 %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %17
13: ; preds = %5
%14 = load i32, i32* %6
%15 = load i8*, i8** %8
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %15)
br label %28
17: ; preds = %5
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %6
%22 = load i8*, i8** %9
%23 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %22)
%24 = load i32, i32* %6
%25 = load i8*, i8** %10
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %24, i8* %25)
br label %27
27: ; preds = %20, %17
br label %28
28: ; preds = %27, %13
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c" %4d:s:[%s]\0A\00"
@.str.1 = [16 x i8] c" %4d:k:[%s]\0A\00"
@.str.2 = [16 x i8] c" %4d:v:[%s]\0A\00"
define i32 @handler(i32 %0, i32 %1, i8* %2, i8* %3, i8* %4) {
switch i32 %1, label %11 [
i32 1, label %6
i32 2, label %8
]
6: ; preds = %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %2)
br label %11
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8* %3)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %0, i8* %4)
br label %11
11: ; preds = %5, %8, %6
ret i32 0
}