#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 *, unsigned char);
int /*<<< orphan*/ sha1(unsigned char *, int /*<<< orphan*/, unsigned char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char **argv) {
  char *s = "But the scientific cast of mind examines the world critically as "
            "if many alternative worlds might exist, as if other things might "
            "be here which are not. Then we are forced to ask why what we see "
            "is present and not something else. Why are the Sun and the Moon "
            "and the planets spheres? Why not pyramids, or cubes, or "
            "dodecahedra? Why not irregular, jumbly shapes? Why so symmetrical "
            "worlds? If you spend any time spinning hypotheses, checking to "
            "see whether they make sense, whether they conform to what else we "
            "know, thinking of tests you can pose to substantiate or deflate "
            "your hypotheses, you will find yourself doing science.";
  unsigned char result[20];
  int i;
  int j;
  for (j = 0; j < 100; j++) {
    sha1((unsigned char *)s, strlen(s), result);
  }
  for (i = 0; i < 20; i++) {
    printf("%02x", result[i]);
  }
  printf("\n", result[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x64,-0x38(%rbp)
jge    1190 <main+0x60>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x40(%rbp),%rdi
mov    %eax,%esi
lea    -0x30(%rbp),%rdx
call   1030 <sha1@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1158 <main+0x28>
movl   $0x0,-0x34(%rbp)
cmpl   $0x14,-0x34(%rbp)
jge    11c4 <main+0x94>
movslq -0x34(%rbp),%rax
lea    0x10c9(%rip),%rdi
movzbl -0x30(%rbp,%rax,1),%esi
call   1050 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1197 <main+0x67>
movslq -0x34(%rbp),%rax
lea    0x10ab(%rip),%rdi
movzbl -0x30(%rbp,%rax,1),%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    $0x64,%ebp
lea    0xebc(%rip),%rbx
mov    %rsp,%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1030 <sha1@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
movzbl (%rsp),%esi
lea    0x1100(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x1(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x2(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x3(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x4(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x5(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x6(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x7(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x8(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x9(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0xa(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0xb(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0xd(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0xe(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x10(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x11(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x12(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x13(%rsp),%esi
mov    %rbx,%rdi
call   1050 <printf@plt>
movzbl 0x14(%rsp),%esi
lea    0xffa(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [629 x i8] c"But the scientific cast of mind examines the world critically as if many alternative worlds might exist, as if other things might be here which are not. Then we are forced to ask why what we see is present and not something else. Why are the Sun and the Moon and the planets spheres? Why not pyramids, or cubes, or dodecahedra? Why not irregular, jumbly shapes? Why so symmetrical worlds? If you spend any time spinning hypotheses, checking to see whether they make sense, whether they conform to what else we know, thinking of tests you can pose to substantiate or deflate your hypotheses, you will find yourself doing science.\00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [20 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([629 x i8], [629 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %9
br label %10
10: ; preds = %19, %2
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 100
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i8*, i8** %6
%15 = load i8*, i8** %6
%16 = call i32 @strlen(i8* %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%18 = call i32 @sha1(i8* %14, i32 %16, i8* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %9
%21 = add nsw i32 %20, 1
store i32 %21, i32* %9
br label %10
22: ; preds = %10
store i32 0, i32* %8
br label %23
23: ; preds = %32, %22
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 20
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %30)
br label %32
32: ; preds = %26
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %23
35: ; preds = %23
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [629 x i8] c"But the scientific cast of mind examines the world critically as if many alternative worlds might exist, as if other things might be here which are not. Then we are forced to ask why what we see is present and not something else. Why are the Sun and the Moon and the planets spheres? Why not pyramids, or cubes, or dodecahedra? Why not irregular, jumbly shapes? Why so symmetrical worlds? If you spend any time spinning hypotheses, checking to see whether they make sense, whether they conform to what else we know, thinking of tests you can pose to substantiate or deflate your hypotheses, you will find yourself doing science.\00"
@.str.1 = [5 x i8] c"%02x\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ 0, %2 ], [ %9, %5 ]
%7 = call i32 @strlen(i8* getelementptr inbounds ([629 x i8], [629 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @sha1(i8* getelementptr inbounds ([629 x i8], [629 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %4)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = load i8, i8* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 1
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 2
%18 = load i8, i8* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %18)
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 3
%21 = load i8, i8* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %21)
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 4
%24 = load i8, i8* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %24)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 5
%27 = load i8, i8* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %27)
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 6
%30 = load i8, i8* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 7
%33 = load i8, i8* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %33)
%35 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 8
%36 = load i8, i8* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %36)
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 9
%39 = load i8, i8* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %39)
%41 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 10
%42 = load i8, i8* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %42)
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 11
%45 = load i8, i8* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %45)
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 12
%48 = load i8, i8* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %48)
%50 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 13
%51 = load i8, i8* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %51)
%53 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 14
%54 = load i8, i8* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %54)
%56 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 15
%57 = load i8, i8* %56
%58 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %57)
%59 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 16
%60 = load i8, i8* %59
%61 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %60)
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 17
%63 = load i8, i8* %62
%64 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %63)
%65 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 18
%66 = load i8, i8* %65
%67 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %66)
%68 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 19
%69 = load i8, i8* %68
%70 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %69)
%71 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 20
%72 = load i8, i8* %71
%73 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %72)
ret i32 0
}