xunge/DecIR huggingface dataset:
void doone(void *arg) {
  printf(1, "%d thread yielding\n", getpid());
  tyield();
  printf(1, "%d thread exited\n", getpid());
  texit();
}


x86 assembly (clang, -O0):
<doone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <tyield@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <texit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doone>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb1(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <tyield@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xea2(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <texit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%d thread yielding\0A\00"
@.str.1 = [18 x i8] c"%d thread exited\0A\00"
define void @doone(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @getpid()
%4 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @tyield()
%6 = call i32 (...) @getpid()
%7 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @texit()
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"%d thread yielding\0A\00"
@.str.1 = [18 x i8] c"%d thread exited\0A\00"
define void @doone(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 (...) @tyield()
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @texit()
ret void
}
void vec2_cross(float *dst, float *b) {
  float z = dst[0] * b[1] - dst[1] * b[0];
  dst[0] = dst[1] = 0;
  dst[2] = z;
}


x86 assembly (clang, -O0):
<vec2_cross>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulss  (%rax),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec2_cross>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
mulss  0x4(%rdi),%xmm1
mulss  0x4(%rsi),%xmm0
subss  %xmm1,%xmm0
movl   $0x0,0x4(%rdi)
movl   $0x0,(%rdi)
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define void @vec2_cross(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float, float* %16
%18 = fmul float %14, %17
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %8, float %11, float %19)
store float %20, float* %5
%21 = load float*, float** %3
%22 = getelementptr inbounds float, float* %21, i64 1
store float 0.000000e+00, float* %22
%23 = load float*, float** %3
%24 = getelementptr inbounds float, float* %23, i64 0
store float 0.000000e+00, float* %24
%25 = load float, float* %5
%26 = load float*, float** %3
%27 = getelementptr inbounds float, float* %26, i64 2
store float %25, float* %27
ret void
}

LLVM IR (-O2):
define void @vec2_cross(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = getelementptr inbounds float, float* %1, i64 1
%5 = load float, float* %4
%6 = getelementptr inbounds float, float* %0, i64 1
%7 = load float, float* %6
%8 = load float, float* %1
%9 = fneg float %7
%10 = fmul float %8, %9
%11 = tail call float @llvm.fmuladd.f32(float %3, float %5, float %10)
store float 0.000000e+00, float* %6
store float 0.000000e+00, float* %0
%12 = getelementptr inbounds float, float* %0, i64 2
store float %11, float* %12
ret void
}
void setup_skx_debug(const char *dirname) {}


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

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

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

LLVM IR (-O2):
define void @setup_skx_debug(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memccpy(char *, char const *, char, size_t);
int /*<<< orphan*/ strlen(char *);
char *strncat(char *restrict dest, const char *restrict src, size_t n) {
  char *cur = dest;
  cur += strlen(cur);
  memccpy(cur, src, '\0', n);
  return dest;
}


x86 assembly (clang, -O0):
<strncat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
xor    %edx,%edx
call   1040 <memccpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncat>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
mov    %r14,%rcx
call   1040 <memccpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strncat(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
%9 = load i8*, i8** %7
%10 = call i32 @strlen(i8* %9)
%11 = load i8*, i8** %7
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds i8, i8* %11, i64 %12
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = load i8*, i8** %5
%16 = load i64, i64* %6
%17 = call i32 @memccpy(i8* %14, i8* %15, i8 signext 0, i64 %16)
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
define i8* @strncat(i8* noalias returned %0, i8* noalias nocapture %1, i64 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @memccpy(i8* %6, i8* %1, i8 signext 0, i64 %2)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ bnInit_64();
void bnInit(void) { bnInit_64(); }


x86 assembly (clang, -O0):
<bnInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bnInit_64@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bnInit>:
xor    %eax,%eax
jmp    1030 <bnInit_64@plt>

LLVM IR (-O0):
define void @bnInit() {
%1 = call i32 (...) @bnInit_64()
ret void
}

LLVM IR (-O2):
define void @bnInit() {
%1 = tail call i32 (...) @bnInit_64()
ret void
}
unsigned short int16_le_at(unsigned char *c) { return c[0] | (c[1] << 8); }


x86 assembly (clang, -O0):
<int16_le_at>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int16_le_at>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i16 @int16_le_at(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @int16_le_at(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i16
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i16
%7 = shl nuw i16 %6, 8
%8 = or i16 %7, %3
ret i16 %8
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, short *, int);
void setI2(unsigned char *p, short i) { memcpy(p, &i, 2); }


x86 assembly (clang, -O0):
<setI2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setI2>:
push   %rax
mov    %si,0x6(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @setI2(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i8*, i8** %3
%6 = call i32 @memcpy(i8* %5, i16* %4, i32 2)
ret void
}

LLVM IR (-O2):
define void @setI2(i8* %0, i16 signext %1) {
%3 = alloca i16
store i16 %1, i16* %3
%4 = call i32 @memcpy(i8* %0, i16* %3, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_rx_mvtc(int, int);
void set_stack_pointer(int value) {
  __builtin_rx_mvtc(2, value);
  __builtin_rx_mvtc(2, 0x1234);
}


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

x86 assembly (clang, -O2):
<set_stack_pointer>:
push   %rax
mov    %edi,%esi
mov    $0x2,%edi
call   1030 <__builtin_rx_mvtc@plt>
mov    $0x2,%edi
mov    $0x1234,%esi
pop    %rax
jmp    1030 <__builtin_rx_mvtc@plt>

LLVM IR (-O0):
define void @set_stack_pointer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @__builtin_rx_mvtc(i32 2, i32 %3)
%5 = call i32 @__builtin_rx_mvtc(i32 2, i32 4660)
ret void
}

LLVM IR (-O2):
define void @set_stack_pointer(i32 %0) {
%2 = tail call i32 @__builtin_rx_mvtc(i32 2, i32 %0)
%3 = tail call i32 @__builtin_rx_mvtc(i32 2, i32 4660)
ret void
}
int HYPRE_CheckError(int ierr, int hypre_error_code) {
  return ierr & hypre_error_code;
}


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

x86 assembly (clang, -O2):
<HYPRE_CheckError>:
mov    %edi,%eax
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @HYPRE_CheckError(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 = and i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @HYPRE_CheckError(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int waitForReturn();
int checkBatch(int numLines) {
  static int lines;
  int r;
  r = 0;
  if (numLines == 0) {
    lines = 0;
  } else {
    lines += numLines;
    if (lines >= 32) {
      r = waitForReturn();
      lines = 0;
    }
  }
  return r;
}


x86 assembly (clang, -O0):
<checkBatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113b <checkBatch+0x2b>
movl   $0x0,0x2ef6(%rip)
jmp    1170 <checkBatch+0x60>
mov    -0x4(%rbp),%eax
add    0x2ee8(%rip),%eax
mov    %eax,0x2ee2(%rip)
cmpl   $0x20,0x2edb(%rip)
jl     116b <checkBatch+0x5b>
mov    $0x0,%al
call   1030 <waitForReturn@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,0x2ec1(%rip)
jmp    1170 <checkBatch+0x60>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkBatch>:
push   %rax
test   %edi,%edi
je     1131 <checkBatch+0x21>
add    0x2f11(%rip),%edi
mov    %edi,0x2f0b(%rip)
xor    %eax,%eax
cmp    $0x20,%edi
jl     113d <checkBatch+0x2d>
xor    %eax,%eax
call   1030 <waitForReturn@plt>
jmp    1133 <checkBatch+0x23>
xor    %eax,%eax
movl   $0x0,0x2eef(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@checkBatch.lines = internal global i32 0
define i32 @checkBatch(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* @checkBatch.lines
br label %16
7: ; preds = %1
%8 = load i32, i32* %2
%9 = load i32, i32* @checkBatch.lines
%10 = add nsw i32 %9, %8
store i32 %10, i32* @checkBatch.lines
%11 = load i32, i32* @checkBatch.lines
%12 = icmp sge i32 %11, 32
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 (...) @waitForReturn()
store i32 %14, i32* %3
store i32 0, i32* @checkBatch.lines
br label %15
15: ; preds = %13, %7
br label %16
16: ; preds = %15, %6
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@checkBatch.lines = internal unnamed_addr global i32 0
define i32 @checkBatch(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i32, i32* @checkBatch.lines
%5 = add nsw i32 %4, %0
store i32 %5, i32* @checkBatch.lines
%6 = icmp sgt i32 %5, 31
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = tail call i32 (...) @waitForReturn()
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ 0, %1 ]
store i32 0, i32* @checkBatch.lines
br label %11
11: ; preds = %9, %3
%12 = phi i32 [ 0, %3 ], [ %10, %9 ]
ret i32 %12
}
double f(double x) { return x; }


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

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

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
ret double %3
}

LLVM IR (-O2):
define double @f(double returned %0) {
ret double %0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ test_ll_functions();
scalar_t__ time(int /*<<< orphan*/ *);
void main() {
  time_t t;
  srand((unsigned)time(&t));
  test_ll_functions();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <test_ll_functions@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <test_ll_functions@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i64 @time(i32* %1)
%3 = trunc i64 %2 to i32
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @test_ll_functions()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @time(i32* %1)
%4 = trunc i64 %3 to i32
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @test_ll_functions()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ unlink(char *);
void remove_pid_file(char *pidfilename) {
  unlink(pidfilename);
  free(pidfilename);
}


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

x86 assembly (clang, -O2):
<remove_pid_file>:
push   %rbx
mov    %rdi,%rbx
call   1040 <unlink@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @remove_pid_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @unlink(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @remove_pid_file(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
int irq_to_gpio(unsigned irq) { return (irq - (0x30 + 0)); }


x86 assembly (clang, -O0):
<irq_to_gpio>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_to_gpio>:
lea    -0x30(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @irq_to_gpio(i32 %0) {
%2 = add i32 %0, -48
ret i32 %2
}
/* Variables and functions */
int foo(int, int);
int main(int argc, char **argv) {
  int a = argc;
  a = foo(a, a);
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <foo@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    %edi,%esi
jmp    1030 <foo@plt>

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
%7 = load i32, i32* %4
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = load i32, i32* %6
%10 = call i32 @foo(i32 %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
ret i32 %11
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @foo(i32 %0, i32 %0)
ret i32 %3
}
void _ttywrch(int ch) {}


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

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

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

LLVM IR (-O2):
define void @_ttywrch(i32 %0) {
ret void
}
/* Variables and functions */
unsigned long GetRGBA91(unsigned char, unsigned char, unsigned char,
                        unsigned char);
unsigned long getrgba(unsigned char r, unsigned char g, unsigned char b,
                      unsigned char a) {
  return GetRGBA91(r, g, b, a);
}


x86 assembly (clang, -O0):
<getrgba>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
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)
mov    -0x1(%rbp),%dl
mov    -0x2(%rbp),%cl
mov    -0x3(%rbp),%al
movzbl %dl,%edi
movzbl %cl,%esi
movzbl %al,%edx
movzbl -0x4(%rbp),%ecx
call   1030 <GetRGBA91@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrgba>:
jmp    1030 <GetRGBA91@plt>

LLVM IR (-O0):
define i64 @getrgba(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %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 = load i8, i8* %6
%11 = load i8, i8* %7
%12 = load i8, i8* %8
%13 = call i64 @GetRGBA91(i8 zeroext %9, i8 zeroext %10, i8 zeroext %11, i8 zeroext %12)
ret i64 %13
}

LLVM IR (-O2):
define i64 @getrgba(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = tail call i64 @GetRGBA91(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ f1();
int /*<<< orphan*/ f2();
void foo(int *a) {
  int cst = 0;
  if ((intptr_t)a == cst) {
    f1();
    if (a)
      f2();
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jne    1162 <foo+0x42>
mov    $0x0,%al
call   1040 <f1@plt>
cmpq   $0x0,-0x8(%rbp)
je     115d <foo+0x3d>
mov    $0x0,%al
call   1030 <f2@plt>
jmp    1162 <foo+0x42>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %rdi,%rdi
je     1116 <foo+0x6>
ret
xor    %eax,%eax
jmp    1030 <f1@plt>

LLVM IR (-O0):
define void @foo(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = ptrtoint i32* %4 to i64
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %5, %7
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = call i32 (...) @f1()
%11 = load i32*, i32** %2
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (...) @f2()
br label %15
15: ; preds = %13, %9
br label %16
16: ; preds = %15, %1
ret void
}

LLVM IR (-O2):
define void @foo(i32* readnone %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @f1()
br label %5
5: ; preds = %3, %1
ret void
}
const char *dlerror(void) { return "Dynamic linking not enabled !"; }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"Dynamic linking not enabled !\00"
define i8* @dlerror() {
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [30 x i8] c"Dynamic linking not enabled !\00"
define i8* @dlerror() {
ret i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char const *);
void string_concat(char *dst, const char *src) { strcat(dst, src); }


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

x86 assembly (clang, -O2):
<string_concat>:
jmp    1030 <strcat@plt>

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

LLVM IR (-O2):
define void @string_concat(i8* %0, i8* %1) {
%3 = tail call i32 @strcat(i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void print_error(char *reason) {
  printf("<TITLE>Order Not Submitted</TITLE>%c", 10);
  printf("<H1>Order Not Submitted</H1>%c", 10);
  printf("Your order has not been submitted, because %s.<P>%c", reason, 10);
  exit(1);
}


x86 assembly (clang, -O0):
<print_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xee7(%rip),%rdi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_error>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"<TITLE>Order Not Submitted</TITLE>%c\00"
@.str.1 = [31 x i8] c"<H1>Order Not Submitted</H1>%c\00"
@.str.2 = [52 x i8] c"Your order has not been submitted, because %s.<P>%c\00"
define void @print_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 10)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 10)
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8* %5, i32 10)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [37 x i8] c"<TITLE>Order Not Submitted</TITLE>%c\00"
@.str.1 = [31 x i8] c"<H1>Order Not Submitted</H1>%c\00"
@.str.2 = [52 x i8] c"Your order has not been submitted, because %s.<P>%c\00"
define void @print_error(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 10)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 10)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 10)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  (void)fprintf(stderr, "usage: mount_devfs [-o options] devfs mount_point\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"usage: mount_devfs [-o options] devfs mount_point\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"usage: mount_devfs [-o options] devfs mount_point\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ eset(int);
int tcFclose(int);
int Mfclose(int nargs, int *args) {
  if (nargs < 1) {
    eset(21);
    return -1;
  }
  int unit = args[0];
  return tcFclose(unit);
}


x86 assembly (clang, -O0):
<Mfclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    114f <Mfclose+0x2f>
mov    $0x15,%edi
call   1040 <eset@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <Mfclose+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <tcFclose@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mfclose>:
push   %rax
test   %edi,%edi
jle    112d <Mfclose+0xd>
mov    (%rsi),%edi
pop    %rax
jmp    1030 <tcFclose@plt>
mov    $0x15,%edi
call   1040 <eset@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @Mfclose(i32 %0, i32* nocapture %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @eset(i32 21)
br label %9
6: ; preds = %2
%7 = load i32, i32* %1
%8 = tail call i32 @tcFclose(i32 %7)
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ -1, %4 ], [ %8, %6 ]
ret i32 %10
}
void arm_mcrr2() {}


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

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

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

LLVM IR (-O2):
define void @arm_mcrr2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ stpncpy(char *, char const *, size_t);
char *strncpy(char *restrict d, const char *restrict s, size_t n) {
  stpncpy(d, s, n);
  return d;
}


x86 assembly (clang, -O0):
<strncpy>:
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 <stpncpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy>:
push   %rbx
mov    %rdi,%rbx
call   1030 <stpncpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @strncpy(i8* noalias returned %0, i8* noalias %1, i64 %2) {
%4 = tail call i32 @stpncpy(i8* %0, i8* %1, i64 %2)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int recGcd(int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a, b;
  printf("Enter two numbers, (a, b) \n");
  scanf("%d %d", &a, &b);
  printf("GCD is %d", recGcd(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <recGcd@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <recGcd@plt>
lea    0xe92(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Enter two numbers, (a, b) \0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [10 x i8] c"GCD is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @recGcd(i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [10 x i8] c"GCD is %d\00"
@str = [27 x i8] c"Enter two numbers, (a, b) \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @recGcd(i32 %7, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
void test_heap() {}


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

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

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

LLVM IR (-O2):
define void @test_heap() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cleanup_screen();
int /*<<< orphan*/ running_zombie();
int /*<<< orphan*/ setup_screen();
int main() {
  setup_screen();
  running_zombie();
  cleanup_screen();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <setup_screen@plt>
mov    $0x0,%al
call   1040 <running_zombie@plt>
mov    $0x0,%al
call   1030 <cleanup_screen@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <setup_screen@plt>
xor    %eax,%eax
call   1040 <running_zombie@plt>
xor    %eax,%eax
call   1030 <cleanup_screen@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @setup_screen()
%3 = call i32 (...) @running_zombie()
%4 = call i32 (...) @cleanup_screen()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @setup_screen()
%2 = tail call i32 (...) @running_zombie()
%3 = tail call i32 (...) @cleanup_screen()
ret i32 0
}
__attribute__((no, noclone)) signed __int128 t103_3add(signed __int128 y) {
  signed __int128 r;
  if (__builtin_add_overflow((signed __int128)(1), y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t103_3add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
add    $0x1,%rdx
adc    $0x0,%rcx
seto   %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1158 <t103_3add+0x48>
jmp    115f <t103_3add+0x4f>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t103_3add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
adc    $0x0,%r14
jno    112b <t103_3add+0x1b>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t103_3add(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 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 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 1, i128 %11)
%13 = extractvalue { i128, i1 } %12, 1
%14 = extractvalue { i128, i1 } %12, 0
store i128 %14, i128* %6
br i1 %13, label %15, label %17
15: ; preds = %2
%16 = call i32 (...) @bar()
br label %17
17: ; preds = %15, %2
%18 = load i128, i128* %6
store i128 %18, i128* %3
%19 = bitcast i128* %3 to { i64, i64 }*
%20 = load { i64, i64 }, { i64, i64 }* %19
ret { i64, i64 } %20
}

LLVM IR (-O2):
define { i64, i64 } @t103_3add(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.sadd.with.overflow.i128(i128 %6, i128 1)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
long strlen(char *p) {
  int n = 0;
  while (*p++)
    n++;
  return n;
}


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

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = zext i32 %8 to i64
br label %13
13: ; preds = %11, %1
%14 = phi i64 [ 0, %1 ], [ %12, %11 ]
ret i64 %14
}
/* Variables and functions */
int CCutil_lprand();
int myrandnum(int n) { return (CCutil_lprand() % n); }


x86 assembly (clang, -O0):
<myrandnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <CCutil_lprand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrandnum>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <CCutil_lprand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @myrandnum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @CCutil_lprand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @myrandnum(i32 %0) {
%2 = tail call i32 (...) @CCutil_lprand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void test_mysql_1(void) {
  assert(0 && "ERROR: dbi:mysql support not compiled in!");
}


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

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

LLVM IR (-O0):
define void @test_mysql_1() {
%1 = call i32 @assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @test_mysql_1() {
%1 = tail call i32 @assert(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fuck_me(void) { printf("being hacked\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"being hacked\00"
define void @fuck_me() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct Token {
  int dummy;
};

/* Variables and functions */
struct Token *exeTokenOperationsWithOperators(struct Token **, struct Token **,
                                              char *);
struct Token *exeTokenOperations(struct Token **firstTokens,
                                 struct Token **lastTokens) {
  exeTokenOperationsWithOperators(firstTokens, lastTokens, "*/");
  return exeTokenOperationsWithOperators(firstTokens, lastTokens, "+-");
}


x86 assembly (clang, -O0):
<exeTokenOperations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xed1(%rip),%rdx
call   1030 <exeTokenOperationsWithOperators@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0xec0(%rip),%rdx
call   1030 <exeTokenOperationsWithOperators@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exeTokenOperations>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdx
call   1030 <exeTokenOperationsWithOperators@plt>
lea    0xed6(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <exeTokenOperationsWithOperators@plt>

LLVM IR (-O0):
%struct.Token = type { i32 }
@.str = [3 x i8] c"*/\00"
@.str.1 = [3 x i8] c"+-\00"
define %struct.Token* @exeTokenOperations(%struct.Token** %0, %struct.Token** %1) {
%3 = alloca %struct.Token**
%4 = alloca %struct.Token**
store %struct.Token** %0, %struct.Token*** %3
store %struct.Token** %1, %struct.Token*** %4
%5 = load %struct.Token**, %struct.Token*** %3
%6 = load %struct.Token**, %struct.Token*** %4
%7 = call %struct.Token* @exeTokenOperationsWithOperators(%struct.Token** %5, %struct.Token** %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = load %struct.Token**, %struct.Token*** %3
%9 = load %struct.Token**, %struct.Token*** %4
%10 = call %struct.Token* @exeTokenOperationsWithOperators(%struct.Token** %8, %struct.Token** %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret %struct.Token* %10
}

LLVM IR (-O2):
%struct.Token = type { i32 }
@.str = [3 x i8] c"*/\00"
@.str.1 = [3 x i8] c"+-\00"
define %struct.Token* @exeTokenOperations(%struct.Token** %0, %struct.Token** %1) {
%3 = tail call %struct.Token* @exeTokenOperationsWithOperators(%struct.Token** %0, %struct.Token** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call %struct.Token* @exeTokenOperationsWithOperators(%struct.Token** %0, %struct.Token** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret %struct.Token* %4
}
/* Type definitions */
struct ptr_list {
  int dummy;
};
struct instruction_list {
  int dummy;
};
struct instruction {
  int dummy;
};

/* Variables and functions */
struct instruction *last_ptr_list(struct ptr_list *);
struct instruction *last_instruction(struct instruction_list *head) {
  return last_ptr_list((struct ptr_list *)head);
}


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

x86 assembly (clang, -O2):
<last_instruction>:
jmp    1030 <last_ptr_list@plt>

LLVM IR (-O0):
%struct.instruction = type { i32 }
%struct.instruction_list = type { i32 }
%struct.ptr_list = type { i32 }
define %struct.instruction* @last_instruction(%struct.instruction_list* %0) {
%2 = alloca %struct.instruction_list*
store %struct.instruction_list* %0, %struct.instruction_list** %2
%3 = load %struct.instruction_list*, %struct.instruction_list** %2
%4 = bitcast %struct.instruction_list* %3 to %struct.ptr_list*
%5 = call %struct.instruction* @last_ptr_list(%struct.ptr_list* %4)
ret %struct.instruction* %5
}

LLVM IR (-O2):
%struct.instruction = type { i32 }
%struct.instruction_list = type { i32 }
%struct.ptr_list = type { i32 }
define %struct.instruction* @last_instruction(%struct.instruction_list* %0) {
%2 = bitcast %struct.instruction_list* %0 to %struct.ptr_list*
%3 = tail call %struct.instruction* @last_ptr_list(%struct.ptr_list* %2)
ret %struct.instruction* %3
}
/* Variables and functions */
int /*<<< orphan*/ dlclose(void *);
int /*<<< orphan*/ dlerror();
void *dlopen(char *, int /*<<< orphan*/);
int /*<<< orphan*/ dlsym(void *, char *);
int main(void) {
  void *handle;
  handle = dlopen("filename", 0);
  dlsym(handle, "symbol");
  dlclose(handle);
  dlerror();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
xor    %esi,%esi
call   1040 <dlopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1050 <dlsym@plt>
mov    -0x10(%rbp),%rdi
call   1060 <dlclose@plt>
mov    $0x0,%al
call   1030 <dlerror@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
xor    %esi,%esi
call   1040 <dlopen@plt>
mov    %rax,%rbx
lea    0xeb0(%rip),%rsi
mov    %rax,%rdi
call   1050 <dlsym@plt>
mov    %rbx,%rdi
call   1060 <dlclose@plt>
xor    %eax,%eax
call   1030 <dlerror@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"filename\00"
@.str.1 = [7 x i8] c"symbol\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @dlopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @dlsym(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @dlclose(i8* %6)
%8 = call i32 (...) @dlerror()
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"filename\00"
@.str.1 = [7 x i8] c"symbol\00"
define i32 @main() {
%1 = tail call i8* @dlopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @dlsym(i8* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @dlclose(i8* %1)
%4 = tail call i32 (...) @dlerror()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
void vuln(char *input) {
  char buf[16];
  strcpy(buf, input);
}


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

x86 assembly (clang, -O2):
<vuln>:
sub    $0x18,%rsp
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @vuln(i8* %0) {
%2 = alloca i8*
%3 = alloca [16 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strcpy(i8* %4, i8* %5)
ret void
}

LLVM IR (-O2):
define void @vuln(i8* %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ console_out(char);
void test_main() { console_out('A'); }


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

x86 assembly (clang, -O2):
<test_main>:
mov    $0x41,%edi
jmp    1030 <console_out@plt>

LLVM IR (-O0):
define void @test_main() {
%1 = call i32 @console_out(i8 signext 65)
ret void
}

LLVM IR (-O2):
define void @test_main() {
%1 = tail call i32 @console_out(i8 signext 65)
ret void
}