#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 */
scalar_t__ getsubopt(char **, char *const *, char **);
int main(void) {
  char buf[] = "k=v";
  char *options = buf;
  char token0[] = "k";
  char *const tokens[] = {token0, NULL};
  char *value = NULL;
  return !(getsubopt(&options, tokens, &value) == 0 && value == buf + 2 &&
           options == buf + 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0xecd(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x12(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
lea    -0x30(%rbp),%rsi
lea    -0x10(%rbp),%rdi
lea    -0x38(%rbp),%rdx
call   1030 <getsubopt@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x39(%rbp)
jne    11a5 <main+0x95>
mov    -0x38(%rbp),%rcx
lea    -0x8(%rbp),%rdx
add    $0x2,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x39(%rbp)
jne    11a5 <main+0x95>
mov    -0x10(%rbp),%rax
lea    -0x8(%rbp),%rcx
add    $0x3,%rcx
cmp    %rcx,%rax
sete   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movl   $0x763d6b,0x8(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x18(%rsp)
movw   $0x6b,0xe(%rsp)
lea    0xe(%rsp),%rax
mov    %rax,0x20(%rsp)
movq   $0x0,0x28(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x18(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1030 <getsubopt@plt>
lea    0xa(%rsp),%rcx
xor    0x10(%rsp),%rcx
lea    0xb(%rsp),%rdx
xor    0x18(%rsp),%rdx
or     %rax,%rcx
xor    %eax,%eax
or     %rcx,%rdx
setne  %al
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.buf = [4 x i8] c"k=v\00"
@__const.main.token0 = [2 x i8] c"k\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i8*
%4 = alloca [2 x i8]
%5 = alloca [2 x i8*]
%6 = alloca i8*
store i32 0, i32* %1
%7 = bitcast [4 x i8]* %2 to i8*
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
store i8* %8, i8** %3
%9 = bitcast [2 x i8]* %4 to i8*
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 0
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
store i8* %11, i8** %10
%12 = getelementptr inbounds i8*, i8** %10, i64 1
store i8* null, i8** %12
store i8* null, i8** %6
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 0
%14 = call i64 @getsubopt(i8** %3, i8** %13, i8** %6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %0
%17 = load i8*, i8** %6
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = icmp eq i8* %17, %19
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds i8, i8* %23, i64 3
%25 = icmp eq i8* %22, %24
br label %26
26: ; preds = %21, %16, %0
%27 = phi i1 [ false, %16 ], [ false, %0 ], [ %25, %21 ]
%28 = xor i1 %27, true
%29 = zext i1 %28 to i32
ret i32 %29
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i16
%4 = alloca [2 x i8*]
%5 = alloca i8*
%6 = bitcast i32* %1 to i8*
store i32 7748971, i32* %1
%7 = bitcast i8** %2 to i8*
%8 = bitcast i8** %2 to i32**
store i32* %1, i32** %8
%9 = bitcast i16* %3 to i8*
store i16 107, i16* %3
%10 = bitcast [2 x i8*]* %4 to i8*
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%12 = bitcast [2 x i8*]* %4 to i16**
store i16* %3, i16** %12
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 1
store i8* null, i8** %13
%14 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%15 = call i64 @getsubopt(i8** %2, i8** %11, i8** %5)
%16 = icmp ne i64 %15, 0
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %6, i64 2
%19 = icmp ne i8* %17, %18
%20 = select i1 %16, i1 true, i1 %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %6, i64 3
%23 = icmp ne i8* %21, %22
%24 = select i1 %20, i1 true, i1 %23
%25 = zext i1 %24 to i32
ret i32 %25
}