#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 *);
int /*<<< orphan*/ obtener_elemento(char *, char *, int, int);
scalar_t__ strcmp(char *, char *);
int buscar_pseudo_org(char *linea, int num_linea) {
  char pseudo[5], valor[10];
  obtener_elemento(linea, pseudo, 1, 5);
  if (strcmp(pseudo, "ORG") != 0)
    return num_linea;
  obtener_elemento(linea, valor, 2, 10);
  return atoi(valor);
}


x86 assembly (clang, -O0):
<buscar_pseudo_org>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x1,%edx
mov    $0x5,%ecx
call   1040 <obtener_elemento@plt>
lea    -0x19(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     117b <buscar_pseudo_org+0x4b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119e <buscar_pseudo_org+0x6e>
mov    -0x10(%rbp),%rdi
lea    -0x23(%rbp),%rsi
mov    $0x2,%edx
mov    $0xa,%ecx
call   1040 <obtener_elemento@plt>
lea    -0x23(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buscar_pseudo_org>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x1(%rsp),%r14
mov    %r14,%rsi
mov    $0x1,%edx
mov    $0x5,%ecx
call   1040 <obtener_elemento@plt>
lea    0xea5(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    118c <buscar_pseudo_org+0x5c>
lea    0x6(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x2,%edx
mov    $0xa,%ecx
call   1040 <obtener_elemento@plt>
mov    %rbp,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"ORG\00"
define i32 @buscar_pseudo_org(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [5 x i8]
%7 = alloca [10 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%10 = call i32 @obtener_elemento(i8* %8, i8* %9, i32 1, i32 5)
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = load i32, i32* %5
store i32 %15, i32* %3
br label %22
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%19 = call i32 @obtener_elemento(i8* %17, i8* %18, i32 2, i32 10)
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %3
br label %22
22: ; preds = %16, %14
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"ORG\00"
define i32 @buscar_pseudo_org(i8* %0, i32 %1) {
%3 = alloca [5 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%7 = call i32 @obtener_elemento(i8* %0, i8* %5, i32 1, i32 5)
%8 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @obtener_elemento(i8* %0, i8* %6, i32 2, i32 10)
%12 = call i32 @atoi(i8* %6)
br label %13
13: ; preds = %2, %10
%14 = phi i32 [ %12, %10 ], [ %1, %2 ]
ret i32 %14
}