#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 *);
int /*<<< orphan*/ fatal_error_i(char *, int);
int /*<<< orphan*/ omp_set_num_threads(int);
int f_ncpu(int mode, unsigned char **sec, float *data, unsigned int ndata,
           char *inv_out, void **local, const char *arg1) {
  int nthreads;
  if (mode == -1) {
    nthreads = atoi(arg1);
    if (nthreads <= 0)
      fatal_error_i("NCPU (num threads) set to %d", nthreads);
    omp_set_num_threads(nthreads);
  }
  return 0;
}


x86 assembly (clang, -O0):
<f_ncpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1189 <f_ncpu+0x59>
mov    0x10(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jg     1181 <f_ncpu+0x51>
mov    -0x34(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <fatal_error_i@plt>
mov    -0x34(%rbp),%edi
call   1040 <omp_set_num_threads@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_ncpu>:
cmp    $0xffffffff,%edi
je     1138 <f_ncpu+0x8>
xor    %eax,%eax
ret
push   %rbx
mov    0x10(%rsp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
test   %eax,%eax
jg     1157 <f_ncpu+0x27>
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
call   1030 <fatal_error_i@plt>
mov    %ebx,%edi
call   1040 <omp_set_num_threads@plt>
pop    %rbx
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [29 x i8] c"NCPU (num threads) set to %d\00"
define i32 @f_ncpu(i32 %0, i8** %1, float* %2, i32 %3, i8* %4, i8** %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8**
%10 = alloca float*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8**
%14 = alloca i8*
%15 = alloca i32
store i32 %0, i32* %8
store i8** %1, i8*** %9
store float* %2, float** %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i8** %5, i8*** %13
store i8* %6, i8** %14
%16 = load i32, i32* %8
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %29
18: ; preds = %7
%19 = load i8*, i8** %14
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %15
%21 = load i32, i32* %15
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* %15
%25 = call i32 @fatal_error_i(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %18
%27 = load i32, i32* %15
%28 = call i32 @omp_set_num_threads(i32 %27)
br label %29
29: ; preds = %26, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"NCPU (num threads) set to %d\00"
define i32 @f_ncpu(i32 %0, i8** nocapture readnone %1, float* nocapture readnone %2, i32 %3, i8* nocapture readnone %4, i8** nocapture readnone %5, i8* nocapture %6) {
%8 = icmp eq i32 %0, -1
br i1 %8, label %9, label %16
9: ; preds = %7
%10 = tail call i32 @atoi(i8* %6)
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @fatal_error_i(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %14
14: ; preds = %12, %9
%15 = tail call i32 @omp_set_num_threads(i32 %10)
br label %16
16: ; preds = %14, %7
ret i32 0
}