#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__ strcmp(char *, char const *);
char *core_command_get_argument_value(int argc, char **argv,
                                      const char *argument) {
  int i;
  char *value;
  value = NULL;
  for (i = 0; i < argc; i++) {
    if (strcmp(argv[i], argument) == 0 && i + 1 < argc) {
      value = argv[i + 1];
      break;
    }
  }
  return value;
}


x86 assembly (clang, -O0):
<core_command_get_argument_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1199 <core_command_get_argument_value+0x89>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1186 <core_command_get_argument_value+0x76>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cmp    -0x4(%rbp),%eax
jge    1186 <core_command_get_argument_value+0x76>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
jmp    1199 <core_command_get_argument_value+0x89>
jmp    118b <core_command_get_argument_value+0x7b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1132 <core_command_get_argument_value+0x22>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<core_command_get_argument_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1170 <core_command_get_argument_value+0x60>
mov    %rdx,%r15
mov    %rsi,%r13
mov    %edi,%r12d
mov    %r12,%rbx
neg    %rbx
mov    $0x1,%ebp
xor    %r14d,%r14d
jmp    1152 <core_command_get_argument_value+0x42>
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rax
add    $0x1,%rax
add    $0x1,%rbp
cmp    $0x1,%rax
je     1173 <core_command_get_argument_value+0x63>
mov    -0x8(%r13,%rbp,8),%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1140 <core_command_get_argument_value+0x30>
cmp    %r12,%rbp
jae    1140 <core_command_get_argument_value+0x30>
mov    0x0(%r13,%rbp,8),%r14
jmp    1173 <core_command_get_argument_value+0x63>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @core_command_get_argument_value(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
store i8* null, i8** %8
store i32 0, i32* %7
br label %9
9: ; preds = %35, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %38
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = load i8*, i8** %6
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %13
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %34
27: ; preds = %22
%28 = load i8**, i8*** %5
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %28, i64 %31
%33 = load i8*, i8** %32
store i8* %33, i8** %8
br label %38
34: ; preds = %22, %13
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %9
38: ; preds = %27, %9
%39 = load i8*, i8** %8
ret i8* %39
}

LLVM IR (-O2):
define i8* @core_command_get_argument_value(i32 %0, i8** nocapture %1, i8* %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %23
5: ; preds = %3
%6 = zext i32 %0 to i64
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %5, %21
%9 = phi i64 [ 0, %5 ], [ %14, %21 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i64 @strcmp(i8* %11, i8* %2)
%13 = icmp eq i64 %12, 0
%14 = add nuw nsw i64 %9, 1
%15 = icmp ult i64 %14, %6
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %17, label %21
17: ; preds = %8
%18 = and i64 %14, 4294967295
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
br label %23
21: ; preds = %8
%22 = icmp eq i64 %14, %7
br i1 %22, label %23, label %8
23: ; preds = %21, %3, %17
%24 = phi i8* [ %20, %17 ], [ null, %3 ], [ null, %21 ]
ret i8* %24
}