#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 */
scalar_t__ errno;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sknobs_set_seed(unsigned int);
unsigned long long strtoull(char *, char **, int /*<<< orphan*/);
int sknobs_set_seed_from_string(char *s) {
  unsigned seed;
  unsigned long long full_value;
  errno = 0;
  full_value = strtoull(s, (char **)NULL, 0);
  if (errno) {
    printf("error: sknobs: sknobs_set_seed_from_string: could not covert to "
           "ull %s\n",
           s);
    return 1;
  }
  seed = full_value & 0x00000000FFFFFFFFULL;
  sknobs_set_seed(seed);
  return 0;
}


x86 assembly (clang, -O0):
<sknobs_set_seed_from_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e9d(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoull@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e7c(%rip),%rax
cmpq   $0x0,(%rax)
je     118a <sknobs_set_seed_from_string+0x5a>
mov    -0x10(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11aa <sknobs_set_seed_from_string+0x7a>
movabs $0xffffffff,%rax
and    -0x20(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <sknobs_set_seed@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sknobs_set_seed_from_string>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    0x2ea1(%rip),%r15
movq   $0x0,(%r15)
xor    %r14d,%r14d
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtoull@plt>
cmpq   $0x0,(%r15)
je     116f <sknobs_set_seed_from_string+0x3f>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%r14d
jmp    1176 <sknobs_set_seed_from_string+0x46>
mov    %eax,%edi
call   1050 <sknobs_set_seed@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@.str = [72 x i8] c"error: sknobs: sknobs_set_seed_from_string: could not covert to ull %s\0A\00"
define i32 @sknobs_set_seed_from_string(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* @errno
%6 = load i8*, i8** %3
%7 = call i64 @strtoull(i8* %6, i8** null, i32 0)
store i64 %7, i64* %5
%8 = load i64, i64* @errno
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %11)
store i32 1, i32* %2
br label %19
13: ; preds = %1
%14 = load i64, i64* %5
%15 = and i64 %14, 4294967295
%16 = trunc i64 %15 to i32
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = call i32 @sknobs_set_seed(i32 %17)
store i32 0, i32* %2
br label %19
19: ; preds = %13, %10
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [72 x i8] c"error: sknobs: sknobs_set_seed_from_string: could not covert to ull %s\0A\00"
define i32 @sknobs_set_seed_from_string(i8* %0) {
store i64 0, i64* @errno
%2 = tail call i64 @strtoull(i8* nocapture %0, i8** null, i32 0)
%3 = load i64, i64* @errno
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %10
7: ; preds = %1
%8 = trunc i64 %2 to i32
%9 = tail call i32 @sknobs_set_seed(i32 %8)
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %11
}