xunge/DecIR huggingface dataset:
long FlashErase(unsigned long ulAddress) {
  ;
  (*((volatile unsigned long *)(0x400FD000 + 0x00000014))) =
      (0x00000001 | 0x00000200 | 0x00000800);
  (*((volatile unsigned long *)(0x400FD000 + 0x00000000))) = ulAddress;
  (*((volatile unsigned long *)(0x400FD000 + 0x00000008))) =
      0xA4420000 | 0x00000002;
  while ((*((volatile unsigned long *)(0x400FD000 + 0x00000008))) &
         0x00000002) {
  }
  if ((*((volatile unsigned long *)(0x400FD000 + 0x0000000C))) &
      (0x00000001 | 0x00000200 | 0x00000800)) {
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<FlashErase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    $0x400fd014,%eax
movq   $0xa01,(%rax)
mov    -0x10(%rbp),%rcx
mov    $0x400fd000,%eax
mov    %rcx,(%rax)
mov    $0x400fd008,%eax
mov    $0xa4420002,%ecx
mov    %rcx,(%rax)
mov    $0x400fd008,%eax
mov    (%rax),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     1148 <FlashErase+0x48>
jmp    112d <FlashErase+0x2d>
mov    $0x400fd00c,%eax
mov    (%rax),%rax
and    $0xa01,%rax
cmp    $0x0,%rax
je     116d <FlashErase+0x6d>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1175 <FlashErase+0x75>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlashErase>:
movq   $0xa01,0x400fd014
mov    %rdi,0x400fd000
40
mov    $0xa4420002,%eax
mov    %rax,0x400fd008
40
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
testq  $0x2,0x400fd008
jne    1130 <FlashErase+0x30>
mov    0x400fd00c,%rax
40
and    $0xa01,%eax
neg    %rax
sbb    %rax,%rax
ret

LLVM IR (-O0):
define i64 @FlashErase(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
store volatile i64 2561, i64* inttoptr (i64 1074778132 to i64*)
%4 = load i64, i64* %3
store volatile i64 %4, i64* inttoptr (i64 1074778112 to i64*)
store volatile i64 2755788802, i64* inttoptr (i64 1074778120 to i64*)
br label %5
5: ; preds = %9, %1
%6 = load volatile i64, i64* inttoptr (i64 1074778120 to i64*)
%7 = and i64 %6, 2
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load volatile i64, i64* inttoptr (i64 1074778124 to i64*)
%12 = and i64 %11, 2561
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i64 -1, i64* %2
br label %16
15: ; preds = %10
store i64 0, i64* %2
br label %16
16: ; preds = %15, %14
%17 = load i64, i64* %2
ret i64 %17
}

LLVM IR (-O2):
define i64 @FlashErase(i64 %0) {
store volatile i64 2561, i64* inttoptr (i64 1074778132 to i64*)
store volatile i64 %0, i64* inttoptr (i64 1074778112 to i64*)
store volatile i64 2755788802, i64* inttoptr (i64 1074778120 to i64*)
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 1074778120 to i64*)
%4 = and i64 %3, 2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = load volatile i64, i64* inttoptr (i64 1074778124 to i64*)
%8 = and i64 %7, 2561
%9 = icmp ne i64 %8, 0
%10 = sext i1 %9 to i64
ret i64 %10
}
__attribute__((always_)) void optnone1() {}


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

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

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

LLVM IR (-O2):
define void @optnone1() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int pc_unit_copy(void *dst, void *src) {
  *((int64_t *)dst) = *((int64_t *)src);
  return 0;
}


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

x86 assembly (clang, -O2):
<pc_unit_copy>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @pc_unit_copy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
store i32 %7, i32* %9
ret i32 0
}

LLVM IR (-O2):
define i32 @pc_unit_copy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret i32 0
}
unsigned short getBitboardValue(unsigned short bitboard,
                                unsigned short indexToRetrieve) {
  return (bitboard & (short)1 << indexToRetrieve) > 0;
}


x86 assembly (clang, -O0):
<getBitboardValue>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBitboardValue>:
xor    %eax,%eax
bt     %esi,%edi
setb   %al
ret

LLVM IR (-O0):
define zeroext i16 @getBitboardValue(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = shl i32 1, %8
%10 = and i32 %6, %9
%11 = icmp sgt i32 %10, 0
%12 = zext i1 %11 to i32
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @getBitboardValue(i16 zeroext %0, i16 zeroext %1) {
%3 = zext i16 %0 to i32
%4 = zext i16 %1 to i32
%5 = shl nuw i32 1, %4
%6 = and i32 %5, %3
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i16
ret i16 %8
}
int isasciidigit(const char c) { return (c >= '0' && c <= '9') ? 1 : 0; }


x86 assembly (clang, -O0):
<isasciidigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isasciidigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isasciidigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isasciidigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
ret i32 %13
}

LLVM IR (-O2):
define i32 @isasciidigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ svz_log(int, char *);
int /*<<< orphan*/ svz_sock_shutdown_all();
void svz_loop_post(void) {
  svz_log(3, "leaving server loop\n");
  svz_sock_shutdown_all();
}


x86 assembly (clang, -O0):
<svz_loop_post>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
lea    0xed0(%rip),%rsi
call   1040 <svz_log@plt>
mov    $0x0,%al
call   1030 <svz_sock_shutdown_all@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<svz_loop_post>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x3,%edi
call   1040 <svz_log@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <svz_sock_shutdown_all@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"leaving server loop\0A\00"
define void @svz_loop_post() {
%1 = call i32 @svz_log(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @svz_sock_shutdown_all()
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"leaving server loop\0A\00"
define void @svz_loop_post() {
%1 = tail call i32 @svz_log(i32 3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @svz_sock_shutdown_all()
ret void
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn23() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn23");
  return result;
}


x86 assembly (clang, -O0):
<fn23>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn23>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn23\00"
define i8* @fn23() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn23\00"
define i8* @fn23() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ C67_asm(char *, int, int, int);
void C67_XORCST(int v, int r, int r2) { C67_asm("XOR.LCST", v, r, r2); }


x86 assembly (clang, -O0):
<C67_XORCST>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xecf(%rip),%rdi
call   1030 <C67_asm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C67_XORCST>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
jmp    1030 <C67_asm@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"XOR.LCST\00"
define void @C67_XORCST(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @C67_asm(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"XOR.LCST\00"
define void @C67_XORCST(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @C67_asm(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ error(int, char *);
int get_char();
int get_data(void) {
  int val;
  if ((val = get_char()) == EOF || !(val & 0100))
    error(1, "missing data value");
  return (val & 077);
}


x86 assembly (clang, -O0):
<get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get_char@plt>
mov    %eax,-0x4(%rbp)
mov    0x2eaf(%rip),%rcx
cmp    (%rcx),%eax
je     1150 <get_data+0x30>
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
jne    1161 <get_data+0x41>
mov    $0x1,%edi
lea    0xea4(%rip),%rsi
call   1030 <error@plt>
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_data>:
push   %rbx
xor    %eax,%eax
call   1040 <get_char@plt>
mov    %eax,%ebx
mov    0x2eb7(%rip),%rax
cmp    (%rax),%ebx
je     113c <get_data+0x1c>
mov    %ebx,%eax
and    $0x40,%eax
jne    114d <get_data+0x2d>
lea    0xebd(%rip),%rsi
mov    $0x1,%edi
call   1030 <error@plt>
and    $0x3f,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [19 x i8] c"missing data value\00"
define i32 @get_data() {
%1 = alloca i32
%2 = call i32 (...) @get_char()
store i32 %2, i32* %1
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = load i32, i32* %1
%7 = and i32 %6, 64
%8 = icmp ne i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5, %0
%10 = call i32 @error(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
%12 = load i32, i32* %1
%13 = and i32 %12, 63
ret i32 %13
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [19 x i8] c"missing data value\00"
define i32 @get_data() {
%1 = tail call i32 (...) @get_char()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
%4 = and i32 %1, 64
%5 = icmp eq i32 %4, 0
%6 = or i1 %3, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %0, %7
%10 = and i32 %1, 63
ret i32 %10
}
int elias_gamma_bits(int value) {
  int bits;
  bits = 1;
  while (value > 1)
    bits += 2, value >>= 1;
  return bits;
}


x86 assembly (clang, -O0):
<elias_gamma_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    112f <elias_gamma_bits+0x2f>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <elias_gamma_bits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<elias_gamma_bits>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     112c <elias_gamma_bits+0x2c>
mov    $0x1,%eax
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x2,%eax
shr    %ecx
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1120 <elias_gamma_bits+0x20>
ret

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

LLVM IR (-O2):
define i32 @elias_gamma_bits(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 2
%7 = lshr i32 %5, 1
%8 = icmp ugt i32 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %10
}
int set_memory_x(unsigned long addr, int numpages) { return 0; }


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

x86 assembly (clang, -O2):
<set_memory_x>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @set_memory_x(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @set_memory_x(i64 %0, i32 %1) {
ret i32 0
}
int coco_remove_directory_msc(const char *path) {
  (void)path;
  return -1;
}


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

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

LLVM IR (-O0):
define i32 @coco_remove_directory_msc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i32 -1
}

LLVM IR (-O2):
define i32 @coco_remove_directory_msc(i8* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ Putw(int, int);
extern void SetWidth_1(int width) { Putw(0x40, width - 1); }


x86 assembly (clang, -O0):
<SetWidth_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
mov    $0x40,%edi
call   1030 <Putw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetWidth_1>:
lea    -0x1(%rdi),%esi
mov    $0x40,%edi
jmp    1030 <Putw@plt>

LLVM IR (-O0):
define void @SetWidth_1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = call i32 @Putw(i32 64, i32 %4)
ret void
}

LLVM IR (-O2):
define void @SetWidth_1(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = tail call i32 @Putw(i32 64, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void sigpipe_handler(int signum) { exit(1); }


x86 assembly (clang, -O0):
<sigpipe_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sigpipe_handler>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @sigpipe_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @sigpipe_handler(i32 %0) {
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test1();
int main(int argc, char **argv) {
  printf("main; -begin;\n");
  test1();
  printf("main; -end;\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <test1@plt>
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <test1@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"main; -begin;\0A\00"
@.str.1 = [13 x i8] c"main; -end;\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @test1()
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"main; -begin;\00"
@str.2 = [12 x i8] c"main; -end;\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @test1()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ call_if_freed_invalid_latent(int);
void call_if_freed_invalid2_bad() { call_if_freed_invalid_latent(7); }


x86 assembly (clang, -O0):
<call_if_freed_invalid2_bad>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
call   1030 <call_if_freed_invalid_latent@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_if_freed_invalid2_bad>:
mov    $0x7,%edi
jmp    1030 <call_if_freed_invalid_latent@plt>

LLVM IR (-O0):
define void @call_if_freed_invalid2_bad() {
%1 = call i32 @call_if_freed_invalid_latent(i32 7)
ret void
}

LLVM IR (-O2):
define void @call_if_freed_invalid2_bad() {
%1 = tail call i32 @call_if_freed_invalid_latent(i32 7)
ret void
}
/* Variables and functions */
int serial_getc();
void serial_getl(char *buf) {
  int c;
  for (;;) {
    c = serial_getc();
    if (c == '\r')
      c = '\n';
    if (c == '\n')
      break;
    *buf++ = c;
  }
  *buf++ = '\0';
}


x86 assembly (clang, -O0):
<serial_getl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <serial_getc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xd,-0xc(%rbp)
jne    1137 <serial_getl+0x27>
movl   $0xa,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    1146 <serial_getl+0x36>
jmp    1161 <serial_getl+0x51>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    111c <serial_getl+0xc>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_getl>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <serial_getc@plt>
cmp    $0xa,%eax
je     1139 <serial_getl+0x29>
cmp    $0xd,%eax
je     1139 <serial_getl+0x29>
mov    %al,(%rbx)
add    $0x1,%rbx
jmp    1120 <serial_getl+0x10>
movb   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @serial_getl(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %7, %5 ]
%4 = tail call i32 (...) @serial_getc()
switch i32 %4, label %5 [
i32 13, label %8
i32 10, label %8
]
5: ; preds = %2
%6 = trunc i32 %4 to i8
%7 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %6, i8* %3
br label %2
8: ; preds = %2, %2
store i8 0, i8* %3
ret void
}
void RTAvlU32Insert(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlU32Insert() {
ret void
}
int test_imm_50int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x50 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_50int64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x50,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_50int64_midword_mem>:
testb  $0x50,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_50int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 80
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_50int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 5242880
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void fun(char *p) {
  char c = p[3];
  printf("%c\n", c);
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0x9(%rbp)
lea    0xed3(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
movsbl 0x3(%rdi),%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define void @fun(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 3
%6 = load i8, i8* %5
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %7)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define void @fun(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %3)
ret void
}
/* Variables and functions */
char *bmhcore(unsigned char *, size_t, unsigned char *, size_t, size_t *);
int /*<<< orphan*/ bmhtable_build(unsigned char *, size_t, size_t *);
char *bmstrstr(unsigned char *text, size_t txtlen, unsigned char *pattern,
               size_t patlen) {
  size_t bmhtable[256];
  bmhtable_build(pattern, patlen, bmhtable);
  return bmhcore(text, txtlen, pattern, patlen, bmhtable);
}


x86 assembly (clang, -O0):
<bmstrstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x820(%rbp),%rdx
call   1040 <bmhtable_build@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x820(%rbp),%r8
call   1030 <bmhcore@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmstrstr>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%r13
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %r13,%rdx
call   1040 <bmhtable_build@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r13,%r8
call   1030 <bmhcore@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @bmstrstr(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca [256 x i64]
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = load i8*, i8** %7
%11 = load i64, i64* %8
%12 = getelementptr inbounds [256 x i64], [256 x i64]* %9, i64 0, i64 0
%13 = call i32 @bmhtable_build(i8* %10, i64 %11, i64* %12)
%14 = load i8*, i8** %5
%15 = load i64, i64* %6
%16 = load i8*, i8** %7
%17 = load i64, i64* %8
%18 = getelementptr inbounds [256 x i64], [256 x i64]* %9, i64 0, i64 0
%19 = call i8* @bmhcore(i8* %14, i64 %15, i8* %16, i64 %17, i64* %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @bmstrstr(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca [256 x i64]
%6 = bitcast [256 x i64]* %5 to i8*
%7 = getelementptr inbounds [256 x i64], [256 x i64]* %5, i64 0, i64 0
%8 = call i32 @bmhtable_build(i8* %2, i64 %3, i64* %7)
%9 = call i8* @bmhcore(i8* %0, i64 %1, i8* %2, i64 %3, i64* %7)
ret i8* %9
}
int geteuid() {}


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

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

LLVM IR (-O0):
define i32 @geteuid() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @geteuid() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int getint(void) {
  int a;
  printf("Please enter an integer > ");
  scanf("%d", &a);
  return (a);
}


x86 assembly (clang, -O0):
<getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Please enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @getint() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [27 x i8] c"Please enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @getint() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ breakpoint();
int inportb(int);
int /*<<< orphan*/ outportb(int, int);
int /*<<< orphan*/ set_debug_traps();
void CKinitDebugger(void) {
  outportb(0x3f8 + 3, inportb(0x3f8 + 3) | 0x80);
  outportb(0x3f8, 12);
  outportb(0x3f8 + 1, 0);
  outportb(0x3f8 + 3, inportb(0x3f8 + 3) & 0x7f);
  set_debug_traps();
  breakpoint();
}


x86 assembly (clang, -O0):
<CKinitDebugger>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3fb,%edi
call   1050 <inportb@plt>
mov    %eax,%esi
or     $0x80,%esi
mov    $0x3fb,%edi
call   1060 <outportb@plt>
mov    $0x3f8,%edi
mov    $0xc,%esi
call   1060 <outportb@plt>
mov    $0x3f9,%edi
xor    %esi,%esi
call   1060 <outportb@plt>
mov    $0x3fb,%edi
call   1050 <inportb@plt>
mov    %eax,%esi
and    $0x7f,%esi
mov    $0x3fb,%edi
call   1060 <outportb@plt>
mov    $0x0,%al
call   1040 <set_debug_traps@plt>
mov    $0x0,%al
call   1030 <breakpoint@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CKinitDebugger>:
push   %rax
mov    $0x3fb,%edi
call   1050 <inportb@plt>
or     $0x80,%eax
mov    $0x3fb,%edi
mov    %eax,%esi
call   1060 <outportb@plt>
mov    $0x3f8,%edi
mov    $0xc,%esi
call   1060 <outportb@plt>
mov    $0x3f9,%edi
xor    %esi,%esi
call   1060 <outportb@plt>
mov    $0x3fb,%edi
call   1050 <inportb@plt>
and    $0x7f,%eax
mov    $0x3fb,%edi
mov    %eax,%esi
call   1060 <outportb@plt>
xor    %eax,%eax
call   1040 <set_debug_traps@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <breakpoint@plt>

LLVM IR (-O0):
define void @CKinitDebugger() {
%1 = call i32 @inportb(i32 1019)
%2 = or i32 %1, 128
%3 = call i32 @outportb(i32 1019, i32 %2)
%4 = call i32 @outportb(i32 1016, i32 12)
%5 = call i32 @outportb(i32 1017, i32 0)
%6 = call i32 @inportb(i32 1019)
%7 = and i32 %6, 127
%8 = call i32 @outportb(i32 1019, i32 %7)
%9 = call i32 (...) @set_debug_traps()
%10 = call i32 (...) @breakpoint()
ret void
}

LLVM IR (-O2):
define void @CKinitDebugger() {
%1 = tail call i32 @inportb(i32 1019)
%2 = or i32 %1, 128
%3 = tail call i32 @outportb(i32 1019, i32 %2)
%4 = tail call i32 @outportb(i32 1016, i32 12)
%5 = tail call i32 @outportb(i32 1017, i32 0)
%6 = tail call i32 @inportb(i32 1019)
%7 = and i32 %6, 127
%8 = tail call i32 @outportb(i32 1019, i32 %7)
%9 = tail call i32 (...) @set_debug_traps()
%10 = tail call i32 (...) @breakpoint()
ret void
}
char *ft_strcpy(char *dst, char const *src) {
  int i;
  i = 0;
  while (src[i]) {
    dst[i] = src[i];
    i++;
  }
  dst[i] = '\0';
  return (dst);
}


x86 assembly (clang, -O0):
<ft_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1149 <ft_strcpy+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <ft_strcpy+0x13>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1127 <ft_strcpy+0x27>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <ft_strcpy+0x10>
mov    %edx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret
xor    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret

LLVM IR (-O0):
define i8* @ft_strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %6
%14 = load i8*, i8** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
%26 = load i8*, i8** %3
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 0, i8* %29
%30 = load i8*, i8** %3
ret i8* %30
}

LLVM IR (-O2):
define i8* @ft_strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %2
%16 = phi i64 [ 0, %2 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 0, i8* %17
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(char *arg0) {
  fprintf(stderr, "Usage: sleepd [-s command] [-d command] [-u n] [-U n] [-I] "
                  "[-i n] [-E] [-e filename] [-a] [-l n] [-w] [-n] [-v] [-c n] "
                  "[-b n] [-A] [-H] [-N [dev] [-t n] [-r n] -s n] [-x n] [-X] "
                  "[-g name] [--xdiff-unused n] [-V] [-h]\n\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [219 x i8] c"Usage: sleepd [-s command] [-d command] [-u n] [-U n] [-I] [-i n] [-E] [-e filename] [-a] [-l n] [-w] [-n] [-v] [-c n] [-b n] [-A] [-H] [-N [dev] [-t n] [-r n] -s n] [-x n] [-X] [-g name] [--xdiff-unused n] [-V] [-h]\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([219 x i8], [219 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [219 x i8] c"Usage: sleepd [-s command] [-d command] [-u n] [-U n] [-I] [-i n] [-E] [-e filename] [-a] [-l n] [-w] [-n] [-v] [-c n] [-b n] [-A] [-H] [-N [dev] [-t n] [-r n] -s n] [-x n] [-X] [-g name] [--xdiff-unused n] [-V] [-h]\0A\0A\00"
define void @usage(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([219 x i8], [219 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x2d() {
  Assert_real((isdigit(45) == 0),
              "/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/ctype/test_isdigit.c",
              230, ("isdigit should be 0 for -"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x2d>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2d,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xe6,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x2d>:
push   %rax
mov    $0x2d,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xe6,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for -\00"
define void @t_isdigit_0x2d() {
%1 = call i64 @isdigit(i32 45)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 230, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for -\00"
define void @t_isdigit_0x2d() {
%1 = tail call i64 @isdigit(i32 45)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 230, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 1;
  int b;
  if (--a)
    printf("%d", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1147 <main+0x37>
mov    -0x8(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
double geom_dA1_cart(double *x, double dx2, double dx3) { return dx2 * dx3; }


x86 assembly (clang, -O0):
<geom_dA1_cart>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_dA1_cart>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @geom_dA1_cart(double* %0, double %1, double %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double
store double* %0, double** %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = load double, double* %6
%9 = fmul double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @geom_dA1_cart(double* nocapture readnone %0, double %1, double %2) {
%4 = fmul double %1, %2
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ wcstombs(char *, int /*<<< orphan*/ const *, int);
int osal_path_existsW(const wchar_t *_path) {
  char path[260];
  wcstombs(path, _path, 260);
  struct stat fileinfo;
  return stat(path, &fileinfo) == 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<osal_path_existsW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x104,%edx
call   1040 <wcstombs@plt>
lea    -0x110(%rbp),%rdi
lea    -0x118(%rbp),%rsi
call   1030 <stat@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osal_path_existsW>:
push   %rbx
sub    $0x120,%rsp
mov    %rdi,%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x104,%edx
call   1040 <wcstombs@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x120,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @osal_path_existsW(i32* %0) {
%2 = alloca i32*
%3 = alloca [260 x i8]
%4 = alloca %struct.stat
store i32* %0, i32** %2
%5 = getelementptr inbounds [260 x i8], [260 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i32 @wcstombs(i8* %5, i32* %6, i32 260)
%8 = getelementptr inbounds [260 x i8], [260 x i8]* %3, i64 0, i64 0
%9 = call i64 @stat(i8* %8, %struct.stat* %4)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 1, i32 0
ret i32 %12
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @osal_path_existsW(i32* %0) {
%2 = alloca [260 x i8]
%3 = alloca %struct.stat
%4 = getelementptr inbounds [260 x i8], [260 x i8]* %2, i64 0, i64 0
%5 = call i32 @wcstombs(i8* %4, i32* %0, i32 260)
%6 = bitcast %struct.stat* %3 to i8*
%7 = call i64 @stat(i8* %4, %struct.stat* %3)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
double M_PI;
double fmod(double, double);
double sin(double);
double iterate(double x_n) {
  return (
      fmod(x_n + 0.2 - (0.5 / (2.0 * M_PI)) * (sin(2.0 * M_PI * x_n)), 1.0));
}


x86 assembly (clang, -O0):
<iterate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec1(%rip),%xmm1
mov    0x2e9a(%rip),%rax
mulsd  (%rax),%xmm1
movsd  0xeb6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe9d(%rip),%xmm0
mov    0x2e76(%rip),%rax
mulsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe4c(%rip),%xmm1
call   1030 <fmod@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterate>:
sub    $0x18,%rsp
movsd  0xed4(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    0x2eab(%rip),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0xeac(%rip),%xmm1
divsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0xe9c(%rip),%xmm1
add    $0x18,%rsp
jmp    1030 <fmod@plt>

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @iterate(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 2.000000e-01
%5 = load double, double* @M_PI
%6 = fmul double 2.000000e+00, %5
%7 = fdiv double 5.000000e-01, %6
%8 = load double, double* @M_PI
%9 = fmul double 2.000000e+00, %8
%10 = load double, double* %2
%11 = fmul double %9, %10
%12 = call double @sin(double %11)
%13 = fneg double %7
%14 = call double @llvm.fmuladd.f64(double %13, double %12, double %4)
%15 = call double @fmod(double %14, double 1.000000e+00)
ret double %15
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @iterate(double %0) {
%2 = fadd double %0, 2.000000e-01
%3 = load double, double* @M_PI
%4 = fmul double %3, 2.000000e+00
%5 = fmul double %4, %0
%6 = tail call double @sin(double %5)
%7 = fdiv double -5.000000e-01, %4
%8 = tail call double @llvm.fmuladd.f64(double %7, double %6, double %2)
%9 = tail call double @fmod(double %8, double 1.000000e+00)
ret double %9
}
/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int);
void writesn(const char *p) {
  write(1, p, strlen(p));
  write(1, "\n", 1);
}


x86 assembly (clang, -O0):
<writesn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xea7(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writesn>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xec1(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @writesn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 1, i8* %3, i32 %5)
%7 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @writesn(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
%4 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
unsigned long long int power(unsigned int a, unsigned int b) {
  int results = 1;
  if (b == 0)
    return 1;
  results = power(a, b - 1) * a;
  return results;
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    113c <power+0x2c>
movq   $0x1,-0x8(%rbp)
jmp    115c <power+0x4c>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
call   1030 <power@plt>
mov    -0xc(%rbp),%ecx
imul   %rcx,%rax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %esi,%esi
je     1126 <power+0x16>
push   %rbx
mov    %edi,%ebx
add    $0xffffffff,%esi
call   1030 <power@plt>
imul   %ebx,%eax
cltq
pop    %rbx
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i64 @power(i32 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 1, i32* %6
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i64 1, i64* %3
br label %21
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sub i32 %12, 1
%14 = call i64 @power(i32 %11, i32 %13)
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = mul i64 %14, %16
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
store i64 %20, i64* %3
br label %21
21: ; preds = %10, %9
%22 = load i64, i64* %3
ret i64 %22
}

LLVM IR (-O2):
define i64 @power(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2, %6
%5 = phi i64 [ %11, %6 ], [ 1, %2 ]
ret i64 %5
6: ; preds = %2
%7 = add i32 %1, -1
%8 = tail call i64 @power(i32 %0, i32 %7)
%9 = trunc i64 %8 to i32
%10 = mul i32 %9, %0
%11 = sext i32 %10 to i64
br label %4
}