#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 */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ findNonce(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *);
int /*<<< orphan*/ print256(int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, int /*<<< orphan*/ *);
int strlen(char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  uint8_t out[32];
  if (argc != 3)
    usage();
  if (strlen(argv[1]) != 64)
    usage();
  if (strlen(argv[2]) != 64)
    usage();
  uint8_t globalThreshold[32];
  uint8_t globalData[32];
  int i;
  char *p1 = argv[1];
  char *p2 = argv[2];
  for (i = 0; i < 32; i++) {
    sscanf(p1, "%2hhx", &globalData[i]);
    sscanf(p2, "%2hhx", &globalThreshold[i]);
    p1 += 2;
    p2 += 2;
  }
  findNonce(globalData, globalThreshold, out);
  print256(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117a <main+0x2a>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
je     1197 <main+0x47>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
je     11b4 <main+0x64>
mov    $0x0,%al
call   1070 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x1a8(%rbp)
movl   $0x0,-0x194(%rbp)
cmpl   $0x20,-0x194(%rbp)
jge    1271 <main+0x121>
mov    -0x1a0(%rbp),%rdi
movslq -0x194(%rbp),%rax
lea    -0x190(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xdf4(%rip),%rsi
call   1060 <sscanf@plt>
mov    -0x1a8(%rbp),%rdi
movslq -0x194(%rbp),%rax
lea    -0x110(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xdcc(%rip),%rsi
call   1060 <sscanf@plt>
mov    -0x1a0(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x1a0(%rbp)
mov    -0x1a8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x194(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x194(%rbp)
jmp    11dc <main+0x8c>
lea    -0x190(%rbp),%rdi
lea    -0x110(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1040 <findNonce@plt>
lea    -0x90(%rbp),%rdi
call   1050 <print256@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1170 <main+0x20>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x8(%rbx),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
je     1185 <main+0x35>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x10(%rbx),%rdi
call   1030 <strlen@plt>
cmp    $0x40,%eax
je     119a <main+0x4a>
xor    %eax,%eax
call   1070 <usage@plt>
mov    0x8(%rbx),%rax
mov    %rax,0x8(%rsp)
mov    0x10(%rbx),%rbp
lea    0x90(%rsp),%r14
lea    0x10(%rsp),%rbx
xor    %r13d,%r13d
lea    0xe42(%rip),%r15
xchg   %ax,%ax
mov    %rbp,%r12
add    %r13,%r12
mov    0x8(%rsp),%rax
lea    (%rax,%r13,1),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <sscanf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <sscanf@plt>
add    $0x4,%r14
add    $0x4,%rbx
add    $0x2,%r13
cmp    $0x40,%r13
jne    11c0 <main+0x70>
lea    0x10(%rsp),%rdi
lea    0x90(%rsp),%rsi
lea    0x110(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <findNonce@plt>
mov    %rbx,%rdi
call   1050 <print256@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%2hhx\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i32]
%7 = alloca [32 x i32]
%8 = alloca [32 x i32]
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (...) @usage()
br label %16
16: ; preds = %14, %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strlen(i8* %19)
%21 = icmp ne i32 %20, 64
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 (...) @usage()
br label %24
24: ; preds = %22, %16
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @strlen(i8* %27)
%29 = icmp ne i32 %28, 64
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 (...) @usage()
br label %32
32: ; preds = %30, %24
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
store i8* %35, i8** %10
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
store i8* %38, i8** %11
store i32 0, i32* %9
br label %39
39: ; preds = %57, %32
%40 = load i32, i32* %9
%41 = icmp slt i32 %40, 32
br i1 %41, label %42, label %60
42: ; preds = %39
%43 = load i8*, i8** %10
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 %45
%47 = call i32 @sscanf(i8* %43, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %46)
%48 = load i8*, i8** %11
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %50
%52 = call i32 @sscanf(i8* %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %51)
%53 = load i8*, i8** %10
%54 = getelementptr inbounds i8, i8* %53, i64 2
store i8* %54, i8** %10
%55 = load i8*, i8** %11
%56 = getelementptr inbounds i8, i8* %55, i64 2
store i8* %56, i8** %11
br label %57
57: ; preds = %42
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
br label %39
60: ; preds = %39
%61 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 0
%62 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 0
%63 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%64 = call i32 @findNonce(i32* %61, i32* %62, i32* %63)
%65 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%66 = call i32 @print256(i32* %65)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%2hhx\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i32]
%4 = alloca [32 x i32]
%5 = alloca [32 x i32]
%6 = bitcast [32 x i32]* %3 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 (...) @usage()
br label %10
10: ; preds = %8, %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
%14 = icmp eq i32 %13, 64
br i1 %14, label %17, label %15
15: ; preds = %10
%16 = tail call i32 (...) @usage()
br label %17
17: ; preds = %15, %10
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32 @strlen(i8* %19)
%21 = icmp eq i32 %20, 64
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = tail call i32 (...) @usage()
br label %24
24: ; preds = %22, %17
%25 = bitcast [32 x i32]* %4 to i8*
%26 = bitcast [32 x i32]* %5 to i8*
%27 = load i8*, i8** %11
%28 = load i8*, i8** %18
br label %29
29: ; preds = %24, %29
%30 = phi i64 [ 0, %24 ], [ %39, %29 ]
%31 = phi i8* [ %28, %24 ], [ %38, %29 ]
%32 = phi i8* [ %27, %24 ], [ %37, %29 ]
%33 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 %30
%34 = call i32 @sscanf(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %33)
%35 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 %30
%36 = call i32 @sscanf(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %35)
%37 = getelementptr inbounds i8, i8* %32, i64 2
%38 = getelementptr inbounds i8, i8* %31, i64 2
%39 = add nuw nsw i64 %30, 1
%40 = icmp eq i64 %39, 32
br i1 %40, label %41, label %29
41: ; preds = %29
%42 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%43 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%44 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%45 = call i32 @findNonce(i32* %42, i32* %43, i32* %44)
%46 = call i32 @print256(i32* %44)
ret i32 0
}