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

/* Variables and functions */
int /*<<< orphan*/ SHA1(char *, int, char *);
int SHA_DIGEST_LENGTH;
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  uint8_t s[6 + 1] = {};
  uint8_t digest[SHA_DIGEST_LENGTH];
  int cnt = 0;
  for (s[0] = '!'; s[0] <= '~'; ++s[0]) {
    for (s[1] = '!'; s[1] <= '~'; ++s[1]) {
      for (s[2] = '!'; s[2] <= '~'; ++s[2]) {
        for (s[3] = '!'; s[3] <= '~'; ++s[3]) {
          for (s[4] = '!'; s[4] <= '~'; ++s[4]) {
            for (s[5] = '!'; s[5] <= '~'; ++s[5]) {
              SHA1(s, sizeof(s) - 1, digest);
              ++cnt;
              if (digest[0] == 0xab && digest[1] == 0xcd && digest[2] == 0xef) {
                goto done;
              }
            }
          }
        }
      }
    }
  }
done:
  printf("sha1\n");
  printf("abcdef\n");
  printf("%s\n", s);
  printf("%d\n", cnt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x9(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movb   $0x21,-0xc(%rbp)
movsbl -0xc(%rbp),%eax
cmp    $0x7e,%eax
jg     129a <main+0x17a>
movb   $0x21,-0xb(%rbp)
movsbl -0xb(%rbp),%eax
cmp    $0x7e,%eax
jg     1288 <main+0x168>
movb   $0x21,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
cmp    $0x7e,%eax
jg     1276 <main+0x156>
movb   $0x21,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x7e,%eax
jg     1264 <main+0x144>
movb   $0x21,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
cmp    $0x7e,%eax
jg     1252 <main+0x132>
movb   $0x21,-0x7(%rbp)
movsbl -0x7(%rbp),%eax
cmp    $0x7e,%eax
jg     1240 <main+0x120>
mov    -0x30(%rbp),%rdx
lea    -0xc(%rbp),%rdi
mov    $0x6,%esi
call   1040 <SHA1@plt>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
movsbl (%rax),%eax
cmp    $0xab,%eax
jne    122e <main+0x10e>
mov    -0x30(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0xcd,%eax
jne    122e <main+0x10e>
mov    -0x30(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0xef,%eax
jne    122e <main+0x10e>
jmp    129f <main+0x17f>
jmp    1233 <main+0x113>
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    11c9 <main+0xa9>
jmp    1245 <main+0x125>
mov    -0x8(%rbp),%al
add    $0x1,%al
mov    %al,-0x8(%rbp)
jmp    11b8 <main+0x98>
jmp    1257 <main+0x137>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    11a7 <main+0x87>
jmp    1269 <main+0x149>
mov    -0xa(%rbp),%al
add    $0x1,%al
mov    %al,-0xa(%rbp)
jmp    1196 <main+0x76>
jmp    127b <main+0x15b>
mov    -0xb(%rbp),%al
add    $0x1,%al
mov    %al,-0xb(%rbp)
jmp    1185 <main+0x65>
jmp    128d <main+0x16d>
mov    -0xc(%rbp),%al
add    $0x1,%al
mov    %al,-0xc(%rbp)
jmp    1174 <main+0x54>
jmp    129f <main+0x17f>
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
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    %rsp,%r12
movb   $0x0,-0x21(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
movb   $0x21,-0x27(%rbp)
xor    %ebx,%ebx
lea    -0x27(%rbp),%r15
nopw   0x0(%rax,%rax,1)
movb   $0x21,-0x26(%rbp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x21,-0x25(%rbp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x21,-0x24(%rbp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x21,-0x23(%rbp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x21,-0x22(%rbp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x6,%esi
mov    %r14,%rdx
call   1050 <SHA1@plt>
add    $0x1,%ebx
movzbl -0x22(%rbp),%eax
add    $0x1,%al
mov    %al,-0x22(%rbp)
cmp    $0x7f,%al
jne    11c0 <main+0x90>
mov    -0x23(%rbp),%al
add    $0x1,%al
mov    %al,-0x23(%rbp)
cmp    $0x7f,%al
jne    11b0 <main+0x80>
mov    -0x24(%rbp),%al
add    $0x1,%al
mov    %al,-0x24(%rbp)
cmp    $0x7f,%al
jne    11a0 <main+0x70>
mov    -0x25(%rbp),%al
add    $0x1,%al
mov    %al,-0x25(%rbp)
cmp    $0x7f,%al
jne    1190 <main+0x60>
mov    -0x26(%rbp),%al
add    $0x1,%al
mov    %al,-0x26(%rbp)
cmp    $0x7f,%al
jne    1180 <main+0x50>
mov    -0x27(%rbp),%al
add    $0x1,%al
mov    %al,-0x27(%rbp)
cmp    $0x7f,%al
jne    1170 <main+0x40>
lea    0xdd9(%rip),%rdi
call   1030 <puts@plt>
lea    0xdd2(%rip),%rdi
call   1030 <puts@plt>
lea    -0x27(%rbp),%rdi
call   1030 <puts@plt>
lea    0xdb4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SHA_DIGEST_LENGTH = global i32 0
@.str = [6 x i8] c"sha1\0A\00"
@.str.1 = [8 x i8] c"abcdef\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [7 x i8]* %2 to i8*
%7 = load i32, i32* @SHA_DIGEST_LENGTH
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
store i32 0, i32* %5
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
store i8 33, i8* %11
br label %12
12: ; preds = %98, %0
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sle i32 %15, 126
br i1 %16, label %17, label %102
17: ; preds = %12
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
store i8 33, i8* %18
br label %19
19: ; preds = %93, %17
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 126
br i1 %23, label %24, label %97
24: ; preds = %19
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
store i8 33, i8* %25
br label %26
26: ; preds = %88, %24
%27 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp sle i32 %29, 126
br i1 %30, label %31, label %92
31: ; preds = %26
%32 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 3
store i8 33, i8* %32
br label %33
33: ; preds = %83, %31
%34 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp sle i32 %36, 126
br i1 %37, label %38, label %87
38: ; preds = %33
%39 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 4
store i8 33, i8* %39
br label %40
40: ; preds = %78, %38
%41 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 4
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp sle i32 %43, 126
br i1 %44, label %45, label %82
45: ; preds = %40
%46 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 5
store i8 33, i8* %46
br label %47
47: ; preds = %73, %45
%48 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 5
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp sle i32 %50, 126
br i1 %51, label %52, label %77
52: ; preds = %47
%53 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%54 = call i32 @SHA1(i8* %53, i32 6, i8* %10)
%55 = load i32, i32* %5
%56 = add nsw i32 %55, 1
store i32 %56, i32* %5
%57 = getelementptr inbounds i8, i8* %10, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 171
br i1 %60, label %61, label %72
61: ; preds = %52
%62 = getelementptr inbounds i8, i8* %10, i64 1
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 205
br i1 %65, label %66, label %72
66: ; preds = %61
%67 = getelementptr inbounds i8, i8* %10, i64 2
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 239
br i1 %70, label %71, label %72
71: ; preds = %66
br label %103
72: ; preds = %66, %61, %52
br label %73
73: ; preds = %72
%74 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 5
%75 = load i8, i8* %74
%76 = add i8 %75, 1
store i8 %76, i8* %74
br label %47
77: ; preds = %47
br label %78
78: ; preds = %77
%79 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 4
%80 = load i8, i8* %79
%81 = add i8 %80, 1
store i8 %81, i8* %79
br label %40
82: ; preds = %40
br label %83
83: ; preds = %82
%84 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 3
%85 = load i8, i8* %84
%86 = add i8 %85, 1
store i8 %86, i8* %84
br label %33
87: ; preds = %33
br label %88
88: ; preds = %87
%89 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
%90 = load i8, i8* %89
%91 = add i8 %90, 1
store i8 %91, i8* %89
br label %26
92: ; preds = %26
br label %93
93: ; preds = %92
%94 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
%95 = load i8, i8* %94
%96 = add i8 %95, 1
store i8 %96, i8* %94
br label %19
97: ; preds = %19
br label %98
98: ; preds = %97
%99 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%100 = load i8, i8* %99
%101 = add i8 %100, 1
store i8 %101, i8* %99
br label %12
102: ; preds = %12
br label %103
103: ; preds = %102, %71
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%106 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %106)
%108 = load i32, i32* %5
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %108)
store i32 0, i32* %1
%110 = load i8*, i8** %3
%111 = load i32, i32* %1
ret i32 %111
}

LLVM IR (-O2):
@SHA_DIGEST_LENGTH = global i32 0
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [5 x i8] c"sha1\00"
@str.4 = [7 x i8] c"abcdef\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 6
store i8 0, i8* %3
%4 = load i32, i32* @SHA_DIGEST_LENGTH
%5 = zext i32 %4 to i64
%6 = tail call i8* @llvm.stacksave()
%7 = alloca i8, i64 %5
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 1
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 2
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 3
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 4
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 5
store i8 33, i8* %2
br label %13
13: ; preds = %0, %46
%14 = phi i32 [ 0, %0 ], [ %26, %46 ]
store i8 33, i8* %8
br label %15
15: ; preds = %13, %42
%16 = phi i32 [ %14, %13 ], [ %26, %42 ]
store i8 33, i8* %9
br label %17
17: ; preds = %15, %38
%18 = phi i32 [ %16, %15 ], [ %26, %38 ]
store i8 33, i8* %10
br label %19
19: ; preds = %17, %34
%20 = phi i32 [ %18, %17 ], [ %26, %34 ]
store i8 33, i8* %11
br label %21
21: ; preds = %19, %30
%22 = phi i32 [ %20, %19 ], [ %26, %30 ]
store i8 33, i8* %12
br label %23
23: ; preds = %21, %23
%24 = phi i32 [ %22, %21 ], [ %26, %23 ]
%25 = call i32 @SHA1(i8* %2, i32 6, i8* %7)
%26 = add nsw i32 %24, 1
%27 = load i8, i8* %12
%28 = add i8 %27, 1
store i8 %28, i8* %12
%29 = icmp eq i8 %28, 127
br i1 %29, label %30, label %23
30: ; preds = %23
%31 = load i8, i8* %11
%32 = add i8 %31, 1
store i8 %32, i8* %11
%33 = icmp eq i8 %32, 127
br i1 %33, label %34, label %21
34: ; preds = %30
%35 = load i8, i8* %10
%36 = add i8 %35, 1
store i8 %36, i8* %10
%37 = icmp eq i8 %36, 127
br i1 %37, label %38, label %19
38: ; preds = %34
%39 = load i8, i8* %9
%40 = add i8 %39, 1
store i8 %40, i8* %9
%41 = icmp eq i8 %40, 127
br i1 %41, label %42, label %17
42: ; preds = %38
%43 = load i8, i8* %8
%44 = add i8 %43, 1
store i8 %44, i8* %8
%45 = icmp eq i8 %44, 127
br i1 %45, label %46, label %15
46: ; preds = %42
%47 = load i8, i8* %2
%48 = add i8 %47, 1
store i8 %48, i8* %2
%49 = icmp eq i8 %48, 127
br i1 %49, label %50, label %13
50: ; preds = %46
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.4, i64 0, i64 0))
%53 = call i32 @puts(i8* %2)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %26)
ret i32 0
}