xunge/DecIR huggingface dataset:
/* Variables and functions */
int fibonacci(int);
int /*<<< orphan*/ printf(char *, int);
void problem_002(void) {
  int m = 1;
  int n = 0;
  int sum = 0;
  while (n < 4000000) {
    sum += n;
    n = fibonacci(3 * m);
    m++;
  }
  printf("%i", sum);
  return;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3d0900,-0x8(%rbp)
jge    116d <problem_002+0x4d>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
imul   $0x3,-0x4(%rbp),%edi
call   1040 <fibonacci@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <problem_002+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
mov    $0x3,%ebp
xor    %eax,%eax
nopl   0x0(%rax)
add    %eax,%ebx
mov    %ebp,%edi
call   1040 <fibonacci@plt>
add    $0x3,%ebp
cmp    $0x3d0900,%eax
jl     1130 <problem_002+0x10>
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @problem_002() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = phi i32 [ 0, %0 ], [ %7, %1 ]
%4 = phi i32 [ 1, %0 ], [ %8, %1 ]
%5 = add nsw i32 %2, %3
%6 = mul nuw nsw i32 %4, 3
%7 = tail call i32 @fibonacci(i32 %6)
%8 = add nuw nsw i32 %4, 1
%9 = icmp slt i32 %7, 4000000
br i1 %9, label %1, label %10
10: ; preds = %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void begin(void) { printf("\nIn begin ()"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"\0AIn begin ()\00"
define void @begin() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0AIn begin ()\00"
define void @begin() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *const, char *const *);
int main(int argc, char *const argv[]) {
  if (argc)
    execv(argv[1], argv + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1145 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
test   %edi,%edi
je     1126 <main+0x16>
push   %rax
mov    0x8(%rsi),%rdi
add    $0x8,%rsi
call   1030 <execv@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @execv(i8* %6, i8** %5)
br label %8
8: ; preds = %4, %2
ret i32 0
}
unsigned long ADCInjectedOffsetDataGet(unsigned long ulBase,
                                       unsigned long ulChannel) {
  unsigned long ulReturn;
  ;
  ;
  ulReturn = ((*((volatile unsigned long *)(ulBase + 0x00000014 +
                                            (ulChannel - 1) * 4))) &
              0x00000FFF);
  return ulReturn;
}


x86 assembly (clang, -O0):
<ADCInjectedOffsetDataGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x14,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    (%rax),%rax
and    $0xfff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCInjectedOffsetDataGet>:
mov    0x10(%rdi,%rsi,4),%rax
and    $0xfff,%eax
ret

LLVM IR (-O0):
define i64 @ADCInjectedOffsetDataGet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 20
%8 = load i64, i64* %4
%9 = sub i64 %8, 1
%10 = mul i64 %9, 4
%11 = add i64 %7, %10
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, 4095
store i64 %14, i64* %5
%15 = load i64, i64* %5
ret i64 %15
}

LLVM IR (-O2):
define i64 @ADCInjectedOffsetDataGet(i64 %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = add i64 %0, 16
%5 = add i64 %4, %3
%6 = inttoptr i64 %5 to i64*
%7 = load volatile i64, i64* %6
%8 = and i64 %7, 4095
ret i64 %8
}
void ff_set_atom_xyz(struct ff *ff, int idx, const double *xyz) {
  (void)ff;
  (void)idx;
  (void)xyz;
}


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

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

LLVM IR (-O0):
%struct.ff = type opaque
define void @ff_set_atom_xyz(%struct.ff* %0, i32 %1, double* %2) {
%4 = alloca %struct.ff*
%5 = alloca i32
%6 = alloca double*
store %struct.ff* %0, %struct.ff** %4
store i32 %1, i32* %5
store double* %2, double** %6
%7 = load %struct.ff*, %struct.ff** %4
%8 = load i32, i32* %5
%9 = load double*, double** %6
ret void
}

LLVM IR (-O2):
%struct.ff = type opaque
define void @ff_set_atom_xyz(%struct.ff* nocapture %0, i32 %1, double* nocapture %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *, char const *);
int usage(FILE *pOut, const char *argv0) {
  fprintf(pOut,
          "usage: %s <program> [args]\n"
          "   or: %s --help\n"
          "   or: %s --version\n",
          argv0, argv0, argv0);
  return 1;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rsi,%rcx
lea    0xee5(%rip),%rsi
mov    %rcx,%rdx
mov    %rcx,%r8
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [65 x i8] c"usage: %s <program> [args]\0A or: %s --help\0A or: %s --version\0A\00"
define i32 @usage(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i8* %8)
ret i32 1
}

LLVM IR (-O2):
@.str = [65 x i8] c"usage: %s <program> [args]\0A or: %s --help\0A or: %s --version\0A\00"
define i32 @usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %1, i8* %1)
ret i32 1
}
/* Type definitions */
struct clock_connection {
  int dummy;
};

/* Variables and functions */
scalar_t__ bulk_read(struct clock_connection *);
void flush_incoming(struct clock_connection *clk) {
  while (bulk_read(clk) >= 0) {
  }
}


x86 assembly (clang, -O0):
<flush_incoming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <bulk_read@plt>
cmp    $0x0,%rax
jl     1134 <flush_incoming+0x24>
jmp    111c <flush_incoming+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_incoming>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <bulk_read@plt>
test   %rax,%rax
jns    1120 <flush_incoming+0x10>
pop    %rbx
ret

LLVM IR (-O0):
%struct.clock_connection = type { i32 }
define void @flush_incoming(%struct.clock_connection* %0) {
%2 = alloca %struct.clock_connection*
store %struct.clock_connection* %0, %struct.clock_connection** %2
br label %3
3: ; preds = %7, %1
%4 = load %struct.clock_connection*, %struct.clock_connection** %2
%5 = call i64 @bulk_read(%struct.clock_connection* %4)
%6 = icmp sge i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.clock_connection = type { i32 }
define void @flush_incoming(%struct.clock_connection* %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i64 @bulk_read(%struct.clock_connection* %0)
%4 = icmp sgt i64 %3, -1
br i1 %4, label %2, label %5
5: ; preds = %2
ret void
}
void av_frame_get_metadata() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_get_metadata() {
ret void
}
int is_numeric(char c) { return c <= '9' && c >= '0'; }


x86 assembly (clang, -O0):
<is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jg     1129 <is_numeric+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
setge  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_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 i2d_NOTICEREF(void) {}


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

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

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

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

/* Variables and functions */
void receiveByte(uint8_t data) {}


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

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

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

LLVM IR (-O2):
define void @receiveByte(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int wscanw(int /*<<< orphan*/ *, char *, int *);
int i_wscanw(WINDOW *win, char *fmt, int *i) { return (wscanw(win, fmt, i)); }


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

x86 assembly (clang, -O2):
<i_wscanw>:
jmp    1030 <wscanw@plt>

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

LLVM IR (-O2):
define i32 @i_wscanw(i32* %0, i8* %1, i32* %2) {
%4 = tail call i32 @wscanw(i32* %0, i8* %1, i32* %2)
ret i32 %4
}
int simulated_while() {
  int i = 0;
  int j = 3 * i;
LOOP_COND:
  if (i < 30) {
    goto INCR;
  } else {
    goto RETURN;
  }
INCR:
  j = j + i;
  i++;
  goto LOOP_COND;
RETURN:
  return j;
}


x86 assembly (clang, -O0):
<simulated_while>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
imul   $0x3,-0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1e,-0x4(%rbp)
jge    1121 <simulated_while+0x21>
jmp    1126 <simulated_while+0x26>
jmp    113d <simulated_while+0x3d>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <simulated_while+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @simulated_while() {
ret i32 435
}
void destroy(void) { return; }


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

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

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

LLVM IR (-O2):
define void @destroy() {
ret void
}
char *strbin(unsigned long int i) {
  static char buffer[1 + sizeof(unsigned long int) * 8] = {0};
  char *p = buffer - 1 + sizeof(unsigned long int) * 8;
  do {
    *--p = '0' + (i & 1);
    i >>= 1;
  } while (i);
  return p;
}


x86 assembly (clang, -O0):
<strbin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0x2f21(%rip),%rax
add    $0x3f,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
add    $0x30,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1117 <strbin+0x17>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strbin>:
lea    0x2f68(%rip),%rax
mov    %rdi,%rcx
nopw   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,-0x1(%rax)
add    $0xffffffffffffffff,%rax
shr    %rcx
cmp    $0x1,%rdi
mov    %rcx,%rdi
ja     1110 <strbin+0x10>
ret

LLVM IR (-O0):
@strbin.buffer = internal global [65 x i8] zeroinitializer
define i8* @strbin(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* getelementptr inbounds ([65 x i8], [65 x i8]* @strbin.buffer, i64 0, i64 63), i8** %3
br label %4
4: ; preds = %13, %1
%5 = load i64, i64* %2
%6 = and i64 %5, 1
%7 = add i64 48, %6
%8 = trunc i64 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 -1
store i8* %10, i8** %3
store i8 %8, i8* %10
%11 = load i64, i64* %2
%12 = lshr i64 %11, 1
store i64 %12, i64* %2
br label %13
13: ; preds = %4
%14 = load i64, i64* %2
%15 = icmp ne i64 %14, 0
br i1 %15, label %4, label %16
16: ; preds = %13
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@strbin.buffer = internal global [65 x i8] zeroinitializer
define i8* @strbin(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %0, %1 ], [ %9, %2 ]
%4 = phi i8* [ getelementptr inbounds ([65 x i8], [65 x i8]* @strbin.buffer, i64 0, i64 63), %1 ], [ %8, %2 ]
%5 = trunc i64 %3 to i8
%6 = and i8 %5, 1
%7 = or i8 %6, 48
%8 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 %7, i8* %8
%9 = lshr i64 %3, 1
%10 = icmp ult i64 %3, 2
br i1 %10, label %11, label %2
11: ; preds = %2
ret i8* %8
}
/* Variables and functions */
int rand();
int GenerateRandomNumberInRange(int lowerLimit, int upperLimit) {
  return rand() % (upperLimit - lowerLimit + 1) + lowerLimit;
}


x86 assembly (clang, -O0):
<GenerateRandomNumberInRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenerateRandomNumberInRange>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @GenerateRandomNumberInRange(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @GenerateRandomNumberInRange(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
int fcmp(const void *a, const void *b) {
  if (*(double *)a < *(double *)b) {
    return -1;
  } else if (*(double *)a > *(double *)b) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1132 <fcmp+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1160 <fcmp+0x60>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1154 <fcmp+0x54>
movl   $0x1,-0x4(%rbp)
jmp    1160 <fcmp+0x60>
jmp    1159 <fcmp+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fcmp(i8* %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 = bitcast i8* %6 to double*
%8 = load double, double* %7
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to double*
%11 = load double, double* %10
%12 = fcmp olt double %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %25
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = bitcast i8* %15 to double*
%17 = load double, double* %16
%18 = load i8*, i8** %5
%19 = bitcast i8* %18 to double*
%20 = load double, double* %19
%21 = fcmp ogt double %17, %20
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 1, i32* %3
br label %25
23: ; preds = %14
br label %24
24: ; preds = %23
store i32 0, i32* %3
br label %25
25: ; preds = %24, %22, %13
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @fcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp olt double %4, %6
%8 = fcmp ogt double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int main(int argc, char **argv) {
  int i;
  for (i = 1; i < argc; i++) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1138 <main+0x38>
jmp    112a <main+0x2a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1119 <main+0x19>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
int iswpunct(int /*<<< orphan*/);
int iswpunct_l(wint_t c, locale_t l) { return iswpunct(c); }


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

x86 assembly (clang, -O2):
<iswpunct_l>:
jmp    1030 <iswpunct@plt>

LLVM IR (-O0):
define i32 @iswpunct_l(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 @iswpunct(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @iswpunct_l(i32 %0, i32 %1) {
%3 = tail call i32 @iswpunct(i32 %0)
ret i32 %3
}
char *getlogin() {}


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

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

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

LLVM IR (-O2):
define noalias i8* @getlogin() {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ reverse(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int i;
  char in[1025];
  scanf("%s", in);
  reverse(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <reverse@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x410,%rsp
lea    0xed1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1025 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [1025 x i8], [1025 x i8]* %3, i64 0, i64 0
%7 = call i32 @reverse(i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1025 x i8]
%2 = getelementptr inbounds [1025 x i8], [1025 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @reverse(i8* %2)
ret i32 0
}
/* Type definitions */
struct table_entry {
  int dummy;
};
struct table_col {
  int dummy;
};

/* Variables and functions */
int l_unit_raw(struct table_col *, struct table_entry *);
int l_unit_cnt(struct table_col *col, struct table_entry *e) {
  return l_unit_raw(col, e);
}


x86 assembly (clang, -O0):
<l_unit_cnt>:
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 <l_unit_raw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_unit_cnt>:
jmp    1030 <l_unit_raw@plt>

LLVM IR (-O0):
%struct.table_col = type { i32 }
%struct.table_entry = type { i32 }
define i32 @l_unit_cnt(%struct.table_col* %0, %struct.table_entry* %1) {
%3 = alloca %struct.table_col*
%4 = alloca %struct.table_entry*
store %struct.table_col* %0, %struct.table_col** %3
store %struct.table_entry* %1, %struct.table_entry** %4
%5 = load %struct.table_col*, %struct.table_col** %3
%6 = load %struct.table_entry*, %struct.table_entry** %4
%7 = call i32 @l_unit_raw(%struct.table_col* %5, %struct.table_entry* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.table_col = type { i32 }
%struct.table_entry = type { i32 }
define i32 @l_unit_cnt(%struct.table_col* %0, %struct.table_entry* %1) {
%3 = tail call i32 @l_unit_raw(%struct.table_col* %0, %struct.table_entry* %1)
ret i32 %3
}
extern void _kill(int pid, int sig) {
  (void)pid;
  (void)sig;
  return;
}


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

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

LLVM IR (-O0):
define void @_kill(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
ret void
}

LLVM IR (-O2):
define void @_kill(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
unsigned long long ___swab64(unsigned long long);
unsigned long long __arch__swab64(unsigned long long x) {
  unsigned long long __tmp = (x);
  return ___swab64(__tmp);
}


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

x86 assembly (clang, -O2):
<__arch__swab64>:
jmp    1030 <___swab64@plt>

LLVM IR (-O0):
define i64 @__arch__swab64(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
%5 = load i64, i64* %3
%6 = call i64 @___swab64(i64 %5)
ret i64 %6
}

LLVM IR (-O2):
define i64 @__arch__swab64(i64 %0) {
%2 = tail call i64 @___swab64(i64 %0)
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ summary;

/* Variables and functions */
char *oml_memsummary_r(char *, int);
char *oml_memsummary() {
  static char summary[1024];
  return oml_memsummary_r(summary, sizeof(summary));
  ;
}


x86 assembly (clang, -O0):
<oml_memsummary>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f25(%rip),%rdi
mov    $0x400,%esi
call   1030 <oml_memsummary_r@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<oml_memsummary>:
lea    0x2f29(%rip),%rdi
mov    $0x400,%esi
jmp    1030 <oml_memsummary_r@plt>

LLVM IR (-O0):
@oml_memsummary.summary = internal global [1024 x i8] zeroinitializer
define i8* @oml_memsummary() {
%1 = call i8* @oml_memsummary_r(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @oml_memsummary.summary, i64 0, i64 0), i32 1024)
ret i8* %1
}

LLVM IR (-O2):
@oml_memsummary.summary = internal global [1024 x i8] zeroinitializer
define i8* @oml_memsummary() {
%1 = tail call i8* @oml_memsummary_r(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @oml_memsummary.summary, i64 0, i64 0), i32 1024)
ret i8* %1
}
int custom_function(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @custom_function() {
ret i32 42
}

LLVM IR (-O2):
define i32 @custom_function() {
ret i32 42
}
/* Variables and functions */
scalar_t__ is_option(char *);
char get_option(char *arg) { return is_option(arg) ? arg[1] : 0; }


x86 assembly (clang, -O0):
<get_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_option@plt>
cmp    $0x0,%rax
je     113f <get_option+0x2f>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <get_option+0x39>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <get_option+0x39>
mov    -0xc(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_option>:
push   %rbx
mov    %rdi,%rbx
call   1030 <is_option@plt>
test   %rax,%rax
je     1123 <get_option+0x13>
mov    0x1(%rbx),%al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @get_option(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @is_option(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
br label %12
11: ; preds = %1
br label %12
12: ; preds = %11, %6
%13 = phi i32 [ %10, %6 ], [ 0, %11 ]
%14 = trunc i32 %13 to i8
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @get_option(i8* %0) {
%2 = tail call i64 @is_option(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
br label %7
7: ; preds = %1, %4
%8 = phi i8 [ %6, %4 ], [ 0, %1 ]
ret i8 %8
}
int MMA8491Q_Init() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @MMA8491Q_Init() {
ret i32 1
}
_Bool dt_valid_yd(int y, int d) {
  return (d >= 1 && (d <= 365 || d == dt_days_in_year(y)));
}


x86 assembly (clang, -O0):
<dt_valid_yd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1162 <dt_valid_yd+0x52>
mov    $0x1,%al
cmpl   $0x16d,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jle    115c <dt_valid_yd+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <dt_days_in_year@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt_valid_yd>:
push   %rbx
test   %esi,%esi
jle    112f <dt_valid_yd+0x1f>
mov    %esi,%ebx
mov    $0x1,%al
cmp    $0x16e,%esi
jb     112d <dt_valid_yd+0x1d>
xor    %eax,%eax
call   1030 <dt_days_in_year@plt>
cmp    %ebx,%eax
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i1 @dt_valid_yd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sge i32 %5, 1
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 365
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = call i32 (i32, ...) bitcast (i32 (...)* @dt_days_in_year to i32 (i32, ...)*)(i32 %12)
%14 = icmp eq i32 %11, %13
br label %15
15: ; preds = %10, %7
%16 = phi i1 [ true, %7 ], [ %14, %10 ]
br label %17
17: ; preds = %15, %2
%18 = phi i1 [ false, %2 ], [ %16, %15 ]
ret i1 %18
}

LLVM IR (-O2):
define zeroext i1 @dt_valid_yd(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = icmp ult i32 %1, 366
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @dt_days_in_year to i32 (i32, ...)*)(i32 %0)
%8 = icmp eq i32 %7, %1
br label %9
9: ; preds = %4, %6, %2
%10 = phi i1 [ false, %2 ], [ true, %4 ], [ %8, %6 ]
ret i1 %10
}
/* Type definitions */
struct _user {
  int dummy;
};

/* Variables and functions */
char pool_mem_size(struct _user *);
char user_size(struct _user *ptr) { return pool_mem_size(ptr); }


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

x86 assembly (clang, -O2):
<user_size>:
jmp    1030 <pool_mem_size@plt>

LLVM IR (-O0):
%struct._user = type { i32 }
define signext i8 @user_size(%struct._user* %0) {
%2 = alloca %struct._user*
store %struct._user* %0, %struct._user** %2
%3 = load %struct._user*, %struct._user** %2
%4 = call signext i8 @pool_mem_size(%struct._user* %3)
ret i8 %4
}

LLVM IR (-O2):
%struct._user = type { i32 }
define signext i8 @user_size(%struct._user* %0) {
%2 = tail call signext i8 @pool_mem_size(%struct._user* %0)
ret i8 %2
}
/* Variables and functions */
int count_params(char **params) {
  int i;
  for (i = 0; params[i] != NULL; i++)
    ;
  return (i);
}


x86 assembly (clang, -O0):
<count_params>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1135 <count_params+0x35>
jmp    1127 <count_params+0x27>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <count_params+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_params>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <count_params+0x10>
ret

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

LLVM IR (-O2):
define i32 @count_params(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/
generic_mcpy_qsort_recurse(void *, int /*<<< orphan*/, size_t, size_t,
                           int (*)(void const *, void const *));
void generic_mcpy_qsort(void *a, size_t n, size_t size,
                        int (*compare)(const void *, const void *)) {
  generic_mcpy_qsort_recurse(a, 0, n - 1, size, compare);
}


x86 assembly (clang, -O0):
<generic_mcpy_qsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
xor    %esi,%esi
call   1030 <generic_mcpy_qsort_recurse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generic_mcpy_qsort>:
mov    %rcx,%r8
mov    %rdx,%rcx
lea    -0x1(%rsi),%rdx
xor    %esi,%esi
jmp    1030 <generic_mcpy_qsort_recurse@plt>

LLVM IR (-O0):
define void @generic_mcpy_qsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32 (i8*, i8*)*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 (i8*, i8*)* %3, i32 (i8*, i8*)** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = sub i64 %10, 1
%12 = load i64, i64* %7
%13 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %8
%14 = call i32 @generic_mcpy_qsort_recurse(i8* %9, i32 0, i64 %11, i64 %12, i32 (i8*, i8*)* %13)
ret void
}

LLVM IR (-O2):
define void @generic_mcpy_qsort(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*)* %3) {
%5 = add i64 %1, -1
%6 = tail call i32 @generic_mcpy_qsort_recurse(i8* %0, i32 0, i64 %5, i64 %2, i32 (i8*, i8*)* %3)
ret void
}
int baz() {
  int i = 1, j = 1;
  j = (0 || (j + 1));
  return i + j;
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @baz() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
store i32 %6, i32* %2
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @baz() {
ret i32 2
}
/* Type definitions */
struct extent_buffer {
  int dummy;
};

/* Variables and functions */
scalar_t__ btrfs_header_level(struct extent_buffer *);
int btrfs_is_leaf(struct extent_buffer *eb) {
  return (btrfs_header_level(eb) == 0);
}


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

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

LLVM IR (-O0):
%struct.extent_buffer = type { i32 }
define i32 @btrfs_is_leaf(%struct.extent_buffer* %0) {
%2 = alloca %struct.extent_buffer*
store %struct.extent_buffer* %0, %struct.extent_buffer** %2
%3 = load %struct.extent_buffer*, %struct.extent_buffer** %2
%4 = call i64 @btrfs_header_level(%struct.extent_buffer* %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
%struct.extent_buffer = type { i32 }
define i32 @btrfs_is_leaf(%struct.extent_buffer* %0) {
%2 = tail call i64 @btrfs_header_level(%struct.extent_buffer* %0)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int fpu_control_t;

/* Variables and functions */
int FE_ALL_EXCEPT;
int /*<<< orphan*/ _FPU_GETCW(int);
int /*<<< orphan*/ _FPU_SETCW(int);
int fesetexcept(int excepts) {
  fpu_control_t temp;
  _FPU_GETCW(temp);
  temp |= excepts & FE_ALL_EXCEPT;
  _FPU_SETCW(temp);
  return 0;
}


x86 assembly (clang, -O0):
<fesetexcept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <_FPU_GETCW@plt>
mov    -0x4(%rbp),%eax
mov    0x2ea3(%rip),%rcx
and    (%rcx),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <_FPU_SETCW@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fesetexcept>:
push   %rax
call   1030 <_FPU_GETCW@plt>
mov    $0xffffffff,%edi
call   1040 <_FPU_SETCW@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@FE_ALL_EXCEPT = global i32 0
define i32 @fesetexcept(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %3
%5 = call i32 @_FPU_GETCW(i32 %4)
%6 = load i32, i32* %2
%7 = load i32, i32* @FE_ALL_EXCEPT
%8 = and i32 %6, %7
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 @_FPU_SETCW(i32 %11)
ret i32 0
}

LLVM IR (-O2):
@FE_ALL_EXCEPT = global i32 0
define i32 @fesetexcept(i32 %0) {
%2 = tail call i32 @_FPU_GETCW(i32 undef)
%3 = tail call i32 @_FPU_SETCW(i32 -1)
ret i32 0
}
unsigned long long load64_bigendian(const unsigned char *x) {
  unsigned long long y = 0;
  long long i;
  for (i = 0; i < 8; ++i)
    y = (y << 8) | x[i];
  return y;
}


x86 assembly (clang, -O0):
<load64_bigendian>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x8,-0x18(%rbp)
jge    114f <load64_bigendian+0x4f>
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <load64_bigendian+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<load64_bigendian>:
movzbl (%rdi),%eax
movzbl 0x1(%rdi),%ecx
shl    $0x10,%eax
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0x2(%rdi),%eax
or     %ecx,%eax
movzbl 0x3(%rdi),%ecx
shl    $0x10,%rax
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0x4(%rdi),%eax
or     %rcx,%rax
movzbl 0x5(%rdi),%ecx
shl    $0x10,%rax
shl    $0x8,%rcx
or     %rax,%rcx
movzbl 0x6(%rdi),%edx
or     %rcx,%rdx
shl    $0x8,%rdx
movzbl 0x7(%rdi),%eax
or     %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @load64_bigendian(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl nuw nsw i64 %3, 16
%8 = shl nuw nsw i64 %6, 8
%9 = or i64 %7, %8
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = or i64 %9, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = shl nuw nsw i64 %13, 16
%18 = shl nuw nsw i64 %16, 8
%19 = or i64 %17, %18
%20 = getelementptr inbounds i8, i8* %0, i64 4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i64
%23 = or i64 %19, %22
%24 = getelementptr inbounds i8, i8* %0, i64 5
%25 = load i8, i8* %24
%26 = zext i8 %25 to i64
%27 = shl i64 %23, 16
%28 = shl nuw nsw i64 %26, 8
%29 = or i64 %27, %28
%30 = getelementptr inbounds i8, i8* %0, i64 6
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = or i64 %29, %32
%34 = shl i64 %33, 8
%35 = getelementptr inbounds i8, i8* %0, i64 7
%36 = load i8, i8* %35
%37 = zext i8 %36 to i64
%38 = or i64 %34, %37
ret i64 %38
}
unsigned long arch_local_save_flags(void) {
  unsigned long flags;
  asm volatile("pushf; pop %0" : "=rm"(flags) : : "memory");
  return flags;
}


x86 assembly (clang, -O0):
<arch_local_save_flags>:
push   %rbp
mov    %rsp,%rbp
pushf
pop    -0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_local_save_flags>:
pushf
pop    -0x8(%rsp)
mov    -0x8(%rsp),%rax
ret

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

LLVM IR (-O2):
define i64 @arch_local_save_flags() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = load i64, i64* %1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  printf("%s\n", "010710");
  exit(0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [7 x i8] c"010710\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [7 x i8] c"010710\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ osUnrecoverableError(int, int);
void osMissingTerminateError(void) { osUnrecoverableError(11, 0x1701U); }


x86 assembly (clang, -O0):
<osMissingTerminateError>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%edi
mov    $0x1701,%esi
call   1030 <osUnrecoverableError@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<osMissingTerminateError>:
mov    $0xb,%edi
mov    $0x1701,%esi
jmp    1030 <osUnrecoverableError@plt>

LLVM IR (-O0):
define void @osMissingTerminateError() {
%1 = call i32 @osUnrecoverableError(i32 11, i32 5889)
ret void
}

LLVM IR (-O2):
define void @osMissingTerminateError() {
%1 = tail call i32 @osUnrecoverableError(i32 11, i32 5889)
ret void
}
int test_function() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @test_function() {
ret i32 1
}
/* Type definitions */
struct timespec {
  unsigned long long tv_sec;
  unsigned long long tv_nsec;
};

/* Variables and functions */
unsigned long long int diff(struct timespec t1, struct timespec t2) {
  return (t2.tv_sec - t1.tv_sec) * 1000000000ULL + (t2.tv_nsec - t1.tv_nsec);
}


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x10(%rbp),%rax
imul   $0x3b9aca00,%rax,%rax
mov    -0x18(%rbp),%rcx
sub    -0x8(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
sub    %rdi,%rdx
imul   $0x3b9aca00,%rdx,%rax
sub    %rsi,%rcx
add    %rcx,%rax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i64 @diff(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca %struct.timespec
%6 = alloca %struct.timespec
%7 = bitcast %struct.timespec* %5 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = bitcast %struct.timespec* %6 to { i64, i64 }*
%11 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %10, i32 0, i32 0
store i64 %2, i64* %11
%12 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %10, i32 0, i32 1
store i64 %3, i64* %12
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%16 = load i64, i64* %15
%17 = sub i64 %14, %16
%18 = mul i64 %17, 1000000000
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%22 = load i64, i64* %21
%23 = sub i64 %20, %22
%24 = add i64 %18, %23
ret i64 %24
}

LLVM IR (-O2):
define i64 @diff(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = sub i64 %2, %0
%6 = mul i64 %5, 1000000000
%7 = sub i64 %3, %1
%8 = add i64 %7, %6
ret i64 %8
}