#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 atoi(char const *);
char *get_str(char *, int);
scalar_t__ strlen(char const *);
int get_req_int(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 atoi(str);
    } else {
      *ok = (0);
      return 0;
    }
  } else {
    *ok = (0);
    return 0;
  }
}


x86 assembly (clang, -O0):
<get_req_int>:
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     11ac <get_req_int+0x7c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <get_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1196 <get_req_int+0x66>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1196 <get_req_int+0x66>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    11bd <get_req_int+0x8d>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11bd <get_req_int+0x8d>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_req_int>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
test   %esi,%esi
js     116b <get_req_int+0x3b>
call   1040 <get_str@plt>
test   %rax,%rax
je     116b <get_req_int+0x3b>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    116b <get_req_int+0x3b>
movl   $0x1,(%r14)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <atoi@plt>
movl   $0x0,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @get_req_int(i8* %0, i32 %1, i32* %2) {
%4 = alloca i32
%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 %27
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 %25
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 %25
21: ; preds = %17
%22 = load i32*, i32** %7
store i32 1, i32* %22
%23 = load i8*, i8** %8
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %4
br label %29
25: ; preds = %17, %11
%26 = load i32*, i32** %7
store i32 0, i32* %26
store i32 0, i32* %4
br label %29
27: ; preds = %3
%28 = load i32*, i32** %7
store i32 0, i32* %28
store i32 0, i32* %4
br label %29
29: ; preds = %27, %25, %21
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @get_req_int(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 = tail call i32 @atoi(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 i32 [ 0, %14 ], [ %12, %11 ], [ 0, %13 ]
ret i32 %16
}