#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*/ strcmp(char *, char *);
int /*<<< orphan*/ warnx(char *, char *);
int koptions(int *options, char *arg) {
  if (!strcmp(arg, "utf-8")) {
    *options |= 16;
    *options &= ~32;
  } else if (!strcmp(arg, "iso-8859-1")) {
    *options |= 32;
    *options &= ~16;
  } else if (!strcmp(arg, "us-ascii")) {
    *options &= ~(16 | 32);
  } else {
    warnx("-K %s: Bad argument", arg);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<koptions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1164 <koptions+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xffffffdf,%ecx
mov    %ecx,(%rax)
jmp    11e7 <koptions+0xc7>
mov    -0x18(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1198 <koptions+0x78>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
or     $0x20,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    %ecx,(%rax)
jmp    11e2 <koptions+0xc2>
mov    -0x18(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c1 <koptions+0xa1>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0xffffffcf,%ecx
mov    %ecx,(%rax)
jmp    11dd <koptions+0xbd>
mov    -0x18(%rbp),%rsi
lea    0xe4e(%rip),%rdi
call   1030 <warnx@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ee <koptions+0xce>
jmp    11e2 <koptions+0xc2>
jmp    11e7 <koptions+0xc7>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<koptions>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1176 <koptions+0x56>
lea    0xec2(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1181 <koptions+0x61>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     118f <koptions+0x6f>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <warnx@plt>
xor    %eax,%eax
jmp    1198 <koptions+0x78>
mov    (%r14),%eax
and    $0xffffffcf,%eax
or     $0x10,%eax
jmp    118a <koptions+0x6a>
mov    (%r14),%eax
and    $0xffffffcf,%eax
or     $0x20,%eax
mov    %eax,(%r14)
jmp    1193 <koptions+0x73>
andb   $0xcf,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [11 x i8] c"iso-8859-1\00"
@.str.2 = [9 x i8] c"us-ascii\00"
@.str.3 = [20 x i8] c"-K %s: Bad argument\00"
define i32 @koptions(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %2
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = or i32 %11, 16
store i32 %12, i32* %10
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = and i32 %14, -33
store i32 %15, i32* %13
br label %40
16: ; preds = %2
%17 = load i8*, i8** %5
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %27, label %20
20: ; preds = %16
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = or i32 %22, 32
store i32 %23, i32* %21
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = and i32 %25, -17
store i32 %26, i32* %24
br label %39
27: ; preds = %16
%28 = load i8*, i8** %5
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i32*, i32** %4
%33 = load i32, i32* %32
%34 = and i32 %33, -49
store i32 %34, i32* %32
br label %38
35: ; preds = %27
%36 = load i8*, i8** %5
%37 = call i32 @warnx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %36)
store i32 0, i32* %3
br label %41
38: ; preds = %31
br label %39
39: ; preds = %38, %20
br label %40
40: ; preds = %39, %9
store i32 1, i32* %3
br label %41
41: ; preds = %40, %35
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [6 x i8] c"utf-8\00"
@.str.1 = [11 x i8] c"iso-8859-1\00"
@.str.2 = [9 x i8] c"us-ascii\00"
@.str.3 = [20 x i8] c"-K %s: Bad argument\00"
define i32 @koptions(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* %0
%7 = and i32 %6, -49
%8 = or i32 %7, 16
store i32 %8, i32* %0
br label %24
9: ; preds = %2
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %0
%14 = and i32 %13, -49
%15 = or i32 %14, 32
store i32 %15, i32* %0
br label %24
16: ; preds = %9
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %0
%21 = and i32 %20, -49
store i32 %21, i32* %0
br label %24
22: ; preds = %16
%23 = tail call i32 @warnx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %24
24: ; preds = %5, %19, %12, %22
%25 = phi i32 [ 0, %22 ], [ 1, %12 ], [ 1, %19 ], [ 1, %5 ]
ret i32 %25
}