xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ is_perfect(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  for (i = 1; i <= 1000; i += 1) {
    if (is_perfect(i)) {
      printf("%d\n", i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     1177 <main+0x57>
mov    -0x8(%rbp),%edi
call   1030 <is_perfect@plt>
cmp    $0x0,%rax
je     1164 <main+0x44>
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
jmp    1169 <main+0x49>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xed0(%rip),%r14
jmp    114b <main+0x2b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x3e9,%ebx
je     1163 <main+0x43>
mov    %ebx,%edi
call   1030 <is_perfect@plt>
test   %rax,%rax
je     1140 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 1, %0 ], [ %8, %7 ]
%3 = tail call i64 @is_perfect(i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %1, %5
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 1001
br i1 %9, label %10, label %1
10: ; preds = %7
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int __attribute__((no)) foo(int bits_per_pixel, int depth) {
  if ((bits_per_pixel | depth) == 1)
    abort();
  return bits_per_pixel;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
cmp    $0x1,%eax
jne    1134 <foo+0x24>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
or     %edi,%esi
cmp    $0x1,%esi
je     111a <foo+0xa>
mov    %edi,%eax
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @foo(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 = load i32, i32* %4
%7 = or i32 %5, %6
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo(i32 returned %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i32 %0
}
numeric(char c) {
  if (c > 127)
    return 0;
  return ((c >= '0') && (c <= '9'));
}


x86 assembly (clang, -O0):
<numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x7f,%eax
jle    1123 <numeric+0x23>
movl   $0x0,-0x4(%rbp)
jmp    114d <numeric+0x4d>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x6(%rbp)
jl     1142 <numeric+0x42>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @numeric(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
%6 = icmp sgt i32 %5, 127
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %19
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 48
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 57
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ false, %8 ], [ %15, %12 ]
%18 = zext i1 %17 to i32
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @numeric(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
void X509V3_get_value_int(void) {}


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

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

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

LLVM IR (-O2):
define void @X509V3_get_value_int() {
ret void
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_error(char *);
void cmd_box_set(int nargs, char **args) {
  if (check_arg_count(nargs, 1) == 1)
    return;
  report_count(1);
  report_error("UNSUPPORTED");
}


x86 assembly (clang, -O0):
<cmd_box_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    115a <cmd_box_set+0x2a>
jmp    1170 <cmd_box_set+0x40>
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xe95(%rip),%rdi
call   1050 <report_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_box_set>:
push   %rax
mov    $0x1,%esi
call   1030 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1142 <cmd_box_set+0x12>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <report_count@plt>
lea    0xead(%rip),%rdi
pop    %rax
jmp    1050 <report_error@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_box_set(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"UNSUPPORTED\00"
define void @cmd_box_set(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 @report_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ QM_ArmSineFInt();
int /*<<< orphan*/ QM_FTabSineF();
int /*<<< orphan*/ QM_FTabSineFInt();
int /*<<< orphan*/ QM_FastSineF();
int /*<<< orphan*/ QM_FasterSineF();
int /*<<< orphan*/ QM_QTabSineF();
int /*<<< orphan*/ QM_QTabSineFInt();
void main(void) {
  QM_FastSineF();
  QM_FasterSineF();
  QM_QTabSineF();
  QM_QTabSineFInt();
  QM_FTabSineF();
  QM_FTabSineFInt();
  QM_ArmSineFInt();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <QM_FastSineF@plt>
mov    $0x0,%al
call   1080 <QM_FasterSineF@plt>
mov    $0x0,%al
call   1040 <QM_QTabSineF@plt>
mov    $0x0,%al
call   1050 <QM_QTabSineFInt@plt>
mov    $0x0,%al
call   1060 <QM_FTabSineF@plt>
mov    $0x0,%al
call   1030 <QM_FTabSineFInt@plt>
mov    $0x0,%al
call   1090 <QM_ArmSineFInt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <QM_FastSineF@plt>
xor    %eax,%eax
call   1080 <QM_FasterSineF@plt>
xor    %eax,%eax
call   1040 <QM_QTabSineF@plt>
xor    %eax,%eax
call   1050 <QM_QTabSineFInt@plt>
xor    %eax,%eax
call   1060 <QM_FTabSineF@plt>
xor    %eax,%eax
call   1030 <QM_FTabSineFInt@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <QM_ArmSineFInt@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @QM_FastSineF()
%2 = call i32 (...) @QM_FasterSineF()
%3 = call i32 (...) @QM_QTabSineF()
%4 = call i32 (...) @QM_QTabSineFInt()
%5 = call i32 (...) @QM_FTabSineF()
%6 = call i32 (...) @QM_FTabSineFInt()
%7 = call i32 (...) @QM_ArmSineFInt()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @QM_FastSineF()
%2 = tail call i32 (...) @QM_FasterSineF()
%3 = tail call i32 (...) @QM_QTabSineF()
%4 = tail call i32 (...) @QM_QTabSineFInt()
%5 = tail call i32 (...) @QM_FTabSineF()
%6 = tail call i32 (...) @QM_FTabSineFInt()
%7 = tail call i32 (...) @QM_ArmSineFInt()
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t libusb_cpu_to_le16(const uint16_t x) {
  union {
    uint8_t b8[2];
    uint16_t b16;
  } _tmp;
  _tmp.b8[1] = x >> 8;
  _tmp.b8[0] = x & 0xff;
  return _tmp.b16;
}


x86 assembly (clang, -O0):
<libusb_cpu_to_le16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libusb_cpu_to_le16>:
movzbl %dil,%eax
ret

LLVM IR (-O0):
%union.anon = type { [2 x i32] }
define i32 @libusb_cpu_to_le16(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 8
%6 = bitcast %union.anon* %3 to [2 x i32]*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 %5, i32* %7
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = bitcast %union.anon* %3 to [2 x i32]*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
store i32 %9, i32* %11
%12 = bitcast %union.anon* %3 to i32*
%13 = load i32, i32* %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @libusb_cpu_to_le16(i32 %0) {
%2 = and i32 %0, 255
ret i32 %2
}
int CreateCameraID(int vid, int chNo) { return (vid << 8) + chNo; }


x86 assembly (clang, -O0):
<CreateCameraID>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateCameraID>:
shl    $0x8,%edi
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @CreateCameraID(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 = shl i32 %5, 8
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @CreateCameraID(i32 %0, i32 %1) {
%3 = shl i32 %0, 8
%4 = add nsw i32 %3, %1
ret i32 %4
}
int put(obj, where, pval)
int obj, where, pval;
{
  move(obj, where);
  return ((-1) - pval);
}


x86 assembly (clang, -O0):
<put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1030 <move@plt>
mov    $0xffffffff,%eax
sub    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put>:
push   %rbx
mov    %edx,%ebx
xor    %eax,%eax
call   1030 <move@plt>
not    %ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @put(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 = call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %7, i32 %8)
%10 = load i32, i32* %6
%11 = sub nsw i32 -1, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @put(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @move to i32 (i32, i32, ...)*)(i32 %0, i32 %1)
%5 = xor i32 %2, -1
ret i32 %5
}
/* Variables and functions */
void *realloc(void *, size_t);
void *clad_realloc(void *old, size_t size) { return realloc(old, size); }


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

x86 assembly (clang, -O2):
<clad_realloc>:
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @clad_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @clad_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
void ELMOCPClkActivityConfig(unsigned int baseAddr, unsigned int configVal) {
  (*((volatile unsigned int *)(baseAddr + (0x10)))) &= ~(0x00000100u);
  (*((volatile unsigned int *)(baseAddr + (0x10)))) |=
      ((configVal << (0x00000008u)) & (0x00000100u));
}


x86 assembly (clang, -O0):
<ELMOCPClkActivityConfig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
shl    $0x8,%edx
and    $0x100,%edx
mov    -0x4(%rbp),%eax
add    $0x10,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ELMOCPClkActivityConfig>:
add    $0x10,%edi
andl   $0xfffffeff,(%rdi)
and    $0x1,%esi
shl    $0x8,%esi
or     %esi,(%rdi)
ret

LLVM IR (-O0):
define void @ELMOCPClkActivityConfig(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 = add i32 %5, 16
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -257
store volatile i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = shl i32 %11, 8
%13 = and i32 %12, 256
%14 = load i32, i32* %3
%15 = add i32 %14, 16
%16 = zext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = or i32 %18, %13
store volatile i32 %19, i32* %17
ret void
}

LLVM IR (-O2):
define void @ELMOCPClkActivityConfig(i32 %0, i32 %1) {
%3 = add i32 %0, 16
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -257
store volatile i32 %7, i32* %5
%8 = shl i32 %1, 8
%9 = and i32 %8, 256
%10 = load volatile i32, i32* %5
%11 = or i32 %10, %9
store volatile i32 %11, i32* %5
ret void
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
extern wchar_t wchar_to_wchar(wchar_t x) { return x - 0x20; }


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

x86 assembly (clang, -O2):
<wchar_to_wchar>:
lea    -0x20(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @wchar_to_wchar(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub nsw i64 %3, 32
ret i64 %4
}

LLVM IR (-O2):
define i64 @wchar_to_wchar(i64 %0) {
%2 = add nsw i64 %0, -32
ret i64 %2
}
int __attribute__((no)) nlt(int a, int b) { return -(a < b); }


x86 assembly (clang, -O0):
<nlt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nlt>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @nlt(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 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = sub nsw i32 0, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @nlt(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
const char *lou_version(void) {
  static const char *version = "3.15.0";
  return version;
}


x86 assembly (clang, -O0):
<lou_version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f15(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lou_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@lou_version.version = internal global i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0)
@.str = [7 x i8] c"3.15.0\00"
define i8* @lou_version() {
%1 = load i8*, i8** @lou_version.version
ret i8* %1
}

LLVM IR (-O2):
@.str = [7 x i8] c"3.15.0\00"
define i8* @lou_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
void proc_start() {}


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

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

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

LLVM IR (-O2):
define void @proc_start() {
ret void
}
void double_to_ullong(unsigned long long *dest, double src) {
  *dest = (unsigned long long)src;
}


x86 assembly (clang, -O0):
<double_to_ullong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee6(%rip),%xmm2
movaps %xmm0,%xmm1
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rax
cvttsd2si %xmm0,%rcx
mov    %rcx,%rdx
sar    $0x3f,%rdx
and    %rdx,%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_to_ullong>:
cvttsd2si %xmm0,%rax
mov    %rax,%rcx
subsd  0xef0(%rip),%xmm0
cvttsd2si %xmm0,%rdx
sar    $0x3f,%rcx
and    %rcx,%rdx
or     %rax,%rdx
mov    %rdx,(%rdi)
ret

LLVM IR (-O0):
define void @double_to_ullong(i64* %0, double %1) {
%3 = alloca i64*
%4 = alloca double
store i64* %0, i64** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fptoui double %5 to i64
%7 = load i64*, i64** %3
store i64 %6, i64* %7
ret void
}

LLVM IR (-O2):
define void @double_to_ullong(i64* nocapture writeonly %0, double %1) {
%3 = fptoui double %1 to i64
store i64 %3, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ benchmark();
int /*<<< orphan*/ initialise_board();
int /*<<< orphan*/ start_trigger();
int /*<<< orphan*/ stop_trigger();
int main() {
  int n;
  initialise_board();
  start_trigger();
  for (n = 0; n < (4096 >> 4); ++n) {
    benchmark();
  }
  stop_trigger();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <initialise_board@plt>
mov    $0x0,%al
call   1030 <start_trigger@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1186 <main+0x46>
mov    $0x0,%al
call   1050 <benchmark@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x24>
mov    $0x0,%al
call   1040 <stop_trigger@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <initialise_board@plt>
xor    %eax,%eax
call   1030 <start_trigger@plt>
mov    $0x100,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <benchmark@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x20>
xor    %eax,%eax
call   1040 <stop_trigger@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @initialise_board()
%4 = call i32 (...) @start_trigger()
store i32 0, i32* %2
br label %5
5: ; preds = %10, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 (...) @benchmark()
br label %10
10: ; preds = %8
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %5
13: ; preds = %5
%14 = call i32 (...) @stop_trigger()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @initialise_board()
%2 = tail call i32 (...) @start_trigger()
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %6, %3 ]
%5 = tail call i32 (...) @benchmark()
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 256
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = tail call i32 (...) @stop_trigger()
ret i32 0
}
int test_imm_64int8_reg(signed char val) {
  return ((val) & (-0x64 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_64int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -100
%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_64int8_reg(i8 signext %0) {
%2 = and i8 %0, -100
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void imprime_vetor_inteiro(int n, int b[]) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d\n", b[i]);
  }
}


x86 assembly (clang, -O0):
<imprime_vetor_inteiro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1157 <imprime_vetor_inteiro+0x47>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <imprime_vetor_inteiro+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime_vetor_inteiro>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1145 <imprime_vetor_inteiro+0x35>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <imprime_vetor_inteiro+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @imprime_vetor_inteiro(i32 %0, i32* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
char *end(char *p) {
  while (*p != '\0')
    p++;
  return p;
}


x86 assembly (clang, -O0):
<end>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1129 <end+0x29>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <end+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<end>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rax)
lea    0x1(%rax),%rax
jne    1110 <end+0x10>
ret

LLVM IR (-O0):
define i8* @end(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define i8* @end(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret i8* %3
}
void SteamAPI_ISteamApps_UninstallDLC(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


x86 assembly (clang, -O0):
<SteamAPI_ISteamApps_UninstallDLC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamAPI_ISteamApps_UninstallDLC>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamApps_UninstallDLC = [33 x i8] c"SteamAPI_ISteamApps_UninstallDLC\00"
define void @SteamAPI_ISteamApps_UninstallDLC(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @__func__.SteamAPI_ISteamApps_UninstallDLC, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamApps_UninstallDLC = [33 x i8] c"SteamAPI_ISteamApps_UninstallDLC\00"
define void @SteamAPI_ISteamApps_UninstallDLC(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @__func__.SteamAPI_ISteamApps_UninstallDLC, i64 0, i64 0), i8* %0)
ret void
}
int fun567() { return 567; }


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

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

LLVM IR (-O0):
define i32 @fun567() {
ret i32 567
}

LLVM IR (-O2):
define i32 @fun567() {
ret i32 567
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void goodbye(void) {
  printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n!!!!!!!!!!!!!!!!!! Thank "
         "you. Come again !!!!!!!!!!!!!!!!\n\n\n\n\n\n\n\n\n\n");
}


x86 assembly (clang, -O0):
<goodbye>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<goodbye>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [88 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A!!!!!!!!!!!!!!!!!! Thank you. Come again !!!!!!!!!!!!!!!!\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
define void @goodbye() {
%1 = call i32 @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [87 x i8] c"\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A!!!!!!!!!!!!!!!!!! Thank you. Come again !!!!!!!!!!!!!!!!\0A\0A\0A\0A\0A\0A\0A\0A\0A\00"
define void @goodbye() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([87 x i8], [87 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void pense(int i) { printf("le philosophe %d pense... \n", i); }


x86 assembly (clang, -O0):
<pense>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pense>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"le philosophe %d pense... \0A\00"
define void @pense(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"le philosophe %d pense... \0A\00"
define void @pense(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int add(int, int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ assume(int);
int rand();
void main() {
  int i = 0;
  int n = rand();
  assume(n > 0);
  i = add(i, 1);
  assert(i == 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assume@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <add@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <rand@plt>
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1050 <assume@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <add@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @rand()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assume(i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @add(i32 %8, i32 1)
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @rand()
%2 = icmp sgt i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assume(i32 %3)
%5 = tail call i32 @add(i32 0, i32 1)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret void
}
void gtk_icon_info_copy() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_info_copy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Bit1_PutVal(int);
void TI1_OnInterrupt(void) {
  static unsigned counter = 0;
  Bit1_PutVal(counter > 1);
  counter = (++counter) % 5;
}


x86 assembly (clang, -O0):
<TI1_OnInterrupt>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x1,0x2f11(%rip)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <Bit1_PutVal@plt>
mov    0x2efe(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ef5(%rip)
mov    $0x5,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,0x2ee6(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TI1_OnInterrupt>:
push   %rax
xor    %edi,%edi
cmpl   $0x2,0x2f12(%rip)
setae  %dil
call   1030 <Bit1_PutVal@plt>
mov    0x2f03(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    $0xcccccccd,%edx
imul   %rcx,%rdx
shr    $0x22,%rdx
lea    (%rdx,%rdx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x2ee1(%rip)
pop    %rax
ret

LLVM IR (-O0):
@TI1_OnInterrupt.counter = internal global i32 0
define void @TI1_OnInterrupt() {
%1 = load i32, i32* @TI1_OnInterrupt.counter
%2 = icmp ugt i32 %1, 1
%3 = zext i1 %2 to i32
%4 = call i32 @Bit1_PutVal(i32 %3)
%5 = load i32, i32* @TI1_OnInterrupt.counter
%6 = add i32 %5, 1
store i32 %6, i32* @TI1_OnInterrupt.counter
%7 = urem i32 %6, 5
store i32 %7, i32* @TI1_OnInterrupt.counter
ret void
}

LLVM IR (-O2):
@TI1_OnInterrupt.counter = internal unnamed_addr global i32 0
define void @TI1_OnInterrupt() {
%1 = load i32, i32* @TI1_OnInterrupt.counter
%2 = icmp ugt i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @Bit1_PutVal(i32 %3)
%5 = load i32, i32* @TI1_OnInterrupt.counter
%6 = add i32 %5, 1
%7 = urem i32 %6, 5
store i32 %7, i32* @TI1_OnInterrupt.counter
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ string_cp(char **, char *);
void set_value(char **dest, char *from, char *def) {
  assert(dest != NULL);
  if ((*dest) == NULL) {
    if (from != NULL) {
      string_cp(dest, from);
    } else {
      (*dest) = def;
    }
  }
}


x86 assembly (clang, -O0):
<set_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1181 <set_value+0x61>
cmpq   $0x0,-0x10(%rbp)
je     1171 <set_value+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <string_cp@plt>
jmp    117c <set_value+0x5c>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1181 <set_value+0x61>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_value>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
cmpq   $0x0,(%rbx)
je     1148 <set_value+0x28>
pop    %rbx
pop    %r14
pop    %r15
ret
test   %r15,%r15
je     115d <set_value+0x3d>
mov    %rbx,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <string_cp@plt>
mov    %r14,(%rbx)
jmp    1142 <set_value+0x22>

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

LLVM IR (-O2):
define void @set_value(i8** %0, i8* %1, i8* %2) {
%4 = icmp ne i8** %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = load i8*, i8** %0
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = icmp eq i8* %1, null
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = tail call i32 @string_cp(i8** %0, i8* %1)
br label %14
13: ; preds = %9
store i8* %2, i8** %0
br label %14
14: ; preds = %11, %13, %3
ret void
}
void TestMiscStmts(void) {
  ({
    int a = 10;
    a;
  });
  ({
    int a = 10;
    a;
    ;
    ;
  });
}


x86 assembly (clang, -O0):
<TestMiscStmts>:
push   %rbp
mov    %rsp,%rbp
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @TestMiscStmts() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 10, i32* %1
%5 = load i32, i32* %1
store i32 %5, i32* %2
%6 = load i32, i32* %2
store i32 10, i32* %3
%7 = load i32, i32* %3
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret void
}

LLVM IR (-O2):
define void @TestMiscStmts() {
ret void
}
void *getdummy(void *pproto, int tproto, void *plast, void *p) {
  p = (void *)pproto;
  return p;
}


x86 assembly (clang, -O0):
<getdummy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @getdummy(i8* readnone returned %0, i32 %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
ret i8* %0
}
/* Variables and functions */
char *getenv(char *);
char *cgiRequestUri() { return getenv("REQUEST_URI"); }


x86 assembly (clang, -O0):
<cgiRequestUri>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <getenv@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiRequestUri>:
lea    0xee9(%rip),%rdi
jmp    1030 <getenv@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"REQUEST_URI\00"
define i8* @cgiRequestUri() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [12 x i8] c"REQUEST_URI\00"
define i8* @cgiRequestUri() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
int fsign(float f) { return (0 < f) - (f < 0); }


x86 assembly (clang, -O0):
<fsign>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsign>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fsign(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp olt float 0.000000e+00, %3
%5 = zext i1 %4 to i32
%6 = load float, float* %2
%7 = fcmp olt float %6, 0.000000e+00
%8 = zext i1 %7 to i32
%9 = sub nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @fsign(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
%3 = zext i1 %2 to i32
%4 = fcmp olt float %0, 0.000000e+00
%5 = sext i1 %4 to i32
%6 = add nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void handle_usr2(int signo) {
  printf("hahhaaa");
  printf("sign = %d\n", signo);
  exit(0);
}


x86 assembly (clang, -O0):
<handle_usr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handle_usr2>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"hahhaaa\00"
@.str.1 = [11 x i8] c"sign = %d\0A\00"
define void @handle_usr2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"hahhaaa\00"
@.str.1 = [11 x i8] c"sign = %d\0A\00"
define void @handle_usr2(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ foo(int *);
int main() {
  int a = 1;
  foo(&a);
  assert(a == 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <foo@plt>
cmpl   $0x4,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <foo@plt>
xor    %edi,%edi
cmpl   $0x4,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = call i32 @foo(i32* %2)
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @foo(i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void thread_sleep(int msec) { usleep(msec * 1000); }


x86 assembly (clang, -O0):
<thread_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @thread_sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @thread_sleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ handle_38(int /*<<< orphan*/);
int gen_38(void) {
  handle_38(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_38>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_38@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_38>:
push   %rax
xor    %edi,%edi
call   1030 <handle_38@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gen_38() {
%1 = call i32 @handle_38(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_38() {
%1 = tail call i32 @handle_38(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello, benchmarks!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
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 = [20 x i8] c"Hello, benchmarks!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [19 x i8] c"Hello, benchmarks!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void usage(int status) {
  FILE *stream;
  if (status != 0) {
    stream = stderr;
  } else {
    stream = stdout;
  }
  fprintf(stream, "Usage: strings [str1] [str2]\n");
  fprintf(stream, "Performs operations with two strings.\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1138 <usage+0x28>
mov    0x2eb4(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
jmp    1146 <usage+0x36>
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
test   %edi,%edi
jne    111e <usage+0xe>
mov    0x2ebc(%rip),%rax
jmp    1125 <usage+0x15>
mov    0x2ebb(%rip),%rax
mov    (%rax),%rbx
lea    0xed1(%rip),%rdi
mov    $0x1d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xed6(%rip),%rdi
mov    $0x26,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@stderr = global i32* null
@stdout = global i32* null
@.str = [30 x i8] c"Usage: strings [str1] [str2]\0A\00"
@.str.1 = [39 x i8] c"Performs operations with two strings.\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32*, i32** @stderr
store i32* %7, i32** %3
br label %10
8: ; preds = %1
%9 = load i32*, i32** @stdout
store i32* %9, i32** %3
br label %10
10: ; preds = %8, %6
%11 = load i32*, i32** %3
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32* null
@stdout = global i32* null
@.str = [30 x i8] c"Usage: strings [str1] [str2]\0A\00"
@.str.1 = [39 x i8] c"Performs operations with two strings.\0A\00"
define void @usage(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = load i32*, i32** @stdout
%4 = load i32*, i32** @stderr
%5 = select i1 %2, i32* %3, i32* %4
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 29, i64 1, i32* %5)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i64 38, i64 1, i32* %5)
ret void
}
int digits2Num(char a, char b, char c, char d) {
  return a * 1000 + b * 100 + c * 10 + d;
}


x86 assembly (clang, -O0):
<digits2Num>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %cl,-0x3(%rbp)
mov    %al,-0x4(%rbp)
movsbl -0x1(%rbp),%eax
imul   $0x3e8,%eax,%eax
movsbl -0x2(%rbp),%ecx
imul   $0x64,%ecx,%ecx
add    %ecx,%eax
movsbl -0x3(%rbp),%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
movsbl -0x4(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digits2Num>:
imul   $0x3e8,%edi,%eax
imul   $0x64,%esi,%esi
add    %eax,%esi
lea    (%rdx,%rdx,4),%eax
lea    (%rsi,%rax,2),%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @digits2Num(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = mul nsw i32 %10, 1000
%12 = load i8, i8* %6
%13 = sext i8 %12 to i32
%14 = mul nsw i32 %13, 100
%15 = add nsw i32 %11, %14
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = mul nsw i32 %17, 10
%19 = add nsw i32 %15, %18
%20 = load i8, i8* %8
%21 = sext i8 %20 to i32
%22 = add nsw i32 %19, %21
ret i32 %22
}

LLVM IR (-O2):
define i32 @digits2Num(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = sext i8 %0 to i32
%6 = mul nsw i32 %5, 1000
%7 = sext i8 %1 to i32
%8 = mul nsw i32 %7, 100
%9 = add nsw i32 %8, %6
%10 = sext i8 %2 to i32
%11 = mul nsw i32 %10, 10
%12 = add nsw i32 %9, %11
%13 = sext i8 %3 to i32
%14 = add nsw i32 %12, %13
ret i32 %14
}