xunge/DecIR huggingface dataset:
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
void clear_file(char *filename) {
  char *cmd = malloc(sizeof(char) * 200);
  sprintf(cmd,
          "getfacl %s > /tmp/aCl && rm -rf %s&&touch %s&&cd /&&setfacl "
          "--restore=/tmp/aCl",
          filename, filename, filename);
  system(cmd);
  system("rm -rf /tmp/aCl");
}


x86 assembly (clang, -O0):
<clear_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xc8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe9f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <system@plt>
lea    0xed9(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xc8,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
lea    0xeb5(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <system@plt>
lea    0xee4(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [79 x i8] c"getfacl %s > /tmp/aCl && rm -rf %s&&touch %s&&cd /&&setfacl --restore=/tmp/aCl\00"
@.str.1 = [16 x i8] c"rm -rf /tmp/aCl\00"
define void @clear_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @malloc(i32 200)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @system(i8* %10)
%12 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [79 x i8] c"getfacl %s > /tmp/aCl && rm -rf %s&&touch %s&&cd /&&setfacl --restore=/tmp/aCl\00"
@.str.1 = [16 x i8] c"rm -rf /tmp/aCl\00"
define void @clear_file(i8* %0) {
%2 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0, i8* %0)
%4 = tail call i32 @system(i8* %2)
%5 = tail call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ yylex();
int main(int argc, char *argv[]) {
  while (yylex() != 0)
    continue;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <yylex@plt>
cmp    $0x0,%rax
je     113c <main+0x2c>
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <yylex@plt>
test   %rax,%rax
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i64 (...) @yylex()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %3
6: ; preds = %3
ret i32 0
}
double abs_double(double input) {
  double retVal;
  if (input < 0) {
    retVal = (double)(input * -1);
  } else {
    retVal = (double)input;
  }
  return retVal;
}


x86 assembly (clang, -O0):
<abs_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    112e <abs_double+0x2e>
movsd  0xee1(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1138 <abs_double+0x38>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_double>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @abs_double(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %2
%8 = fmul double %7, -1.000000e+00
store double %8, double* %3
br label %11
9: ; preds = %1
%10 = load double, double* %2
store double %10, double* %3
br label %11
11: ; preds = %9, %6
%12 = load double, double* %3
ret double %12
}

LLVM IR (-O2):
define double @abs_double(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int usage(char *cmd) {
  fprintf(stderr, "\nUSAGE: %s input=<input> password=<password>\n\n", cmd);
  return (-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"\0AUSAGE: %s input=<input> password=<password>\0A\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 -1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"\0AUSAGE: %s input=<input> password=<password>\0A\0A\00"
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 -1
}
void __DELETE_java_nio_ReadWriteCharArrayBuffer(void *me, void *client_data) {}


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

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

LLVM IR (-O0):
define void @__DELETE_java_nio_ReadWriteCharArrayBuffer(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 @__DELETE_java_nio_ReadWriteCharArrayBuffer(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void do_exit(argc, argv) char **argv;
{ exit(0); }


x86 assembly (clang, -O0):
<do_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

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

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

LLVM IR (-O2):
define void @do_exit(i32 %0, i8** nocapture readnone %1) {
tail call void @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t
sdp_event_query_attribute_value_get_attribute_id(const uint8_t *event) {
  return little_endian_read_16(event, 4);
}


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

x86 assembly (clang, -O2):
<sdp_event_query_attribute_value_get_attribute_id>:
mov    $0x4,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @sdp_event_query_attribute_value_get_attribute_id(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 4)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ write_to_vga(char, char);
int set_attr_at_off(char x, char y, char attr) {
  write_to_vga(y * 160 + x * 2 + 1, attr);
}


x86 assembly (clang, -O0):
<set_attr_at_off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
movsbl -0x6(%rbp),%eax
imul   $0xa0,%eax,%eax
movsbl -0x5(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
add    $0x1,%eax
movsbl %al,%edi
movsbl -0x7(%rbp),%esi
call   1030 <write_to_vga@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_attr_at_off>:
shl    $0x5,%esi
lea    (%rsi,%rsi,2),%eax
neg    %eax
add    %dil,%dil
add    %al,%dil
or     $0x1,%dil
movsbl %dil,%edi
mov    %edx,%esi
jmp    1030 <write_to_vga@plt>

LLVM IR (-O0):
define i32 @set_attr_at_off(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = mul nsw i32 %9, 160
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = mul nsw i32 %12, 2
%14 = add nsw i32 %10, %13
%15 = add nsw i32 %14, 1
%16 = trunc i32 %15 to i8
%17 = load i8, i8* %7
%18 = call i32 @write_to_vga(i8 signext %16, i8 signext %17)
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @set_attr_at_off(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = mul i8 %1, -96
%5 = shl i8 %0, 1
%6 = add i8 %4, %5
%7 = or i8 %6, 1
%8 = tail call i32 @write_to_vga(i8 signext %7, i8 signext %2)
ret i32 undef
}
void __attribute__((__warning__(
    "curl_easy_setopt expects a curl_read_callback argument for this option")))
__attribute__((__unused__)) __attribute__((__no__))
_curl_easy_setopt_err_read_cb(void) {
  __asm__("");
}


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

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

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

LLVM IR (-O2):
define void @_curl_easy_setopt_err_read_cb() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct fbdevice {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ full_framebuffer_with_color(struct fbdevice *,
                                               int /*<<< orphan*/,
                                               int /*<<< orphan*/,
                                               int /*<<< orphan*/);
void clear_framebuffer(struct fbdevice *dev) {
  full_framebuffer_with_color(dev, 0, 0, 0);
}


x86 assembly (clang, -O0):
<clear_framebuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <full_framebuffer_with_color@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_framebuffer>:
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <full_framebuffer_with_color@plt>

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

LLVM IR (-O2):
%struct.fbdevice = type { i32 }
define void @clear_framebuffer(%struct.fbdevice* %0) {
%2 = tail call i32 @full_framebuffer_with_color(%struct.fbdevice* %0, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ leds_pattern_toggle(int);
void heartbeat_forever(void) {
  for (;;) {
    leds_pattern_toggle((0x1));
    delay(500000);
    leds_pattern_toggle((0x1));
    delay(380000);
    leds_pattern_toggle((0x1));
    delay(240000);
    leds_pattern_toggle((0x1));
    delay(2400000);
  }
}


x86 assembly (clang, -O0):
<heartbeat_forever>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <heartbeat_forever+0x9>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x7a120,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x5cc60,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x3a980,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x249f00,%edi
call   1040 <delay@plt>
jmp    1129 <heartbeat_forever+0x9>

x86 assembly (clang, -O2):
<heartbeat_forever>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x7a120,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x5cc60,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x3a980,%edi
call   1040 <delay@plt>
mov    $0x1,%edi
call   1030 <leds_pattern_toggle@plt>
mov    $0x249f00,%edi
call   1040 <delay@plt>
jmp    1130 <heartbeat_forever+0x10>

LLVM IR (-O0):
define void @heartbeat_forever() {
br label %1
1: ; preds = %1, %0
%2 = call i32 @leds_pattern_toggle(i32 1)
%3 = call i32 @delay(i32 500000)
%4 = call i32 @leds_pattern_toggle(i32 1)
%5 = call i32 @delay(i32 380000)
%6 = call i32 @leds_pattern_toggle(i32 1)
%7 = call i32 @delay(i32 240000)
%8 = call i32 @leds_pattern_toggle(i32 1)
%9 = call i32 @delay(i32 2400000)
br label %1
}

LLVM IR (-O2):
define void @heartbeat_forever() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @leds_pattern_toggle(i32 1)
%3 = tail call i32 @delay(i32 500000)
%4 = tail call i32 @leds_pattern_toggle(i32 1)
%5 = tail call i32 @delay(i32 380000)
%6 = tail call i32 @leds_pattern_toggle(i32 1)
%7 = tail call i32 @delay(i32 240000)
%8 = tail call i32 @leds_pattern_toggle(i32 1)
%9 = tail call i32 @delay(i32 2400000)
br label %1
}
void setcursortype(int type) {}


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

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

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

LLVM IR (-O2):
define void @setcursortype(i32 %0) {
ret void
}
/* Variables and functions */
double parse_number(char const *, int, int, int, char, char **);
double strtod(char const *, char **);
double underlying_strtod(const char *nptr, char **endptr) {
  if (1) {
    return strtod(nptr, endptr);
  } else {
    return parse_number(nptr, 10, 10, 1, 'e', endptr);
  }
}


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

x86 assembly (clang, -O2):
<underlying_strtod>:
jmp    1030 <strtod@plt>

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

LLVM IR (-O2):
define double @underlying_strtod(i8* %0, i8** nocapture %1) {
%3 = tail call double @strtod(i8* %0, i8** %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ match_field();
void do_query() { match_field(); }


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

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

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

LLVM IR (-O2):
define void @do_query() {
%1 = tail call i32 (...) @match_field()
ret void
}
int ioctl_status() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ioctl_status() {
ret i32 0
}
int test_imm_ABuint8_mem(unsigned char *val) {
  return ((*val) & (0xAB << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_ABuint8_mem>:
testb  $0xab,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_ABuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -85
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int _bits_clear(unsigned char *bytes, unsigned int bit) {
  int r = !!(bytes[bit >> 3] & (1 << (bit & 7)));
  bytes[bit >> 3] &= ~(1 << (bit & 7));
  return r;
}


x86 assembly (clang, -O0):
<_bits_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x3,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%esi
shl    %cl,%esi
xor    $0xffffffff,%esi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x3,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%edx
and    %esi,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bits_clear>:
mov    %esi,%ecx
mov    %esi,%edx
shr    $0x3,%rdx
and    $0x7,%cl
mov    $0x1,%esi
shl    %cl,%esi
movzbl (%rdi,%rdx,1),%r8d
mov    %r8d,%eax
shr    %cl,%eax
not    %sil
and    %r8b,%sil
and    $0x1,%eax
mov    %sil,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define i32 @_bits_clear(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = lshr i32 %7, 3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i32, i32* %4
%14 = and i32 %13, 7
%15 = shl i32 1, %14
%16 = and i32 %12, %15
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = xor i1 %18, true
%20 = zext i1 %19 to i32
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = and i32 %21, 7
%23 = shl i32 1, %22
%24 = xor i32 %23, -1
%25 = load i8*, i8** %3
%26 = load i32, i32* %4
%27 = lshr i32 %26, 3
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %25, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = and i32 %31, %24
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @_bits_clear(i8* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 3
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %1, 7
%9 = shl nuw nsw i32 1, %8
%10 = lshr i32 %7, %8
%11 = and i32 %10, 1
%12 = trunc i32 %9 to i8
%13 = xor i8 %12, -1
%14 = and i8 %6, %13
store i8 %14, i8* %5
ret i32 %11
}
int Bematech_FI_LeituraRecebimentosNaoFiscais(Var, Retorno) {
  return Formata("\x1b|35|33|\x1b", Var, Retorno);
}


x86 assembly (clang, -O0):
<Bematech_FI_LeituraRecebimentosNaoFiscais>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <Formata@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bematech_FI_LeituraRecebimentosNaoFiscais>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <Formata@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\1B|35|33|\1B\00"
define i32 @Bematech_FI_LeituraRecebimentosNaoFiscais(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 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"\1B|35|33|\1B\00"
define i32 @Bematech_FI_LeituraRecebimentosNaoFiscais(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @Formata to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int MCD(int, int);
int mcm(int n, int m) { return (n * m) / MCD(n, m); }


x86 assembly (clang, -O0):
<mcm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <MCD@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcm>:
push   %rbx
mov    %esi,%ebx
imul   %edi,%ebx
call   1030 <MCD@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @mcm(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 = mul nsw i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @MCD(i32 %8, i32 %9)
%11 = sdiv i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @mcm(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @MCD(i32 %0, i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
int toto() {
  int i, j, b;
  int a[100];
  for (j = 0; j <= 20; j++) {
    a[j] = b + i;
    if (j * i == b)
      break;
    a[j + b] = b + i;
  }
  a[i] = b + 3;
  return a[b];
}


x86 assembly (clang, -O0):
<toto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jg     1165 <toto+0x65>
mov    -0xc(%rbp),%ecx
add    -0x4(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1142 <toto+0x42>
jmp    1165 <toto+0x65>
mov    -0xc(%rbp),%ecx
add    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cltq
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <toto+0x12>
mov    -0xc(%rbp),%ecx
add    $0x3,%ecx
movslq -0x4(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
movslq -0xc(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
add    $0x120,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @toto() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
store i32 0, i32* %2
br label %5
5: ; preds = %30, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 20
br i1 %7, label %8, label %33
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32, i32* %1
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %13
store i32 %11, i32* %14
%15 = load i32, i32* %2
%16 = load i32, i32* %1
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %3
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %8
br label %33
21: ; preds = %8
%22 = load i32, i32* %3
%23 = load i32, i32* %1
%24 = add nsw i32 %22, %23
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = add nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %28
store i32 %24, i32* %29
br label %30
30: ; preds = %21
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %5
33: ; preds = %20, %5
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 3
%36 = load i32, i32* %1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %37
store i32 %35, i32* %38
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %40
%42 = load i32, i32* %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @toto() {
ret i32 undef
}
unsigned long haproxy_uri_hash(char *uri, int uri_len) {
  unsigned long hash = 0;
  int c;
  while (uri_len--) {
    c = *uri++;
    if (c == '?')
      break;
    hash = c + (hash << 6) + (hash << 16) - hash;
  }
  return hash % 4;
}


x86 assembly (clang, -O0):
<haproxy_uri_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1172 <haproxy_uri_hash+0x72>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3f,-0x1c(%rbp)
jne    114b <haproxy_uri_hash+0x4b>
jmp    1172 <haproxy_uri_hash+0x72>
movslq -0x1c(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x6,%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1113 <haproxy_uri_hash+0x13>
mov    -0x18(%rbp),%rax
and    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<haproxy_uri_hash>:
test   %esi,%esi
je     1130 <haproxy_uri_hash+0x30>
mov    %esi,%ecx
xor    %edx,%edx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rdi,%rdx,1),%esi
cmp    $0x3f,%rsi
je     112c <haproxy_uri_hash+0x2c>
imul   $0x1003f,%rax,%rax
add    %rsi,%rax
add    $0x1,%rdx
cmp    %edx,%ecx
jne    1110 <haproxy_uri_hash+0x10>
and    $0x3,%eax
ret
xor    %eax,%eax
and    $0x3,%eax
ret

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

LLVM IR (-O2):
define i64 @haproxy_uri_hash(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %17, label %4
4: ; preds = %2, %11
%5 = phi i32 [ %8, %11 ], [ %1, %2 ]
%6 = phi i8* [ %12, %11 ], [ %0, %2 ]
%7 = phi i64 [ %15, %11 ], [ 0, %2 ]
%8 = add nsw i32 %5, -1
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 63
br i1 %10, label %17, label %11
11: ; preds = %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = zext i8 %9 to i64
%14 = mul i64 %7, 65599
%15 = add i64 %14, %13
%16 = icmp eq i32 %8, 0
br i1 %16, label %17, label %4
17: ; preds = %11, %4, %2
%18 = phi i64 [ 0, %2 ], [ %7, %4 ], [ %15, %11 ]
%19 = and i64 %18, 3
ret i64 %19
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ strcmp(char const *, char *);
FILE *fopen_or_default(const char *path, const char *mode, FILE *def) {
  if (!strcmp(path, "-")) {
    return def;
  } else {
    return fopen(path, mode);
  }
}


x86 assembly (clang, -O0):
<fopen_or_default>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115a <fopen_or_default+0x3a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <fopen_or_default+0x4b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopen_or_default>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xecb(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     114e <fopen_or_default+0x2e>
mov    %rbx,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fopen@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
define i32* @fopen_or_default(i8* nocapture %0, i8* nocapture %1, i32* readnone %2) {
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32* @fopen(i8* %0, i8* %1)
br label %8
8: ; preds = %3, %6
%9 = phi i32* [ %7, %6 ], [ %2, %3 ]
ret i32* %9
}
/* Variables and functions */
int /*<<< orphan*/ set_raw_term(int /*<<< orphan*/);
void suspend_keyboard(void) { set_raw_term(0); }


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

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

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

LLVM IR (-O2):
define void @suspend_keyboard() {
%1 = tail call i32 @set_raw_term(i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int date_get_sec(void) {
  time_t t = time(NULL);
  struct tm *lt = localtime(&t);
  return lt->tm_sec;
}


x86 assembly (clang, -O0):
<date_get_sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @date_get_sec() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @date_get_sec() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("Usage: ./file-io src dest\n");
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1143 <main+0x33>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x3,%edi
je     112d <main+0x1d>
push   %rax
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Usage: ./file-io src dest\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@str = [26 x i8] c"Usage: ./file-io src dest\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %7
}
/* Variables and functions */
double ArcTan(int, int);
float Angle(int x1, int y1, int x2, int y2) {
  return ArcTan(x2 - x1, y2 - y1) * 57.2958;
}


x86 assembly (clang, -O0):
<Angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
sub    -0x8(%rbp),%esi
call   1030 <ArcTan@plt>
movsd  0xec3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Angle>:
push   %rax
sub    %edi,%edx
sub    %esi,%ecx
mov    %edx,%edi
mov    %ecx,%esi
call   1030 <ArcTan@plt>
mulsd  0xeda(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Angle(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %8
%13 = load i32, i32* %6
%14 = sub nsw i32 %12, %13
%15 = call double @ArcTan(i32 %11, i32 %14)
%16 = fmul double %15, 5.729580e+01
%17 = fptrunc double %16 to float
ret float %17
}

LLVM IR (-O2):
define float @Angle(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %2, %0
%6 = sub nsw i32 %3, %1
%7 = tail call double @ArcTan(i32 %5, i32 %6)
%8 = fmul double %7, 5.729580e+01
%9 = fptrunc double %8 to float
ret float %9
}
/* Type definitions */
struct test_cases {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ MAP_GROWSDOWN;
int __init_cow(struct test_cases *, int /*<<< orphan*/);
int init_cow_gd(struct test_cases *tcs) {
  return __init_cow(tcs, MAP_GROWSDOWN);
}


x86 assembly (clang, -O0):
<init_cow_gd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <__init_cow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_cow_gd>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <__init_cow@plt>

LLVM IR (-O0):
%struct.test_cases = type { i32 }
@MAP_GROWSDOWN = global i32 0
define i32 @init_cow_gd(%struct.test_cases* %0) {
%2 = alloca %struct.test_cases*
store %struct.test_cases* %0, %struct.test_cases** %2
%3 = load %struct.test_cases*, %struct.test_cases** %2
%4 = load i32, i32* @MAP_GROWSDOWN
%5 = call i32 @__init_cow(%struct.test_cases* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.test_cases = type { i32 }
@MAP_GROWSDOWN = global i32 0
define i32 @init_cow_gd(%struct.test_cases* %0) {
%2 = load i32, i32* @MAP_GROWSDOWN
%3 = tail call i32 @__init_cow(%struct.test_cases* %0, i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ swap16(int /*<<< orphan*/);
int16_t be16_to_cpu(int16_t x) { return (swap16(x)); }


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

x86 assembly (clang, -O2):
<be16_to_cpu>:
jmp    1030 <swap16@plt>

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

LLVM IR (-O2):
define i32 @be16_to_cpu(i32 %0) {
%2 = tail call i32 @swap16(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printarray(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quickSortWrapper(int *, int);
int main() {
  int alist[8] = {10, 7, 4, 0, 1, -1, 3, 4};
  quickSortWrapper(alist, (sizeof alist / sizeof alist[0]));
  printf("\n After applying the quickSort algortihm on the array, the result "
         "is : \n");
  printarray(alist, 0, (sizeof alist / sizeof alist[0]) - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
call   1030 <quickSortWrapper@plt>
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <printarray@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <quickSortWrapper@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1050 <printarray@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.alist = [8 x i32] [i32 10, i32 7, i32 4, i32 0, i32 1, i32 -1, i32 3, i32 4]
@.str = [73 x i8] c"\0A After applying the quickSort algortihm on the array, the result is : \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
store i32 0, i32* %1
%3 = bitcast [8 x i32]* %2 to i8*
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%5 = call i32 @quickSortWrapper(i32* %4, i32 8)
%6 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%8 = call i32 @printarray(i32* %7, i32 0, i32 7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.alist = [8 x i32] [i32 10, i32 7, i32 4, i32 0, i32 1, i32 -1, i32 3, i32 4]
@str = [72 x i8] c"\0A After applying the quickSort algortihm on the array, the result is : \00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @quickSortWrapper(i32* %3, i32 8)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
%6 = call i32 @printarray(i32* %3, i32 0, i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void myhandler(int signo __attribute__((unused))) {
  printf("SIGCHLD called. Inside handler\n");
}


x86 assembly (clang, -O0):
<myhandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [32 x i8] c"SIGCHLD called. Inside handler\0A\00"
define void @myhandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"SIGCHLD called. Inside handler\00"
define void @myhandler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ compare_and_swap32(unsigned int volatile *, int, int);
void atmc_add32(volatile unsigned int *address, int inc) {
  int old_value;
  int new_value;
  do {
    old_value = *address;
    new_value = old_value + inc;
  } while (!compare_and_swap32(address, old_value, new_value));
}


x86 assembly (clang, -O0):
<atmc_add32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <compare_and_swap32@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    111f <atmc_add32+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atmc_add32>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
lea    (%rsi,%r14,1),%edx
mov    %rbx,%rdi
call   1030 <compare_and_swap32@plt>
test   %eax,%eax
je     1120 <atmc_add32+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @atmc_add32(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
br label %7
7: ; preds = %13, %2
%8 = load i32*, i32** %3
%9 = load volatile i32, i32* %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
store i32 %12, i32* %6
br label %13
13: ; preds = %7
%14 = load i32*, i32** %3
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @compare_and_swap32(i32* %14, i32 %15, i32 %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br i1 %19, label %7, label %20
20: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @atmc_add32(i32* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i32, i32* %0
%5 = add nsw i32 %4, %1
%6 = tail call i32 @compare_and_swap32(i32* %0, i32 %4, i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %3, label %8
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ insert_sort0(int *, int);
void insert_sort(int *arr, int index) {
  if (index > 0) {
    insert_sort(arr, index - 1);
    insert_sort0(arr, index);
  }
}


x86 assembly (clang, -O0):
<insert_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1154 <insert_sort+0x34>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <insert_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <insert_sort0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_sort>:
test   %esi,%esi
jle    1146 <insert_sort+0x26>
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    -0x1(%rbx),%esi
call   1030 <insert_sort@plt>
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <insert_sort0@plt>
ret

LLVM IR (-O0):
define void @insert_sort(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 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = call i32 @insert_sort0(i32* %11, i32 %12)
br label %14
14: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @insert_sort(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = add nsw i32 %1, -1
tail call void @insert_sort(i32* %0, i32 %6)
%7 = tail call i32 @insert_sort0(i32* %0, i32 %1)
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_set_source_mute_by_index() {
  printf("NOT IMPLEMENTED:"
         "pa_context_set_source_mute_by_index"
         "\n");
}


x86 assembly (clang, -O0):
<pa_context_set_source_mute_by_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [53 x i8] c"NOT IMPLEMENTED:pa_context_set_source_mute_by_index\0A\00"
define i32 @pa_context_set_source_mute_by_index() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [52 x i8] c"NOT IMPLEMENTED:pa_context_set_source_mute_by_index\00"
define i32 @pa_context_set_source_mute_by_index() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
char *smalloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *dupstr(const char *s) {
  char *r = smalloc(1 + strlen(s));
  strcpy(r, s);
  return r;
}


x86 assembly (clang, -O0):
<dupstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <smalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dupstr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <smalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @dupstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 1, %5
%7 = call i8* @smalloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @dupstr(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @smalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}