#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 /*<<< orphan*/ sscanf(char *, char *, int *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int getItemN(char *strLine) {
  int result, len;
  len = strlen(strLine) - 30;
  char tmp[len + 1];
  strncpy(tmp, strLine + 30, len);
  tmp[len] = '\0';
  sscanf(tmp, "%d ", &result);
  return result;
}


x86 assembly (clang, -O0):
<getItemN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0xffffffe2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
add    $0x1e,%rsi
mov    -0x10(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x28(%rbp),%rdi
movslq -0x10(%rbp),%rax
movb   $0x0,(%rdi,%rax,1)
lea    0xe69(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0xc(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getItemN>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %rsp,%r15
movslq %eax,%r12
lea    -0x1e(%r12),%rdx
lea    -0x1d(%r12),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
add    $0x1e,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncpy@plt>
movb   $0x0,-0x1e(%r12,%rbx,1)
lea    0xe7c(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
mov    -0x24(%rbp),%eax
mov    %r15,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @getItemN(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 30
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %5
%14 = alloca i8, i64 %12
store i64 %12, i64* %6
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 30
%17 = load i32, i32* %4
%18 = call i32 @strncpy(i8* %14, i8* %16, i32 %17)
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %14, i64 %20
store i8 0, i8* %21
%22 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%23 = load i32, i32* %3
%24 = load i8*, i8** %5
ret i32 %23
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @getItemN(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, -30
%6 = add nsw i32 %4, -29
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = getelementptr inbounds i8, i8* %0, i64 30
%11 = call i32 @strncpy(i8* %9, i8* %10, i32 %5)
%12 = sext i32 %5 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
store i8 0, i8* %13
%14 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
ret i32 %15
}