#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 int subChangeQWORD(char *stringQWORD) {
  const int strlen = 8;
  const int dlSub = 48;
  const int dlCmp = 10;
  const int dlCmpMaybe = 7;
  const int eaxSHL = 4;
  unsigned int eax = 0;
  int i;
  for (i = 0; i < strlen; i++) {
    unsigned int dl = (unsigned int)stringQWORD[i];
    printf("dl: %c\t", dl);
    dl -= dlSub;
    printf("dl - 48: %c\t", dl);
    if (dl == dlCmp) {
      printf("Break!\n");
      break;
    }
    dl -= dlCmpMaybe;
    printf("dl - 7: %c\t", dl);
    printf("eax: 0x%08x\t\t", eax);
    eax = eax << eaxSHL;
    printf("eax << 4: 0x%08x\t", eax);
    eax |= dl;
    printf("eax |= dl: 0x%08x\n", eax);
    printf("-------------------------------------------------------------------"
           "--------------------------------------------\n");
  }
  return eax;
}


x86 assembly (clang, -O0):
<subChangeQWORD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
movl   $0x30,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x7,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x8,-0x24(%rbp)
jge    1229 <subChangeQWORD+0x119>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0x28(%rbp)
jne    11ae <subChangeQWORD+0x9e>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <subChangeQWORD+0x119>
mov    -0x28(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114d <subChangeQWORD+0x3d>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subChangeQWORD>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf1f(%rip),%r13
xor    %r14d,%r14d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsbl (%rbx,%r14,1),%r15d
lea    0xeb4(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x30(%r15),%r12d
lea    0xea7(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xa,%r12d
je     11d4 <subChangeQWORD+0xb4>
add    $0xffffffc9,%r15d
lea    0xe99(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
shl    $0x4,%ebp
lea    0xe8f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
or     %r15d,%ebp
lea    0xe8e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
add    $0x1,%r14
cmp    $0x8,%r14
jne    1140 <subChangeQWORD+0x20>
jmp    11e0 <subChangeQWORD+0xc0>
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"dl: %c\09\00"
@.str.1 = [13 x i8] c"dl - 48: %c\09\00"
@.str.2 = [8 x i8] c"Break!\0A\00"
@.str.3 = [12 x i8] c"dl - 7: %c\09\00"
@.str.4 = [14 x i8] c"eax: 0x%08x\09\09\00"
@.str.5 = [18 x i8] c"eax << 4: 0x%08x\09\00"
@.str.6 = [19 x i8] c"eax |= dl: 0x%08x\0A\00"
@.str.7 = [113 x i8] c"---------------------------------------------------------------------------------------------------------------\0A\00"
define i32 @subChangeQWORD(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %2
store i32 8, i32* %3
store i32 48, i32* %4
store i32 10, i32* %5
store i32 7, i32* %6
store i32 4, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %48, %1
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %51
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %10
%24 = sub i32 %23, 48
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %10
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %31
29: ; preds = %14
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %51
31: ; preds = %14
%32 = load i32, i32* %10
%33 = sub i32 %32, 7
store i32 %33, i32* %10
%34 = load i32, i32* %10
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %8
%39 = shl i32 %38, 4
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %10
%43 = load i32, i32* %8
%44 = or i32 %43, %42
store i32 %44, i32* %8
%45 = load i32, i32* %8
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([113 x i8], [113 x i8]* @.str.7, i64 0, i64 0))
br label %48
48: ; preds = %31
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %11
51: ; preds = %29, %11
%52 = load i32, i32* %8
ret i32 %52
}

LLVM IR (-O2):
@.str = [8 x i8] c"dl: %c\09\00"
@.str.1 = [13 x i8] c"dl - 48: %c\09\00"
@.str.3 = [12 x i8] c"dl - 7: %c\09\00"
@.str.4 = [14 x i8] c"eax: 0x%08x\09\09\00"
@.str.5 = [18 x i8] c"eax << 4: 0x%08x\09\00"
@.str.6 = [19 x i8] c"eax |= dl: 0x%08x\0A\00"
@str = [112 x i8] c"---------------------------------------------------------------------------------------------------------------\00"
@str.8 = [7 x i8] c"Break!\00"
define i32 @subChangeQWORD(i8* nocapture %0) {
br label %2
2: ; preds = %1, %14
%3 = phi i64 [ 0, %1 ], [ %23, %14 ]
%4 = phi i32 [ 0, %1 ], [ %20, %14 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = add nsw i32 %7, -48
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %9, 10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
br label %25
14: ; preds = %2
%15 = add nsw i32 %7, -55
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%18 = shl i32 %4, 4
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = or i32 %15, %18
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %20)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([112 x i8], [112 x i8]* @str, i64 0, i64 0))
%23 = add nuw nsw i64 %3, 1
%24 = icmp eq i64 %23, 8
br i1 %24, label %25, label %2
25: ; preds = %14, %12
%26 = phi i32 [ %4, %12 ], [ %20, %14 ]
ret i32 %26
}