#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 *);
scalar_t__ strcmp(char *, char *);
int cb_get_next_id(void *id, int argc, char **argv, char **column_name) {
  for (int i = 0; i < argc; i++) {
    if (strcmp(column_name[i], "seq") == 0) {
      (*(int *)id) = atoi(argv[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<cb_get_next_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1198 <cb_get_next_id+0x78>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xea3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1185 <cb_get_next_id+0x65>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    118a <cb_get_next_id+0x6a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113e <cb_get_next_id+0x1e>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cb_get_next_id>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1179 <cb_get_next_id+0x59>
mov    %rcx,%r13
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%ebx
xor    %ebp,%ebp
lea    0xebd(%rip),%r12
jmp    1159 <cb_get_next_id+0x39>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1179 <cb_get_next_id+0x59>
mov    0x0(%r13,%rbp,8),%rdi
mov    %r12,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1150 <cb_get_next_id+0x30>
mov    (%r14,%rbp,8),%rdi
call   1040 <atoi@plt>
mov    %eax,(%r15)
jmp    1150 <cb_get_next_id+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"seq\00"
define i32 @cb_get_next_id(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
store i32 0, i32* %9
br label %10
10: ; preds = %32, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load i8**, i8*** %8
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %14
%23 = load i8**, i8*** %7
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
%29 = load i8*, i8** %5
%30 = bitcast i8* %29 to i32*
store i32 %28, i32* %30
br label %31
31: ; preds = %22, %14
br label %32
32: ; preds = %31
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %10
35: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"seq\00"
define i32 @cb_get_next_id(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i8** nocapture %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = bitcast i8* %0 to i32*
%8 = zext i32 %1 to i64
br label %10
9: ; preds = %20, %4
ret i32 0
10: ; preds = %6, %20
%11 = phi i64 [ 0, %6 ], [ %21, %20 ]
%12 = getelementptr inbounds i8*, i8** %3, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = getelementptr inbounds i8*, i8** %2, i64 %11
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
store i32 %19, i32* %7
br label %20
20: ; preds = %10, %16
%21 = add nuw nsw i64 %11, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %9, label %10
}