#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*/ printf(char *, int, int);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int get_n_blocks(int argc, char **argv, int p) {
  int n_blocks;
  if (argc == 2) {
    n_blocks = (int)strtol(argv[1], NULL, 10);
    if (n_blocks < p) {
      printf("Configuration error: n_blocks %i is smaller than the number of "
             "process %d, set to default (the number of process)\n",
             n_blocks, p);
      n_blocks = p;
    }
  } else {
    n_blocks = p;
  }
  return n_blocks;
}


x86 assembly (clang, -O0):
<get_n_blocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    117e <get_n_blocks+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1179 <get_n_blocks+0x59>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1184 <get_n_blocks+0x64>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_n_blocks>:
push   %rbx
mov    %edx,%ebx
cmp    $0x2,%edi
jne    1150 <get_n_blocks+0x30>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
cmp    %ebx,%eax
jge    114e <get_n_blocks+0x2e>
lea    0xebd(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
jmp    1150 <get_n_blocks+0x30>
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [115 x i8] c"Configuration error: n_blocks %i is smaller than the number of process %d, set to default (the number of process)\0A\00"
define i32 @get_n_blocks(i32 %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %25
10: ; preds = %3
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strtol(i8* %13, i32* null, i32 10)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %10
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
%23 = load i32, i32* %6
store i32 %23, i32* %7
br label %24
24: ; preds = %19, %10
br label %27
25: ; preds = %3
%26 = load i32, i32* %6
store i32 %26, i32* %7
br label %27
27: ; preds = %25, %24
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
@.str = [115 x i8] c"Configuration error: n_blocks %i is smaller than the number of process %d, set to default (the number of process)\0A\00"
define i32 @get_n_blocks(i32 %0, i8** nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @strtol(i8* nocapture %7, i32* null, i32 10)
%9 = trunc i64 %8 to i32
%10 = icmp slt i32 %9, %2
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = tail call i32 @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %2)
br label %13
13: ; preds = %3, %5, %11
%14 = phi i32 [ %2, %11 ], [ %9, %5 ], [ %2, %3 ]
ret i32 %14
}