xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _unset_usage(void) {
  fputs("Usage: unset [-fv] name [...]\n  -f	\n  -v	\n", stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_unset_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_unset_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Usage: unset [-fv] name [...]\0A -f\09\0A -v\09\0A\00"
@stderr = global i32 0
define i32 @_unset_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [43 x i8] c"Usage: unset [-fv] name [...]\0A -f\09\0A -v\09\0A\00"
@stderr = global i32 0
define i32 @_unset_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
void gtk_expander_set_use_underline() {}


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

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

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

LLVM IR (-O2):
define void @gtk_expander_set_use_underline() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ step_hash(int);
signed char func_57(int p_58, unsigned p_59, unsigned short p_60, int p_61,
                    signed char p_62) {
  step_hash(12);
  return p_58;
}


x86 assembly (clang, -O0):
<func_57>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r8b,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    $0xc,%edi
call   1030 <step_hash@plt>
mov    -0x4(%rbp),%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_57>:
push   %rbx
mov    %edi,%ebx
mov    $0xc,%edi
call   1030 <step_hash@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @func_57(i32 %0, i32 %1, i16 zeroext %2, i32 %3, i8 signext %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i16
%9 = alloca i32
%10 = alloca i8
store i32 %0, i32* %6
store i32 %1, i32* %7
store i16 %2, i16* %8
store i32 %3, i32* %9
store i8 %4, i8* %10
%11 = call i32 @step_hash(i32 12)
%12 = load i32, i32* %6
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @func_57(i32 %0, i32 %1, i16 zeroext %2, i32 %3, i8 signext %4) {
%6 = tail call i32 @step_hash(i32 12)
%7 = trunc i32 %0 to i8
ret i8 %7
}
int do_331() { return 331; }


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

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

LLVM IR (-O0):
define i32 @do_331() {
ret i32 331
}

LLVM IR (-O2):
define i32 @do_331() {
ret i32 331
}
/* Type definitions */
struct lexer_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ucpp_init_buf_lexer_state(struct lexer_state *, int);
void init_lexer_state(struct lexer_state *ls) {
  ucpp_init_buf_lexer_state(ls, 1);
}


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

x86 assembly (clang, -O2):
<init_lexer_state>:
mov    $0x1,%esi
jmp    1030 <ucpp_init_buf_lexer_state@plt>

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

LLVM IR (-O2):
%struct.lexer_state = type { i32 }
define void @init_lexer_state(%struct.lexer_state* %0) {
%2 = tail call i32 @ucpp_init_buf_lexer_state(%struct.lexer_state* %0, i32 1)
ret void
}
/* Variables and functions */
double get_seconds_gettimeofday();
double get_seconds() { return get_seconds_gettimeofday(); }


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

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

LLVM IR (-O0):
define double @get_seconds() {
%1 = call double (...) @get_seconds_gettimeofday()
ret double %1
}

LLVM IR (-O2):
define double @get_seconds() {
%1 = tail call double (...) @get_seconds_gettimeofday()
ret double %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n1 = 0, result = 0;
  printf("Digite um numero para saber seu quadrado: ");
  scanf("%d", &n1);
  result = n1 * n1;
  printf("O quadrado de %d = %d", n1, result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%edx
imul   %esi,%edx
lea    0xed3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Digite um numero para saber seu quadrado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"O quadrado de %d = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = load i32, i32* %1
%7 = mul nsw i32 %5, %6
store i32 %7, i32* %2
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Digite um numero para saber seu quadrado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"O quadrado de %d = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
void moudrv_read(void) {}


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

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

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

LLVM IR (-O2):
define void @moudrv_read() {
ret void
}
/* Variables and functions */
short log10(short);
short internal_log10_s(short value) { return log10(value); }


x86 assembly (clang, -O0):
<internal_log10_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <log10@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_log10_s>:
jmp    1030 <log10@plt>

LLVM IR (-O0):
define signext i16 @internal_log10_s(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @log10(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @internal_log10_s(i16 signext %0) {
%2 = tail call signext i16 @log10(i16 signext %0)
ret i16 %2
}
unsigned int Mod(unsigned int dividend, unsigned divider) {
  while (dividend >= divider) {
    dividend -= divider;
  }
  return dividend;
}


x86 assembly (clang, -O0):
<Mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jb     1126 <Mod+0x26>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    110a <Mod+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mod>:
mov    %edi,%eax
add    %esi,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
sub    %esi,%eax
cmp    %esi,%eax
jae    1110 <Mod+0x10>
ret

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

LLVM IR (-O2):
define i32 @Mod(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %6, %3 ]
%5 = icmp ult i32 %4, %1
%6 = sub i32 %4, %1
br i1 %5, label %7, label %3
7: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handler() { printf("TICK!\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"TICK!\00"
define void @handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
void dead() {}


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

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

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

LLVM IR (-O2):
define void @dead() {
ret void
}
void set_page_writable() {}


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

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

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

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

/* Variables and functions */
int EPERM;
int pthread_rwlock_always_fail_EPERM(pthread_rwlock_t *rwlock) { return EPERM; }


x86 assembly (clang, -O0):
<pthread_rwlock_always_fail_EPERM>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_rwlock_always_fail_EPERM>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EPERM = global i32 0
define i32 @pthread_rwlock_always_fail_EPERM(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @EPERM
ret i32 %3
}

LLVM IR (-O2):
@EPERM = global i32 0
define i32 @pthread_rwlock_always_fail_EPERM(i32* nocapture readnone %0) {
%2 = load i32, i32* @EPERM
ret i32 %2
}
/* Variables and functions */
int sqrt(int);
int esPrimo(int numeroprimo) {
  int i;
  for (i = 2; 2 <= i <= sqrt(numeroprimo); i++)
    if (numeroprimo % i == 0)
      return 0;
    else
      return 1;
}


x86 assembly (clang, -O0):
<esPrimo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    $0x2,%eax
cmp    -0xc(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sqrt@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     116d <esPrimo+0x5d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1166 <esPrimo+0x56>
movl   $0x0,-0x4(%rbp)
jmp    116d <esPrimo+0x5d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<esPrimo>:
push   %rbx
mov    %edi,%ebx
call   1030 <sqrt@plt>
and    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @esPrimo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 2, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = icmp sle i32 2, %6
%8 = zext i1 %7 to i32
%9 = load i32, i32* %3
%10 = call i32 @sqrt(i32 %9)
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %22
12: ; preds = %5
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = srem i32 %13, %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 0, i32* %2
br label %22
18: ; preds = %12
store i32 1, i32* %2
br label %22
19: ; No predecessors!
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %17, %18, %5
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @esPrimo(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
%3 = and i32 %0, 1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
void *thread1Work(void *p) {
  for (int i = 0; i < 1000; i++) {
    printf("Thread 1: %d\n", i + 1);
    fflush(stdout);
  }
  pthread_exit(NULL);
  return NULL;
}


x86 assembly (clang, -O0):
<thread1Work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    117e <thread1Work+0x4e>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <thread1Work+0x13>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread1Work>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xebf(%rip),%r14
mov    0x2e98(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    (%r15),%edi
call   1050 <fflush@plt>
add    $0x1,%ebx
cmp    $0x3e9,%ebx
jne    1150 <thread1Work+0x20>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Thread 1: %d\0A\00"
@stdout = global i32 0
define i8* @thread1Work(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
%17 = call i32 @pthread_exit(i32* null)
ret i8* null
}

LLVM IR (-O2):
@.str = [14 x i8] c"Thread 1: %d\0A\00"
@stdout = global i32 0
define noalias i8* @thread1Work(i8* nocapture readnone %0) {
br label %4
2: ; preds = %4
%3 = tail call i32 @pthread_exit(i32* null)
ret i8* null
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %6, %4 ]
%6 = add nuw nsw i32 %5, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = tail call i32 @fflush(i32 %8)
%10 = icmp eq i32 %6, 1000
br i1 %10, label %2, label %4
}
/* Variables and functions */
int /*<<< orphan*/ TCOFLUSH;
scalar_t__ tcflush(int, int /*<<< orphan*/);
int kiss_platform_serial_oflush(int handle) {
  if (tcflush(handle, TCOFLUSH))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<kiss_platform_serial_oflush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ecb(%rip),%rax
mov    (%rax),%esi
call   1030 <tcflush@plt>
cmp    $0x0,%rax
je     1142 <kiss_platform_serial_oflush+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1149 <kiss_platform_serial_oflush+0x39>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kiss_platform_serial_oflush>:
push   %rax
mov    0x2ed8(%rip),%rax
mov    (%rax),%esi
call   1030 <tcflush@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@TCOFLUSH = global i32 0
define i32 @kiss_platform_serial_oflush(i32 %0) {
%2 = load i32, i32* @TCOFLUSH
%3 = tail call i64 @tcflush(i32 %0, i32 %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int invert(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%0x\n", invert(240, 4, 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xf0,%edi
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xf0,%edi
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%0x\0A\00"
define i32 @main() {
%1 = tail call i32 @invert(i32 240, i32 4, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
int net_connect(unsigned long ipaddr, unsigned short port) { return 0; }


x86 assembly (clang, -O0):
<net_connect>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @net_connect(i64 %0, i16 zeroext %1) {
%3 = alloca i64
%4 = alloca i16
store i64 %0, i64* %3
store i16 %1, i16* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @net_connect(i64 %0, i16 zeroext %1) {
ret i32 0
}
int foo(int a) {
  void *p;
  if (a != 0)
    p = &&L0;
  else
    p = &&L1;
  goto *p;
L0:
  return 1;
L1:
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1121 <foo+0x21>
lea    0x21(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    112c <foo+0x2c>
lea    0x1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1151 <foo+0x51>
movl   $0x1,-0x4(%rbp)
jmp    114c <foo+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret
mov    -0x18(%rbp),%rax
jmp    *%rax

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

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* blockaddress(@foo, %11), i8** %4
br label %9
8: ; preds = %1
store i8* blockaddress(@foo, %12), i8** %4
br label %9
9: ; preds = %8, %7
%10 = load i8*, i8** %4
br label %15
11: ; preds = %15
store i32 1, i32* %2
br label %13
12: ; preds = %15
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
15: ; preds = %9
%16 = phi i8* [ %10, %9 ]
indirectbr i8* %16, [label %11, label %12]
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int16_t;

/* Variables and functions */
void write_short(u_int16_t *addr, u_int16_t value) { *addr = value; }


x86 assembly (clang, -O0):
<write_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_short>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @write_short(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret void
}
OP(fd, ee) {
  illegal_1();
  op_ee();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_ee@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_ee()
ret i32 undef
}
int TestBit(int n) {
  if ((2 << (31)) | n)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<TestBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0x0,%eax
cmp    $0x0,%eax
je     1122 <TestBit+0x22>
movl   $0x1,-0x4(%rbp)
jmp    1129 <TestBit+0x29>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @TestBit(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
long fromMilli(long);
long toMilli(long);
long Add_hours(long tm, long hrs) {
  long ms = toMilli(tm);
  long ha = hrs * 3600000L;
  return fromMilli(ms + ha);
}


x86 assembly (clang, -O0):
<Add_hours>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <toMilli@plt>
mov    %rax,-0x18(%rbp)
imul   $0x36ee80,-0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
add    -0x20(%rbp),%rdi
call   1040 <fromMilli@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Add_hours>:
push   %rbx
mov    %rsi,%rbx
call   1030 <toMilli@plt>
imul   $0x36ee80,%rbx,%rdi
add    %rax,%rdi
pop    %rbx
jmp    1040 <fromMilli@plt>

LLVM IR (-O0):
define i64 @Add_hours(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = call i64 @toMilli(i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %4
%10 = mul nsw i64 %9, 3600000
store i64 %10, i64* %6
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = add nsw i64 %11, %12
%14 = call i64 @fromMilli(i64 %13)
ret i64 %14
}

LLVM IR (-O2):
define i64 @Add_hours(i64 %0, i64 %1) {
%3 = tail call i64 @toMilli(i64 %0)
%4 = mul nsw i64 %1, 3600000
%5 = add nsw i64 %3, %4
%6 = tail call i64 @fromMilli(i64 %5)
ret i64 %6
}
OP(ed, fd) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
char *RCSid() {
  return RCSid("$Id: getcolor.c,v 1.32 2011/10/08 00:07:41 sfeam Exp $");
}


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

x86 assembly (clang, -O2):
<RCSid>:
jmp    1100 <RCSid>

LLVM IR (-O0):
@.str = [55 x i8] c"$Id: getcolor.c,v 1.32 2011/10/08 00:07:41 sfeam Exp $\00"
define i8* @RCSid() {
%1 = call i8* (i8*, ...) bitcast (i8* ()* @RCSid to i8* (i8*, ...)*)(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @RCSid() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ err_msg_out_of_memory();
void *malloc(size_t);
__attribute__((malloc, warn_unused_result)) void *mallocx(size_t l) {
  void *m = malloc(l);
  if (m == NULL)
    err_msg_out_of_memory();
  return m;
}


x86 assembly (clang, -O0):
<mallocx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <mallocx+0x2b>
mov    $0x0,%al
call   1030 <err_msg_out_of_memory@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mallocx>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <mallocx+0x15>
xor    %eax,%eax
call   1030 <err_msg_out_of_memory@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @mallocx(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @err_msg_out_of_memory()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
double f4_sum_short_post_double(short v, double v0) {
  return v0 + ((double)(v));
}


x86 assembly (clang, -O0):
<f4_sum_short_post_double>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movswl -0x2(%rbp),%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4_sum_short_post_double>:
cvtsi2sd %edi,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f4_sum_short_post_double(i16 signext %0, double %1) {
%3 = alloca i16
%4 = alloca double
store i16 %0, i16* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load i16, i16* %3
%7 = sitofp i16 %6 to double
%8 = fadd double %5, %7
ret double %8
}

LLVM IR (-O2):
define double @f4_sum_short_post_double(i16 signext %0, double %1) {
%3 = sitofp i16 %0 to double
%4 = fadd double %3, %1
ret double %4
}
double dither(void) {
  unsigned int bit, v;
  static unsigned int x = 0xbeefface;
  bit = (x ^ (x >> 1) ^ (x >> 21) ^ (x >> 31)) & 1;
  x = x << 1 | bit;
  v = (x & 0x0000000f) | ((x & 0x000f0000) >> 12) | ((x & 0x0f000000) >> 16);
  return (double)v / 4096 - 0.5;
}


x86 assembly (clang, -O0):
<dither>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%ecx
mov    %ecx,%edx
shr    %edx
mov    %ecx,%eax
xor    %edx,%eax
mov    %ecx,%edx
shr    $0x15,%edx
xor    %edx,%eax
shr    $0x1f,%ecx
xor    %ecx,%eax
and    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    0x2ef6(%rip),%eax
add    %eax,%eax
mov    -0x4(%rbp),%ecx
or     %ecx,%eax
mov    %eax,0x2ee9(%rip)
mov    0x2ee3(%rip),%ecx
mov    %ecx,%eax
and    $0xf,%eax
mov    %ecx,%edx
and    $0xf0000,%edx
shr    $0xc,%edx
or     %edx,%eax
and    $0xf000000,%ecx
shr    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xe9b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe87(%rip),%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dither>:
mov    0x2f1a(%rip),%eax
mov    %eax,%ecx
shr    %ecx
xor    %eax,%ecx
mov    %eax,%edx
shr    $0x15,%edx
xor    %ecx,%edx
mov    %eax,%ecx
shr    $0x1f,%ecx
and    $0x1,%edx
xor    %ecx,%edx
lea    (%rdx,%rax,2),%ecx
mov    %ecx,0x2efa(%rip)
and    $0xf,%ecx
mov    %eax,%edx
shr    $0xb,%edx
and    $0xf0,%edx
shr    $0xf,%eax
and    $0xf00,%eax
or     %edx,%eax
or     %ecx,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xeb4(%rip),%xmm0
addsd  0xeb4(%rip),%xmm0
ret

LLVM IR (-O0):
@dither.x = internal global i32 -1091568946
define double @dither() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @dither.x
%4 = load i32, i32* @dither.x
%5 = lshr i32 %4, 1
%6 = xor i32 %3, %5
%7 = load i32, i32* @dither.x
%8 = lshr i32 %7, 21
%9 = xor i32 %6, %8
%10 = load i32, i32* @dither.x
%11 = lshr i32 %10, 31
%12 = xor i32 %9, %11
%13 = and i32 %12, 1
store i32 %13, i32* %1
%14 = load i32, i32* @dither.x
%15 = shl i32 %14, 1
%16 = load i32, i32* %1
%17 = or i32 %15, %16
store i32 %17, i32* @dither.x
%18 = load i32, i32* @dither.x
%19 = and i32 %18, 15
%20 = load i32, i32* @dither.x
%21 = and i32 %20, 983040
%22 = lshr i32 %21, 12
%23 = or i32 %19, %22
%24 = load i32, i32* @dither.x
%25 = and i32 %24, 251658240
%26 = lshr i32 %25, 16
%27 = or i32 %23, %26
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = uitofp i32 %28 to double
%30 = fdiv double %29, 4.096000e+03
%31 = fsub double %30, 5.000000e-01
ret double %31
}

LLVM IR (-O2):
@dither.x = internal unnamed_addr global i32 -1091568946
define double @dither() {
%1 = load i32, i32* @dither.x
%2 = lshr i32 %1, 1
%3 = xor i32 %2, %1
%4 = lshr i32 %1, 21
%5 = xor i32 %3, %4
%6 = lshr i32 %1, 31
%7 = and i32 %5, 1
%8 = xor i32 %7, %6
%9 = shl i32 %1, 1
%10 = or i32 %8, %9
store i32 %10, i32* @dither.x
%11 = and i32 %10, 15
%12 = lshr i32 %9, 12
%13 = and i32 %12, 240
%14 = lshr i32 %9, 16
%15 = and i32 %14, 3840
%16 = or i32 %15, %13
%17 = or i32 %16, %11
%18 = uitofp i32 %17 to double
%19 = fmul double %18, 0x3F30000000000000
%20 = fadd double %19, -5.000000e-01
ret double %20
}
void RTSemRWRequestWriteNoResumeDebug(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSemRWRequestWriteNoResumeDebug() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SendWeaponPref();
void AutoBrake_OnChange(void) { SendWeaponPref(); }


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

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

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

LLVM IR (-O2):
define void @AutoBrake_OnChange() {
%1 = tail call i32 (...) @SendWeaponPref()
ret void
}
double CT_getTickFrequency(void) { return 1e9; }


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

x86 assembly (clang, -O2):
<CT_getTickFrequency>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @CT_getTickFrequency() {
ret double 1.000000e+09
}

LLVM IR (-O2):
define double @CT_getTickFrequency() {
ret double 1.000000e+09
}
char *string_copy(char *dest, const char *src) {
  int i;
  for (i = 0; src[i] != '\0'; i++) {
    dest[i] = src[i];
  }
  return dest;
}


x86 assembly (clang, -O0):
<string_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <string_copy+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <string_copy+0x13>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_copy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1120 <string_copy+0x20>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <string_copy+0x10>
ret

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

LLVM IR (-O2):
define i8* @string_copy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Howdy!\n");
  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>
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 = [8 x i8] c"Howdy!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Howdy!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
unsigned int foo(unsigned int x, unsigned int y, unsigned int z) {
  return x + (-y * z * z);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
imul   %edx,%esi
imul   %edx,%esi
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @foo(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 = load i32, i32* %5
%9 = sub i32 0, %8
%10 = load i32, i32* %6
%11 = mul i32 %9, %10
%12 = load i32, i32* %6
%13 = mul i32 %11, %12
%14 = add i32 %7, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = mul i32 %4, %2
%6 = sub i32 %0, %5
ret i32 %6
}
void dblptr_main(void) { double (*valfnc)(const char *); }


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

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

LLVM IR (-O0):
define void @dblptr_main() {
%1 = alloca double (i8*)*
ret void
}

LLVM IR (-O2):
define void @dblptr_main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void print(const char *data, size_t data_length) {
  for (size_t i = 0; i < data_length; ++i) {
    putchar((int)((const unsigned char *)data)[i]);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1158 <print+0x48>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <print+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1143 <print+0x33>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <print+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @print(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %11, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = tail call i32 @putchar(i32 %9)
%11 = add nuw i64 %6, 1
%12 = icmp eq i64 %11, %1
br i1 %12, label %4, label %5
}
/* Variables and functions */
long double sin(double);
__attribute__((weak)) long double sinl(long double x) { return sin((double)x); }


x86 assembly (clang, -O0):
<sinl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
define weak x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call x86_fp80 @sin(double %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define weak x86_fp80 @sinl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call x86_fp80 @sin(double %2)
ret x86_fp80 %3
}
void qcom_glink_set_drvdata(void *ch, void *data) {}


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

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

LLVM IR (-O0):
define void @qcom_glink_set_drvdata(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @qcom_glink_set_drvdata(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int blender_block_write_start(int, void const *, unsigned long, int);
int FS460_image_set_start_write(const void *p_image_data,
                                unsigned long length) {
  return blender_block_write_start(0xB000, p_image_data, length, 1);
}


x86 assembly (clang, -O0):
<FS460_image_set_start_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0xb000,%edi
mov    $0x1,%ecx
call   1030 <blender_block_write_start@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FS460_image_set_start_write>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0xb000,%edi
mov    $0x1,%ecx
jmp    1030 <blender_block_write_start@plt>

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

LLVM IR (-O2):
define i32 @FS460_image_set_start_write(i8* %0, i64 %1) {
%3 = tail call i32 @blender_block_write_start(i32 45056, i8* %0, i64 %1, i32 1)
ret i32 %3
}
/* Variables and functions */
int g(int, int);
int h(int);
int f(int t, int c) {
  int d = 0;
  int e = 0;
  if (t) {
    d = h(c);
    e = t;
  } else
    d = 0, e = 0;
  return g(e, d);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     115c <f+0x3c>
mov    -0x8(%rbp),%edi
call   1030 <h@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    116a <f+0x4a>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     1132 <f+0x12>
mov    %esi,%edi
call   1030 <h@plt>
mov    %eax,%esi
jmp    1134 <f+0x14>
xor    %esi,%esi
mov    %ebx,%edi
pop    %rbx
jmp    1040 <g@plt>

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

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @h(i32 %1)
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ 0, %2 ]
%8 = tail call i32 @g(i32 %0, i32 %7)
ret i32 %8
}
/* Type definitions */
typedef int ushort;
typedef int /*<<< orphan*/ in_addr_t;

/* Variables and functions */
int ntohl(int /*<<< orphan*/);
ushort get_ip_index(in_addr_t s_addr) { return ntohl(s_addr) & 65535; }


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

x86 assembly (clang, -O2):
<get_ip_index>:
push   %rax
call   1030 <ntohl@plt>
movzwl %ax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_ip_index(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ntohl(i32 %3)
%5 = and i32 %4, 65535
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_ip_index(i32 %0) {
%2 = tail call i32 @ntohl(i32 %0)
%3 = and i32 %2, 65535
ret i32 %3
}
/* Variables and functions */
void *malloc(size_t);
void *protobuf_c_system_alloc(void *allocator_data, size_t size) {
  return malloc(size);
}


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

x86 assembly (clang, -O2):
<protobuf_c_system_alloc>:
mov    %rsi,%rdi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @protobuf_c_system_alloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i8* @malloc(i64 %5)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @protobuf_c_system_alloc(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
ret i8* %3
}
/* Variables and functions */
int yas_bma222_read_reg(unsigned char, unsigned char *, int);
int yas_bma222_read_reg_byte(unsigned char adr) {
  unsigned char buf = 0xff;
  int err;
  err = yas_bma222_read_reg(adr, &buf, 1);
  if (err == 0) {
    return buf;
  }
  return 0;
}


x86 assembly (clang, -O0):
<yas_bma222_read_reg_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movb   $0xff,-0x6(%rbp)
lea    -0x6(%rbp),%rsi
mov    $0x1,%edx
movzbl -0x5(%rbp),%edi
call   1030 <yas_bma222_read_reg@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114d <yas_bma222_read_reg_byte+0x3d>
movzbl -0x6(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <yas_bma222_read_reg_byte+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yas_bma222_read_reg_byte>:
push   %rax
movb   $0xff,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <yas_bma222_read_reg@plt>
xor    %ecx,%ecx
test   %eax,%eax
movzbl 0x7(%rsp),%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @yas_bma222_read_reg_byte(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
store i8 %0, i8* %3
store i8 -1, i8* %4
%6 = load i8, i8* %3
%7 = call i32 @yas_bma222_read_reg(i8 zeroext %6, i8* %4, i32 1)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
store i32 %12, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @yas_bma222_read_reg_byte(i8 zeroext %0) {
%2 = alloca i8
store i8 -1, i8* %2
%3 = call i32 @yas_bma222_read_reg(i8 zeroext %0, i8* %2, i32 1)
%4 = icmp eq i32 %3, 0
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void reset_format(void) { printf("\x1b[0m"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[0m\00"
define void @reset_format() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}