xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ isdigit(char);
int isANum(char *name) {
  while (*name) {
    if (!isdigit(*name) && *name != '-')
      return 0;
    ++name;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isANum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116b <isANum+0x5b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    115a <isANum+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     115a <isANum+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    1172 <isANum+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <isANum+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isANum>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114f <isANum+0x3f>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    113b <isANum+0x2b>
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     114f <isANum+0x3f>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1130 <isANum+0x20>
cmpb   $0x2d,-0x1(%rbx)
je     1130 <isANum+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isANum(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %19, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i32 @isdigit(i8 signext %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 45
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 0, i32* %2
br label %23
19: ; preds = %13, %8
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %4
22: ; preds = %4
store i32 1, i32* %2
br label %23
23: ; preds = %22, %18
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @isANum(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = tail call i32 @isdigit(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 45
br i1 %11, label %12, label %16
12: ; preds = %9, %4
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %9, %12, %1
%17 = phi i32 [ 1, %1 ], [ 1, %12 ], [ 0, %9 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
void putpmsg(int f, void *p, void *p2, void *p3, void *p4) { sleep(0); }


x86 assembly (clang, -O0):
<putpmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %edi,%edi
call   1030 <sleep@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putpmsg>:
xor    %edi,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @putpmsg(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = call i32 @sleep(i32 0)
ret void
}

LLVM IR (-O2):
define void @putpmsg(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4) {
%6 = tail call i32 @sleep(i32 0)
ret void
}
int test_imm_5Auint16_reg(unsigned short val) {
  return ((val) & (0x5A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Auint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x5a,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Auint16_reg>:
test   $0x5a,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Auint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 90
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int whoWon(char ch) {
  switch (ch) {
  case 'O':
    return -1;
    break;
  case 'X':
    return 1;
    break;
  }
}


x86 assembly (clang, -O0):
<whoWon>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x4f,%eax
je     1130 <whoWon+0x30>
jmp    111f <whoWon+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x58,%eax
je     113c <whoWon+0x3c>
jmp    1143 <whoWon+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    1143 <whoWon+0x43>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<whoWon>:
xor    %eax,%eax
cmp    $0x4f,%dil
setne  %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @whoWon(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %8 [
i32 79, label %6
i32 88, label %7
]
6: ; preds = %1
store i32 -1, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %6, %7, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @whoWon(i8 signext %0) {
%2 = icmp eq i8 %0, 79
%3 = select i1 %2, i32 -1, i32 1
ret i32 %3
}
void MD5_Update(void) {}


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

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

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

LLVM IR (-O2):
define void @MD5_Update() {
ret void
}
/* Variables and functions */
int mjson_esc(int, int);
int mjson_escape(int c) { return mjson_esc(c, 1); }


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

x86 assembly (clang, -O2):
<mjson_escape>:
mov    $0x1,%esi
jmp    1030 <mjson_esc@plt>

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

LLVM IR (-O2):
define i32 @mjson_escape(i32 %0) {
%2 = tail call i32 @mjson_esc(i32 %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void caml_gr_current_y() { exit(1); }


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

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

LLVM IR (-O0):
define void @caml_gr_current_y() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @caml_gr_current_y() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ err(int, char *);
scalar_t__ raw_tty_putc(int);
void tty_putc(int c) {
  if (raw_tty_putc(c) == EOF) {
    err(1, "raw_tty_putc");
  }
}


x86 assembly (clang, -O0):
<tty_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <raw_tty_putc@plt>
mov    0x2eae(%rip),%rcx
cmp    (%rcx),%rax
jne    1154 <tty_putc+0x34>
mov    $0x1,%edi
lea    0xeb1(%rip),%rsi
call   1040 <err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tty_putc>:
push   %rax
call   1030 <raw_tty_putc@plt>
mov    0x2ebb(%rip),%rcx
cmp    (%rcx),%rax
jne    1144 <tty_putc+0x24>
lea    0xec7(%rip),%rsi
mov    $0x1,%edi
pop    %rax
jmp    1040 <err@plt>
pop    %rax
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [13 x i8] c"raw_tty_putc\00"
define void @tty_putc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @raw_tty_putc(i32 %3)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [13 x i8] c"raw_tty_putc\00"
define void @tty_putc(i32 %0) {
%2 = tail call i64 @raw_tty_putc(i32 %0)
%3 = load i64, i64* @EOF
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}
int ti_vosc_start(double const *options) { return (int)options[1] - 1; }


x86 assembly (clang, -O0):
<ti_vosc_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si 0x8(%rax),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_vosc_start>:
cvttsd2si 0x8(%rdi),%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @ti_vosc_start(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 1
%5 = load double, double* %4
%6 = fptosi double %5 to i32
%7 = sub nsw i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @ti_vosc_start(double* nocapture %0) {
%2 = getelementptr inbounds double, double* %0, i64 1
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = add nsw i32 %4, -1
ret i32 %5
}
void SCB_SCB_IRQ_Interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @SCB_SCB_IRQ_Interrupt() {
ret void
}
char escape(char c) {
  switch (c) {
  case '\\':
    return '\\';
  default:
    return '\0';
  }
  return 0;
}


x86 assembly (clang, -O0):
<escape>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
sub    $0x5c,%al
jne    1123 <escape+0x23>
jmp    111a <escape+0x1a>
movb   $0x5c,-0x1(%rbp)
jmp    1127 <escape+0x27>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape>:
xor    %ecx,%ecx
cmp    $0x5c,%dil
mov    $0x5c,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @escape(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 92, label %6
]
6: ; preds = %1
store i8 92, i8* %2
br label %8
7: ; preds = %1
store i8 0, i8* %2
br label %8
8: ; preds = %7, %6
%9 = load i8, i8* %2
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @escape(i8 signext %0) {
%2 = icmp eq i8 %0, 92
%3 = select i1 %2, i8 92, i8 0
ret i8 %3
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *my_strdup(const char *s) {
  size_t len = strlen(s) + 1;
  char *t = malloc(len);
  if (t != NULL) {
    memcpy(t, s, len);
  }
  return t;
}


x86 assembly (clang, -O0):
<my_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1177 <my_strdup+0x47>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <my_strdup+0x31>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @my_strdup(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 = call i8* @malloc(i64 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = load i8*, i8** %2
%16 = load i64, i64* %3
%17 = call i32 @memcpy(i8* %14, i8* %15, i64 %16)
br label %18
18: ; preds = %13, %1
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
define i8* @my_strdup(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* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
/* Type definitions */
typedef scalar_t__ __m256;

/* Variables and functions */
__m256 _avx_sub(__m256 a, __m256 b) { return a - b; }


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

x86 assembly (clang, -O2):
<_avx_sub>:
mov    %rdi,%rax
sub    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @_avx_sub(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @_avx_sub(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
ret i64 %3
}
/* Variables and functions */
int align_BS(int);
int get_block_count(int size) { return align_BS(size) / 512; }


x86 assembly (clang, -O0):
<get_block_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <align_BS@plt>
mov    $0x200,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_block_count>:
push   %rax
call   1030 <align_BS@plt>
lea    0x1ff(%rax),%ecx
test   %eax,%eax
cmovs  %ecx,%eax
sar    $0x9,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_block_count(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @align_BS(i32 %3)
%5 = sdiv i32 %4, 512
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_block_count(i32 %0) {
%2 = tail call i32 @align_BS(i32 %0)
%3 = sdiv i32 %2, 512
ret i32 %3
}
void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
                             struct ath_tx_status *ts) {}


x86 assembly (clang, -O0):
<ath_dynack_sample_tx_ts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ath_hw = type opaque
%struct.sk_buff = type opaque
%struct.ath_tx_status = type opaque
define void @ath_dynack_sample_tx_ts(%struct.ath_hw* %0, %struct.sk_buff* %1, %struct.ath_tx_status* %2) {
%4 = alloca %struct.ath_hw*
%5 = alloca %struct.sk_buff*
%6 = alloca %struct.ath_tx_status*
store %struct.ath_hw* %0, %struct.ath_hw** %4
store %struct.sk_buff* %1, %struct.sk_buff** %5
store %struct.ath_tx_status* %2, %struct.ath_tx_status** %6
ret void
}

LLVM IR (-O2):
%struct.ath_hw = type opaque
%struct.sk_buff = type opaque
%struct.ath_tx_status = type opaque
define void @ath_dynack_sample_tx_ts(%struct.ath_hw* nocapture %0, %struct.sk_buff* nocapture %1, %struct.ath_tx_status* nocapture %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ endwin();
void end_win(WINDOW *w1, WINDOW *w2) {
  delwin(w1);
  delwin(w2);
  endwin();
}


x86 assembly (clang, -O0):
<end_win>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <delwin@plt>
mov    -0x10(%rbp),%rdi
call   1030 <delwin@plt>
mov    $0x0,%al
call   1040 <endwin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_win>:
push   %rbx
mov    %rsi,%rbx
call   1030 <delwin@plt>
mov    %rbx,%rdi
call   1030 <delwin@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <endwin@plt>

LLVM IR (-O0):
define void @end_win(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = call i32 @delwin(i32* %5)
%7 = load i32*, i32** %4
%8 = call i32 @delwin(i32* %7)
%9 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
define void @end_win(i32* %0, i32* %1) {
%3 = tail call i32 @delwin(i32* %0)
%4 = tail call i32 @delwin(i32* %1)
%5 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdout;
void output_plain(char *str) {
  printf("%s\n", str);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<output_plain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_plain>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
define void @output_plain(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void *realloc(void *, size_t);
void *sal_realloc(void *chunk, size_t size) {
  void *ptr = realloc(chunk, size);
  if (ptr == NULL) {
    printf("Cannot alloc %d bytes.\n", (int)size);
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<sal_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1178 <sal_realloc+0x48>
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sal_realloc>:
push   %rbx
mov    %rsi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1140 <sal_realloc+0x10>
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Cannot alloc %d bytes.\0A\00"
define i8* @sal_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i64, i64* %4
%13 = trunc i64 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@.str = [24 x i8] c"Cannot alloc %d bytes.\0A\00"
define noalias i8* @sal_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = trunc i64 %1 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret i8* %3
}
int do_189() { return 189; }


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

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

LLVM IR (-O0):
define i32 @do_189() {
ret i32 189
}

LLVM IR (-O2):
define i32 @do_189() {
ret i32 189
}
void rop3_11_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = S & stk3;
  stk1 = T | stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_11_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_11_1_1>:
mov    (%rdi),%al
mov    %edx,%ecx
or     %sil,%cl
not    %cl
and    %al,%sil
or     %cl,%sil
and    %dl,%al
or     %sil,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_11_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %9
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = load i8, i8* %9
%18 = zext i8 %17 to i32
%19 = and i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %8
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = or i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = xor i32 %28, -1
%30 = trunc i32 %29 to i8
store i8 %30, i8* %7
%31 = load i8, i8* %7
%32 = zext i8 %31 to i32
%33 = load i8, i8* %5
%34 = zext i8 %33 to i32
%35 = xor i32 %34, -1
%36 = and i32 %32, %35
%37 = load i8, i8* %6
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = and i32 %36, %39
%41 = load i8*, i8** %4
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = load i8, i8* %5
%45 = zext i8 %44 to i32
%46 = and i32 %43, %45
%47 = or i32 %40, %46
%48 = load i8*, i8** %4
%49 = load i8, i8* %48
%50 = zext i8 %49 to i32
%51 = load i8, i8* %6
%52 = zext i8 %51 to i32
%53 = and i32 %50, %52
%54 = or i32 %47, %53
%55 = trunc i32 %54 to i8
%56 = load i8*, i8** %4
store i8 %55, i8* %56
ret void
}

LLVM IR (-O2):
define void @rop3_11_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %2, %1
%6 = xor i8 %5, -1
%7 = and i8 %4, %1
%8 = or i8 %7, %6
%9 = and i8 %4, %2
%10 = or i8 %8, %9
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isxdigit(int);
void t_isxdigit_0xd3() {
  Assert_real((isxdigit(211) == 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_isxdigit.c",
              1060, ("isxdigit should be 0 for 0xd3"));
}


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

x86 assembly (clang, -O2):
<t_isxdigit_0xd3>:
push   %rax
mov    $0xd3,%edi
call   1030 <isxdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x424,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xd3\00"
define void @t_isxdigit_0xd3() {
%1 = call i64 @isxdigit(i32 211)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1060, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isxdigit.c\00"
@.str.1 = [30 x i8] c"isxdigit should be 0 for 0xd3\00"
define void @t_isxdigit_0xd3() {
%1 = tail call i64 @isxdigit(i32 211)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1060, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/ const,
                                 int /*<<< orphan*/ const);
void function_sse2(__m128i *dst, const __m128i *a, const __m128i *b) {
  *dst = _mm_xor_si128(*a, *b);
}


x86 assembly (clang, -O0):
<function_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_sse2>:
push   %rbx
mov    %rdi,%rbx
mov    (%rsi),%edi
mov    (%rdx),%esi
call   1030 <_mm_xor_si128@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @function_sse2(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** %5
%8 = load i32, i32* %7
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = call i32 @_mm_xor_si128(i32 %8, i32 %10)
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @function_sse2(i32* nocapture writeonly %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = tail call i32 @_mm_xor_si128(i32 %4, i32 %5)
store i32 %6, i32* %0
ret void
}
/* Variables and functions */
scalar_t__ KL_util_malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *KL_create_identifier(const char *str) {
  char *new_str = (char *)KL_util_malloc(strlen(str) + 1);
  strcpy(new_str, str);
  return new_str;
}


x86 assembly (clang, -O0):
<KL_create_identifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1030 <KL_util_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KL_create_identifier>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1030 <KL_util_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @KL_create_identifier(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @KL_util_malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @KL_create_identifier(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @KL_util_malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
float celsius_to_fahr(float celsius) {
  float fahr;
  fahr = (9.0 / 5.0) * celsius + 32.0;
  return fahr;
}


x86 assembly (clang, -O0):
<celsius_to_fahr>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<celsius_to_fahr>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @celsius_to_fahr(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %5, double 3.200000e+01)
%7 = fptrunc double %6 to float
store float %7, float* %3
%8 = load float, float* %3
ret float %8
}

LLVM IR (-O2):
define float @celsius_to_fahr(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\rHello World!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"\0DHello World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"\0DHello World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_ACuint8_reg(unsigned char val) {
  return ((val) & (0xAC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_ACuint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xac,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_ACuint8_reg>:
test   $0xac,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_ACuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -84
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ puts(char *);
void echo() {
  char buf[4];
  gets(buf);
  puts(buf);
}


x86 assembly (clang, -O0):
<echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x4(%rbp),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<echo>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @echo() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
ret void
}

LLVM IR (-O2):
define void @echo() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @puts(i8* %2)
ret void
}
/* Variables and functions */
unsigned int lookup_ain_by_key(char const *);
unsigned int lookup_ain_by_name(char const *);
int get_adc_ain(const char *key, unsigned int *ain) {
  *ain = lookup_ain_by_key(key);
  if (*ain == -1) {
    *ain = lookup_ain_by_name(key);
    if (*ain == -1) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<get_adc_ain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <lookup_ain_by_key@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    117d <get_adc_ain+0x5d>
mov    -0x10(%rbp),%rdi
call   1030 <lookup_ain_by_name@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1178 <get_adc_ain+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1184 <get_adc_ain+0x64>
jmp    117d <get_adc_ain+0x5d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_adc_ain>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <lookup_ain_by_key@plt>
mov    %eax,(%r14)
cmp    $0xffffffff,%eax
jne    1147 <get_adc_ain+0x27>
mov    %rbx,%rdi
call   1030 <lookup_ain_by_name@plt>
mov    %eax,(%r14)
cmp    $0xffffffff,%eax
je     1154 <get_adc_ain+0x34>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
jmp    114c <get_adc_ain+0x2c>

LLVM IR (-O0):
define i32 @get_adc_ain(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
%6 = load i8*, i8** %4
%7 = call i32 @lookup_ain_by_key(i8* %6)
%8 = load i32*, i32** %5
store i32 %7, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %21
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @lookup_ain_by_name(i8* %13)
%15 = load i32*, i32** %5
store i32 %14, i32* %15
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %20
19: ; preds = %12
store i32 0, i32* %3
br label %22
20: ; preds = %12
br label %21
21: ; preds = %20, %2
store i32 1, i32* %3
br label %22
22: ; preds = %21, %19
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @get_adc_ain(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @lookup_ain_by_key(i8* %0)
store i32 %3, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @lookup_ain_by_name(i8* %0)
store i32 %6, i32* %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %9, label %8
8: ; preds = %5, %2
br label %9
9: ; preds = %5, %8
%10 = phi i32 [ 1, %8 ], [ 0, %5 ]
ret i32 %10
}
/* Variables and functions */
int EINVAL;
int sysfs_get_hardware_limits(unsigned int, unsigned long *, unsigned long *);
int cpufreq_get_hardware_limits(unsigned int cpu, unsigned long *min,
                                unsigned long *max) {
  if ((!min) || (!max))
    return -EINVAL;
  return sysfs_get_hardware_limits(cpu, min, max);
}


x86 assembly (clang, -O0):
<cpufreq_get_hardware_limits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1139 <cpufreq_get_hardware_limits+0x29>
cmpq   $0x0,-0x18(%rbp)
jne    114c <cpufreq_get_hardware_limits+0x3c>
xor    %eax,%eax
mov    0x2e9e(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <cpufreq_get_hardware_limits+0x4f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <sysfs_get_hardware_limits@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpufreq_get_hardware_limits>:
test   %rsi,%rsi
je     111f <cpufreq_get_hardware_limits+0xf>
test   %rdx,%rdx
je     111f <cpufreq_get_hardware_limits+0xf>
jmp    1030 <sysfs_get_hardware_limits@plt>
mov    0x2eba(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @cpufreq_get_hardware_limits(i32 %0, i64* %1, i64* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64*
%7 = alloca i64*
store i32 %0, i32* %5
store i64* %1, i64** %6
store i64* %2, i64** %7
%8 = load i64*, i64** %6
%9 = icmp ne i64* %8, null
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i64*, i64** %7
%12 = icmp ne i64* %11, null
br i1 %12, label %16, label %13
13: ; preds = %10, %3
%14 = load i32, i32* @EINVAL
%15 = sub nsw i32 0, %14
store i32 %15, i32* %4
br label %21
16: ; preds = %10
%17 = load i32, i32* %5
%18 = load i64*, i64** %6
%19 = load i64*, i64** %7
%20 = call i32 @sysfs_get_hardware_limits(i32 %17, i64* %18, i64* %19)
store i32 %20, i32* %4
br label %21
21: ; preds = %16, %13
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @cpufreq_get_hardware_limits(i32 %0, i64* %1, i64* %2) {
%4 = icmp ne i64* %1, null
%5 = icmp ne i64* %2, null
%6 = and i1 %4, %5
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = load i32, i32* @EINVAL
%9 = sub nsw i32 0, %8
br label %12
10: ; preds = %3
%11 = tail call i32 @sysfs_get_hardware_limits(i32 %0, i64* %1, i64* %2)
br label %12
12: ; preds = %10, %7
%13 = phi i32 [ %11, %10 ], [ %9, %7 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *ba_alloc(int);
void *ba_free(void *);
void *ba_resize(void *, int);
scalar_t__ charncmp(void *, char, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(void *, char *);
int strlen(void *);
scalar_t__ strncmp(void *, char *, int);
int main() {
  fprintf(stderr, "    --> test_balloc_safe bail, no BALLOC_SAFE\n");
  return 0;
  void *memory = ba_alloc(10);
  assert(charncmp(memory, '\0', 10) == 0);
  strcpy(memory, "123456789a");
  memory = ba_resize(memory, 20);
  assert(strncmp(memory, "123456789a", 10) == 0);
  assert(strlen(memory) == 10);
  assert(charncmp(memory + 10, '\0', 10) == 0);
  strcpy(memory, "1234567891234567891");
  void *ptr = memory;
  memory = ba_free(memory);
  assert(charncmp(ptr, '\0', 20) == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c" --> test_balloc_safe bail, no BALLOC_SAFE\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c" --> test_balloc_safe bail, no BALLOC_SAFE\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ my_isdigit(char, char *);
int my_isspace(char c, char *base) {
  if (my_isdigit(c, base))
    return (0);
  if (c == ' ')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<my_isspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x5(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <my_isdigit@plt>
cmp    $0x0,%rax
je     1147 <my_isspace+0x37>
movl   $0x0,-0x4(%rbp)
jmp    1167 <my_isspace+0x57>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1160 <my_isspace+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1167 <my_isspace+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_isspace>:
push   %rbx
mov    %edi,%ebx
call   1030 <my_isdigit@plt>
test   %rax,%rax
sete   %al
cmp    $0x20,%bl
sete   %cl
and    %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @my_isspace(i8 signext %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
store i8 %0, i8* %4
store i8* %1, i8** %5
%6 = load i8, i8* %4
%7 = load i8*, i8** %5
%8 = call i64 @my_isdigit(i8 signext %6, i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %17
11: ; preds = %2
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %3
br label %17
16: ; preds = %11
store i32 0, i32* %3
br label %17
17: ; preds = %16, %15, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @my_isspace(i8 signext %0, i8* %1) {
%3 = tail call i64 @my_isdigit(i8 signext %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = icmp eq i8 %0, 32
%6 = and i1 %5, %4
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
size_t strlen(char *const);
void trim(char *const str) {
  size_t length = strlen(str);
  if (str[length - 1] == '\n') {
    str[length - 1] = '\0';
  }
}


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1152 <trim+0x42>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1125 <trim+0x15>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @trim(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, -1
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 10
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 0, i8* %4
br label %8
8: ; preds = %7, %1
ret void
}
int getent(char *cp, char *name) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @getent(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
int prime(int num) {
  int i;
  for (i = 2; i < num; i++) {
    if (num % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1149 <prime+0x49>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <prime+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1150 <prime+0x50>
jmp    113b <prime+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <prime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prime>:
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1120 <prime+0x20>
mov    $0x2,%esi
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1123 <prime+0x23>
add    $0x1,%esi
cmp    %esi,%edi
jne    1110 <prime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @prime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 2, i32* %4
br label %5
5: ; preds = %16, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = srem i32 %10, %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 0, i32* %2
br label %20
15: ; preds = %9
br label %16
16: ; preds = %15
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %5
19: ; preds = %5
store i32 1, i32* %2
br label %20
20: ; preds = %19, %14
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
double YfromRGB(double r, double g, double b) {
  return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}


x86 assembly (clang, -O0):
<YfromRGB>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xef0(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xedb(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xebe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<YfromRGB>:
mulsd  0xef8(%rip),%xmm1
mulsd  0xef8(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xef4(%rip),%xmm2
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @YfromRGB(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* %4
%8 = load double, double* %5
%9 = fmul double 7.152000e-01, %8
%10 = call double @llvm.fmuladd.f64(double 2.126000e-01, double %7, double %9)
%11 = load double, double* %6
%12 = call double @llvm.fmuladd.f64(double 7.220000e-02, double %11, double %10)
ret double %12
}

LLVM IR (-O2):
define double @YfromRGB(double %0, double %1, double %2) {
%4 = fmul double %1, 7.152000e-01
%5 = tail call double @llvm.fmuladd.f64(double %0, double 2.126000e-01, double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double 7.220000e-02, double %5)
ret double %6
}
/* Variables and functions */
int __kern_mm_free(char *);
int kfree(char *ptr) { return __kern_mm_free(ptr); }


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

x86 assembly (clang, -O2):
<kfree>:
jmp    1030 <__kern_mm_free@plt>

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

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