xunge/DecIR huggingface dataset:
void pointer_arith4_Bad(int x) {
  int len = 5;
  char p[5];
  (p + x)[10 - x] = 0;
}


x86 assembly (clang, -O0):
<pointer_arith4_Bad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0xd(%rbp),%rax
movslq -0x4(%rbp),%rcx
add    %rcx,%rax
mov    $0xa,%ecx
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @pointer_arith4_Bad(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x i8]
store i32 %0, i32* %2
store i32 5, i32* %3
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i32, i32* %2
%10 = sub nsw i32 10, %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8 0, i8* %12
ret void
}

LLVM IR (-O2):
define void @pointer_arith4_Bad(i32 %0) {
ret void
}
void task_tick_idle(struct rq *rq, struct task_struct *curr) {}


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

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

LLVM IR (-O0):
%struct.rq = type opaque
%struct.task_struct = type opaque
define void @task_tick_idle(%struct.rq* %0, %struct.task_struct* %1) {
%3 = alloca %struct.rq*
%4 = alloca %struct.task_struct*
store %struct.rq* %0, %struct.rq** %3
store %struct.task_struct* %1, %struct.task_struct** %4
ret void
}

LLVM IR (-O2):
%struct.rq = type opaque
%struct.task_struct = type opaque
define void @task_tick_idle(%struct.rq* nocapture %0, %struct.task_struct* nocapture %1) {
ret void
}
unsigned short int writesec0(char drive, char sec, char head, char trk,
                             char *Buffer) {
  return 0;
}


x86 assembly (clang, -O0):
<writesec0>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %cl,-0x3(%rbp)
mov    %al,-0x4(%rbp)
mov    %r8,-0x10(%rbp)
xor    %eax,%eax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @writesec0(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8* %4) {
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8*
store i8 %0, i8* %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
store i8* %4, i8** %10
ret i16 0
}

LLVM IR (-O2):
define zeroext i16 @writesec0(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3, i8* nocapture readnone %4) {
ret i16 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ F_SETFL;
int O_NONBLOCK;
int SO_REUSEADDR;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fcntl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
void setNonBlocking(int sock) {
  if (fcntl(sock, F_SETFL, O_NONBLOCK | SO_REUSEADDR) == -1) {
    perror("Non blockign set failed");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<setNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
mov    0x2e71(%rip),%rax
or     (%rax),%edx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
jne    1181 <setNonBlocking+0x51>
lea    0xe92(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setNonBlocking>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
mov    0x2ea7(%rip),%rax
mov    0x2e80(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
je     1158 <setNonBlocking+0x28>
pop    %rax
ret
lea    0xea1(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [24 x i8] c"Non blockign set failed\00"
@EXIT_FAILURE = global i32 0
define void @setNonBlocking(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETFL
%5 = load i32, i32* @O_NONBLOCK
%6 = load i32, i32* @SO_REUSEADDR
%7 = or i32 %5, %6
%8 = call i32 @fcntl(i32 %3, i32 %4, i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
ret void
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@O_NONBLOCK = global i32 0
@SO_REUSEADDR = global i32 0
@.str = [24 x i8] c"Non blockign set failed\00"
@EXIT_FAILURE = global i32 0
define void @setNonBlocking(i32 %0) {
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @O_NONBLOCK
%4 = load i32, i32* @SO_REUSEADDR
%5 = or i32 %4, %3
%6 = tail call i32 @fcntl(i32 %0, i32 %2, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret void
}
void Msp430TimerCapComP__9__Compare__default__fired(void) {}


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

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

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

LLVM IR (-O2):
define void @Msp430TimerCapComP__9__Compare__default__fired() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ decrypt();
int /*<<< orphan*/ encrypt();
void main(int argc, char *argv[]) {
  encrypt();
  decrypt();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <encrypt@plt>
mov    $0x0,%al
call   1030 <decrypt@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @encrypt()
%6 = call i32 (...) @decrypt()
ret void
}

LLVM IR (-O2):
define void @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @encrypt()
%4 = tail call i32 (...) @decrypt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ configureBlePatch();
void refreshBlePatch(void) { configureBlePatch(); }


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

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

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

LLVM IR (-O2):
define void @refreshBlePatch() {
%1 = tail call i32 (...) @configureBlePatch()
ret void
}
char *rhash_strdup(const char *str, const char *srcfile, int srcline) {
  void *res = strdup(str);
  if (!res) {
    report_error(srcfile, srcline, "strdup(\"%s\") failed\n", str);
    rsh_exit(2);
  }
  return res;
}


x86 assembly (clang, -O0):
<rhash_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1180 <rhash_strdup+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rcx
lea    0xe93(%rip),%rdx
mov    $0x0,%al
call   1030 <report_error@plt>
mov    $0x2,%edi
mov    $0x0,%al
call   1040 <rsh_exit@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rhash_strdup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %rdi,%r14
call   1050 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1170 <rhash_strdup+0x40>
lea    0xeac(%rip),%rdx
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <report_error@plt>
mov    $0x2,%edi
xor    %eax,%eax
call   1040 <rsh_exit@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"strdup(\22%s\22) failed\0A\00"
define i8* @rhash_strdup(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i8* @strdup(i8* %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %18, label %12
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = load i8*, i8** %4
%16 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @report_error to i32 (i8*, i32, i8*, i8*, ...)*)(i8* %13, i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 (i32, ...) bitcast (i32 (...)* @rsh_exit to i32 (i32, ...)*)(i32 2)
br label %18
18: ; preds = %12, %3
%19 = load i8*, i8** %7
ret i8* %19
}

LLVM IR (-O2):
@.str = [21 x i8] c"strdup(\22%s\22) failed\0A\00"
define i8* @rhash_strdup(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @strdup(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @report_error to i32 (i8*, i32, i8*, i8*, ...)*)(i8* %1, i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @rsh_exit to i32 (i32, ...)*)(i32 2)
br label %9
9: ; preds = %6, %3
ret i8* %4
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct flashrom_flashctx *const);
void flashrom_flash_release(struct flashrom_flashctx *const flashrom_flashctx) {
  free(flashrom_flashctx);
}


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

x86 assembly (clang, -O2):
<flashrom_flash_release>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define void @flashrom_flash_release(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @free(%struct.flashrom_flashctx* %3)
ret void
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define void @flashrom_flash_release(%struct.flashrom_flashctx* nocapture %0) {
%2 = tail call i32 @free(%struct.flashrom_flashctx* %0)
ret void
}
/* Variables and functions */
int genrand_int32();
int random_int2(int l, int u) { return (genrand_int32() % (u + 1 - l) + l); }


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

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

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

LLVM IR (-O2):
define i32 @random_int2(i32 %0, i32 %1) {
%3 = tail call i32 (...) @genrand_int32()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
unsigned int BCDToDecimal(unsigned int value) {
  unsigned int accumulator = 0;
  unsigned int multiplier = 1;
  int i;
  for (i = 0; i < 8; i++) {
    accumulator += (value & 0xF) * multiplier;
    multiplier *= 10;
    value >>= 4;
  }
  return accumulator;
}


x86 assembly (clang, -O0):
<BCDToDecimal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    1154 <BCDToDecimal+0x54>
mov    -0x4(%rbp),%eax
and    $0xf,%eax
imul   -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111c <BCDToDecimal+0x1c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BCDToDecimal>:
mov    %edi,%eax
and    $0xf,%eax
mov    %edi,%ecx
shr    $0x4,%ecx
and    $0xf,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rax,%rcx,2),%eax
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0xf,%ecx
imul   $0x64,%ecx,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0xc,%eax
and    $0xf,%eax
imul   $0x3e8,%eax,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    $0x10,%ecx
and    $0xf,%ecx
imul   $0x2710,%ecx,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x14,%eax
and    $0xf,%eax
imul   $0x186a0,%eax,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    $0x18,%ecx
and    $0xf,%ecx
imul   $0xf4240,%ecx,%ecx
add    %eax,%ecx
shr    $0x1c,%edi
imul   $0x989680,%edi,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @BCDToDecimal(i32 %0) {
%2 = and i32 %0, 15
%3 = lshr i32 %0, 4
%4 = and i32 %3, 15
%5 = mul nuw nsw i32 %4, 10
%6 = add nuw nsw i32 %5, %2
%7 = lshr i32 %0, 8
%8 = and i32 %7, 15
%9 = mul nuw nsw i32 %8, 100
%10 = add nuw nsw i32 %9, %6
%11 = lshr i32 %0, 12
%12 = and i32 %11, 15
%13 = mul nuw nsw i32 %12, 1000
%14 = add nuw nsw i32 %13, %10
%15 = lshr i32 %0, 16
%16 = and i32 %15, 15
%17 = mul nuw nsw i32 %16, 10000
%18 = add nuw nsw i32 %17, %14
%19 = lshr i32 %0, 20
%20 = and i32 %19, 15
%21 = mul nuw nsw i32 %20, 100000
%22 = add nuw nsw i32 %21, %18
%23 = lshr i32 %0, 24
%24 = and i32 %23, 15
%25 = mul nuw nsw i32 %24, 1000000
%26 = add nuw nsw i32 %25, %22
%27 = lshr i32 %0, 28
%28 = mul nuw nsw i32 %27, 10000000
%29 = add nuw nsw i32 %28, %26
ret i32 %29
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ srand48(unsigned long);
void rte_srand(uint64_t seedval) { srand48((long unsigned int)seedval); }


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

x86 assembly (clang, -O2):
<rte_srand>:
jmp    1030 <srand48@plt>

LLVM IR (-O0):
define void @rte_srand(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @srand48(i64 %3)
ret void
}

LLVM IR (-O2):
define void @rte_srand(i64 %0) {
%2 = tail call i32 @srand48(i64 %0)
ret void
}
/* Variables and functions */
char *strrchr(char *, char);
char *progname(char *arg0) {
  char *nm;
  nm = strrchr(arg0, '/');
  if (nm)
    nm++;
  else
    nm = arg0;
  return nm;
}


x86 assembly (clang, -O0):
<progname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <progname+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <progname+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<progname>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @progname(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Open Source Sw Project\n");
  printf("first Git Hub Tranning\n");
  printf("hello sunmoon");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"Open Source Sw Project\0A\00"
@.str.1 = [24 x i8] c"first Git Hub Tranning\0A\00"
@.str.2 = [14 x i8] c"hello sunmoon\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [14 x i8] c"hello sunmoon\00"
@str = [23 x i8] c"Open Source Sw Project\00"
@str.3 = [23 x i8] c"first Git Hub Tranning\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double RAND_MAX;
double rand();
double getRandomNumberBetween(double x, double y) {
  double r;
  r = x + (y - x) * rand() / (RAND_MAX + 1.0);
  return r;
}


x86 assembly (clang, -O0):
<getRandomNumberBetween>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
movsd  0xea5(%rip),%xmm2
mov    0x2e86(%rip),%rax
addsd  (%rax),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomNumberBetween>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mulsd  0x8(%rsp),%xmm0
mov    0x2eb0(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @getRandomNumberBetween(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = load double, double* %3
%9 = fsub double %7, %8
%10 = call double (...) @rand()
%11 = fmul double %9, %10
%12 = load double, double* @RAND_MAX
%13 = fadd double %12, 1.000000e+00
%14 = fdiv double %11, %13
%15 = fadd double %6, %14
store double %15, double* %5
%16 = load double, double* %5
ret double %16
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @getRandomNumberBetween(double %0, double %1) {
%3 = fsub double %1, %0
%4 = tail call double (...) @rand()
%5 = fmul double %3, %4
%6 = load double, double* @RAND_MAX
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %5, %7
%9 = fadd double %8, %0
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void teardown(void) { endwin(); }


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

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

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

LLVM IR (-O2):
define void @teardown() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int _xdg_mime_media_type_equal(char const *, char const *);
int /*<<< orphan*/ xdg_mime_init();
int xdg_mime_media_type_equal(const char *mime_a, const char *mime_b) {
  xdg_mime_init();
  return _xdg_mime_media_type_equal(mime_a, mime_b);
}


x86 assembly (clang, -O0):
<xdg_mime_media_type_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <xdg_mime_init@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <_xdg_mime_media_type_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdg_mime_media_type_equal>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <xdg_mime_init@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <_xdg_mime_media_type_equal@plt>

LLVM IR (-O0):
define i32 @xdg_mime_media_type_equal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @xdg_mime_init()
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @_xdg_mime_media_type_equal(i8* %6, i8* %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @xdg_mime_media_type_equal(i8* %0, i8* %1) {
%3 = tail call i32 (...) @xdg_mime_init()
%4 = tail call i32 @_xdg_mime_media_type_equal(i8* %0, i8* %1)
ret i32 %4
}
/* Variables and functions */
long long atan(long long);
long long internal_atan_l(long long value) { return atan(value); }


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

x86 assembly (clang, -O2):
<internal_atan_l>:
jmp    1030 <atan@plt>

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

LLVM IR (-O2):
define i64 @internal_atan_l(i64 %0) {
%2 = tail call i64 @atan(i64 %0)
ret i64 %2
}
void fd(int motor) {}


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

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

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

LLVM IR (-O2):
define void @fd(i32 %0) {
ret void
}
/* Variables and functions */
int abs(int);
int max(int, int);
int min(int, int);
double pow(double, double);
double sqrt(int);
void test_math() {
  double r, x, z;
  int y;
  y = min(1, 2);
  y = max(1, 2);
  y = abs(1);
  r = pow(x, z);
  r = sqrt(y);
}


x86 assembly (clang, -O0):
<test_math>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <min@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <max@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%edi
call   1030 <abs@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1060 <pow@plt>
movsd  %xmm0,-0x8(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <sqrt@plt>
movsd  %xmm0,-0x8(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_math>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <min@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1040 <max@plt>
call   1050 <pow@plt>
mov    $0x1,%edi
pop    %rax
jmp    1060 <sqrt@plt>

LLVM IR (-O0):
define void @test_math() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = call i32 @min(i32 1, i32 2)
store i32 %5, i32* %4
%6 = call i32 @max(i32 1, i32 2)
store i32 %6, i32* %4
%7 = call i32 @abs(i32 1)
store i32 %7, i32* %4
%8 = load double, double* %2
%9 = load double, double* %3
%10 = call double @pow(double %8, double %9)
store double %10, double* %1
%11 = load i32, i32* %4
%12 = call double @sqrt(i32 %11)
store double %12, double* %1
ret void
}

LLVM IR (-O2):
define void @test_math() {
%1 = tail call i32 @min(i32 1, i32 2)
%2 = tail call i32 @max(i32 1, i32 2)
%3 = tail call double @pow(double undef, double undef)
%4 = tail call double @sqrt(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WriteDiagFile(char *);
void doi(char *lps) { WriteDiagFile(lps); }


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

x86 assembly (clang, -O2):
<doi>:
jmp    1030 <WriteDiagFile@plt>

LLVM IR (-O0):
define void @doi(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @WriteDiagFile(i8* %3)
ret void
}

LLVM IR (-O2):
define void @doi(i8* %0) {
%2 = tail call i32 @WriteDiagFile(i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
double rand();
double random_lt_1() {
  double rn;
  do {
    rn = rand() / (double)RAND_MAX;
  } while (1.0 == rn);
  return rn;
}


x86 assembly (clang, -O0):
<random_lt_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    0x2ec2(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xec4(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    1152 <random_lt_1+0x42>
jp     1152 <random_lt_1+0x42>
jmp    1118 <random_lt_1+0x8>
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_lt_1>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
divsd  %xmm1,%xmm0
ucomisd 0xec5(%rip),%xmm0
jne    113f <random_lt_1+0x2f>
jnp    1120 <random_lt_1+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @random_lt_1() {
%1 = alloca double
br label %2
2: ; preds = %7, %0
%3 = call double (...) @rand()
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to double
%6 = fdiv double %3, %5
store double %6, double* %1
br label %7
7: ; preds = %2
%8 = load double, double* %1
%9 = fcmp oeq double 1.000000e+00, %8
br i1 %9, label %2, label %10
10: ; preds = %7
%11 = load double, double* %1
ret double %11
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @random_lt_1() {
br label %1
1: ; preds = %1, %0
%2 = tail call double (...) @rand()
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
%6 = fcmp oeq double %5, 1.000000e+00
br i1 %6, label %1, label %7
7: ; preds = %1
ret double %5
}
void ADC_DelSig_1_ISR2(void) {}


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

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

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

LLVM IR (-O2):
define void @ADC_DelSig_1_ISR2() {
ret void
}
unsigned long long bar(unsigned long long x) { return x - 0x12345600000000ULL; }


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

x86 assembly (clang, -O2):
<bar>:
movabs $0xffedcbaa00000000,%rax
cb ed ff
add    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @bar(i64 %0) {
%2 = add i64 %0, -5124093552623616
ret i64 %2
}
int get_index(const char *list, const char *element) {
  return ((element - list) / (127 + 1));
}


x86 assembly (clang, -O0):
<get_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    $0x80,%ecx
cqto
idiv   %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_index>:
sub    %rdi,%rsi
lea    0x7f(%rsi),%rax
test   %rsi,%rsi
cmovns %rsi,%rax
shr    $0x7,%rax
ret

LLVM IR (-O0):
define i32 @get_index(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = sdiv i64 %9, 128
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @get_index(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = sdiv i64 %5, 128
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ _clear_error_stack();
int _load_cache_contents();
int load_cache_contents(void) {
  { _clear_error_stack(); };
  return (_load_cache_contents());
}


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

x86 assembly (clang, -O2):
<load_cache_contents>:
push   %rax
xor    %eax,%eax
call   1040 <_clear_error_stack@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <_load_cache_contents@plt>

LLVM IR (-O0):
define i32 @load_cache_contents() {
%1 = call i32 (...) @_clear_error_stack()
%2 = call i32 (...) @_load_cache_contents()
ret i32 %2
}

LLVM IR (-O2):
define i32 @load_cache_contents() {
%1 = tail call i32 (...) @_clear_error_stack()
%2 = tail call i32 (...) @_load_cache_contents()
ret i32 %2
}
void setInt(unsigned char *array, int offset, unsigned int value) {
  array[offset + 0] = value >> 0;
  array[offset + 1] = value >> 8;
  array[offset + 2] = value >> 16;
  array[offset + 3] = value >> 24;
}


x86 assembly (clang, -O0):
<setInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x0,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
shr    $0x8,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
shr    $0x10,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
shr    $0x18,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setInt>:
movslq %esi,%rax
mov    %edx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @setInt(i8* %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 i32, i32* %6
%8 = lshr i32 %7, 0
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 0
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
store i8 %9, i8* %14
%15 = load i32, i32* %6
%16 = lshr i32 %15, 8
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
store i8 %17, i8* %22
%23 = load i32, i32* %6
%24 = lshr i32 %23, 16
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 2
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8 %25, i8* %30
%31 = load i32, i32* %6
%32 = lshr i32 %31, 24
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %4
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
store i8 %33, i8* %38
ret void
}

LLVM IR (-O2):
define void @setInt(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = trunc i32 %2 to i8
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %4, i8* %6
%7 = lshr i32 %2, 8
%8 = trunc i32 %7 to i8
%9 = add nsw i32 %1, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 %8, i8* %11
%12 = lshr i32 %2, 16
%13 = trunc i32 %12 to i8
%14 = add nsw i32 %1, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
store i8 %13, i8* %16
%17 = lshr i32 %2, 24
%18 = trunc i32 %17 to i8
%19 = add nsw i32 %1, 3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
store i8 %18, i8* %21
ret void
}
/* Variables and functions */
int /*<<< orphan*/ squeeze(int);
void nonzero(void) { squeeze(1); }


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

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

LLVM IR (-O0):
define void @nonzero() {
%1 = call i32 @squeeze(i32 1)
ret void
}

LLVM IR (-O2):
define void @nonzero() {
%1 = tail call i32 @squeeze(i32 1)
ret void
}
/* Variables and functions */
int count_files(char *);
int /*<<< orphan*/ printf(char *, int, char *);
int main() {
  char *path = "/faststorage/project/DanishPanGenome2";
  int sum = count_files(path);
  printf("There are %d files in '%s'\n", sum, path);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <count_files@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <count_files@plt>
lea    0xeef(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"/faststorage/project/DanishPanGenome2\00"
@.str.1 = [28 x i8] c"There are %d files in '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @count_files(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %6, i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"/faststorage/project/DanishPanGenome2\00"
@.str.1 = [28 x i8] c"There are %d files in '%s'\0A\00"
define i32 @main() {
%1 = tail call i32 @count_files(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int strnlen(char *, int);
void strnlen_constant6(char x) {
  char a[] = "123456";
  if (strnlen(a, 3) != 3)
    (void)*(char *)0;
  a[0] = x;
  if (strnlen(a, 3) != 3)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strnlen_constant6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xed6(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0xece(%rip),%al
mov    %al,-0x2(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <strnlen@plt>
cmp    $0x3,%eax
je     1152 <strnlen_constant6+0x42>
mov    -0x1(%rbp),%al
mov    %al,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <strnlen@plt>
cmp    $0x3,%eax
je     116f <strnlen_constant6+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen_constant6>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movl   $0x363534,0x3(%rsp)
movl   $0x34333231,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <strnlen@plt>
mov    %bl,(%rsp)
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <strnlen@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.strnlen_constant6.a = [7 x i8] c"123456\00"
define void @strnlen_constant6(i8 signext %0) {
%2 = alloca i8
%3 = alloca [7 x i8]
store i8 %0, i8* %2
%4 = bitcast [7 x i8]* %3 to i8*
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%6 = call i32 @strnlen(i8* %5, i32 3)
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8, i8* null
br label %10
10: ; preds = %8, %1
%11 = load i8, i8* %2
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 %11, i8* %12
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%14 = call i32 @strnlen(i8* %13, i32 3)
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = load i8, i8* null
br label %18
18: ; preds = %16, %10
ret void
}

LLVM IR (-O2):
@__const.strnlen_constant6.a = [7 x i8] c"123456\00"
define void @strnlen_constant6(i8 signext %0) {
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%4 = call i32 @strnlen(i8* %3, i32 3)
store i8 %0, i8* %3
%5 = call i32 @strnlen(i8* %3, i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fn2();
int /*<<< orphan*/ fn5();
int /*<<< orphan*/ fn7();
int /*<<< orphan*/ fn9();
void *tf(void *a) {
  switch ((long)a) {
  case 0:
    fn2();
    break;
  case 1:
    fn5();
    break;
  case 2:
    fn7();
    break;
  case 3:
    fn9();
    break;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<tf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     119d <tf+0x5d>
mov    -0x10(%rbp),%rax
lea    0xe97(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <fn2@plt>
jmp    119d <tf+0x5d>
mov    $0x0,%al
call   1050 <fn5@plt>
jmp    119d <tf+0x5d>
mov    $0x0,%al
call   1030 <fn7@plt>
jmp    119d <tf+0x5d>
mov    $0x0,%al
call   1040 <fn9@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tf>:
push   %rax
cmp    $0x3,%rdi
ja     1179 <tf+0x39>
lea    0xeb2(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1060 <fn2@plt>
jmp    1179 <tf+0x39>
xor    %eax,%eax
call   1050 <fn5@plt>
jmp    1179 <tf+0x39>
xor    %eax,%eax
call   1030 <fn7@plt>
jmp    1179 <tf+0x39>
xor    %eax,%eax
call   1040 <fn9@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @tf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
switch i64 %4, label %13 [
i64 0, label %5
i64 1, label %7
i64 2, label %9
i64 3, label %11
]
5: ; preds = %1
%6 = call i32 (...) @fn2()
br label %13
7: ; preds = %1
%8 = call i32 (...) @fn5()
br label %13
9: ; preds = %1
%10 = call i32 (...) @fn7()
br label %13
11: ; preds = %1
%12 = call i32 (...) @fn9()
br label %13
13: ; preds = %1, %11, %9, %7, %5
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @tf(i8* %0) {
%2 = ptrtoint i8* %0 to i64
switch i64 %2, label %11 [
i64 0, label %3
i64 1, label %5
i64 2, label %7
i64 3, label %9
]
3: ; preds = %1
%4 = tail call i32 (...) @fn2()
br label %11
5: ; preds = %1
%6 = tail call i32 (...) @fn5()
br label %11
7: ; preds = %1
%8 = tail call i32 (...) @fn7()
br label %11
9: ; preds = %1
%10 = tail call i32 (...) @fn9()
br label %11
11: ; preds = %1, %9, %7, %5, %3
ret i8* null
}
/* Type definitions */
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
void fd_set_clear(fd_set *rd, fd_set *wr, fd_set *er) {
  if (rd)
    FD_ZERO(rd);
  if (wr)
    FD_ZERO(wr);
  if (er)
    FD_ZERO(er);
}


x86 assembly (clang, -O0):
<fd_set_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <fd_set_clear+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <FD_ZERO@plt>
cmpq   $0x0,-0x10(%rbp)
je     114c <fd_set_clear+0x3c>
mov    -0x10(%rbp),%rdi
call   1030 <FD_ZERO@plt>
cmpq   $0x0,-0x18(%rbp)
je     1160 <fd_set_clear+0x50>
mov    -0x18(%rbp),%rdi
call   1030 <FD_ZERO@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_set_clear>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
test   %rdi,%rdi
je     1124 <fd_set_clear+0x14>
call   1030 <FD_ZERO@plt>
test   %rbx,%rbx
je     1131 <fd_set_clear+0x21>
mov    %rbx,%rdi
call   1030 <FD_ZERO@plt>
test   %r14,%r14
je     1145 <fd_set_clear+0x35>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <FD_ZERO@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @fd_set_clear(i32* %0, i32* %1, i32* %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @FD_ZERO(i32* %0)
br label %7
7: ; preds = %5, %3
%8 = icmp eq i32* %1, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @FD_ZERO(i32* %1)
br label %11
11: ; preds = %9, %7
%12 = icmp eq i32* %2, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @FD_ZERO(i32* %2)
br label %15
15: ; preds = %13, %11
ret void
}
/* Variables and functions */
int zsock_shutdown(int, int);
int shutdown(int sock, int how) { return zsock_shutdown(sock, how); }


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

x86 assembly (clang, -O2):
<shutdown>:
jmp    1030 <zsock_shutdown@plt>

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

LLVM IR (-O2):
define i32 @shutdown(i32 %0, i32 %1) {
%3 = tail call i32 @zsock_shutdown(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
size_t INT_MAX;
int bytes2mb(size_t bytes) {
  size_t res = bytes;
  res >>= 20;
  if (res > INT_MAX)
    res = INT_MAX;
  return res;
}


x86 assembly (clang, -O0):
<bytes2mb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x14,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ec1(%rip),%rcx
cmp    (%rcx),%rax
jbe    113e <bytes2mb+0x3e>
mov    0x2eb1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes2mb>:
shr    $0x14,%rdi
mov    0x2edd(%rip),%rax
mov    (%rax),%rax
cmp    %rax,%rdi
cmovbe %edi,%eax
ret

LLVM IR (-O0):
@INT_MAX = global i64 0
define i32 @bytes2mb(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
%5 = load i64, i64* %3
%6 = lshr i64 %5, 20
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = load i64, i64* @INT_MAX
%9 = icmp ugt i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i64, i64* @INT_MAX
store i64 %11, i64* %3
br label %12
12: ; preds = %10, %1
%13 = load i64, i64* %3
%14 = trunc i64 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define i32 @bytes2mb(i64 %0) {
%2 = lshr i64 %0, 20
%3 = load i64, i64* @INT_MAX
%4 = icmp ugt i64 %2, %3
%5 = select i1 %4, i64 %3, i64 %2
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ nrf_write(int, unsigned char *, int);
void __attribute__((unused)) nrf_set_aa(unsigned char aa) {
  nrf_write(0x20 | 0x01, &aa, 1);
}


x86 assembly (clang, -O0):
<nrf_set_aa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x21,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <nrf_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_set_aa>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x21,%edi
mov    $0x1,%edx
call   1030 <nrf_write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @nrf_set_aa(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @nrf_write(i32 33, i8* %2, i32 1)
ret void
}

LLVM IR (-O2):
define void @nrf_set_aa(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @nrf_write(i32 33, i8* %2, i32 1)
ret void
}
long swap(x)
long x;
{
  long r;
  char *a = (char *)&x;
  char *b = (char *)&r;
  b[0] = a[3];
  b[1] = a[2];
  b[2] = a[1];
  b[3] = a[0];
  return r;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @swap(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %2
%6 = bitcast i64* %2 to i8*
store i8* %6, i8** %4
%7 = bitcast i64* %3 to i8*
store i8* %7, i8** %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 3
%10 = load i8, i8* %9
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 %10, i8* %12
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
%28 = load i64, i64* %3
ret i64 %28
}

LLVM IR (-O2):
define i64 @swap(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = zext i32 %3 to i64
ret i64 %4
}