xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_timed_schedule_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_timed@%p::schedule (rtpp_timed_schedule) is invoked "
          "after destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_timed_schedule_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_timed_schedule_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [83 x i8] c"Method rtpp_timed@%p::schedule (rtpp_timed_schedule) is invoked after destruction\0A\00"
define void @rtpp_timed_schedule_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [83 x i8] c"Method rtpp_timed@%p::schedule (rtpp_timed_schedule) is invoked after destruction\0A\00"
define void @rtpp_timed_schedule_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int foo() {
  printf("Hello from foo.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Hello from foo.\0A\00"
define i32 @foo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"Hello from foo.\00"
define i32 @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
double clip_by_value(double x, double clip_value_min, double clip_value_max) {
  if (x < clip_value_min)
    return clip_value_min;
  else if (x > clip_value_max)
    return clip_value_max;
  else
    return x;
}


x86 assembly (clang, -O0):
<clip_by_value>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <clip_by_value+0x36>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <clip_by_value+0x5f>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1155 <clip_by_value+0x55>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <clip_by_value+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clip_by_value>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @clip_by_value(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load double, double* %6
store double %12, double* %4
br label %21
13: ; preds = %3
%14 = load double, double* %5
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double, double* %7
store double %18, double* %4
br label %21
19: ; preds = %13
%20 = load double, double* %5
store double %20, double* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load double, double* %4
ret double %22
}

LLVM IR (-O2):
define double @clip_by_value(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}
int test_imm_5Euint16_reg(unsigned short val) {
  return ((val) & (-0x5E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_5Euint16_reg>:
test   $0xffa2,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -94
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void elsa_cs_config(struct pcmcia_device *link) { int i, j, last_fn; }


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

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

LLVM IR (-O0):
%struct.pcmcia_device = type opaque
define void @elsa_cs_config(%struct.pcmcia_device* %0) {
%2 = alloca %struct.pcmcia_device*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store %struct.pcmcia_device* %0, %struct.pcmcia_device** %2
ret void
}

LLVM IR (-O2):
%struct.pcmcia_device = type opaque
define void @elsa_cs_config(%struct.pcmcia_device* nocapture %0) {
ret void
}
void _infix_operator_plus_u32_u32(unsigned long lhs, unsigned long rhs,
                                  unsigned long *__rval_1) {
  *__rval_1 = lhs + rhs;
}


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

x86 assembly (clang, -O2):
<_infix_operator_plus_u32_u32>:
add    %rsi,%rdi
mov    %rdi,(%rdx)
ret

LLVM IR (-O0):
define void @_infix_operator_plus_u32_u32(i64 %0, i64 %1, i64* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64* %2, i64** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = add i64 %7, %8
%10 = load i64*, i64** %6
store i64 %9, i64* %10
ret void
}

LLVM IR (-O2):
define void @_infix_operator_plus_u32_u32(i64 %0, i64 %1, i64* nocapture writeonly %2) {
%4 = add i64 %1, %0
store i64 %4, i64* %2
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
size_t strlen(char const *);
int str_has_suffix(const char *str, const char *suffix) {
  size_t len = strlen(str);
  size_t suffix_len = strlen(suffix);
  if (len < suffix_len) {
    return -1;
  }
  return strcmp(str + (len - suffix_len), suffix);
}


x86 assembly (clang, -O0):
<str_has_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1164 <str_has_suffix+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    117f <str_has_suffix+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
sub    -0x28(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_has_suffix>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
sub    %rax,%rbx
jae    114b <str_has_suffix+0x2b>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
add    %rbx,%r15
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcmp@plt>

LLVM IR (-O0):
define i32 @str_has_suffix(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %6
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
store i64 %11, i64* %7
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 -1, i32* %3
br label %24
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = sub i64 %18, %19
%21 = getelementptr inbounds i8, i8* %17, i64 %20
%22 = load i8*, i8** %5
%23 = call i32 @strcmp(i8* %21, i8* %22)
store i32 %23, i32* %3
br label %24
24: ; preds = %16, %15
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @str_has_suffix(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp ult i64 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = sub i64 %3, %4
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(1) %1)
br label %10
10: ; preds = %2, %6
%11 = phi i32 [ %9, %6 ], [ -1, %2 ]
ret i32 %11
}
int test_imm_E4int8_mem(signed char *val) {
  return ((*val) & (-0xE4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E4int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff1c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E4int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff1c,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E4int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -228
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
scalar_t__ strtol(char *, char **, int);
int cb_size(void *res, int argc, char **argv, char **azColName) {
  char *err_ptr = NULL;
  *((int *)res) = (int)strtol(argv[0], &err_ptr, 10);
  if (argv[0] == err_ptr)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<cb_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
cmp    -0x30(%rbp),%rax
jne    1169 <cb_size+0x59>
movl   $0xffffffff,-0x4(%rbp)
jmp    1170 <cb_size+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cb_size>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
movq   $0x0,(%rsp)
mov    (%rdx),%rdi
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,(%r14)
mov    (%rbx),%rcx
xor    %eax,%eax
cmp    (%rsp),%rcx
sete   %al
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @cb_size(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%7 = load i8*, i8** %2
%8 = call i64 @strtol(i8* %7, i8** %5, i32 10)
%9 = trunc i64 %8 to i32
%10 = bitcast i8* %0 to i32*
store i32 %9, i32* %10
%11 = load i8*, i8** %2
%12 = load i8*, i8** %5
%13 = icmp eq i8* %11, %12
%14 = sext i1 %13 to i32
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void I2SRxFIFOLimitSet(unsigned long ulBase, unsigned long ulLevel) {
  DEBUG_ASSERT(ulBase == 0x40054000);
  DEBUG_ASSERT(ulLevel <= 16);
  (*((volatile unsigned long *)(ulBase + 0x0000080C))) = ulLevel;
}


x86 assembly (clang, -O0):
<I2SRxFIFOLimitSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40054000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x10,-0x10(%rbp)
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x80c(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SRxFIFOLimitSet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40054000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x11,%r14
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r14,0x80c(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @I2SRxFIFOLimitSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1074085888
%7 = zext i1 %6 to i32
%8 = call i32 @DEBUG_ASSERT(i32 %7)
%9 = load i64, i64* %4
%10 = icmp ule i64 %9, 16
%11 = zext i1 %10 to i32
%12 = call i32 @DEBUG_ASSERT(i32 %11)
%13 = load i64, i64* %4
%14 = load i64, i64* %3
%15 = add i64 %14, 2060
%16 = inttoptr i64 %15 to i64*
store volatile i64 %13, i64* %16
ret void
}

LLVM IR (-O2):
define void @I2SRxFIFOLimitSet(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074085888
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = icmp ult i64 %1, 17
%7 = zext i1 %6 to i32
%8 = tail call i32 @DEBUG_ASSERT(i32 %7)
%9 = add i64 %0, 2060
%10 = inttoptr i64 %9 to i64*
store volatile i64 %1, i64* %10
ret void
}
int main() {
  int a = 2;
  return ++a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void keyPressed(unsigned char key, int x, int y) {
  switch (key) {
  case 'd':
    break;
  case 'o':
    break;
  case 'q':
    break;
  case 'x':
    break;
  case 's':
    break;
  case 'a':
    exit(0);
  default:;
  }
}


x86 assembly (clang, -O0):
<keyPressed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x17,%eax
ja     116e <keyPressed+0x5e>
mov    -0x18(%rbp),%rax
lea    0xebb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1173 <keyPressed+0x63>
jmp    1173 <keyPressed+0x63>
jmp    1173 <keyPressed+0x63>
jmp    1173 <keyPressed+0x63>
jmp    1173 <keyPressed+0x63>
xor    %edi,%edi
call   1030 <exit@plt>
jmp    1173 <keyPressed+0x63>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyPressed>:
cmp    $0x61,%dil
je     1117 <keyPressed+0x7>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @keyPressed(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %16 [
i32 100, label %9
i32 111, label %10
i32 113, label %11
i32 120, label %12
i32 115, label %13
i32 97, label %14
]
9: ; preds = %3
br label %17
10: ; preds = %3
br label %17
11: ; preds = %3
br label %17
12: ; preds = %3
br label %17
13: ; preds = %3
br label %17
14: ; preds = %3
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %3
br label %17
17: ; preds = %16, %13, %12, %11, %10, %9
ret void
}

LLVM IR (-O2):
define void @keyPressed(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 97
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
ret void
}
/* Variables and functions */
int same_page(void *ptr1, void *ptr2) {
  return (((uintptr_t)ptr1) & (~((uintptr_t)(4096 - 1)))) ==
         (((uintptr_t)ptr2) & (~((uintptr_t)(4096 - 1))));
}


x86 assembly (clang, -O0):
<same_page>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffffff000,%rax
mov    -0x10(%rbp),%rcx
and    $0xfffffffffffff000,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_page>:
xor    %rsi,%rdi
xor    %eax,%eax
cmp    $0x1000,%rdi
setb   %al
ret

LLVM IR (-O0):
define i32 @same_page(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 = ptrtoint i8* %5 to i64
%7 = and i64 %6, -4096
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
%10 = and i64 %9, -4096
%11 = icmp eq i64 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @same_page(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = xor i64 %4, %3
%6 = icmp ult i64 %5, 4096
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ one();
void two(void) { one(); }


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

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

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

LLVM IR (-O2):
define void @two() {
%1 = tail call i32 (...) @one()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ led_clear();
int /*<<< orphan*/ led_set_code(int, unsigned char);
void show_slot_title(unsigned char slot) {
  led_clear();
  led_set_code(5, 'S');
  led_set_code(4, 'L');
  led_set_code(3, 'O');
  led_set_code(1, (slot / 10) + 0x30);
  led_set_code(0, (slot % 10) + 0x30);
}


x86 assembly (clang, -O0):
<show_slot_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <led_clear@plt>
mov    $0x5,%edi
mov    $0x53,%esi
call   1040 <led_set_code@plt>
mov    $0x4,%edi
mov    $0x4c,%esi
call   1040 <led_set_code@plt>
mov    $0x3,%edi
mov    $0x4f,%esi
call   1040 <led_set_code@plt>
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x1,%edi
movzbl %al,%esi
call   1040 <led_set_code@plt>
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
xor    %edi,%edi
movzbl %al,%esi
call   1040 <led_set_code@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_slot_title>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <led_clear@plt>
mov    $0x5,%edi
mov    $0x53,%esi
call   1040 <led_set_code@plt>
mov    $0x4,%edi
mov    $0x4c,%esi
call   1040 <led_set_code@plt>
mov    $0x3,%edi
mov    $0x4f,%esi
call   1040 <led_set_code@plt>
imul   $0xcd,%ebp,%ebx
shr    $0xb,%ebx
lea    0x30(%rbx),%eax
movzbl %al,%esi
mov    $0x1,%edi
call   1040 <led_set_code@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %al,%bpl
or     $0x30,%bpl
movzbl %bpl,%esi
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <led_set_code@plt>

LLVM IR (-O0):
define void @show_slot_title(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 (...) @led_clear()
%4 = call i32 @led_set_code(i32 5, i8 zeroext 83)
%5 = call i32 @led_set_code(i32 4, i8 zeroext 76)
%6 = call i32 @led_set_code(i32 3, i8 zeroext 79)
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = sdiv i32 %8, 10
%10 = add nsw i32 %9, 48
%11 = trunc i32 %10 to i8
%12 = call i32 @led_set_code(i32 1, i8 zeroext %11)
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = srem i32 %14, 10
%16 = add nsw i32 %15, 48
%17 = trunc i32 %16 to i8
%18 = call i32 @led_set_code(i32 0, i8 zeroext %17)
ret void
}

LLVM IR (-O2):
define void @show_slot_title(i8 zeroext %0) {
%2 = tail call i32 (...) @led_clear()
%3 = tail call i32 @led_set_code(i32 5, i8 zeroext 83)
%4 = tail call i32 @led_set_code(i32 4, i8 zeroext 76)
%5 = tail call i32 @led_set_code(i32 3, i8 zeroext 79)
%6 = udiv i8 %0, 10
%7 = add nuw nsw i8 %6, 48
%8 = tail call i32 @led_set_code(i32 1, i8 zeroext %7)
%9 = urem i8 %0, 10
%10 = or i8 %9, 48
%11 = tail call i32 @led_set_code(i32 0, i8 zeroext %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SetMotor(int, int);
int /*<<< orphan*/ SetTime(int);
void SetMotorsAndTime(int v1, int v2, int v3, int v4) {
  SetMotor(0, v1);
  SetMotor(1, v2);
  SetMotor(2, v3);
  SetTime(v4);
}


x86 assembly (clang, -O0):
<SetMotorsAndTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <SetMotor@plt>
mov    -0x8(%rbp),%esi
mov    $0x1,%edi
call   1030 <SetMotor@plt>
mov    -0xc(%rbp),%esi
mov    $0x2,%edi
call   1030 <SetMotor@plt>
mov    -0x10(%rbp),%edi
call   1040 <SetTime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetMotorsAndTime>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%esi
xor    %edi,%edi
call   1030 <SetMotor@plt>
mov    $0x1,%edi
mov    %ebx,%esi
call   1030 <SetMotor@plt>
mov    $0x2,%edi
mov    %ebp,%esi
call   1030 <SetMotor@plt>
mov    %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <SetTime@plt>

LLVM IR (-O0):
define void @SetMotorsAndTime(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = call i32 @SetMotor(i32 0, i32 %9)
%11 = load i32, i32* %6
%12 = call i32 @SetMotor(i32 1, i32 %11)
%13 = load i32, i32* %7
%14 = call i32 @SetMotor(i32 2, i32 %13)
%15 = load i32, i32* %8
%16 = call i32 @SetTime(i32 %15)
ret void
}

LLVM IR (-O2):
define void @SetMotorsAndTime(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @SetMotor(i32 0, i32 %0)
%6 = tail call i32 @SetMotor(i32 1, i32 %1)
%7 = tail call i32 @SetMotor(i32 2, i32 %2)
%8 = tail call i32 @SetTime(i32 %3)
ret void
}
/* Variables and functions */
int *calloc(int, int);
int /*<<< orphan*/ printf(char *, int);
void main(void) {
  int *p;
  p = calloc(10, sizeof(int));
  *p = 10;
  *(p + 1) = 20;
  printf("%d\n", *p);
  printf("%d\n", *(p + 1));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x14,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = tail call i32* @calloc(i32 10, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 20)
ret void
}
/* Variables and functions */
scalar_t__ Malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *StringCopy(char *str) {
  int strLen = strlen(str);
  char *newString = (char *)Malloc(strLen + 1);
  memcpy(newString, str, strLen);
  newString[strLen] = '\000';
  return newString;
}


x86 assembly (clang, -O0):
<StringCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1030 <Malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringCopy>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1030 <Malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @StringCopy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i64 @Malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = call i32 @memcpy(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %4
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 0, i8* %18
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
define i8* @StringCopy(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @Malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %2)
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo4(void) { printf("Hi\n"); }


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

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

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

LLVM IR (-O2):
@str = [3 x i8] c"Hi\00"
define void @foo4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
int is_hex(int ch) {
  return ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'f')) ||
         ((ch >= 'A') && (ch <= 'F'));
}


x86 assembly (clang, -O0):
<is_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     1120 <is_hex+0x20>
mov    $0x1,%al
cmpl   $0x39,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <is_hex+0x58>
cmpl   $0x61,-0x4(%rbp)
jl     1139 <is_hex+0x39>
mov    $0x1,%al
cmpl   $0x66,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <is_hex+0x58>
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1152 <is_hex+0x52>
cmpl   $0x46,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_hex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
setb   %al
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
cmp    $0x6,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_hex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br i1 %7, label %22, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 97
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 102
br i1 %13, label %22, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 65
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 70
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br label %22
22: ; preds = %20, %11, %5
%23 = phi i1 [ true, %11 ], [ true, %5 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_hex(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
struct ioctl_entry {
  int dummy;
};
struct ioctl_args {
  int dummy;
};

/* Variables and functions */
int do_get_ioctl_int(struct ioctl_args *, struct ioctl_entry *);
int get_trigger(struct ioctl_args *args, struct ioctl_entry *entry) {
  return do_get_ioctl_int(args, entry);
}


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

x86 assembly (clang, -O2):
<get_trigger>:
jmp    1030 <do_get_ioctl_int@plt>

LLVM IR (-O0):
%struct.ioctl_args = type { i32 }
%struct.ioctl_entry = type { i32 }
define i32 @get_trigger(%struct.ioctl_args* %0, %struct.ioctl_entry* %1) {
%3 = alloca %struct.ioctl_args*
%4 = alloca %struct.ioctl_entry*
store %struct.ioctl_args* %0, %struct.ioctl_args** %3
store %struct.ioctl_entry* %1, %struct.ioctl_entry** %4
%5 = load %struct.ioctl_args*, %struct.ioctl_args** %3
%6 = load %struct.ioctl_entry*, %struct.ioctl_entry** %4
%7 = call i32 @do_get_ioctl_int(%struct.ioctl_args* %5, %struct.ioctl_entry* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.ioctl_args = type { i32 }
%struct.ioctl_entry = type { i32 }
define i32 @get_trigger(%struct.ioctl_args* %0, %struct.ioctl_entry* %1) {
%3 = tail call i32 @do_get_ioctl_int(%struct.ioctl_args* %0, %struct.ioctl_entry* %1)
ret i32 %3
}
/* Type definitions */
typedef int time_t;
struct timezone {
  int /*<<< orphan*/ tz_dsttime;
  int /*<<< orphan*/ tz_minuteswest;
};
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
time_t my_clock(void) {
  struct timeval tp;
  struct timezone tzp = {.tz_minuteswest = 0, .tz_dsttime = 0};
  gettimeofday(&tp, &tzp);
  return tp.tv_sec * 1000 + (tp.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<my_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_clock>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <gettimeofday@plt>
imul   $0x3e8,0x8(%rsp),%ecx
movslq 0xc(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32, i32 }
define i32 @my_clock() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timezone* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000
%11 = add nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32, i32 }
define i32 @my_clock() {
%1 = alloca %struct.timeval
%2 = alloca i64
%3 = bitcast i64* %2 to %struct.timezone*
%4 = bitcast %struct.timeval* %1 to i8*
%5 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%6 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %3)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %12, %9
ret i32 %13
}
int midpoint(int *array, int l, int u) { return l + ((u - l) / 2); }


x86 assembly (clang, -O0):
<midpoint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<midpoint>:
sub    %esi,%edx
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
sar    %eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @midpoint(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 %8, %9
%11 = sdiv i32 %10, 2
%12 = add nsw i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @midpoint(i32* nocapture readnone %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %2, %1
%5 = sdiv i32 %4, 2
%6 = add nsw i32 %5, %1
ret i32 %6
}
R0A1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if (r0 <= (*((int *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<R0A1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa98ac7,%ecx
cmp    (%rcx),%eax
jg     1134 <R0A1+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <R0A1+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<R0A1>:
xor    %eax,%eax
cmp    %edi,0xa98ac7
setge  %al
ret

LLVM IR (-O0):
define i32 @R0A1(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* %8
%15 = load i32, i32* inttoptr (i64 11111111 to i32*)
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %6
store i32 1, i32* %7
br label %19
18: ; preds = %6
store i32 0, i32* %7
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @R0A1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
%7 = load i32, i32* inttoptr (i64 11111111 to i32*)
%8 = icmp sge i32 %7, %0
%9 = zext i1 %8 to i32
ret i32 %9
}
void suite_Empty() {}


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

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

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

LLVM IR (-O2):
define void @suite_Empty() {
ret void
}
/* Type definitions */
struct ptrlist_struct {
  int dummy;
};
struct elasticarray {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ elasticarray_shrink(struct elasticarray *, size_t, int);
void ptrlist_shrink(struct ptrlist_struct *EA, size_t nrec) {
  elasticarray_shrink((struct elasticarray *)EA, nrec, sizeof(void *));
}


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

x86 assembly (clang, -O2):
<ptrlist_shrink>:
mov    $0x8,%edx
jmp    1030 <elasticarray_shrink@plt>

LLVM IR (-O0):
%struct.ptrlist_struct = type { i32 }
%struct.elasticarray = type { i32 }
define void @ptrlist_shrink(%struct.ptrlist_struct* %0, i64 %1) {
%3 = alloca %struct.ptrlist_struct*
%4 = alloca i64
store %struct.ptrlist_struct* %0, %struct.ptrlist_struct** %3
store i64 %1, i64* %4
%5 = load %struct.ptrlist_struct*, %struct.ptrlist_struct** %3
%6 = bitcast %struct.ptrlist_struct* %5 to %struct.elasticarray*
%7 = load i64, i64* %4
%8 = call i32 @elasticarray_shrink(%struct.elasticarray* %6, i64 %7, i32 8)
ret void
}

LLVM IR (-O2):
%struct.ptrlist_struct = type { i32 }
%struct.elasticarray = type { i32 }
define void @ptrlist_shrink(%struct.ptrlist_struct* %0, i64 %1) {
%3 = bitcast %struct.ptrlist_struct* %0 to %struct.elasticarray*
%4 = tail call i32 @elasticarray_shrink(%struct.elasticarray* %3, i64 %1, i32 8)
ret void
}
/* Variables and functions */
int INT_MAX;
int atoi(char *);
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char **argv) {
  signed int x = INT_MAX * atoi(argv[1]);
  (void)argc;
  printf("%d\nsizeof int: %lu\n sizeof long: %lu\n", x, sizeof(int),
         sizeof(long));
  return 0;
}


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    0x2eab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x4,%edx
mov    $0x8,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
imul   %eax,%ebx
lea    0xec3(%rip),%rdi
mov    %ebx,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
@.str = [38 x i8] c"%d\0Asizeof int: %lu\0A sizeof long: %lu\0A\00"
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* @INT_MAX
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
%12 = mul nsw i32 %7, %11
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %14, i32 4, i32 8)
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i32 0
@.str = [38 x i8] c"%d\0Asizeof int: %lu\0A sizeof long: %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @INT_MAX
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = mul nsw i32 %6, %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %7, i32 4, i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ror16addr(int /*<<< orphan*/);
int /*<<< orphan*/ zeropagex();
void rorZpx16(void) { ror16addr(zeropagex()); }


x86 assembly (clang, -O0):
<rorZpx16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <zeropagex@plt>
mov    %eax,%edi
call   1040 <ror16addr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rorZpx16>:
push   %rax
xor    %eax,%eax
call   1030 <zeropagex@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ror16addr@plt>

LLVM IR (-O0):
define void @rorZpx16() {
%1 = call i32 (...) @zeropagex()
%2 = call i32 @ror16addr(i32 %1)
ret void
}

LLVM IR (-O2):
define void @rorZpx16() {
%1 = tail call i32 (...) @zeropagex()
%2 = tail call i32 @ror16addr(i32 %1)
ret void
}
/* Variables and functions */
int term_baud_down(int);
int baud_down(int baud) {
  int nb;
  nb = term_baud_down(baud);
  if (nb == 0)
    nb = baud;
  return nb;
}


x86 assembly (clang, -O0):
<baud_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <term_baud_down@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1136 <baud_down+0x26>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baud_down>:
push   %rbx
mov    %edi,%ebx
call   1030 <term_baud_down@plt>
test   %eax,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @baud_down(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @term_baud_down(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %2
store i32 %9, i32* %3
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @baud_down(i32 %0) {
%2 = tail call i32 @term_baud_down(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 %0, i32 %2
ret i32 %4
}
/* Variables and functions */
int getline2(char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int main(void) {
  int len;
  char buffer[128];
  while (1) {
    len = getline2(buffer, 128);
    if (len == 0)
      break;
    printf("len = %d, line = %s\n", len, buffer);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x80,%esi
call   1030 <getline2@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1155 <main+0x35>
jmp    1170 <main+0x50>
mov    -0x8(%rbp),%esi
lea    -0x90(%rbp),%rdx
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsp,%rdi
mov    $0x80,%esi
call   1030 <getline2@plt>
test   %eax,%eax
je     116e <main+0x4e>
lea    0xebe(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
call   1030 <getline2@plt>
test   %eax,%eax
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"len = %d, line = %s\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @getline2(i8* %2, i32 128)
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %3, %0 ]
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %2)
%8 = call i32 @getline2(i8* %2, i32 128)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %0
ret i32 0
}
void BIO_dump_indent_cb(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_dump_indent_cb() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close_all();
int /*<<< orphan*/ sys_env_destroy(int /*<<< orphan*/);
void exit(void) {
  close_all();
  sys_env_destroy(0);
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <close_all@plt>
xor    %edi,%edi
call   1030 <sys_env_destroy@plt>

x86 assembly (clang, -O2):
<exit>:
push   %rax
xor    %eax,%eax
call   1040 <close_all@plt>
xor    %edi,%edi
call   1030 <sys_env_destroy@plt>

LLVM IR (-O0):
define void @exit() {
%1 = call i32 (...) @close_all()
%2 = call i32 @sys_env_destroy(i32 0)
unreachable
}

LLVM IR (-O2):
define void @exit() {
%1 = tail call i32 (...) @close_all()
%2 = tail call i32 @sys_env_destroy(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
int copyout(const void *kaddr, void *uaddr, size_t len) {
  memcpy(uaddr, kaddr, len);
  return (0);
}


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

x86 assembly (clang, -O2):
<copyout>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @copyout(i8* %0, i8* %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** %5
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = call i32 @memcpy(i8* %7, i8* %8, i64 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @copyout(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcpy(i8* %1, i8* %0, i64 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void USB_LP_CAN1_RX0_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @USB_LP_CAN1_RX0_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @USB_LP_CAN1_RX0_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}