xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ isspace(char);
int /*<<< orphan*/ strchr(char *, char);
int symchar(char c) {
  static char *special = "()';`,\\|";
  return (!isspace(c) && !strchr(special, c));
}


x86 assembly (clang, -O0):
<symchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x2(%rbp)
jne    1162 <symchar+0x42>
mov    0x2ee2(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symchar>:
push   %rbx
mov    %edi,%ebx
call   1040 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1132 <symchar+0x12>
pop    %rbx
ret
movsbl %bl,%esi
lea    0xec4(%rip),%rdi
call   1030 <strchr@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
@symchar.special = internal global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0)
@.str = [9 x i8] c"()';`,\\|\00"
define i32 @symchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @isspace(i8 signext %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = load i8*, i8** @symchar.special
%8 = load i8, i8* %2
%9 = call i32 @strchr(i8* %7, i8 signext %8)
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br label %12
12: ; preds = %6, %1
%13 = phi i1 [ false, %1 ], [ %11, %6 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
@.str = [9 x i8] c"()';`,\\|\00"
define i32 @symchar(i8 signext %0) {
%2 = tail call i32 @isspace(i8 signext %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @strchr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
scalar_t__ fabs(int);
float sqrt(int);
float distance(int a, int b, int x, int y) {
  float result;
  result = (float)fabs(a * x - y + b) / sqrt(a * a + 1);
  return (result);
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
imul   -0xc(%rbp),%edi
sub    -0x10(%rbp),%edi
add    -0x8(%rbp),%edi
call   1030 <fabs@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
imul   -0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
imul   %edi,%edx
sub    %ecx,%esi
lea    (%rsi,%rdx,1),%edi
call   1030 <fabs@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,0xc(%rsp)
imul   %ebx,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <sqrt@plt>
movss  0xc(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %7
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %8
%14 = sub nsw i32 %12, %13
%15 = load i32, i32* %6
%16 = add nsw i32 %14, %15
%17 = call i64 @fabs(i32 %16)
%18 = sitofp i64 %17 to float
%19 = load i32, i32* %5
%20 = load i32, i32* %5
%21 = mul nsw i32 %19, %20
%22 = add nsw i32 %21, 1
%23 = call float @sqrt(i32 %22)
%24 = fdiv float %18, %23
store float %24, float* %9
%25 = load float, float* %9
ret float %25
}

LLVM IR (-O2):
define float @distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %2, %0
%6 = sub i32 %1, %3
%7 = add i32 %6, %5
%8 = tail call i64 @fabs(i32 %7)
%9 = sitofp i64 %8 to float
%10 = mul nsw i32 %0, %0
%11 = add nuw nsw i32 %10, 1
%12 = tail call float @sqrt(i32 %11)
%13 = fdiv float %9, %12
ret float %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void line(char ch, int n) {
  int k;
  for (k = 0; k < n; k++)
    printf("%c", ch);
  printf("\n");
}


x86 assembly (clang, -O0):
<line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1154 <line+0x44>
movsbl -0x1(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <line+0x18>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    112c <line+0x1c>
mov    %esi,%ebx
movsbl %dil,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <line+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @line(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @line(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sext i8 %0 to i32
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %9, %6 ]
%8 = tail call i32 @putchar(i32 %5)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, %1
br i1 %10, label %11, label %6
11: ; preds = %6, %2
%12 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
struct timestamp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct timestamp *);
void dispose_timestamp(struct timestamp *target) {
  free(target);
  target = NULL;
  return;
}


x86 assembly (clang, -O0):
<dispose_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispose_timestamp>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.timestamp = type { i32 }
define void @dispose_timestamp(%struct.timestamp* %0) {
%2 = alloca %struct.timestamp*
store %struct.timestamp* %0, %struct.timestamp** %2
%3 = load %struct.timestamp*, %struct.timestamp** %2
%4 = call i32 @free(%struct.timestamp* %3)
store %struct.timestamp* null, %struct.timestamp** %2
ret void
}

LLVM IR (-O2):
%struct.timestamp = type { i32 }
define void @dispose_timestamp(%struct.timestamp* nocapture %0) {
%2 = tail call i32 @free(%struct.timestamp* %0)
ret void
}
void kcompactd_stop(int nid) {}


x86 assembly (clang, -O0):
<kcompactd_stop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<kcompactd_stop>:
ret

LLVM IR (-O0):
define void @kcompactd_stop(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @kcompactd_stop(i32 %0) {
ret void
}
/* Variables and functions */
int atoi(char *);
int uct_to_bjt(char uct[]) {
  int iuct = atoi(uct);
  int h = (iuct / 10000 + 8) % 24;
  int bjt = h * 10000 + iuct % 10000;
  return bjt;
}


x86 assembly (clang, -O0):
<uct_to_bjt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
add    $0x8,%eax
mov    $0x18,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
imul   $0x2710,-0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uct_to_bjt>:
push   %rax
call   1030 <atoi@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%r8
shr    $0x3f,%r8
sar    $0x2c,%rcx
lea    (%rcx,%r8,1),%esi
add    $0x8,%esi
movslq %esi,%rsi
imul   $0x2aaaaaab,%rsi,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rdi
add    %edx,%edi
shl    $0x3,%edi
lea    (%rdi,%rdi,2),%edx
sub    %edx,%esi
imul   $0x2710,%esi,%edx
add    %r8d,%ecx
imul   $0x2710,%ecx,%ecx
sub    %ecx,%eax
add    %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @uct_to_bjt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @atoi(i8* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sdiv i32 %8, 10000
%10 = add nsw i32 %9, 8
%11 = srem i32 %10, 24
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 10000
%14 = load i32, i32* %3
%15 = srem i32 %14, 10000
%16 = add nsw i32 %13, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @uct_to_bjt(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = sdiv i32 %2, 10000
%4 = add nsw i32 %3, 8
%5 = srem i32 %4, 24
%6 = mul nsw i32 %5, 10000
%7 = srem i32 %2, 10000
%8 = add nsw i32 %6, %7
ret i32 %8
}
void do_short_math(short int *x) {
  printf("%s: X before: %d\n", __func__, *x);
  *x += 5;
  printf("%s: X after: %d\n", __func__, *x);
}


x86 assembly (clang, -O0):
<do_short_math>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
lea    0xed6(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movswl (%rax),%ecx
add    $0x5,%ecx
mov    %cx,(%rax)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
lea    0xecd(%rip),%rdi
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_short_math>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movswl (%rdi),%edx
lea    0xedf(%rip),%rdi
lea    0xeea(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movzwl (%rbx),%eax
add    $0x5,%eax
mov    %ax,(%rbx)
movswl %ax,%edx
lea    0xedb(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s: X before: %d\0A\00"
@__func__.do_short_math = [14 x i8] c"do_short_math\00"
@.str.1 = [17 x i8] c"%s: X after: %d\0A\00"
define void @do_short_math(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.do_short_math, i64 0, i64 0), i32 %5)
%7 = load i16*, i16** %2
%8 = load i16, i16* %7
%9 = sext i16 %8 to i32
%10 = add nsw i32 %9, 5
%11 = trunc i32 %10 to i16
store i16 %11, i16* %7
%12 = load i16*, i16** %2
%13 = load i16, i16* %12
%14 = sext i16 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.do_short_math, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s: X before: %d\0A\00"
@__func__.do_short_math = [14 x i8] c"do_short_math\00"
@.str.1 = [17 x i8] c"%s: X after: %d\0A\00"
define void @do_short_math(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = sext i16 %2 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.do_short_math, i64 0, i64 0), i32 %3)
%5 = load i16, i16* %0
%6 = add i16 %5, 5
store i16 %6, i16* %0
%7 = sext i16 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.do_short_math, i64 0, i64 0), i32 %7)
ret void
}
void b3Swap32(unsigned char *ptr) {
  unsigned char val;
  val = *(ptr);
  *(ptr) = *(ptr + 3);
  *(ptr + 3) = val;
  ptr += 1;
  val = *(ptr);
  *(ptr) = *(ptr + 1);
  *(ptr + 1) = val;
}


x86 assembly (clang, -O0):
<b3Swap32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<b3Swap32>:
mov    (%rdi),%al
mov    0x3(%rdi),%cl
mov    %cl,(%rdi)
mov    %al,0x3(%rdi)
rolw   $0x8,0x1(%rdi)
ret

LLVM IR (-O0):
define void @b3Swap32(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
store i8 %5, i8* %3
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 3
%8 = load i8, i8* %7
%9 = load i8*, i8** %2
store i8 %8, i8* %9
%10 = load i8, i8* %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 3
store i8 %10, i8* %12
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %14, i8** %2
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
store i8 %16, i8* %3
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = load i8*, i8** %2
store i8 %19, i8* %20
%21 = load i8, i8* %3
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8 %21, i8* %23
ret void
}

LLVM IR (-O2):
define void @b3Swap32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 3
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = load i8, i8* %7
store i8 %8, i8* %5
store i8 %6, i8* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printCharacters(char *);
int /*<<< orphan*/ puts(char *);
void fig07_11() {
  char string[] = "print characters of a string";
  puts("The string is:");
  printCharacters(string);
  puts("");
}


x86 assembly (clang, -O0):
<fig07_11>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec4(%rip),%al
mov    %al,-0x4(%rbp)
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rdi
call   1040 <printCharacters@plt>
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig07_11>:
sub    $0x28,%rsp
movups 0xed2(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rdi
call   1050 <printCharacters@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.fig07_11.string = [29 x i8] c"print characters of a string\00"
@.str = [15 x i8] c"The string is:\00"
@.str.1 = [1 x i8] zeroinitializer
define void @fig07_11() {
%1 = alloca [29 x i8]
%2 = bitcast [29 x i8]* %1 to i8*
%3 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [29 x i8], [29 x i8]* %1, i64 0, i64 0
%5 = call i32 @printCharacters(i8* %4)
%6 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.fig07_11.string = [29 x i8] c"print characters of a string\00"
@.str = [15 x i8] c"The string is:\00"
define void @fig07_11() {
%1 = alloca [29 x i8]
%2 = getelementptr inbounds [29 x i8], [29 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printCharacters(i8* %2)
%5 = call i32 @putchar(i32 10)
ret void
}
int cmp2(const void *a, const void *b) { return (*(char *)a - *(char *)b); }


x86 assembly (clang, -O0):
<cmp2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp2>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp2(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
int check_disk_change(struct block_device *x) {
  int a;
  return a;
}


x86 assembly (clang, -O0):
<check_disk_change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_disk_change>:
ret

LLVM IR (-O0):
%struct.block_device = type opaque
define i32 @check_disk_change(%struct.block_device* %0) {
%2 = alloca %struct.block_device*
%3 = alloca i32
store %struct.block_device* %0, %struct.block_device** %2
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
%struct.block_device = type opaque
define i32 @check_disk_change(%struct.block_device* nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_209() {
  Assert_real((isqrt(209) == 14),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              1050, ("Integer square root of 209 should be 14"));
}


x86 assembly (clang, -O0):
<t_sqrt_209>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd1,%edi
call   1030 <isqrt@plt>
cmp    $0xe,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x41a,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_209>:
push   %rax
mov    $0xd1,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xe,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x41a,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 209 should be 14\00"
define void @t_sqrt_209() {
%1 = call i32 @isqrt(i32 209)
%2 = icmp eq i32 %1, 14
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1050, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 209 should be 14\00"
define void @t_sqrt_209() {
%1 = tail call i32 @isqrt(i32 209)
%2 = icmp eq i32 %1, 14
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 1050, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int do_d() { return 1; }


x86 assembly (clang, -O0):
<do_d>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_d>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @do_d() {
ret i32 1
}

LLVM IR (-O2):
define i32 @do_d() {
ret i32 1
}
/* Variables and functions */
int int_value();
int int_range(int min, int max) {
  int val = int_value();
  if (val < min || max < val)
    val = min;
  return val;
}


x86 assembly (clang, -O0):
<int_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <int_value@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     1140 <int_range+0x30>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1146 <int_range+0x36>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <int_value@plt>
cmp    %ebx,%eax
mov    %eax,%ecx
cmovg  %ebp,%ecx
cmp    %ebp,%eax
cmovl  %ebp,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @int_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (...) @int_value()
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10, %2
%15 = load i32, i32* %3
store i32 %15, i32* %5
br label %16
16: ; preds = %14, %10
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @int_range(i32 %0, i32 %1) {
%3 = tail call i32 (...) @int_value()
%4 = icmp slt i32 %3, %0
%5 = icmp sgt i32 %3, %1
%6 = or i1 %4, %5
%7 = select i1 %6, i32 %0, i32 %3
ret i32 %7
}
/* Variables and functions */
float powf(float, float);
float exponential_in(float step, float max_steps, float max_val) {
  return (step == 0) ? 0 : powf(max_val, (float)step / max_steps);
}


x86 assembly (clang, -O0):
<exponential_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    114b <exponential_in+0x3b>
jp     114b <exponential_in+0x3b>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1164 <exponential_in+0x54>
movss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
divss  -0x8(%rbp),%xmm1
call   1030 <powf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exponential_in>:
movaps %xmm0,%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm3
jne    1121 <exponential_in+0x11>
jp     1121 <exponential_in+0x11>
xorps  %xmm0,%xmm0
ret
divss  %xmm1,%xmm3
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
jmp    1030 <powf@plt>

LLVM IR (-O0):
define float @exponential_in(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = fcmp oeq float %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %3
br label %16
10: ; preds = %3
%11 = load float, float* %6
%12 = load float, float* %4
%13 = load float, float* %5
%14 = fdiv float %12, %13
%15 = call float @powf(float %11, float %14)
br label %16
16: ; preds = %10, %9
%17 = phi float [ 0.000000e+00, %9 ], [ %15, %10 ]
ret float %17
}

LLVM IR (-O2):
define float @exponential_in(float %0, float %1, float %2) {
%4 = fcmp oeq float %0, 0.000000e+00
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = fdiv float %0, %1
%7 = tail call float @powf(float %2, float %6)
br label %8
8: ; preds = %3, %5
%9 = phi float [ %7, %5 ], [ 0.000000e+00, %3 ]
ret float %9
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void configurePropPatch(void) {
  uint8_t *pPatchTab = (uint8_t *)(0x21000000 + 0x03D4);
  pPatchTab[76] = 0;
  pPatchTab[62] = 1;
  pPatchTab[64] = 2;
}


x86 assembly (clang, -O0):
<configurePropPatch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x210003d4,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x130(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0xf8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x2,0x100(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<configurePropPatch>:
movl   $0x0,0x21000504
movl   $0x1,0x210004cc
movl   $0x2,0x210004d4
ret

LLVM IR (-O0):
define void @configurePropPatch() {
%1 = alloca i32*
store i32* inttoptr (i64 553649108 to i32*), i32** %1
%2 = load i32*, i32** %1
%3 = getelementptr inbounds i32, i32* %2, i64 76
store i32 0, i32* %3
%4 = load i32*, i32** %1
%5 = getelementptr inbounds i32, i32* %4, i64 62
store i32 1, i32* %5
%6 = load i32*, i32** %1
%7 = getelementptr inbounds i32, i32* %6, i64 64
store i32 2, i32* %7
ret void
}

LLVM IR (-O2):
define void @configurePropPatch() {
store i32 0, i32* inttoptr (i64 553649412 to i32*)
store i32 1, i32* inttoptr (i64 553649356 to i32*)
store i32 2, i32* inttoptr (i64 553649364 to i32*)
ret void
}
/* Variables and functions */
int rd_uart_lsr();
int /*<<< orphan*/ wr_uart_thr(int);
int outbyte(int c) {
  while ((rd_uart_lsr() & (1 << 6)) == 0)
    ;
  wr_uart_thr(c);
  return 0;
}


x86 assembly (clang, -O0):
<outbyte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rd_uart_lsr@plt>
and    $0x40,%eax
cmp    $0x0,%eax
jne    1143 <outbyte+0x23>
jmp    112b <outbyte+0xb>
mov    -0x4(%rbp),%edi
call   1040 <wr_uart_thr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outbyte>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <rd_uart_lsr@plt>
test   $0x40,%al
je     1130 <outbyte+0x10>
mov    %ebx,%edi
call   1040 <wr_uart_thr@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @outbyte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = call i32 (...) @rd_uart_lsr()
%5 = and i32 %4, 64
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i32, i32* %2
%10 = call i32 @wr_uart_thr(i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @outbyte(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 (...) @rd_uart_lsr()
%4 = and i32 %3, 64
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = tail call i32 @wr_uart_thr(i32 %0)
ret i32 0
}
unsigned int baseTwoLog(unsigned long int n) {
  int k = 0;
  while (n > 1) {
    n = n >> 1;
    ++k;
  }
  return k;
}


x86 assembly (clang, -O0):
<baseTwoLog>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x1,-0x8(%rbp)
jbe    1134 <baseTwoLog+0x34>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <baseTwoLog+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<baseTwoLog>:
xor    %eax,%eax
cmp    $0x2,%rdi
jb     111f <baseTwoLog+0x1f>
xor    %eax,%eax
mov    %rdi,%rcx
nopl   (%rax)
shr    %rcx
add    $0x1,%eax
cmp    $0x3,%rdi
mov    %rcx,%rdi
ja     1110 <baseTwoLog+0x10>
ret

LLVM IR (-O0):
define i32 @baseTwoLog(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i64, i64* %2
%6 = icmp ugt i64 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i64, i64* %2
%9 = lshr i64 %8, 1
store i64 %9, i64* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @baseTwoLog(i64 %0) {
%2 = icmp ugt i64 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i64 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i64 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
int bf_test(char *b, int nr) {
  int idx = nr / 8;
  int mask = 1 << (nr % 8);
  return (b[idx] & mask) != 0;
}


x86 assembly (clang, -O0):
<bf_test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
and    -0x14(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_test>:
mov    %esi,%ecx
lea    0x7(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x3,%eax
cltq
movsbl (%rdi,%rax,1),%eax
and    $0x7,%cl
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bf_test(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 8
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = srem i32 %9, 8
%11 = shl i32 1, %10
store i32 %11, i32* %6
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i32, i32* %6
%19 = and i32 %17, %18
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @bf_test(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = and i32 %1, 7
%5 = sext i32 %3 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = lshr i32 %8, %4
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_CLR_I2C_BUS1_SDA_PIN() { clear_io_bit(0x34, 5); }


x86 assembly (clang, -O0):
<TOSH_CLR_I2C_BUS1_SDA_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x34,%edi
mov    $0x5,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_I2C_BUS1_SDA_PIN>:
mov    $0x34,%edi
mov    $0x5,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_I2C_BUS1_SDA_PIN() {
%1 = call i32 @clear_io_bit(i32 52, i32 5)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_I2C_BUS1_SDA_PIN() {
%1 = tail call i32 @clear_io_bit(i32 52, i32 5)
ret void
}
int sum(int x) {
  if (x == 0) {
    return x;
  }
  return x + sum(x - 1);
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1130 <sum+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <sum+0x3b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <sum@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %edi,%edi
je     1119 <sum+0x19>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
imul   %eax,%eax
shr    %rcx
add    %edi,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @sum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %14
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = call i32 @sum(i32 %11)
%13 = add nsw i32 %9, %12
store i32 %13, i32* %2
br label %14
14: ; preds = %8, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @sum(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = mul i32 %4, %4
%6 = zext i32 %4 to i33
%7 = add i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %5, %0
%13 = sub i32 %12, %11
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void listfreeallitems(char **list, int count) {
  int i = 0;
  for (i; i < count; i++) {
    free(list[i]);
  }
}


x86 assembly (clang, -O0):
<listfreeallitems>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <listfreeallitems+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <listfreeallitems+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listfreeallitems>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1142 <listfreeallitems+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <listfreeallitems+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @listfreeallitems(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %5
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load i8**, i8*** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @free(i8* %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %7
21: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @listfreeallitems(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @free(i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *get_ruleset_list(char const *);
int is_empty_ruleset(const char *rulesetname) {
  return get_ruleset_list(rulesetname) == NULL;
}


x86 assembly (clang, -O0):
<is_empty_ruleset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_ruleset_list@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_empty_ruleset>:
push   %rax
call   1030 <get_ruleset_list@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_empty_ruleset(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32* @get_ruleset_list(i8* %3)
%5 = icmp eq i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_empty_ruleset(i8* %0) {
%2 = tail call i32* @get_ruleset_list(i8* %0)
%3 = icmp eq i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
void resetString(char *str) { memset(str, '\0', sizeof(str)); }


x86 assembly (clang, -O0):
<resetString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resetString>:
xor    %esi,%esi
mov    $0x8,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @resetString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @memset(i8* %3, i8 signext 0, i32 8)
ret void
}

LLVM IR (-O2):
define void @resetString(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i8 signext 0, i32 8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_multiport(char *device, int fd) {
  printf("Setserial was compiled under a kernel which did not\n");
  printf("support the special serial multiport configs.\n");
}


x86 assembly (clang, -O0):
<get_multiport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_multiport>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Setserial was compiled under a kernel which did not\0A\00"
@.str.1 = [47 x i8] c"support the special serial multiport configs.\0A\00"
define void @get_multiport(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [52 x i8] c"Setserial was compiled under a kernel which did not\00"
@str.2 = [46 x i8] c"support the special serial multiport configs.\00"
define void @get_multiport(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.2, i64 0, i64 0))
ret void
}
int cntDigits(int data) {
  int cnt = 0;
  {
    do {
      cnt++;
      data /= 10;
    } while (data);
  }
  return cnt;
}


x86 assembly (clang, -O0):
<cntDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    110e <cntDigits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cntDigits>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <cntDigits+0x10>
ret

LLVM IR (-O0):
define i32 @cntDigits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 10
store i32 %8, i32* %2
br label %9
9: ; preds = %4
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br i1 %11, label %4, label %12
12: ; preds = %9
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @cntDigits(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = phi i32 [ 0, %1 ], [ %5, %2 ]
%5 = add nuw nsw i32 %4, 1
%6 = sdiv i32 %3, 10
%7 = add i32 %3, 9
%8 = icmp ult i32 %7, 19
br i1 %8, label %9, label %2
9: ; preds = %2
ret i32 %5
}
/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *xmalloc(int);
char *xstring(const char *s) {
  size_t len = strlen(s) + 1;
  char *p = xmalloc(sizeof(char) * len);
  strncpy(p, s, len);
  return p;
}


x86 assembly (clang, -O0):
<xstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstring>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15d,%edi
call   1050 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xstring(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = mul i64 1, %9
%11 = trunc i64 %10 to i32
%12 = call i8* @xmalloc(i32 %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = load i64, i64* %3
%16 = call i32 @strncpy(i8* %13, i8* %14, i64 %15)
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @xstring(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @xmalloc(i32 %3)
%6 = tail call i32 @strncpy(i8* %5, i8* %0, i64 %4)
ret i8* %5
}
void Init() {}


x86 assembly (clang, -O0):
<Init>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Init>:
ret

LLVM IR (-O0):
define void @Init() {
ret void
}

LLVM IR (-O2):
define void @Init() {
ret void
}
/* Variables and functions */
scalar_t__ CRYPTO_secure_malloc_init(int, int);
int test_false(char *, int, char *, int);
int test_sec_mem(void) {
  return test_false(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/"
      "humble-video-captive/src/main/gnu/openssl/csrc/test/secmemtest.c",
      128, "CRYPTO_secure_malloc_init(4096, 32)",
      (CRYPTO_secure_malloc_init(4096, 32)) != 0);
}


x86 assembly (clang, -O0):
<test_sec_mem>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1000,%edi
mov    $0x20,%esi
call   1040 <CRYPTO_secure_malloc_init@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xeba(%rip),%rdi
mov    $0x80,%esi
lea    0xf72(%rip),%rdx
call   1030 <test_false@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sec_mem>:
push   %rax
mov    $0x1000,%edi
mov    $0x20,%esi
call   1040 <CRYPTO_secure_malloc_init@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xec1(%rip),%rdi
lea    0xf7e(%rip),%rdx
mov    $0x80,%esi
pop    %rax
jmp    1030 <test_false@plt>

LLVM IR (-O0):
@.str = [196 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/secmemtest.c\00"
@.str.1 = [36 x i8] c"CRYPTO_secure_malloc_init(4096, 32)\00"
define i32 @test_sec_mem() {
%1 = call i64 @CRYPTO_secure_malloc_init(i32 4096, i32 32)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @test_false(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [196 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/artclarke/humble-video/refs/heads/master/humble-video-captive/src/main/gnu/openssl/csrc/test/secmemtest.c\00"
@.str.1 = [36 x i8] c"CRYPTO_secure_malloc_init(4096, 32)\00"
define i32 @test_sec_mem() {
%1 = tail call i64 @CRYPTO_secure_malloc_init(i32 4096, i32 32)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @test_false(i8* getelementptr inbounds ([196 x i8], [196 x i8]* @.str, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ getpid();
scalar_t__ getppid();
int /*<<< orphan*/ printf(char *, long);
int main(int argc, char *argv[]) {
  pid_t pid;
  pid_t ppid;
  pid = getpid();
  ppid = getppid();
  printf(" PID: %ld\n", (long)pid);
  printf("PPID: %ld\n", (long)ppid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <getppid@plt>
mov    %rax,%r14
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c" PID: %ld\0A\00"
@.str.1 = [11 x i8] c"PPID: %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 (...) @getpid()
store i64 %8, i64* %6
%9 = call i64 (...) @getppid()
store i64 %9, i64* %7
%10 = load i64, i64* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = load i64, i64* %7
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c" PID: %ld\0A\00"
@.str.1 = [11 x i8] c"PPID: %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @getpid()
%4 = tail call i64 (...) @getppid()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64 %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int is_pad(int /*<<< orphan*/ const *);
bool ncurses_is_pad(const WINDOW *win) { return is_pad(win); }


x86 assembly (clang, -O0):
<ncurses_is_pad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_pad@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncurses_is_pad>:
jmp    1030 <is_pad@plt>

LLVM IR (-O0):
define i32 @ncurses_is_pad(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @is_pad(i32* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @ncurses_is_pad(i32* %0) {
%2 = tail call i32 @is_pad(i32* %0)
ret i32 %2
}