#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 */
#define EX_DATAERR 129
int /*<<< orphan*/ EX_OSERR;
#define EX_UNAVAILABLE 128
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int ofwo_action(char *, char *);
char *strdup(char *);
char *strrchr(char *, char);
int /*<<< orphan*/ warnx(char *, char *, ...);
int action(char *line) {
  int rv;
  char *keyword, *arg;
  keyword = strdup(line);
  if (keyword == NULL)
    err(EX_OSERR, "malloc() failed");
  if ((arg = strrchr(keyword, '=')) != NULL)
    *arg++ = '\0';
  switch (rv = ofwo_action(keyword, arg)) {
  case EX_UNAVAILABLE:
    warnx("nothing available for '%s'.", keyword);
    break;
  case EX_DATAERR:
    warnx("invalid value '%s' for '%s'.", arg, keyword);
    break;
  }
  free(keyword);
  return (rv);
}


x86 assembly (clang, -O0):
<action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <strdup@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1199 <action+0x39>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
call   1060 <err@plt>
mov    -0x18(%rbp),%rdi
mov    $0x3d,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11c7 <action+0x67>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <ofwo_action@plt>
mov    %eax,-0xc(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x24(%rbp)
sub    $0x80,%eax
je     11ff <action+0x9f>
jmp    11ec <action+0x8c>
mov    -0x24(%rbp),%eax
sub    $0x81,%eax
je     1216 <action+0xb6>
jmp    122c <action+0xcc>
mov    -0x18(%rbp),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <warnx@plt>
jmp    122c <action+0xcc>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <warnx@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<action>:
push   %rbp
push   %r14
push   %rbx
call   1080 <strdup@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1186 <action+0x26>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1060 <err@plt>
mov    %r14,%rdi
mov    $0x3d,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     11a4 <action+0x44>
mov    %rax,%rbx
add    $0x1,%rbx
movb   $0x0,(%rax)
jmp    11a6 <action+0x46>
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <ofwo_action@plt>
mov    %eax,%ebp
cmp    $0x81,%eax
je     11d5 <action+0x75>
cmp    $0x80,%ebp
jne    11e9 <action+0x89>
lea    0xe47(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <warnx@plt>
jmp    11e9 <action+0x89>
lea    0xe50(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <warnx@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@EX_OSERR = global i32 0
@.str = [16 x i8] c"malloc() failed\00"
@.str.1 = [28 x i8] c"nothing available for '%s'.\00"
@.str.2 = [29 x i8] c"invalid value '%s' for '%s'.\00"
define i32 @action(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* @EX_OSERR
%12 = call i32 @err(i32 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %1
%14 = load i8*, i8** %4
%15 = call i8* @strrchr(i8* %14, i8 signext 61)
store i8* %15, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %5
store i8 0, i8* %18
br label %20
20: ; preds = %17, %13
%21 = load i8*, i8** %4
%22 = load i8*, i8** %5
%23 = call i32 @ofwo_action(i8* %21, i8* %22)
store i32 %23, i32* %3
switch i32 %23, label %31 [
i32 128, label %24
i32 129, label %27
]
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %31
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = load i8*, i8** %4
%30 = call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %28, i8* %29)
br label %31
31: ; preds = %20, %27, %24
%32 = load i8*, i8** %4
%33 = call i32 @free(i8* %32)
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@EX_OSERR = global i32 0
@.str = [16 x i8] c"malloc() failed\00"
@.str.1 = [28 x i8] c"nothing available for '%s'.\00"
@.str.2 = [29 x i8] c"invalid value '%s' for '%s'.\00"
define i32 @action(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @EX_OSERR
%6 = tail call i32 @err(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %4, %1
%8 = tail call i8* @strrchr(i8* dereferenceable(1) %2, i8 signext 61)
%9 = icmp eq i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %8
br label %12
12: ; preds = %10, %7
%13 = phi i8* [ %11, %10 ], [ null, %7 ]
%14 = tail call i32 @ofwo_action(i8* %2, i8* %13)
switch i32 %14, label %19 [
i32 128, label %15
i32 129, label %17
]
15: ; preds = %12
%16 = tail call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %19
17: ; preds = %12
%18 = tail call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %2)
br label %19
19: ; preds = %12, %17, %15
%20 = tail call i32 @free(i8* %2)
ret i32 %14
}