#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*/ answer;

/* Variables and functions */
int /*<<< orphan*/ SHA1(char *, int, unsigned char *);
int SHA_DIGEST_LENGTH;
int memcmp(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
void main(int argc, char *argv[]) {
  char answer[7] = "po'oihe";
  unsigned char hash[SHA_DIGEST_LENGTH];
  SHA1(answer, sizeof(answer), hash);
  if (argc < 2) {
    printf("Program takes one argument!\n");
    return;
  }
  if (argc > 2) {
    printf("Program takes one argument!\n");
    return;
  }
  int comp = (memcmp(argv[1], answer, sizeof(answer)));
  if (comp > 0) {
    printf("Input value over target value\n");
    return;
  }
  if (comp < 0) {
    printf("Input value under target value\n");
    return;
  }
  if (comp == 0) {
    for (int i = 0; i < 20; i++) {
      printf("%x", hash[i]);
    }
    return;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x6568696f,-0x15(%rbp)
movl   $0x6f276f70,-0x18(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x7,%esi
call   1050 <SHA1@plt>
cmpl   $0x2,-0x4(%rbp)
jge    11ab <main+0x7b>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1286 <main+0x156>
cmpl   $0x2,-0x4(%rbp)
jle    11cf <main+0x9f>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1286 <main+0x156>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x7,%edx
call   1040 <memcmp@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    120c <main+0xdc>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1286 <main+0x156>
cmpl   $0x0,-0x30(%rbp)
jge    1230 <main+0x100>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x2c(%rbp)
jmp    1286 <main+0x156>
cmpl   $0x0,-0x30(%rbp)
jne    127f <main+0x14f>
movl   $0x0,-0x34(%rbp)
cmpl   $0x14,-0x34(%rbp)
jge    1273 <main+0x143>
mov    -0x40(%rbp),%rax
movslq -0x34(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1241 <main+0x111>
movl   $0x1,-0x2c(%rbp)
jmp    1286 <main+0x156>
movl   $0x0,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    %rsp,%r12
movl   $0x6568696f,-0x25(%rbp)
movl   $0x6f276f70,-0x28(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    -0x28(%rbp),%rdi
mov    $0x7,%esi
mov    %r15,%rdx
call   1060 <SHA1@plt>
cmp    $0x1,%ebx
jle    11b9 <main+0x79>
cmp    $0x2,%ebx
jne    11b9 <main+0x79>
mov    0x8(%r14),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x7,%edx
call   1050 <memcmp@plt>
test   %eax,%eax
jle    11d5 <main+0x95>
lea    0xe72(%rip),%rdi
jmp    11c0 <main+0x80>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rsp
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
jns    11e0 <main+0xa0>
lea    0xe2c(%rip),%rdi
jmp    11c0 <main+0x80>
movzbl (%r15),%esi
lea    0xe1c(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x1(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x2(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x3(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x4(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x5(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x6(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x7(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x8(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x9(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xa(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xb(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xc(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xd(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xe(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0xf(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x10(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x11(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x12(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x13(%r15),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c5 <main+0x85>

LLVM IR (-O0):
@__const.main.answer = [7 x i8] c"po'oihe"
@SHA_DIGEST_LENGTH = global i32 0
@.str = [29 x i8] c"Program takes one argument!\0A\00"
@.str.1 = [31 x i8] c"Input value over target value\0A\00"
@.str.2 = [32 x i8] c"Input value under target value\0A\00"
@.str.3 = [3 x i8] c"%x\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [7 x i8]
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = bitcast [7 x i8]* %5 to i8*
%12 = load i32, i32* @SHA_DIGEST_LENGTH
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %6
%15 = alloca i8, i64 %13
store i64 %13, i64* %7
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%17 = call i32 @SHA1(i8* %16, i32 7, i8* %15)
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 2
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %8
br label %61
22: ; preds = %2
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %8
br label %61
27: ; preds = %22
%28 = load i8**, i8*** %4
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%32 = call i32 @memcmp(i8* %30, i8* %31, i32 7)
store i32 %32, i32* %9
%33 = load i32, i32* %9
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %27
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %8
br label %61
37: ; preds = %27
%38 = load i32, i32* %9
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %8
br label %61
42: ; preds = %37
%43 = load i32, i32* %9
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %60
45: ; preds = %42
store i32 0, i32* %10
br label %46
46: ; preds = %56, %45
%47 = load i32, i32* %10
%48 = icmp slt i32 %47, 20
br i1 %48, label %49, label %59
49: ; preds = %46
%50 = load i32, i32* %10
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %15, i64 %51
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %49
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %10
br label %46
59: ; preds = %46
store i32 1, i32* %8
br label %61
60: ; preds = %42
store i32 0, i32* %8
br label %61
61: ; preds = %60, %59, %40, %35, %25, %20
%62 = load i8*, i8** %6
%63 = load i32, i32* %8
switch i32 %63, label %65 [
i32 0, label %64
i32 1, label %64
]
64: ; preds = %61, %61
ret void
65: ; preds = %61
unreachable
}

LLVM IR (-O2):
@__const.main.answer = [7 x i8] c"po'oihe"
@SHA_DIGEST_LENGTH = global i32 0
@.str.3 = [3 x i8] c"%x\00"
@str = [31 x i8] c"Input value under target value\00"
@str.4 = [30 x i8] c"Input value over target value\00"
@str.6 = [28 x i8] c"Program takes one argument!\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = alloca [7 x i8]
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @SHA_DIGEST_LENGTH
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = call i32 @SHA1(i8* %4, i32 7, i8* %8)
%10 = icmp slt i32 %0, 2
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
br label %108
13: ; preds = %2
%14 = icmp eq i32 %0, 2
br i1 %14, label %17, label %15
15: ; preds = %13
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
br label %108
17: ; preds = %13
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @memcmp(i8* %19, i8* %4, i32 7)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, i64 0, i64 0))
br label %108
24: ; preds = %17
%25 = icmp slt i32 %20, 0
br i1 %25, label %106, label %26
26: ; preds = %24
%27 = load i8, i8* %8
%28 = zext i8 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds i8, i8* %8, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds i8, i8* %8, i64 2
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds i8, i8* %8, i64 3
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds i8, i8* %8, i64 4
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds i8, i8* %8, i64 5
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds i8, i8* %8, i64 6
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds i8, i8* %8, i64 7
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds i8, i8* %8, i64 8
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds i8, i8* %8, i64 9
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = getelementptr inbounds i8, i8* %8, i64 10
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds i8, i8* %8, i64 11
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %72)
%74 = getelementptr inbounds i8, i8* %8, i64 12
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = getelementptr inbounds i8, i8* %8, i64 13
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds i8, i8* %8, i64 14
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %84)
%86 = getelementptr inbounds i8, i8* %8, i64 15
%87 = load i8, i8* %86
%88 = zext i8 %87 to i32
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %88)
%90 = getelementptr inbounds i8, i8* %8, i64 16
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %92)
%94 = getelementptr inbounds i8, i8* %8, i64 17
%95 = load i8, i8* %94
%96 = zext i8 %95 to i32
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %96)
%98 = getelementptr inbounds i8, i8* %8, i64 18
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %100)
%102 = getelementptr inbounds i8, i8* %8, i64 19
%103 = load i8, i8* %102
%104 = zext i8 %103 to i32
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %104)
br label %108
106: ; preds = %24
%107 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %108
108: ; preds = %26, %22, %106, %15, %11
ret void
}