xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open_sysfs(char const *, char const *, int /*<<< orphan*/);
int read_sysfs_int_fd(int, char const *, char const *);
int read_sysfs_int(const char *sys_pfx, const char *node) {
  extern int errno;
  int fd, val;
  fd = open_sysfs(sys_pfx, node, O_RDONLY);
  val = read_sysfs_int_fd(fd, sys_pfx, node);
  close(fd);
  return val;
}


x86 assembly (clang, -O0):
<read_sysfs_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
call   1040 <open_sysfs@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <read_sysfs_int_fd@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_sysfs_int>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
call   1040 <open_sysfs@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <read_sysfs_int_fd@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1050 <close@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @read_sysfs_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = load i32, i32* @O_RDONLY
%10 = call i32 @open_sysfs(i8* %7, i8* %8, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @read_sysfs_int_fd(i32 %11, i8* %12, i8* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %5
%16 = call i32 @close(i32 %15)
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @read_sysfs_int(i8* %0, i8* %1) {
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open_sysfs(i8* %0, i8* %1, i32 %3)
%5 = tail call i32 @read_sysfs_int_fd(i32 %4, i8* %0, i8* %1)
%6 = tail call i32 @close(i32 %4)
ret i32 %5
}
void IntSystemDisable(unsigned int intrNum) {
  (*((volatile unsigned int *)((0x48200000) +
                               (0x8c + ((intrNum >> (0x05)) * 0x20))))) =
      (0x01 << (intrNum & (0x1F)));
}


x86 assembly (clang, -O0):
<IntSystemDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
shr    $0x5,%eax
shl    $0x5,%eax
add    $0x8c,%eax
add    $0x48200000,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntSystemDisable>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    $0xffffffe0,%ecx
add    $0x4820008c,%ecx
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @IntSystemDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 31
%5 = shl i32 1, %4
%6 = load i32, i32* %2
%7 = lshr i32 %6, 5
%8 = mul i32 %7, 32
%9 = add i32 140, %8
%10 = add i32 1210056704, %9
%11 = zext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %5, i32* %12
ret void
}

LLVM IR (-O2):
define void @IntSystemDisable(i32 %0) {
%2 = and i32 %0, 31
%3 = shl nuw i32 1, %2
%4 = and i32 %0, -32
%5 = add i32 %4, 1210056844
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
store volatile i32 %3, i32* %7
ret void
}
unsigned char uart0GetCh(void) {
  while (!((*((volatile unsigned long *)0xE000C014)) & 0x01))
    ;
  return (*((volatile unsigned long *)0xE000C000));
}


x86 assembly (clang, -O0):
<uart0GetCh>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <uart0GetCh+0x9>
mov    $0xe000c014,%eax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112b <uart0GetCh+0x2b>
jmp    1130 <uart0GetCh+0x30>
jmp    1109 <uart0GetCh+0x9>
mov    $0xe000c000,%eax
mov    (%rax),%rax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart0GetCh>:
mov    $0xe000c000,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testq  $0x1,0x14(%rax)
je     1110 <uart0GetCh+0x10>
mov    (%rax),%rax
ret

LLVM IR (-O0):
define zeroext i8 @uart0GetCh() {
br label %1
1: ; preds = %6, %0
%2 = load volatile i64, i64* inttoptr (i64 3758145556 to i64*)
%3 = and i64 %2, 1
%4 = icmp ne i64 %3, 0
%5 = xor i1 %4, true
br i1 %5, label %6, label %7
6: ; preds = %1
br label %1
7: ; preds = %1
%8 = load volatile i64, i64* inttoptr (i64 3758145536 to i64*)
%9 = trunc i64 %8 to i8
ret i8 %9
}

LLVM IR (-O2):
define zeroext i8 @uart0GetCh() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i64, i64* inttoptr (i64 3758145556 to i64*)
%3 = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = load volatile i64, i64* inttoptr (i64 3758145536 to i64*)
%7 = trunc i64 %6 to i8
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, int);
void assertTrueImpl(char *message, int assertion, char *filename,
                    int lineNumber) {
  if (assertion == 0) {
    printf("TEST FAILURE: \"%s\" at %s line %d\n", message, filename,
           lineNumber);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<assertTrueImpl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1165 <assertTrueImpl+0x45>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertTrueImpl>:
test   %esi,%esi
je     1125 <assertTrueImpl+0x5>
ret
push   %rax
mov    %rdi,%rax
lea    0xed0(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"TEST FAILURE: \22%s\22 at %s line %d\0A\00"
@EXIT_FAILURE = global i32 0
define void @assertTrueImpl(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %4
%12 = load i8*, i8** %5
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13, i32 %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"TEST FAILURE: \22%s\22 at %s line %d\0A\00"
@EXIT_FAILURE = global i32 0
define void @assertTrueImpl(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp eq i32 %1, 0
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %2, i32 %3)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ rmdir(char const *);
int main(int argc, const char *argv[]) {
  if (argc != 2) {
    printf("wrong argument!\n");
    exit(-1);
  }
  if (rmdir(argv[1]) < 0) {
    perror("rmdir");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1176 <main+0x36>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <rmdir@plt>
cmp    $0x0,%rax
jge    1199 <main+0x59>
lea    0xe7d(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1166 <main+0x26>
mov    0x8(%rsi),%rdi
call   1040 <rmdir@plt>
test   %rax,%rax
js     1158 <main+0x18>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea1(%rip),%rdi
call   1050 <perror@plt>
jmp    1154 <main+0x14>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"wrong argument!\0A\00"
@.str.1 = [6 x i8] c"rmdir\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @rmdir(i8* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %11
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"rmdir\00"
@str = [16 x i8] c"wrong argument!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @rmdir(i8* %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
ret i32 0
}
float blargg_max(float x, float y) {
  if (x < y)
    x = y;
  return x;
}


x86 assembly (clang, -O0):
<blargg_max>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    112b <blargg_max+0x2b>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<blargg_max>:
maxss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @blargg_max(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp olt float %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %4
store float %9, float* %3
br label %10
10: ; preds = %8, %2
%11 = load float, float* %3
ret float %11
}

LLVM IR (-O2):
define float @blargg_max(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %1, float %0
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void test20_head() {
  do {
    printf("test20");
    puts("");
  } while (0);
}


x86 assembly (clang, -O0):
<test20_head>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <test20_head+0x9>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test20_head>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"test20\00"
@.str.1 = [1 x i8] zeroinitializer
define void @test20_head() {
br label %1
1: ; preds = %0
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %4
4: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"test20\00"
define void @test20_head() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int test_sincos();
int test_sincostaylor();
int main(void) {
  int fail = test_sincostaylor();
  fail = test_sincos();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_sincostaylor()
%2 = tail call i32 (...) @test_sincos()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS7;
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_PCTX;

/* Variables and functions */
int ASN1_item_print(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int,
                    int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
int /*<<< orphan*/ PKCS7_it;
int PKCS7_print_ctx(BIO *out, PKCS7 *x, int indent, const ASN1_PCTX *pctx) {
  return ASN1_item_print(out, (ASN1_VALUE *)x, indent, &PKCS7_it, pctx);
}


x86 assembly (clang, -O0):
<PKCS7_print_ctx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%r8
mov    0x2ea3(%rip),%rcx
call   1030 <ASN1_item_print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PKCS7_print_ctx>:
mov    %rcx,%r8
mov    0x2ec6(%rip),%rcx
jmp    1030 <ASN1_item_print@plt>

LLVM IR (-O0):
@PKCS7_it = global i32 0
define i32 @PKCS7_print_ctx(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 = load i32*, i32** %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %8
%13 = call i32 @ASN1_item_print(i32* %9, i32* %10, i32 %11, i32* @PKCS7_it, i32* %12)
ret i32 %13
}

LLVM IR (-O2):
@PKCS7_it = global i32 0
define i32 @PKCS7_print_ctx(i32* %0, i32* %1, i32 %2, i32* %3) {
%5 = tail call i32 @ASN1_item_print(i32* %0, i32* %1, i32 %2, i32* @PKCS7_it, i32* %3)
ret i32 %5
}
int test_isNonZero(int x) { return x != 0; }


x86 assembly (clang, -O0):
<test_isNonZero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isNonZero>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @test_isNonZero(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @test_isNonZero(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
int AddMachine(int a, int b) { return (a + b); }


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

x86 assembly (clang, -O2):
<AddMachine>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @AddMachine(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int);
bool endswith(const char *s, const char *suffix) {
  int n = strlen(s);
  int m = strlen(suffix);
  return n >= m && strncmp(s + (n - m), suffix, m) == 0;
}


x86 assembly (clang, -O0):
<endswith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x19(%rbp)
jl     117e <endswith+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endswith>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
xor    %ecx,%ecx
sub    %eax,%ebp
jl     115a <endswith+0x3a>
movslq %ebp,%rcx
add    %rcx,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @endswith(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = sub nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %15, i64 %19
%21 = load i8*, i8** %4
%22 = load i32, i32* %6
%23 = call i64 @strncmp(i8* %20, i8* %21, i32 %22)
%24 = icmp eq i64 %23, 0
br label %25
25: ; preds = %14, %2
%26 = phi i1 [ false, %2 ], [ %24, %14 ]
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @endswith(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp slt i32 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = sub nsw i32 %3, %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = tail call i64 @strncmp(i8* %9, i8* %1, i32 %4)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %6, %2
%14 = phi i32 [ 0, %2 ], [ %12, %6 ]
ret i32 %14
}
/* Type definitions */
struct target {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ isns_target_register(struct target *);
void isns_start(void) { isns_target_register(((struct target *)1)); }


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

x86 assembly (clang, -O2):
<isns_start>:
mov    $0x1,%edi
jmp    1030 <isns_target_register@plt>

LLVM IR (-O0):
%struct.target = type { i32 }
define void @isns_start() {
%1 = call i32 @isns_target_register(%struct.target* inttoptr (i64 1 to %struct.target*))
ret void
}

LLVM IR (-O2):
%struct.target = type { i32 }
define void @isns_start() {
%1 = tail call i32 @isns_target_register(%struct.target* inttoptr (i64 1 to %struct.target*))
ret void
}
void serializer_write_short(char *dest, int *pointer, short value) {
  dest[(*pointer)] = ((value >> 0) & 0xff);
  dest[(*pointer) + 1] = (value >> 8) & 0xff;
  (*pointer) += 2;
}


x86 assembly (clang, -O0):
<serializer_write_short>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movswl -0x12(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %dl,(%rax,%rcx,1)
movswl -0x12(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<serializer_write_short>:
movslq (%rsi),%rax
mov    %dl,(%rdi,%rax,1)
movslq (%rsi),%rax
mov    %dh,0x1(%rax,%rdi,1)
addl   $0x2,(%rsi)
ret

LLVM IR (-O0):
define void @serializer_write_short(i8* %0, i32* %1, i16 signext %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i16
store i8* %0, i8** %4
store i32* %1, i32** %5
store i16 %2, i16* %6
%7 = load i16, i16* %6
%8 = sext i16 %7 to i32
%9 = ashr i32 %8, 0
%10 = and i32 %9, 255
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %4
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
store i8 %11, i8* %16
%17 = load i16, i16* %6
%18 = sext i16 %17 to i32
%19 = ashr i32 %18, 8
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %4
%23 = load i32*, i32** %5
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %22, i64 %26
store i8 %21, i8* %27
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 2
store i32 %30, i32* %28
ret void
}

LLVM IR (-O2):
define void @serializer_write_short(i8* nocapture writeonly %0, i32* nocapture %1, i16 signext %2) {
%4 = trunc i16 %2 to i8
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %4, i8* %7
%8 = lshr i16 %2, 8
%9 = trunc i16 %8 to i8
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 %9, i8* %13
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 2
store i32 %15, i32* %1
ret void
}
/* Variables and functions */
int getPosition(int);
int /*<<< orphan*/ printf(char *, int, int);
void printAllPositions(int nb_motor) {
  int i;
  for (i = 1; i <= nb_motor; i++)
    printf("motors[%d]->pos=%d;\n", i, getPosition(i));
}


x86 assembly (clang, -O0):
<printAllPositions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     116b <printAllPositions+0x4b>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <getPosition@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <printAllPositions+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAllPositions>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1166 <printAllPositions+0x46>
mov    %edi,%r15d
neg    %r15d
mov    $0x1,%ebx
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <getPosition@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
lea    (%r15,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1140 <printAllPositions+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"motors[%d]->pos=%d;\0A\00"
define void @printAllPositions(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = tail call i32 @getPosition(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = add nuw i32 %4, 1
%8 = icmp eq i32 %4, %0
br i1 %8, label %9, label %3
9: ; preds = %3, %1
ret void
}
int _isatty(int file) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @_isatty(i32 %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ emptyBlock(int);
int /*<<< orphan*/ writeToDisk(int, int);
int deleteIntCode(int intNo) {
  emptyBlock(21);
  int i;
  for (i = 0; i < 2; i++)
    writeToDisk(21, ((intNo - 1) * 2) + 5 + i);
  return 0;
}


x86 assembly (clang, -O0):
<deleteIntCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x15,%edi
call   1030 <emptyBlock@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116d <deleteIntCode+0x4d>
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
shl    $0x1,%esi
add    $0x5,%esi
add    -0x8(%rbp),%esi
mov    $0x15,%edi
call   1040 <writeToDisk@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <deleteIntCode+0x1c>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteIntCode>:
push   %rbx
mov    %edi,%ebx
mov    $0x15,%edi
call   1030 <emptyBlock@plt>
lea    (%rbx,%rbx,1),%esi
add    $0x3,%esi
mov    $0x15,%edi
call   1040 <writeToDisk@plt>
lea    (%rbx,%rbx,1),%esi
add    $0x4,%esi
mov    $0x15,%edi
call   1040 <writeToDisk@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @deleteIntCode(i32 %0) {
%2 = tail call i32 @emptyBlock(i32 21)
%3 = shl i32 %0, 1
%4 = add i32 %3, 3
%5 = tail call i32 @writeToDisk(i32 21, i32 %4)
%6 = add i32 %3, 4
%7 = tail call i32 @writeToDisk(i32 21, i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  int i = 1, j = 2, k = 3;
  printf("Output if DEBUG is defined:\n");
  (i);
  (j);
  (k);
  (2 * i + j * k);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Output if DEBUG is defined:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = load i32, i32* %2
%10 = mul nsw i32 2, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = add nsw i32 %10, %13
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"Output if DEBUG is defined:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ petter(int);
int main() { petter(12); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
call   1030 <petter@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xc,%edi
call   1030 <petter@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @petter(i32 12)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @petter(i32 12)
ret i32 0
}
unsigned xrop3_205_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D | T;
  stk2 = ~stk2;
  stk1 = S | stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_205_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_205_1_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
not    %ecx
shl    $0x8,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_205_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = xor i32 %25, -1
store i32 %26, i32* %9
%27 = load i32, i32* %6
%28 = load i32, i32* %9
%29 = or i32 %27, %28
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = xor i32 %31, -1
%33 = and i32 %30, %32
%34 = load i32, i32* %7
%35 = xor i32 %34, -1
%36 = and i32 %33, %35
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = and i32 %37, %38
%40 = or i32 %36, %39
%41 = load i32, i32* %5
%42 = load i32, i32* %7
%43 = and i32 %41, %42
%44 = or i32 %40, %43
ret i32 %44
}

LLVM IR (-O2):
define i32 @xrop3_205_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = xor i32 %5, -1
%7 = shl nsw i32 %6, 8
%8 = xor i32 %4, -1
%9 = and i32 %7, %8
%10 = or i8 %1, %0
%11 = zext i8 %10 to i32
%12 = or i32 %9, %11
ret i32 %12
}
/* Variables and functions */
int add_all_digits(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  scanf("%d", &num);
  printf("%d\n", add_all_digits(num));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @add_all_digits(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
char uart1_putc(const char c) {
  putchar(c);
  return c;
}


x86 assembly (clang, -O0):
<uart1_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @uart1_putc(i8 returned signext %0) {
%2 = tail call i32 @putchar(i8 signext %0)
ret i8 %0
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void reaper_handle(int sig) {
  while (waitpid(-1, NULL, WNOHANG) > 0) {
  };
}


x86 assembly (clang, -O0):
<reaper_handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    1141 <reaper_handle+0x31>
jmp    111b <reaper_handle+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reaper_handle>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1120 <reaper_handle+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @reaper_handle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* @WNOHANG
%5 = call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @reaper_handle(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load i32, i32* @WNOHANG
%4 = tail call i64 @waitpid(i32 -1, i32* null, i32 %3)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
ret void
}
void __CUT__Sample_blah() {}


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

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

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

LLVM IR (-O2):
define void @__CUT__Sample_blah() {
ret void
}
void os_check() {}


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

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

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

LLVM IR (-O2):
define void @os_check() {
ret void
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  int /*<<< orphan*/ tv_sec;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int clock_gettime(clockid_t clock_id, struct timespec *tp) {
  tp->tv_sec = time(NULL);
  tp->tv_nsec = 0;
  return 0;
}


x86 assembly (clang, -O0):
<clock_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_gettime>:
push   %rbx
mov    %rsi,%rbx
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,0x8(%rbx)
movq   $0x0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i32 }
define i32 @clock_gettime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = call i32 @time(i32* null)
%6 = load %struct.timespec*, %struct.timespec** %4
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
store i32 %5, i32* %7
%8 = load %struct.timespec*, %struct.timespec** %4
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
store i64 0, i64* %9
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i64, i32 }
define i32 @clock_gettime(i32 %0, %struct.timespec* nocapture writeonly %1) {
%3 = tail call i32 @time(i32* null)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
store i32 %3, i32* %4
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
store i64 0, i64* %5
ret i32 0
}
int test5(int x) { return x / 10 < 2; }


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x2,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
xor    %eax,%eax
cmp    $0x14,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @test5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 10
%5 = icmp slt i32 %4, 2
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test5(i32 %0) {
%2 = icmp slt i32 %0, 20
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
void *__libc_realloc(void *, size_t);
int /*<<< orphan*/ log_event(int, void *, size_t);
void *realloc(void *ptr, size_t size) {
  void *newptr = __libc_realloc(ptr, size);
  log_event(2, ptr, 0);
  log_event(1, newptr, size);
  return newptr;
}


x86 assembly (clang, -O0):
<realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <__libc_realloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x2,%edi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <log_event@plt>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
call   1030 <log_event@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <__libc_realloc@plt>
mov    %rax,%r15
mov    $0x2,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <log_event@plt>
mov    $0x1,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <log_event@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @realloc(i8* %0, i64 %1) {
%3 = tail call i8* @__libc_realloc(i8* %0, i64 %1)
%4 = tail call i32 @log_event(i32 2, i8* %0, i64 0)
%5 = tail call i32 @log_event(i32 1, i8* %3, i64 %1)
ret i8* %3
}
int main() { return 15 / 7; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ USBFS_Dp_ClearInterrupt();
void USBFS_DP_ISR(void) { (void)USBFS_Dp_ClearInterrupt(); }


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

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

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

LLVM IR (-O2):
define void @USBFS_DP_ISR() {
%1 = tail call i32 (...) @USBFS_Dp_ClearInterrupt()
ret void
}
/* Variables and functions */
float log2f(float);
float __ocl_log2_float(float src) { return log2f(src); }


x86 assembly (clang, -O0):
<__ocl_log2_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <log2f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_log2_float>:
jmp    1030 <log2f@plt>

LLVM IR (-O0):
define float @__ocl_log2_float(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @log2f(float %3)
ret float %4
}

LLVM IR (-O2):
define float @__ocl_log2_float(float %0) {
%2 = tail call float @log2f(float %0)
ret float %2
}
int naive_bt_l(int base, int offset) {
  unsigned char val = offset;
  val &= 31;
  return !!(base & (1 << val));
}


x86 assembly (clang, -O0):
<naive_bt_l>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
and    $0x1f,%eax
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%eax
movzbl -0x9(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<naive_bt_l>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @naive_bt_l(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = trunc i32 %6 to i8
store i8 %7, i8* %5
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
%10 = and i32 %9, 31
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i32, i32* %3
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = shl i32 1, %14
%16 = and i32 %12, %15
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @naive_bt_l(i32 %0, i32 %1) {
%3 = and i32 %1, 31
%4 = lshr i32 %0, %3
%5 = and i32 %4, 1
ret i32 %5
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int IsStringEqualToString(const char *p_left, const char *p_right) {
  return strcmp(p_left, p_right) == 0;
}


x86 assembly (clang, -O0):
<IsStringEqualToString>:
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 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @IsStringEqualToString(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 i64 @strcmp(i8* %5, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @IsStringEqualToString(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
void dtp_hook_begin(void) {}


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

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

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

LLVM IR (-O2):
define void @dtp_hook_begin() {
ret void
}
void swap(char *i, char *j) {
  char saved = *i;
  *i = *j;
  *j = saved;
}


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

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @swap(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i8, i8* %5
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
int get_bit(int, int /*<<< orphan*/);
int twos_complement(int);
unsigned int fill_register(int val) {
  int output, val_bit;
  val_bit = get_bit(val, 0);
  output = twos_complement(val_bit);
  return output;
}


x86 assembly (clang, -O0):
<fill_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1040 <get_bit@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <twos_complement@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_register>:
push   %rax
xor    %esi,%esi
call   1040 <get_bit@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <twos_complement@plt>

LLVM IR (-O0):
define i32 @fill_register(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @get_bit(i32 %5, i32 0)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @twos_complement(i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @fill_register(i32 %0) {
%2 = tail call i32 @get_bit(i32 %0, i32 0)
%3 = tail call i32 @twos_complement(i32 %2)
ret i32 %3
}
void set_word(addr, data) {
  addr &= 0x0000ffff;
  memory_write_word(data, addr);
}


x86 assembly (clang, -O0):
<set_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1030 <memory_write_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_word>:
mov    %esi,%eax
movzwl %di,%esi
mov    %eax,%edi
xor    %eax,%eax
jmp    1030 <memory_write_word@plt>

LLVM IR (-O0):
define void @set_word(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 = and i32 %5, 65535
store i32 %6, i32* %3
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = call i32 (i32, i32, ...) bitcast (i32 (...)* @memory_write_word to i32 (i32, i32, ...)*)(i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @set_word(i32 %0, i32 %1) {
%3 = and i32 %0, 65535
%4 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @memory_write_word to i32 (i32, i32, ...)*)(i32 %1, i32 %3)
ret void
}
int mx51_neon_fixup(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @mx51_neon_fixup() {
ret i32 0
}

LLVM IR (-O2):
define i32 @mx51_neon_fixup() {
ret i32 0
}