#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 */
char *get_str(char *, int);
scalar_t__ strlen(char const *);
char get_req_char(char *line, int column_number, int *ok) {
  if (column_number >= 0) {
    const char *str = get_str(line, column_number);
    if (str && strlen(str) > 0) {
      *ok = (!(0));
      return str[0];
    } else {
      *ok = (0);
      return '?';
    }
  } else {
    *ok = (0);
    return '?';
  }
}


x86 assembly (clang, -O0):
<get_req_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1196 <get_req_char+0x76>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <get_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1183 <get_req_char+0x63>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1183 <get_req_char+0x63>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    11a4 <get_req_char+0x84>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movb   $0x3f,-0x1(%rbp)
jmp    11a4 <get_req_char+0x84>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movb   $0x3f,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_req_char>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
test   %esi,%esi
js     1150 <get_req_char+0x30>
call   1040 <get_str@plt>
test   %rax,%rax
je     1150 <get_req_char+0x30>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    1150 <get_req_char+0x30>
movl   $0x1,(%r14)
mov    (%rbx),%al
jmp    1159 <get_req_char+0x39>
movl   $0x0,(%r14)
mov    $0x3f,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define signext i8 @get_req_char(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32, i32* %6
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i8* @get_str(i8* %12, i32 %13)
store i8* %14, i8** %8
%15 = load i8*, i8** %8
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %26
17: ; preds = %11
%18 = load i8*, i8** %8
%19 = call i64 @strlen(i8* %18)
%20 = icmp sgt i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i32*, i32** %7
store i32 1, i32* %22
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
store i8 %25, i8* %4
br label %30
26: ; preds = %17, %11
%27 = load i32*, i32** %7
store i32 0, i32* %27
store i8 63, i8* %4
br label %30
28: ; preds = %3
%29 = load i32*, i32** %7
store i32 0, i32* %29
store i8 63, i8* %4
br label %30
30: ; preds = %28, %26, %21
%31 = load i8, i8* %4
ret i8 %31
}

LLVM IR (-O2):
define signext i8 @get_req_char(i8* %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp sgt i32 %1, -1
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = tail call i8* @get_str(i8* %0, i32 %1)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = tail call i64 @strlen(i8* %6)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
store i32 1, i32* %2
%12 = load i8, i8* %6
br label %15
13: ; preds = %8, %5
store i32 0, i32* %2
br label %15
14: ; preds = %3
store i32 0, i32* %2
br label %15
15: ; preds = %11, %13, %14
%16 = phi i8 [ 63, %14 ], [ %12, %11 ], [ 63, %13 ]
ret i8 %16
}